wish #516 trombino sur Xnet
authorx2001corpet <x2001corpet@839d8a87-29fc-0310-9880-83ba4fa771e5>
Wed, 22 Nov 2006 21:55:43 +0000 (21:55 +0000)
committerx2001corpet <x2001corpet@839d8a87-29fc-0310-9880-83ba4fa771e5>
Wed, 22 Nov 2006 21:55:43 +0000 (21:55 +0000)
git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@1130 839d8a87-29fc-0310-9880-83ba4fa771e5

include/xnet/page.inc.php
modules/xnetgrp.php
templates/include/trombi.tpl
templates/xnet/groupe/trombi.tpl [new file with mode: 0644]

index abc1e72..d7deaa3 100644 (file)
@@ -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')) {
index 1e4b301..9dac685 100644 (file)
@@ -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;
index 63eb2fd..0776b85 100644 (file)
   <tr>
   {/if}
     <td class="center">
-      <a href="profile/{$p.forlife}" class="popup2">
-        <img src="photo/{$p.forlife}" width="110" alt=" [ PHOTO ] " />
+      <a href="{if $urlmainsite}{$urlmainsite}{/if}profile/{$p.forlife}" class="popup2">
+        <img src="{if $urlmainsite}{$urlmainsite}{/if}photo/{$p.forlife}" width="110" alt=" [ PHOTO ] " />
       </a>
-      {if $trombi_admin && $smarty.session.perms eq 'admin'}
+      {if $trombi_admin && $smarty.session.perms eq 'admin' && !$urlmainsite}
       <a href="admin/trombino/{$p.user_id}">
         {icon name=wrench title="[admin]"}</a>
       {/if}
       <br />
-      <a href="profile/{$p.forlife}" class="popup2">
+      <a href="{if $urlmainsite}{$urlmainsite}{/if}profile/{$p.forlife}" class="popup2">
         {$p.prenom} {$p.nom}{if $trombi_show_promo} ({$p.promo}){/if}
       </a>
     </td>
diff --git a/templates/xnet/groupe/trombi.tpl b/templates/xnet/groupe/trombi.tpl
new file mode 100644 (file)
index 0000000..2c83109
--- /dev/null
@@ -0,0 +1,33 @@
+{**************************************************************************}\r
+{*                                                                        *}\r
+{*  Copyright (C) 2003-2006 Polytechnique.org                             *}\r
+{*  http://opensource.polytechnique.org/                                  *}\r
+{*                                                                        *}\r
+{*  This program is free software; you can redistribute it and/or modify  *}\r
+{*  it under the terms of the GNU General Public License as published by  *}\r
+{*  the Free Software Foundation; either version 2 of the License, or     *}\r
+{*  (at your option) any later version.                                   *}\r
+{*                                                                        *}\r
+{*  This program is distributed in the hope that it will be useful,       *}\r
+{*  but WITHOUT ANY WARRANTY; without even the implied warranty of        *}\r
+{*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *}\r
+{*  GNU General Public License for more details.                          *}\r
+{*                                                                        *}\r
+{*  You should have received a copy of the GNU General Public License     *}\r
+{*  along with this program; if not, write to the Free Software           *}\r
+{*  Foundation, Inc.,                                                     *}\r
+{*  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA               *}\r
+{*                                                                        *}\r
+{**************************************************************************}\r
+\r
+<h1>\r
+  Trombinoscope du groupe\r
+</h1>\r
+<p>\r
+{if $trombi}\r
+\r
+{$trombi->show()|smarty:nodefaults}\r
+\r
+{/if}\r
+\r
+{* vim:set et sw=2 sts=2 sws=2: *}\r