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