From: x2001corpet Date: Wed, 22 Nov 2006 21:55:43 +0000 (+0000) Subject: wish #516 trombino sur Xnet X-Git-Tag: xorg/0.9.12~68 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=28929cf07a801da3eb0e2a2255b1ce083fe76ea2;p=platal.git wish #516 trombino sur Xnet git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@1130 839d8a87-29fc-0310-9880-83ba4fa771e5 --- diff --git a/include/xnet/page.inc.php b/include/xnet/page.inc.php index abc1e72..d7deaa3 100644 --- a/include/xnet/page.inc.php +++ b/include/xnet/page.inc.php @@ -78,6 +78,7 @@ class XnetPage extends PlatalPage $sub['présentation'] = "$dim/"; if (may_update() || (is_member() && $globals->asso('pub') == 'public')) { $sub['annuaire du groupe'] = "$dim/annuaire"; + $sub['trombinoscope'] = "$dim/trombi"; $sub['carte'] = "$dim/geoloc"; } if ((is_member() || may_update()) && $globals->asso('mail_domain')) { diff --git a/modules/xnetgrp.php b/modules/xnetgrp.php index 1e4b301..9dac685 100644 --- a/modules/xnetgrp.php +++ b/modules/xnetgrp.php @@ -80,6 +80,7 @@ class XnetGrpModule extends PLModule '%grp/mail' => $this->make_hook('mail', AUTH_MDP), '%grp/annuaire' => $this->make_hook('annuaire', AUTH_MDP), '%grp/annuaire/vcard' => $this->make_hook('vcard', AUTH_MDP), + '%grp/trombi' => $this->make_hook('trombi', AUTH_MDP), '%grp/subscribe' => $this->make_hook('subscribe', AUTH_MDP), '%grp/paiement' => $this->make_hook('paiement', AUTH_MDP), @@ -398,6 +399,45 @@ class XnetGrpModule extends PLModule $page->assign('ann', $ann); } + function handler_trombi(&$page, $num = 1) + { + global $globals; + $page->changeTpl('xnet/groupe/trombi.tpl'); + $page->setType($globals->asso('cat')); + $page->assign('asso', $globals->asso()); + $page->assign('admin', may_update()); + $page->assign('urlmainsite', "https://www.polytechnique.org/"); + $trombi = new Trombi(array($this, '_trombi_getlist')); + $trombi->hidePromo(); + $trombi->setAdmin(); + $page->assign_by_ref('trombi', $trombi); + } + + function _trombi_getlist($offset, $limit) + { + global $globals; + $where = "WHERE m.asso_id= '".addslashes($globals->asso('id'))."'"; + + $res = XDB::query( + "SELECT COUNT(*) + FROM auth_user_md5 AS u + RIGHT JOIN photo AS p ON u.user_id=p.uid + INNER JOIN groupex.membres AS m ON (m.uid = u.user_id) + $where"); + $pnb = $res->fetchOneCell(); + + $res = XDB::query("SELECT promo, user_id, a.alias AS forlife, + IF (nom_usage='', u.nom, nom_usage) AS nom, u.prenom + FROM photo AS p + INNER JOIN auth_user_md5 AS u ON u.user_id=p.uid + INNER JOIN aliases AS a ON ( u.user_id=a.id AND a.type='a_vie' ) + INNER JOIN groupex.membres AS m ON (m.uid = u.user_id) + $where + ORDER BY promo, u.nom, u.prenom LIMIT {?}, {?}", $offset*$limit, $limit); + + return array($pnb, $res->fetchAllAssoc()); + } + function handler_vcard(&$page, $photos = null) { global $globals; diff --git a/templates/include/trombi.tpl b/templates/include/trombi.tpl index 63eb2fd..0776b85 100644 --- a/templates/include/trombi.tpl +++ b/templates/include/trombi.tpl @@ -28,15 +28,15 @@ {/if} - -  [ PHOTO ] + +  [ PHOTO ] - {if $trombi_admin && $smarty.session.perms eq 'admin'} + {if $trombi_admin && $smarty.session.perms eq 'admin' && !$urlmainsite} {icon name=wrench title="[admin]"} {/if}
- + {$p.prenom} {$p.nom}{if $trombi_show_promo} ({$p.promo}){/if} diff --git a/templates/xnet/groupe/trombi.tpl b/templates/xnet/groupe/trombi.tpl new file mode 100644 index 0000000..2c83109 --- /dev/null +++ b/templates/xnet/groupe/trombi.tpl @@ -0,0 +1,33 @@ +{**************************************************************************} +{* *} +{* Copyright (C) 2003-2006 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 *} +{* *} +{**************************************************************************} + +

+ Trombinoscope du groupe +

+

+{if $trombi} + +{$trombi->show()|smarty:nodefaults} + +{/if} + +{* vim:set et sw=2 sts=2 sws=2: *}