From: Raphaël Barrois Date: Sun, 8 May 2011 16:21:41 +0000 (+0200) Subject: Rename XnetUserView to GroupMemberView and add ListMemberView. X-Git-Tag: xorg/1.1.1~21 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=83d6305f09f15e395dbfeaa464eea6c38a58ef9e;p=platal.git Rename XnetUserView to GroupMemberView and add ListMemberView. Signed-off-by: Raphaël Barrois --- diff --git a/include/userset.inc.php b/include/userset.inc.php index be7564d..88028d6 100644 --- a/include/userset.inc.php +++ b/include/userset.inc.php @@ -123,22 +123,27 @@ class AdvancedSearchSet extends SearchSet } } -/** Simple set based on an array of User objects +/** Simple set based on an array of User emails */ -class ArraySet extends ProfileSet +class UserArraySet extends UserSet { - public function __construct(array $users) + public function __construct(array $emails) { - $hruids = User::getBulkHruid($users, array('User', '_silent_user_callback')); - if (is_null($hruids) || count($hruids) == 0) { - $cond = new PFC_False(); - } else { - $cond = new UFC_Hruid($hruids); - } - parent::__construct($cond); + parent::__construct(new UFC_Email($emails)); } } +/** Simple set based on an array of Profile emails + */ +class ProfileArraySet extends ProfileSet +{ + public function __construct(array $emails) + { + parent::__construct(new UFC_Email($emails)); + } +} + + /** A multipage view for profiles * Allows the display of bounds when sorting by name or promo. */ @@ -345,7 +350,7 @@ abstract class UserView extends MultipageView } } -class XnetFicheView extends UserView +class GroupMemberView extends UserView { public function __construct(PlSet $set, array $params) { @@ -360,7 +365,26 @@ class XnetFicheView extends UserView public function templateName() { - return 'include/plview.xnetuser.tpl'; + return 'include/plview.groupmember.tpl'; + } +} + +class ListMemberView extends UserView +{ + public function __construct(PlSet $set, array $params) + { + $this->entriesPerPage = 100; + $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.listmember.tpl'; } } diff --git a/templates/include/plview.xnetuser.entry.tpl b/templates/include/plview.groupmember.entry.tpl similarity index 100% rename from templates/include/plview.xnetuser.entry.tpl rename to templates/include/plview.groupmember.entry.tpl diff --git a/templates/include/plview.xnetuser.tpl b/templates/include/plview.groupmember.tpl similarity index 96% rename from templates/include/plview.xnetuser.tpl rename to templates/include/plview.groupmember.tpl index 8a0342b..f22449b 100644 --- a/templates/include/plview.xnetuser.tpl +++ b/templates/include/plview.groupmember.tpl @@ -33,7 +33,7 @@ {assign var=lostUsers value=false} {foreach from=$set item=user} {if $user->lost}{assign var=lostUsers value=true}{/if} - {include file="include/plview.xnetuser.entry.tpl" user=$user} + {include file="include/plview.groupmember.entry.tpl" user=$user} {/foreach} diff --git a/templates/include/plview.listmember.tpl b/templates/include/plview.listmember.tpl new file mode 100644 index 0000000..6d9f75b --- /dev/null +++ b/templates/include/plview.listmember.tpl @@ -0,0 +1,72 @@ +{**************************************************************************} +{* *} +{* Copyright (C) 2003-2011 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 *} +{* *} +{**************************************************************************} + + + + {if $details.own || hasPerms('admin,groupadmin')} + + {/if} + + {assign var=current_key value=''} + {foreach from=$set item=user} + + + + {if t($delete)} + + {/if} + + {/foreach} +
+ + {icon name="page_excel" title="Télécharger la liste des membres"} + Télécharger la liste des membres au format Excel + +
+ {if $order eq 'promo'} + {assign var=user_key value=$user->promo()} + {elseif $order eq 'name'} + {assign var=user_key value=$user->lastName()|string_format:'%.1s'|upper} + {else} + {assign var=user_key value=''} + {/if} + {if $user_key neq $current_key} + {assign var=current_key value=$user_key} + {$user_key} + {/if} + + {if $user->hasProfile()} + {if $user->lost}{assign var=lostUsers value=true}{/if} + {profile user=$user} + {else} + {$user->displayName()} + {/if} + + {if t($user.uid)} + {icon name=user_edit title='Éditer'}  + {else} + {icon name=null}  + {/if} + {icon name=cross title='Retirer'} +
+ +{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}