2 /***************************************************************************
3 * Copyright (C) 2003-2007 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 setType
55 public function setType($type)
57 $this->assign('xnet_type', strtolower($type));
61 // {{{ function useMenu
63 private function useMenu()
70 $sub['liste des groupes'] = 'plan';
71 $sub['documentation'] = 'Xnet';
72 $sub['signaler un bug'] = array('href' => 'send_bug', 'class' => 'popup_840x600');
73 $menu["no_title"] = $sub;
75 if (S
::logged() && $globals->asso()) {
77 $dim = $globals->asso('diminutif');
78 $sub['présentation'] = "login/$dim/";
79 if (may_update() ||
(is_member() && $globals->asso('pub') == 'public')
80 ||
$globals->asso('cat') == 'Promotions') {
81 $sub['annuaire du groupe'] = "$dim/annuaire";
82 $sub['trombinoscope'] = "$dim/trombi";
83 $sub['carte'] = "$dim/geoloc";
85 if (is_member() ||
may_update()) {
86 if ($globals->asso('forum')) {
87 $sub['forum'] = "$dim/forum";
89 if ($globals->asso('mail_domain')) {
90 $sub['listes de diffusion'] = "$dim/lists";
93 $sub['événement'] = "$dim/events";
94 if (may_update() ||
is_member()) {
95 $sub['télépaiement'] = "$dim/payment";
98 $menu[$globals->asso('nom')] = $sub;
101 if (S
::logged() && may_update()) {
103 $sub['modifier l\'accueil'] = "$dim/edit";
104 $sub['gérer les annonces'] = "$dim/admin/announces";
105 if ($globals->asso('mail_domain')) {
106 $sub['envoyer un mail'] = "$dim/mail";
107 $sub['créer une liste'] = "$dim/lists/create";
108 $sub['créer un alias'] = "$dim/alias/create";
110 if (S
::has_perms()) {
111 $sub['gérer les groupes'] = array('href' => 'admin', 'style' => 'color: gray;');
112 $sub['clear cache'] = array('href' => 'purge_cache', 'style' => 'color: gray;');
114 $menu['Administrer'] = $sub;
115 } elseif (S
::has_perms()) {
117 $sub['gérer les groupes'] = 'admin';
118 $sub['clear cache'] = 'purge_cache';
119 $menu['Administrer'] = $sub;
122 $this->assign('menu', $menu);
128 // {{{ function list_all_my_groups
130 function list_all_my_groups($params)
136 "SELECT a.nom, a.diminutif
137 FROM groupex.asso AS a
138 INNER JOIN groupex.membres AS m ON m.asso_id = a.id
139 WHERE m.uid={?}", S
::v('uid'));
140 $links = '<a href="exit">déconnexion</a>';
141 $html = '<div>Mes groupes (' . $links . ') :</div>';
142 while (list($nom, $mini) = $res->next()) {
143 $html .= "<span class='gp'>• <a href='login/$mini'>$nom</a></span>";
151 function cat_pp($cat)
154 'groupesx' => 'Groupes X' ,
155 'binets' => 'Binets' ,
156 'institutions' => 'Institutions' ,
157 'promotions' => 'Promotions'
160 return $trans[strtolower($cat)];
165 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: