Use PlView / PlSet for list directory.
authorRaphaël Barrois <raphael.barrois@polytechnique.org>
Sun, 8 May 2011 16:22:57 +0000 (18:22 +0200)
committerRaphaël Barrois <raphael.barrois@polytechnique.org>
Sun, 8 May 2011 16:22:57 +0000 (18:22 +0200)
Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
modules/lists.php
templates/lists/annu.tpl

index eec6fa2..20477a6 100644 (file)
@@ -377,29 +377,37 @@ class ListsModule extends PLModule
             $page->kill("La liste n'existe pas ou tu n'as pas le droit d'en voir les détails.");
         }
 
-        global $platal;
         list(,$members) = $this->client->get_members($liste);
+
+        if ($action == 'moderators') {
+            $members = $owners;
+            $show_moderators = true;
+            $action = $subaction;
+            $subaction = '';
+        } else {
+            $show_moderators = false;
+        }
         $users = array();
         foreach ($members as $m) {
             $users[] = $m[1];
         }
+
         require_once 'userset.inc.php';
-        $view = new ArraySet($users);
-        $view->addMod('trombi', 'Trombinoscope', true, array('with_promo' => true));
-        if (empty($GLOBALS['IS_XNET_SITE'])) {
-            $view->addMod('minifiche', 'Mini-fiches', false);
+        if ($action == 'listmember' || $action == '') {
+            $view = new UserArraySet($users);
+        } else {
+            $view = new ProfileArraySet($users);
         }
+        $view->addMod('trombi', 'Trombinoscope', false, array('with_promo' => true));
+        $view->addMod('minifiche', 'Mini-fiches', false);
+        $view->addMod('listmember', 'Annuaire', true);
         // TODO: Reactivate when the new map is completed.
         // $view->addMod('geoloc', 'Planisphère');
         $view->apply("lists/annu/$liste", $page, $action, $subaction);
-        if ($action == 'geoloc' && $subaction) {
-            return;
-        }
 
         $page->changeTpl('lists/annu.tpl');
-        $moderos = list_sort_owners($owners[1]);
         $page->assign_by_ref('details', $owners[0]);
-        $page->assign_by_ref('owners',  $moderos);
+        $page->assign('show_moderators', $show_moderators);
     }
 
     function handler_archives($page, $liste = null, $action = null, $artid = null)
index 93326ef..c80f1b6 100644 (file)
   </tr>
 </table>
 
-{include core=plset.tpl}
-
-<h1>
-  modérateurs de la liste
-</h1>
+<p class="center">
+[<a href="{$platal->ns}{$plset_base}/{$plset_mod}{$plset_args}" {if !$show_moderators}class="erreur"{/if}>membres</a>]
+[<a href="{$platal->ns}{$plset_base}/moderators/{$plset_mod}{$plset_args}" {if $show_moderators}class="erreur"{/if}>modérateurs</a>]
+</p>
 
-<table cellpadding="8" cellspacing="2" style="width:100%;">
-  {foreach from=$owners item=xs key=promo}
-    {foreach from=$xs item=x}
-      {if $promo}
-      {cycle values="1,2,3,4" assign="loop"}
-      {if $loop eq "1"}<tr>{/if}
-        <td class='center'>
-          <img src="photo/{$x.l}" width="80" alt=" [ PHOTO ] " />
-          <br />
-          <a href="profile/{$x.l}" class="popup2">
-            {$x.n} ({$promo})
-          </a>
-        </td>
-      {if $loop eq "4"}</tr>{/if}
-      {/if}
-    {/foreach}
-  {/foreach}
-  {if $loop eq "1"}
-    {cycle values="1,2,3" assign="loop"}
-    {cycle values="1,2,3" assign="loop"}
-    {cycle values="1,2,3" assign="loop"}
-    <td></td><td></td><td></td></tr>
-  {elseif $loop eq "2"}
-    {cycle values="1,2,3" assign="loop"}
-    {cycle values="1,2,3" assign="loop"}
-    <td></td><td></td></tr>
-  {elseif $loop eq "3"}
-    {cycle values="1,2,3" assign="loop"}
-    <td></td></tr>
-  {/if}
-</table>
+{include core=plset.tpl}
 
 {* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}