From 027b16e31e0ca17ad00e567329bad1035b22650f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Barrois?= Date: Sun, 8 May 2011 18:37:47 +0200 Subject: [PATCH] TrombiView is now User-based. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Raphaël Barrois --- include/userset.inc.php | 76 ++++++++++++++++++------------------- modules/lists.php | 17 +++------ modules/xnetgrp.php | 14 +++---- templates/include/plview.trombi.tpl | 16 ++++---- 4 files changed, 57 insertions(+), 66 deletions(-) diff --git a/include/userset.inc.php b/include/userset.inc.php index 88028d6..012092a 100644 --- a/include/userset.inc.php +++ b/include/userset.inc.php @@ -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) diff --git a/modules/lists.php b/modules/lists.php index 20477a6..5b2b0db 100644 --- a/modules/lists.php +++ b/modules/lists.php @@ -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'); diff --git a/modules/xnetgrp.php b/modules/xnetgrp.php index 9193a60..a6a8113 100644 --- a/modules/xnetgrp.php +++ b/modules/xnetgrp.php @@ -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); diff --git a/templates/include/plview.trombi.tpl b/templates/include/plview.trombi.tpl index 8db07cf..8213c95 100644 --- a/templates/include/plview.trombi.tpl +++ b/templates/include/plview.trombi.tpl @@ -32,23 +32,23 @@ {assign var=key_cur value=$set_keys[trombi]} {assign var=key_next value=$set_keys[trombi.index_next]} - {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} - {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} {elseif ($smarty.section.trombi.index % 3 == 0) && ($smarty.section.trombi.last)} {assign var=key_cur value=$set_keys[trombi]} - {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} - {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} {/if} -- 2.1.4