annuaire.php
authorPierre Habouzit (MadCoder <pierre.habouzit@m4x.org>
Thu, 21 Apr 2005 15:49:38 +0000 (15:49 +0000)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Thu, 26 Jun 2008 21:28:42 +0000 (23:28 +0200)
git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-583

htdocs.net/groupe/annuaire.php [new file with mode: 0644]
templates/xnet/groupe/annuaire.tpl [new file with mode: 0644]

diff --git a/htdocs.net/groupe/annuaire.php b/htdocs.net/groupe/annuaire.php
new file mode 100644 (file)
index 0000000..9299760
--- /dev/null
@@ -0,0 +1,45 @@
+<?php
+require 'xnet.inc.php';
+
+new_group_page('xnet/groupe/annuaire.tpl');
+$page->setType($globals->asso('cat'));
+$page->assign('asso', $globals->asso());
+$page->assign('admin', may_update());
+$page->useMenu();
+
+$tri = (Env::get('order') == 'alpha' ? 'promo, nom, prenom' : 'nom, prenom, promo');
+$res = $globals->xdb->iterRow(
+            'SELECT  SUBSTRING(IF(m.origine="X",u.nom,m.nom), 1, 1), COUNT(IF(m.origine="X",u.nom,m.nom))
+               FROM  groupex.membres AS m
+          LEFT JOIN  auth_user_md5   AS u ON ( u.user_id = m.uid )
+              WHERE  asso_id = {?}
+           GROUP BY  SUBSTRING(IF(m.origine="X",u.nom,m.nom), 1, 1)', $globals->asso('id'));
+$alphabet = array();
+$nb_tot = 0;
+while (list($char, $nb) = $res->next()) {
+    $alphabet[ord($char)] = $char;
+    $nb_tot += $nb;
+}
+$page->assign('alphabet', $alphabet);
+$page->assign('nb_tot',   $nb_tot);
+
+$ini = Env::has('initiale') ? 'AND IF(m.origine="X",u.nom,m.nom) LIKE "'.addslashes(Env::get('initiale')).'%"' : '';
+
+$ann = $globals->xdb->iterator(
+          "SELECT  IF(m.origine='X',IF(u.nom_usage, u.nom_usage, u.nom) ,m.nom) AS nom,
+                   IF(m.origine='X',u.prenom,m.prenom) AS prenom,
+                   IF(m.origine='X',u.promo,'extérieur') AS promo,
+                   IF(m.origine='X',a.alias,m.email) AS email,
+                   IF(m.origine='X',FIND_IN_SET('femme', u.flags),0) AS femme,
+                   m.perms='admin' AS admin,
+                   m.origine='X' AS x
+             FROM  groupex.membres AS m
+        LEFT JOIN  auth_user_md5   AS u ON ( u.user_id = m.uid )
+        LEFT JOIN  aliases         AS a ON ( a.id = m.uid AND a.type='a_vie' )
+            WHERE  m.asso_id = {?} $ini
+         ORDER BY  $tri", $globals->asso('id'));
+$page->assign('ann', $ann);
+
+$page->run();
+
+?>
diff --git a/templates/xnet/groupe/annuaire.tpl b/templates/xnet/groupe/annuaire.tpl
new file mode 100644 (file)
index 0000000..ce0186f
--- /dev/null
@@ -0,0 +1,89 @@
+{***************************************************************************
+ *  Copyright (C) 2003-2004 Polytechnique.org                              *
+ *  http://opensource.polytechnique.org/                                   *
+ *                                                                         *
+ *  This program is free software; you can redistribute it and/or modify   *
+ *  it under the terms of the GNU General Public License as published by   *
+ *  the Free Software Foundation; either version 2 of the License, or      *
+ *  (at your option) any later version.                                    *
+ *                                                                         *
+ *  This program is distributed in the hope that it will be useful,        *
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
+ *  GNU General Public License for more details.                           *
+ *                                                                         *
+ *  You should have received a copy of the GNU General Public License      *
+ *  along with this program; if not, write to the Free Software            *
+ *  Foundation, Inc.,                                                      *
+ *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
+ ***************************************************************************}
+
+<h1>{$asso.nom} : Annuaire du groupe </h1>
+
+<p class="descr">
+Le groupe {$asso.nom} compte {$nb_tot} membres.
+</p>
+
+<p class="descr">
+Les membres extérieurs du groupe sont intégrés à cette liste, et repérés par l'inscription 'extérieur' dans la colonne promotion.
+</p>
+
+{if $admin}
+<p class="descr">
+Fonctionnalités visibles uniquement par les administrateurs :
+</p>
+<ul class="descr">
+  <li><a href="membresx-edit.php?new=x">Ajouter un membre X</a></li>
+  <li><a href="membres-edit.php?new=ext">Ajouter un membre extérieur</a></li>
+</ul>
+{/if}
+
+<p class="descr">
+Choisis une initiale pour restreindre la liste aux membres dont le nom commence par cette lettre. Tu
+peux aussi <a href='{$smarty.server.PHP_SELF}'>afficher toute la liste</a>.
+</p>
+
+<p class="center">
+{foreach from=$alphabet item=c}
+[<a href="?initiale={$c}">{$c}</a>]
+{/foreach}
+</p>
+
+
+
+<table summary"membres du groupe" style="width: 100%">
+  <tr>
+    <th>prénom et nom</th>
+    <th>promotion</th>
+    <th>fiche X.org / carte / lui écrire</th>
+    {if $admin}
+    <th></th>
+    <th>admin</th>
+    <th>éditer un profil</th>
+    <th>désinscrire</th>
+    {/if}
+  </tr>
+  {iterate from=$ann item=m}
+  <tr>
+    <td>{if $m.femme}&bull;{/if}{$m.prenom} {$m.nom}</td>
+    <td>{$m.promo}</td>
+    <td>
+      {if $m.x}
+      <a href="https://www.polytechnique.org/fiche.php?user={$m.email}"><img src="{rel}/images/loupe.gif" alt="[fiche]" /></a>
+      <a href="https://www.polytechnique.org/vcard.php/{$m.email}.vcf/?x={$m.email}"><img src="{rel}/images/vcard.png" alt="[vcard]" /></a>
+      <a href="mailto:{$m.email}@polytechnique.org"><img src="{rel}/images/mail.png" alt="mail" /></a>
+      {else}
+      <a href="mailto:{$m.email}"><img src="{rel}/images/mail.png" alt="mail"></a>
+      {/if}
+    </td>
+    {if $admin}
+    <td></td>
+    <td>{if $m.admin}&times;{else}&nbsp;{/if}</td>
+    <td><a href="{if $m.x}membresx{else}membres{/if}-edit.php?edit={$m.email}"><img src="{rel}/images/profil.png" alt="Edition du profil" /></a></td>
+    <td><a href="{if $m.x}membresx{else}membres{/if}-edit.php?del={$m.email}"><img src="{rel}/images/del.png" alt="Suppression de {$m.prenom} {$m.nom}" /></a></td>
+    {/if}
+  </tr>
+  {/iterate}
+</table>
+
+{* vim:set et sw=2 sts=2 sws=2: *}