array_push($tables_to_clear['user_id'], 'newsletter_ins', 'auth_user_quick', 'binets_ins');
$tables_to_clear['id'] = array('aliases');
$tables_to_clear['contact'] = array('contacts');
- $tables_to_clear['guid'] = array('groupesx_ins');
XDB::execute("UPDATE auth_user_md5
SET date_ins = 0, promo_sortie = 0, nom_usage = '', password = '', perms = 'pending',
nationalite = '', cv = '', section = 0, date = 0, smtppass = ''
$user['binets'] = $res->fetchColumn();
$user['binets_join'] = join(', ', $user['binets']);
- $res = XDB::iterRow("SELECT text, url
- FROM groupesx_ins
- LEFT JOIN groupesx_def ON groupesx_ins.gid = groupesx_def.id
- WHERE guid = {?}", $uid);
+ $res = XDB::iterRow("SELECT a.diminutif, a.nom, a.site
+ FROM groupex.asso AS a
+ LEFT JOIN groupex.membres AS m ON (m.asso_id = a.id)
+ WHERE m.uid = {?} AND (a.cat = 'GroupesX' OR a.cat = 'Institutions')
+ AND pub = 'public'", $uid);
$user['gpxs'] = Array();
$user['gpxs_name'] = Array();
- while (list($gxt, $gxu) = $res->next()) {
- $user['gpxs'][] = $gxu ? "<a href=\"$gxu\">$gxt</a>" : $gxt;
+ while (list($gxd, $gxt, $gxu) = $res->next()) {
+ if (!$gxu) {
+ $gxu = 'http://www.polytechnique.net/' . $gxd;
+ }
+ $user['gpxs'][] = '<span title="' . pl_entities($gxt) . "\"><a href=\"$gxu\">$gxd</a></span>";
$user['gpxs_name'][] = $gxt;
}
$user['gpxs_join'] = join(', ', $user['gpxs']);
'admin/binets' => $this->make_hook('admin_binets', AUTH_MDP, 'admin'),
'admin/medals' => $this->make_hook('admin_medals', AUTH_MDP, 'admin'),
'admin/formations' => $this->make_hook('admin_formations', AUTH_MDP, 'admin'),
- 'admin/groupes-x' => $this->make_hook('admin_groupesx', AUTH_MDP, 'admin'),
'admin/sections' => $this->make_hook('admin_sections', AUTH_MDP, 'admin'),
'admin/secteurs' => $this->make_hook('admin_secteurs', AUTH_MDP, 'admin'),
'admin/trombino' => $this->make_hook('admin_trombino', AUTH_MDP, 'admin'),
$table_editor->describe('url','site web',false);
$table_editor->apply($page, $action, $id);
}
- function handler_admin_groupesx(&$page, $action = 'list', $id = null) {
- $page->assign('xorg_title','Polytechnique.org - Administration - Groupes X');
- $page->assign('title', 'Gestion des Groupes X');
- $table_editor = new PLTableEditor('admin/groupes-x','groupesx_def','id');
- $table_editor->add_join_table('groupesx_ins','gid',true);
- $table_editor->describe('text','intitulé',true);
- $table_editor->describe('url','site web',false);
- $table_editor->apply($page, $action, $id);
- }
function handler_admin_sections(&$page, $action = 'list', $id = null) {
$page->assign('xorg_title','Polytechnique.org - Administration - Sections');
$page->assign('title', 'Gestion des Sections');
parent::__construct($wiz);
$this->settings['section'] = new ProfileSection();
$this->settings['binets'] = new ProfileGroup('binets', 'user_id', 'binet_id');
- $this->settings['groupesx'] = new ProfileGroup('groupesx', 'guid', 'gid');
+ }
+
+ public function prepare(PlatalPage &$page)
+ {
+ parent::prepare($page);
+ $page->assign('mygroups', XDB::iterator("SELECT a.nom, a.site, a.diminutif, a.unsub_url, a.pub, m.perms
+ FROM groupex.asso AS a
+ INNER JOIN groupex.membres AS m ON (m.asso_id = a.id)
+ WHERE m.uid = {?} AND (a.cat = 'GroupesX' OR a.cat = 'Institutions')",
+ S::i('uid')));
+ $page->assign('listgroups', XDB::iterator("SELECT a.nom, a.diminutif, a.sub_url,
+ IF (a.cat = 'Institutions', a.cat, d.nom) AS dom
+ FROM groupex.asso AS a
+ LEFT JOIN groupex.dom AS d ON (d.id = a.dom)
+ WHERE a.inscriptible != 0
+ AND (a.cat = 'GroupesX' OR a.cat = 'Institutions')
+ ORDER BY a.cat, a.dom, a.nom"));
}
}
|
<a href="admin/binets">Binets</a>
|
- <a href="admin/groupes-x">Groupes X</a>
- |
<a href="admin/skins">Skins</a>
|
<a href="admin/medals">Décorations</a>
update(cat);
}
+ function updateSubLink(cb)
+ {
+ var href = cb.value ? cb.value : "http://www.polytechnique.net";
+ document.getElementById("groupesx_sub").href = href;
+ }
+
//]]>
</script>
{/literal}
-<table class="bicol" summary="Profil: Informations Polytechniciennes">
+<table class="bicol" style="margin-bottom: 1em" summary="Profil: Informations Polytechniciennes">
<tr>
<th colspan="2">
Informations polytechniciennes
</td>
</tr>
{/foreach}
- <!-- Groupes X -->
- <tr id="groupesx">
- <td class="titre">Groupe(s) X</td>
- <td>
- <select name="groupesx_sel" onchange="update('groupesx')">
- {select_db_table table="groupesx_def" valeur=0 champ="text" pad='1'}
- </select>
- <a id="groupesx_add" href="javascript:add('groupesx')">{icon name="add" title="Ajouter ce groupe X"}</a>
+</table>
+<table class="bicol" style="margin-bottom: 1em">
+ <tr>
+ <th colspan="2">Groupes et institutions X</th>
+ </tr>
+ <tr>
+ <td colspan="2">
+ <p>
+ La gestion des annuaires des groupes X est réalisée grâce à
+ <a href="http://www.polytechnique.net">Polytechnique.net</a>. Pour faire apparaître un groupe sur ta fiche
+ il faut que soit inscrit dans ce groupe sur l'annuaire sur Polytechnique.net.
+ </p>
+ <p>
+ Tu es actuellement inscrit aux groupes X suivants :
+ </p>
</td>
</tr>
- {foreach item=text key=bid from=$groupesx}
- <tr id="groupesx_{$bid}">
- <td>
- <input type="hidden" name="groupesx[{$bid}]" value="{$text}" />
+ {iterate from=$mygroups item=group}
+ <tr>
+ <td class="titre">
+ {if $group.pub neq 'public'}{icon name=error title="Liste de membres a accès restreint"}{/if}
+ {if $group.perms eq 'admin'}{icon name=wrench title="Tu es administrateur du groupe"}{/if}
+ {if $group.site}<a href="{$group.site}">{else}<a href="http://www.polytechnique.net/{$group.diminutif}">{/if}
+ {$group.nom}
+ </a>
</td>
+ <td style="text-align: right; width: 30%">
+ <a href="{if $group.unsub_url}{$group.unsub_url}{else}http://www.polytechnique.net/{$group.diminutif}/unsubscribe{/if}">
+ {icon name=cross title="Demander désinscription"} Demander ta désinscription
+ </a>
+ </td>
+ </tr>
+ {/iterate}
+ <tr>
+ <td colspan="2" class="smaller">
+ <div class="titre">Signification des symboles :</div>
+ {icon name=error} L'annuaire du groupe est à visibilité restreinte et ce groupe n'apparaîtra pas sur ta fiche<br />
+ {icon name=wrench} Tu es administrateur du groupe
+ </td>
+ </tr>
+ <tr class="pair">
+ <td colspan="2">
+ <p>
+ Tu peux demander ton inscription aux groupes X qui t'intéressent. Voici la liste de ceux disponibles actuellement
+ sur Polytechnique.net et qui autorisent les demandes d'inscription :
+ </p>
+ </td>
+ <tr class="pair">
<td>
- <div style="float: left; width: 70%">
- {$text}
- </div>
- <a href="javascript:remove('groupesx', {$bid})">{icon name="cross" title="Supprimer ce groupe X"}</a>
+ {assign var=groupcat value=""}
+ {assign var=ingroup value=false}
+ <select name="groupesx_sub" onchange="updateSubLink(this)">
+ {iterate from=$listgroups item=group}
+ {if $group.dom neq $groupcat}
+ {if $ingroup}
+ </optgroup>
+ {assign var=ingroup value=false}
+ {/if}
+ {if $group.dom}
+ <optgroup label="{$group.dom}">
+ {assign var=ingroup value=true}
+ {assign var=groupcat value="`$group.dom`"}
+ {/if}
+ {/if}
+ <option value="{if $group.sub_url}{$group.sub_url}{else}http://www.polytechnique.net/{$group.diminutif}/subscribe{/if}">
+ {$group.nom}
+ </option>
+ {/iterate}
+ {if $ingroup}</optgroup>{/if}
+ </select>
+ </td>
+ <td style="text-align: right">
+ <a href="http://www.polytechnique.net" id="groupesx_sub">
+ {icon name="add" title="Demander ton inscription"} Demander ton inscription
+ </a>
</td>
</tr>
- {/foreach}
</table>
<script type="text/javascript">
-update('groupesx');
update('binets');
+updateSubLink(document.forms.prof_annu.groupesx_sub);
</script>
{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
{if $logged}
{if $x.section}<div><em class="intitule">Section : </em><span>{$x.section}</span></div>{/if}
{if $x.binets_join}<div><em class="intitule">Binet(s) : </em><span>{$x.binets_join}</span></div>{/if}
- {if $x.gpxs_join}<div><em class="intitule">Groupe(s) X : </em><span>{$x.gpxs_join|smarty:nodefaults}</span></div>{/if}
+ {if $x.gpxs_join}<div><em class="intitule">Groupe(s) et institution(s) X : </em><span><br/>{$x.gpxs_join|smarty:nodefaults}</span></div>{/if}
{/if}
{if $x.web}<div><em class="intitule">Site Web : </em><br /><a href="{$x.web}" class='popup'>{$x.web}</a></div>{/if}
{if $x.freetext}<div><em class="intitule">Commentaires : </em><br /><span>{$x.freetext|smarty:nodefaults}</span></div>{/if}