2 /***************************************************************************
3 * Copyright (C) 2003-2008 Polytechnique.org *
4 * http://opensource.polytechnique.org/ *
6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 2 of the License, or *
9 * (at your option) any later version. *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program; if not, write to the Free Software *
19 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
20 ***************************************************************************/
22 class XnetPage
extends PlatalPage
24 public $nomenu = false
;
26 // {{{ function XnetPage()
28 public function __construct($tpl, $type=SKINNED
)
30 parent
::__construct($tpl, $type);
32 $this->register_function('list_all_my_groups', 'list_all_my_groups');
33 $this->register_modifier('cat_pp', 'cat_pp');
34 $this->assign('it_is_xnet', true
);
36 if (!S
::logged() && Get
::has('auth')) {
37 XnetSession
::doAuthX();
49 $this->_run('xnet/skin.tpl');
53 // {{{ function changeTpl()
55 public function changeTpl($tpl, $type = SKINNED
)
58 parent
::changeTpl($tpl, $type);
59 $this->assign('is_logged', S
::logged());
60 if ($globals->asso('id')) {
61 $this->assign('asso', $globals->asso());
62 $this->setType($globals->asso('cat'));
63 $this->assign('is_admin', may_update());
64 $this->assign('is_member', is_member());
69 // {{{ function setType
71 public function setType($type)
73 $this->assign('xnet_type', strtolower($type));
77 // {{{ function useMenu
79 private function useMenu()
86 $sub['liste des groupes'] = 'plan';
87 $sub['documentation'] = 'Xnet';
88 $sub['signaler un bug'] = array('href' => 'send_bug', 'class' => 'popup_840x600');
89 $menu["no_title"] = $sub;
91 $perms = S
::v('perms');
92 $dim = $globals->asso('diminutif');
93 if (S
::logged() && $globals->asso()) {
95 $sub['présentation'] = "login/$dim/";
96 if ($perms->hasFlag('groupannu')) {
97 $sub['annuaire du groupe'] = "$dim/annuaire";
98 $sub['trombinoscope'] = "$dim/trombi";
99 $sub['planisphère'] = "$dim/geoloc";
101 if ($perms->hasFlag('groupmember')) {
102 if ($globals->asso('forum')) {
103 $sub['forum'] = "$dim/forum";
105 if ($globals->asso('mail_domain')) {
106 $sub['listes de diffusion'] = "$dim/lists";
109 $sub['événement'] = "$dim/events";
110 if ($perms->hasFlag('groupmember')) {
111 $sub['télépaiement'] = "$dim/payment";
114 $menu[$globals->asso('nom')] = $sub;
117 if ($globals->asso() && is_object($perms) && $perms->hasFlag('groupadmin')) {
119 $sub['modifier l\'accueil'] = "$dim/edit";
120 $sub['gérer les annonces'] = "$dim/admin/announces";
121 if ($globals->asso('mail_domain')) {
122 $sub['envoyer un mail'] = "$dim/mail";
123 $sub['créer une liste'] = "$dim/lists/create";
124 $sub['créer un alias'] = "$dim/alias/create";
126 if (S
::has_perms()) {
127 $sub['gérer les groupes'] = array('href' => 'admin', 'style' => 'color: gray;');
128 $sub['clear cache'] = array('href' => 'purge_cache', 'style' => 'color: gray;');
130 $menu['Administrer'] = $sub;
131 } elseif (S
::has_perms()) {
133 $sub['gérer les groupes'] = 'admin';
134 $sub['clear cache'] = 'purge_cache';
135 $menu['Administrer'] = $sub;
138 $this->assign('menu', $menu);
144 // {{{ function list_all_my_groups
146 function list_all_my_groups($params)
152 "SELECT a.nom, a.diminutif
153 FROM groupex.asso AS a
154 INNER JOIN groupex.membres AS m ON m.asso_id = a.id
155 WHERE m.uid={?}", S
::v('uid'));
156 $links = '<a href="exit">déconnexion</a>';
157 $html = '<div>Mes groupes (' . $links . ') :</div>';
158 while (list($nom, $mini) = $res->next()) {
159 $html .= "<span class='gp'>• <a href='login/$mini'>$nom</a></span>";
167 function cat_pp($cat)
170 'groupesx' => 'Groupes X' ,
171 'binets' => 'Binets' ,
172 'institutions' => 'Institutions' ,
173 'promotions' => 'Promotions'
176 return $trans[strtolower($cat)];
181 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: