encoding et petite modif
[platal.git] / include / xnet / page.inc.php
CommitLineData
0337d704 1<?php
2/***************************************************************************
3 * Copyright (C) 2003-2004 Polytechnique.org *
4 * http://opensource.polytechnique.org/ *
5 * *
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. *
10 * *
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. *
15 * *
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 *
18 * Foundation, Inc., *
19 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
20 ***************************************************************************/
21
22require_once('platal/page.inc.php');
23require_once('xnet/smarty.plugins.inc.php');
24
25// {{{ class XnetPage
26
27class XnetPage extends PlatalPage
28{
29 // {{{ function XnetPage()
30
31 function XnetPage($tpl, $type=SKINNED)
32 {
33 $this->PlatalPage($tpl, $type);
34 }
35
36 // }}}
37 // {{{ function run()
38
39 function run()
40 {
41 $this->_run('xnet/skin.tpl');
42 }
43
44 // }}}
45 // {{{ function setType
46
47 function setType($type)
48 {
49 $this->assign('xnet_type', strtolower($type));
50 }
51
52 // }}}
53 // {{{ function useMenu
54
55 function useMenu()
56 {
57 global $globals;
58
59 $menu = array();
60
61 $sub = array();
62 $sub['accueil'] = 'index.php';
63 $sub['liste des groupes'] = 'plan.php';
64 if (logged()) {
65 if (has_perms()) {
66 $sub['admin X.net'] = 'admin.php';
67 }
68 $sub['déconnexion'] = 'deconnexion.php';
69 }
70 $menu["Menu Principal"] = $sub;
71
72 if (logged() && (is_member() || may_update())) {
73 $sub = array();
74 $dim = $globals->asso('diminutif');
75 $sub['présentation'] = "$dim/asso.php";
76 if (may_update() || $globals->asso('pub') == 'public')
77 $sub['annuaire du groupe'] = "$dim/annuaire.php";
78 if ($globals->asso('mail_domain')) {
79 $sub['listes de diffusion'] = "$dim/listes.php";
80 }
81 $sub['événement'] = "$dim/evenements.php";
82 if (false) {
83 $sub['carnet'] = "$dim/carnet.php";
84 }
85 $sub['télépaiement'] = "$dim/telepaiement.php";
86
87 $menu[$globals->asso('nom')] = $sub;
88 }
89
90 if (logged() && may_update()) {
91 $sub = array();
92 $sub['modifier l\'accueil'] = "$dim/edit.php";
0df3edb9 93 if ($globals->wiki->wikidir && $globals->xnet->wiki)
94 $sub['wiki'] = "$dim/Accueil";
0337d704 95 if ($globals->asso('mail_domain')) {
96 $sub['envoyer un mail'] = "$dim/mail.php";
97 $sub['créer une liste'] = "$dim/listes-create.php";
98 $sub['créer un alias'] = "$dim/alias-create.php";
99 }
100 $menu['Administrer Groupe'] = $sub;
101 }
102
103 $this->assign('menu', $menu);
104 }
105
106 // }}}
107 // {{{ function doAuth()
108
109 function doAuth()
110 {
111 $this->register_function('list_all_my_groups', 'list_all_my_groups');
112 $this->register_modifier('cat_pp', 'cat_pp');
113 $this->assign('it_is_xnet', true);
114 if (!logged() && Get::has('auth')) {
115 $_SESSION['session']->doAuthX($this);
116 }
117 }
118
119 // }}}
120}
121
122// }}}
123// {{{ class XnetAuth
124
125/** Une classe pour les pages nécessitant l'authentification.
126 * (equivalent de controlauthentification.inc.php)
127 */
128class XnetAuth extends XnetPage
129{
130 // {{{ function XnetAuth()
131
132 function XnetAuth($tpl, $type=SKINNED)
133 {
134 $this->XnetPage($tpl, $type);
135 }
136
137 // }}}
138 // {{{ function doAuth()
139
140 function doAuth()
141 {
142 parent::doAuth();
143 $_SESSION['session']->doAuth($this);
144 }
145
146 // }}}
147}
148
149// }}}
150// {{{ class XnetAdmin
151
152/** Une classe pour les pages réservées aux admins (authentifiés!).
153 */
154class XnetAdmin extends XnetAuth
155{
156 // {{{ function XnetAdmin()
157
158 function XnetAdmin($tpl, $type=SKINNED)
159 {
160 global $globals;
161
162 $this->XnetAuth($tpl, $type);
163 check_perms();
164
165 $this->useMenu();
166 if ($globals->asso('cat')) {
167 $this->assign('asso', $globals->asso());
168 $this->setType($globals->asso('cat'));
169 }
170 }
171
172 // }}}
173}
174
175// }}}
176// {{{ class XnetGroupPage
177
178/** Une classe pour les pages réservées aux admins (authentifiés!).
179 */
180class XnetGroupPage extends XnetAuth
181{
182 // {{{ function XnetAdmin()
183
184 function XnetGroupPage($tpl, $type=SKINNED)
185 {
186 global $globals;
187
188 $this->XnetAuth($tpl, $type);
189 if (!is_member() && !has_perms()) {
190 $this->kill("You have not sufficient credentials");
191 }
192
193 $this->useMenu();
194 $this->assign('asso', $globals->asso());
195 $this->setType($globals->asso('cat'));
196 }
197
198 // }}}
199}
200
201// }}}
202// {{{ class XnetGroupAdmin
203
204/** Une classe pour les pages réservées aux admins (authentifiés!).
205 */
206class XnetGroupAdmin extends XnetAuth
207{
208 // {{{ function XnetAdmin()
209
210 function XnetGroupAdmin($tpl, $type=SKINNED)
211 {
212 global $globals;
213
214 $this->XnetAuth($tpl, $type);
215 if (!may_update()) {
216 $this->kill("You have not sufficient credentials");
217 }
218
219 $this->useMenu();
220 $this->assign('asso', $globals->asso());
221 $this->setType($globals->asso('cat'));
222 }
223
224 // }}}
225}
226
227// }}}
228// vim:set et sw=4 sts=4 sws=4 foldmethod=marker:
229?>