Minor skin update
[platal.git] / include / xnet / page.inc.php
CommitLineData
0337d704 1<?php
2/***************************************************************************
2b105fb6 3 * Copyright (C) 2003-2006 Polytechnique.org *
0337d704 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
0337d704 22class XnetPage extends PlatalPage
23{
24 // {{{ function XnetPage()
25
26 function XnetPage($tpl, $type=SKINNED)
27 {
28 $this->PlatalPage($tpl, $type);
63528107 29
30 $this->register_function('list_all_my_groups', 'list_all_my_groups');
31 $this->register_modifier('cat_pp', 'cat_pp');
32 $this->assign('it_is_xnet', true);
33
34 if (!S::logged() && Get::has('auth')) {
35 XnetSession::doAuthX();
36 }
0337d704 37 }
38
39 // }}}
40 // {{{ function run()
41
42 function run()
43 {
44 $this->_run('xnet/skin.tpl');
45 }
46
47 // }}}
48 // {{{ function setType
49
50 function setType($type)
51 {
52 $this->assign('xnet_type', strtolower($type));
53 }
54
55 // }}}
56 // {{{ function useMenu
57
58 function useMenu()
59 {
60 global $globals;
61
62 $menu = array();
63
cab08090 64 if (S::logged()) {
59ff13cf 65 $sub = array();
71fe935c 66 $sub['déconnexion'] = 'exit';
59ff13cf 67 $menu['no_title'] = $sub;
0337d704 68 }
59ff13cf 69
70 $sub = array();
71 $sub['accueil'] = '';
72 $sub['liste des groupes'] = 'plan';
27455960 73 $sub['documentation'] = 'Xnet';
0337d704 74 $menu["Menu Principal"] = $sub;
75
cab08090 76 if (S::logged() && (is_member() || may_update())) {
0337d704 77 $sub = array();
78 $dim = $globals->asso('diminutif');
ae7bb180 79 $sub['présentation'] = "$dim/";
2b105fb6 80 if (may_update() || $globals->asso('pub') == 'public') {
2e94d2b8 81 $sub['annuaire du groupe'] = "$dim/annuaire";
e336465e 82 $sub['carte'] = "$dim/geoloc";
2b105fb6 83 }
0337d704 84 if ($globals->asso('mail_domain')) {
80f44cfe 85 $sub['listes de diffusion'] = "$dim/lists";
59ff13cf 86 $sub['envoyer un mail'] = "$dim/mail";
0337d704 87 }
4f10a058 88 $sub['événement'] = "$dim/events";
75687bb9 89 $sub['télépaiement'] = "$dim/paiement";
0337d704 90
91 $menu[$globals->asso('nom')] = $sub;
92 }
93
cab08090 94 if (S::logged() && may_update()) {
0337d704 95 $sub = array();
2e94d2b8 96 $sub['modifier l\'accueil'] = "$dim/edit";
0337d704 97 if ($globals->asso('mail_domain')) {
80f44cfe 98 $sub['créer une liste'] = "$dim/lists/create";
d1fcf09c 99 $sub['créer un alias'] = "$dim/alias/create";
0337d704 100 }
59ff13cf 101 if (S::has_perms()) {
102 $sub['gérer les groupes'] = 'admin';
103 }
104 $menu['Administrer'] = $sub;
8383ee06 105 } elseif (S::has_perms()) {
106 $sub = array();
107 $sub['gérer les groupes'] = 'admin';
108 $menu['Administrer'] = $sub;
0337d704 109 }
110
111 $this->assign('menu', $menu);
112 }
113
114 // }}}
0337d704 115}
116
b76f0797 117// {{{ function list_all_my_groups
118
119function list_all_my_groups($params)
120{
121 if (!S::logged()) {
122 return;
123 }
124 $res = XDB::iterRow(
125 "SELECT a.nom, a.diminutif
126 FROM groupex.asso AS a
127 INNER JOIN groupex.membres AS m ON m.asso_id = a.id
128 WHERE m.uid={?}", S::v('uid'));
129 $html = '<div>Mes groupes :</div>';
130 while (list($nom, $mini) = $res->next()) {
131 $html .= "<a class='gp' href='$mini/'>&bull; $nom</a>";
132 }
133 return $html;
134}
135
136// }}}
137// {{{ cat_pp
138
139function cat_pp($cat)
140{
141 $trans = array(
142 'groupesx' => 'Groupes X' ,
143 'binets' => 'Binets' ,
144 'institutions' => 'Institutions' ,
145 'promotions' => 'Promotions'
146 );
147
148 return $trans[strtolower($cat)];
149}
150
151// }}}
152
0337d704 153// vim:set et sw=4 sts=4 sws=4 foldmethod=marker:
154?>