TrombiView is now User-based.
authorRaphaël Barrois <raphael.barrois@polytechnique.org>
Sun, 8 May 2011 16:37:47 +0000 (18:37 +0200)
committerRaphaël Barrois <raphael.barrois@polytechnique.org>
Sun, 8 May 2011 16:37:47 +0000 (18:37 +0200)
Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
include/userset.inc.php
modules/lists.php
modules/xnetgrp.php
templates/include/plview.trombi.tpl

index 88028d6..012092a 100644 (file)
@@ -269,44 +269,6 @@ class MentorView extends ProfileView
     }
 }
 
-class TrombiView extends ProfileView
-{
-    public function __construct(PlSet $set, array $params)
-    {
-        $this->entriesPerPage = 24;
-        $this->defaultkey = 'name';
-        if (@$params['with_score']) {
-            $this->addSort(new PlViewOrder('score', array(
-                            new UFO_Score(true),
-                            new UFO_ProfileUpdate(true),
-                            new UFO_Promo(UserFilter::DISPLAY, true),
-                            new UFO_Name(Profile::DN_SORT),
-            ), 'pertinence'));
-        }
-        $set->addCond(new UFC_Photo());
-        $this->addSort(new PlViewOrder('name', array(new UFO_Name(Profile::DN_SORT)), 'nom'));
-        $this->addSort(new PlViewOrder('promo', array(
-                        new UFO_Promo(UserFilter::DISPLAY, true),
-                        new UFO_Name(Profile::DN_SORT),
-                    ), 'promotion'));
-        parent::__construct($set, $params);
-    }
-
-    public function templateName()
-    {
-        return 'include/plview.trombi.tpl';
-    }
-
-    public function apply(PlPage $page)
-    {
-        if (!empty($GLOBALS['IS_XNET_SITE'])) {
-            global $globals;
-            $page->assign('mainsiteurl', 'https://' . $globals->core->secure_domain . '/');
-        }
-        return parent::apply($page);
-    }
-}
-
 /** A multipage view for users
  * Allows the display of bounds when sorting by name or promo.
  */
@@ -388,6 +350,44 @@ class ListMemberView extends UserView
     }
 }
 
+class TrombiView extends UserView
+{
+    public function __construct(PlSet $set, array $params)
+    {
+        $this->entriesPerPage = 24;
+        $this->defaultkey = 'name';
+        if (@$params['with_score']) {
+            $this->addSort(new PlViewOrder('score', array(
+                            new UFO_Score(true),
+                            new UFO_ProfileUpdate(true),
+                            new UFO_Promo(UserFilter::DISPLAY, true),
+                            new UFO_Name(Profile::DN_SORT),
+            ), 'pertinence'));
+        }
+        $set->addCond(new UFC_Photo());
+        $this->addSort(new PlViewOrder('name', array(new UFO_Name(Profile::DN_SORT)), 'nom'));
+        $this->addSort(new PlViewOrder('promo', array(
+                        new UFO_Promo(UserFilter::DISPLAY, true),
+                        new UFO_Name(Profile::DN_SORT),
+                    ), 'promotion'));
+        parent::__construct($set, $params);
+    }
+
+    public function templateName()
+    {
+        return 'include/plview.trombi.tpl';
+    }
+
+    public function apply(PlPage $page)
+    {
+        if (!empty($GLOBALS['IS_XNET_SITE'])) {
+            global $globals;
+            $page->assign('mainsiteurl', 'https://' . $globals->core->secure_domain . '/');
+        }
+        return parent::apply($page);
+    }
+}
+
 class GadgetView implements PlView
 {
     public function __construct(PlSet $set, array $params)
index 20477a6..5b2b0db 100644 (file)
@@ -380,26 +380,21 @@ class ListsModule extends PLModule
         list(,$members) = $this->client->get_members($liste);
 
         if ($action == 'moderators') {
-            $members = $owners;
+            $users = $owners;
             $show_moderators = true;
             $action = $subaction;
             $subaction = '';
         } else {
             $show_moderators = false;
-        }
-        $users = array();
-        foreach ($members as $m) {
-            $users[] = $m[1];
+            $users = array();
+            foreach ($members as $m) {
+                $users[] = $m[1];
+            }
         }
 
         require_once 'userset.inc.php';
-        if ($action == 'listmember' || $action == '') {
-            $view = new UserArraySet($users);
-        } else {
-            $view = new ProfileArraySet($users);
-        }
+        $view = new UserArraySet($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');
index 9193a60..a6a8113 100644 (file)
@@ -326,16 +326,12 @@ class XnetGrpModule extends PLModule
 
         __autoload('userset');
         $admins = false;
-        if ($action == 'trombi') {
-            $view = new ProfileSet(new UFC_Group($globals->asso('id')));
-        } else {
-            if ($action == 'admins') {
-                $admins = true;
-                $action = $subaction;
-            }
-            $view = new UserSet(new UFC_Group($globals->asso('id'), $admins));
+        if ($action == 'admins') {
+            $admins = true;
+            $action = $subaction;
         }
-        $view->addMod('xnetfiche', 'Annuaire');
+        $view = new UserSet(new UFC_Group($globals->asso('id'), $admins));
+        $view->addMod('groupmember', 'Annuaire');
         $view->addMod('trombi', 'Trombinoscope');
         $view->apply('annuaire', $page, $action);
         $page->assign('only_admin', $admins);
index 8db07cf..8213c95 100644 (file)
   {assign var=key_cur  value=$set_keys[trombi]}
   {assign var=key_next value=$set_keys[trombi.index_next]}
   <tr>
-    {include file="include/plview.trombi.entry.tpl" profile=$set[$key_prev] photo=true}
-    {include file="include/plview.trombi.entry.tpl" profile=$set[$key_cur] photo=true}
-    {include file="include/plview.trombi.entry.tpl" profile=$set[$key_next] photo=true}
+    {include file="include/plview.trombi.entry.tpl" profile=$set[$key_prev]->profile() photo=true}
+    {include file="include/plview.trombi.entry.tpl" profile=$set[$key_cur]->profile() photo=true}
+    {include file="include/plview.trombi.entry.tpl" profile=$set[$key_next]->profile() photo=true}
   </tr>
   <tr>
-    {include file="include/plview.trombi.entry.tpl" profile=$set[$key_prev] photo=false}
-    {include file="include/plview.trombi.entry.tpl" profile=$set[$key_cur] photo=false}
-    {include file="include/plview.trombi.entry.tpl" profile=$set[$key_next] photo=false}
+    {include file="include/plview.trombi.entry.tpl" profile=$set[$key_prev]->profile() photo=false}
+    {include file="include/plview.trombi.entry.tpl" profile=$set[$key_cur]->profile() photo=false}
+    {include file="include/plview.trombi.entry.tpl" profile=$set[$key_next]->profile() photo=false}
   </tr>
   {elseif ($smarty.section.trombi.index % 3 == 0) && ($smarty.section.trombi.last)}
   {assign var=key_cur  value=$set_keys[trombi]}
   <tr>
-    {include file="include/plview.trombi.entry.tpl" profile=$set[$key_cur] photo=true}
+    {include file="include/plview.trombi.entry.tpl" profile=$set[$key_cur]->profile() photo=true}
     <td></td><td></td>
   </tr>
   <tr style="margin-top: 0; padding-top: 0">
-    {include file="include/plview.trombi.entry.tpl" profile=$set[$key_cur] photo=false}
+    {include file="include/plview.trombi.entry.tpl" profile=$set[$key_cur]->profile() photo=false}
     <td></td><td></td>
   </tr>
   {/if}