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 PlPage
24 public $nomenu = false
;
26 // {{{ function XnetPage()
28 public function __construct()
30 parent
::__construct();
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
);
37 $this->assign('is_logged', S
::logged());
38 if ($globals->asso('id')) {
39 $this->assign('asso', $globals->asso());
40 $this->setType($globals->asso('cat'));
41 $this->assign('is_admin', may_update());
42 $this->assign('is_member', is_member());
44 $this->addJsLink('xorg.js');
55 $this->_run('xnet/skin.tpl');
59 // {{{ function setType
61 public function setType($type)
63 $this->assign('xnet_type', strtolower($type));
67 // {{{ function useMenu
69 private function useMenu()
76 $sub['liste des groupes'] = 'plan';
77 $sub['documentation'] = 'Xnet';
78 $sub['signaler un bug'] = array('href' => 'send_bug/'.$_SERVER['REQUEST_URI'], 'class' => 'popup_840x600');
79 $menu["no_title"] = $sub;
81 $perms = S
::v('perms');
82 $dim = $globals->asso('diminutif');
83 if (S
::logged() && $globals->asso()) {
85 $sub['présentation'] = "login/$dim/";
86 if ($perms->hasFlag('groupannu')) {
87 $sub['annuaire du groupe'] = "$dim/annuaire";
88 $sub['trombinoscope'] = "$dim/trombi";
89 $sub['planisphère'] = "$dim/geoloc";
91 if ($perms->hasFlag('groupmember')) {
92 if ($globals->asso('forum')) {
93 $sub['forum'] = "$dim/forum";
95 if ($globals->asso('mail_domain')) {
96 $sub['listes de diffusion'] = "$dim/lists";
99 $sub['événement'] = "$dim/events";
100 if ($perms->hasFlag('groupmember')) {
101 $sub['télépaiement'] = "$dim/payment";
104 $menu[$globals->asso('nom')] = $sub;
107 if ($globals->asso() && is_object($perms) && $perms->hasFlag('groupadmin')) {
109 $sub['modifier l\'accueil'] = "$dim/edit";
110 $sub['gérer les annonces'] = "$dim/admin/announces";
111 if ($globals->asso('mail_domain')) {
112 $sub['envoyer un mail'] = "$dim/mail";
113 $sub['créer une liste'] = "$dim/lists/create";
114 $sub['créer un alias'] = "$dim/alias/create";
116 if (S
::has_perms()) {
117 $sub['gérer les groupes'] = array('href' => 'admin', 'style' => 'color: gray;');
118 $sub['clear cache'] = array('href' => 'purge_cache?token=' . S
::v('xsrf_token'), 'style' => 'color: gray;');
120 $menu['Administrer'] = $sub;
121 } elseif (S
::has_perms()) {
123 $sub['gérer les groupes'] = 'admin';
124 $sub['clear cache'] = 'purge_cache?token=' . S
::v('xsrf_token');
125 $menu['Administrer'] = $sub;
128 $this->assign('menu', $menu);
134 // {{{ function list_all_my_groups
136 function list_all_my_groups($params)
142 "SELECT a.nom, a.diminutif
143 FROM groupex.asso AS a
144 INNER JOIN groupex.membres AS m ON m.asso_id = a.id
145 WHERE m.uid={?}", S
::v('uid'));
146 $links = '<a href="exit">déconnexion</a>';
147 $html = '<div>Mes groupes (' . $links . ') :</div>';
148 while (list($nom, $mini) = $res->next()) {
149 $html .= "<span class='gp'>• <a href='login/$mini'>$nom</a></span>";
157 function cat_pp($cat)
160 'groupesx' => 'Groupes X' ,
161 'binets' => 'Binets' ,
162 'institutions' => 'Institutions' ,
163 'promotions' => 'Promotions'
166 return $trans[strtolower($cat)];
171 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: