list my groups
authorPierre Habouzit (MadCoder <pierre.habouzit@m4x.org>
Mon, 18 Apr 2005 10:06:01 +0000 (10:06 +0000)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Thu, 26 Jun 2008 21:28:38 +0000 (23:28 +0200)
git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-564

htdocs.net/css/xnet.css
include/xnet/page.inc.php
include/xnet/smarty.plugins.inc.php [new file with mode: 0644]
templates/xnet/skin.tpl

index f9abaec..4578767 100644 (file)
@@ -82,14 +82,20 @@ td#perso ul {
     font-size: 90%;
 }
 
+td#perso a.gp {
+    display: block;
+    margin: 2px 1em;
+    font-weight: bold;
+    font-size: 85%;
+    float: left;
+    text-align: center;
+}
+
 td#search {
     text-align: right;
+    width: 300px;
 }
 
-/***************************************************************************
- * CLASSES
- ***************************************************************************/
-
 #content {
     width: 100%;
 }
@@ -115,6 +121,13 @@ td#menu { width: 150px; }
     vertical-align: middle;
 }
 
+/***************************************************************************
+ * CLASSES
+ ***************************************************************************/
+
+.erreur { color: red; }
+.error  { color: red; }
+
 
 .descr {
     text-align: justify;
@@ -140,7 +153,6 @@ table.links a {
     font-weight: bold;
 }
 
-
 /***************************************************************************
  * Special pages
  ***************************************************************************/
index 85b21d8..d17c39f 100644 (file)
@@ -29,10 +29,13 @@ class XnetPage extends PlatalPage
 
     function XnetPage($tpl, $type=SKINNED)
     {
+        global $globals;
         $this->PlatalPage($tpl, $type);
         if (Get::has('auth')) {
             $_SESSION['session']->doAuthX($this);
         }
+        require_once('xnet/smarty.plugins.inc.php');
+        $this->register_function('list_all_my_groups', 'list_all_my_groups');
     }
 
     // }}}
diff --git a/include/xnet/smarty.plugins.inc.php b/include/xnet/smarty.plugins.inc.php
new file mode 100644 (file)
index 0000000..1144fe5
--- /dev/null
@@ -0,0 +1,45 @@
+<?php
+/***************************************************************************
+ *  Copyright (C) 2003-2004 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                *
+ ***************************************************************************/
+
+// {{{  function list_all_my_groups
+
+function list_all_my_groups($params)
+{
+    if (!logged()) {
+        return;
+    }
+    global $globals;
+    $res = $globals->xdb->iterRow(
+            "SELECT  a.nom, a.diminutif
+               FROM  groupex.asso    AS a
+         INNER JOIN  groupex.membres AS m ON m.asso_id = a.id
+              WHERE  m.uid={?}", Session::getInt('uid'));
+    $html = '';
+    while (list($nom, $mini) = $res->next()) {
+        $html .= "<a class='gp' href='$mini'>&bull; $nom</a>";
+    }
+    return $html;
+}
+
+// }}}
+
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker:
+?>
index 65cd040..25b9f85 100644 (file)
@@ -94,6 +94,7 @@
             <li><a href="login.php">extérieur</a></li>
           </ul>
           {/only_public}
+          {list_all_my_groups}
         </td>
         <td id="search">
           <form method="get" action="{rel}/recherche.php">