migrate trivial pages into xnet module
[platal.git] / modules / xnet.php
1 <?php
2 /***************************************************************************
3 * Copyright (C) 2003-2006 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
22 class XnetModule extends PLModule
23 {
24 function handlers()
25 {
26 return array(
27 'index' => $this->make_hook('index', AUTH_PUBLIC),
28 'exit' => $this->make_hook('exit', AUTH_PUBLIC),
29
30 'about' => $this->make_hook('about', AUTH_PUBLIC),
31 'article12' => $this->make_hook('article12', AUTH_PUBLIC),
32 'article16' => $this->make_hook('article16', AUTH_PUBLIC),
33 'creategpx' => $this->make_hook('creategpx', AUTH_PUBLIC),
34 'services' => $this->make_hook('services', AUTH_PUBLIC),
35 'manuel' => $this->make_hook('manuel', AUTH_PUBLIC),
36
37 'plan' => $this->make_hook('plan', AUTH_PUBLIC),
38 );
39 }
40
41 function handler_index(&$page)
42 {
43 $page->changeTpl('xnet/index.tpl');
44 return PL_OK;
45 }
46
47 function handler_exit(&$page)
48 {
49 XnetSession::destroy();
50 $page->changeTpl('xnet/deconnexion.tpl');
51 $page->useMenu();
52 return PL_OK;
53 }
54
55 function handler_about(&$page)
56 {
57 $page->changeTpl('xnet/apropos.tpl');
58 $page->useMenu();
59 return PL_OK;
60 }
61
62 function handler_article12(&$page)
63 {
64 $page->changeTpl('xnet/article12.tpl');
65 $page->useMenu();
66 return PL_OK;
67 }
68
69 function handler_article16(&$page)
70 {
71 $page->changeTpl('xnet/article16.tpl');
72 $page->useMenu();
73 return PL_OK;
74 }
75
76 function handler_creategpx(&$page)
77 {
78 $page->changeTpl('xnet/creation-groupex.tpl');
79 $page->useMenu();
80 return PL_OK;
81 }
82
83 function handler_creategpx(&$page)
84 {
85 $page->changeTpl('xnet/services.tpl');
86 $page->useMenu();
87 return PL_OK;
88 }
89
90 function handler_manuel(&$page)
91 {
92 $page->changeTpl('xnet/manuel.tpl');
93 $page->useMenu();
94 return PL_OK;
95 }
96
97 function handler_plan(&$page)
98 {
99 global $globals;
100
101 $page->changeTpl('xnet/plan.tpl');
102
103 $page->setType('plan');
104
105 $res = $globals->xdb->iterator(
106 'SELECT dom.id, dom.nom as domnom, asso.diminutif, asso.nom
107 FROM groupex.dom
108 INNER JOIN groupex.asso ON dom.id = asso.dom
109 WHERE FIND_IN_SET("GroupesX", dom.cat) AND FIND_IN_SET("GroupesX", asso.cat)
110 ORDER BY dom.nom, asso.nom');
111 $groupesx = array();
112 while ($tmp = $res->next()) { $groupesx[$tmp['id']][] = $tmp; }
113 $page->assign('groupesx', $groupesx);
114
115 $res = $globals->xdb->iterator(
116 'SELECT dom.id, dom.nom as domnom, asso.diminutif, asso.nom
117 FROM groupex.dom
118 INNER JOIN groupex.asso ON dom.id = asso.dom
119 WHERE FIND_IN_SET("Binets", dom.cat) AND FIND_IN_SET("Binets", asso.cat)
120 ORDER BY dom.nom, asso.nom');
121 $binets = array();
122 while ($tmp = $res->next()) { $binets[$tmp['id']][] = $tmp; }
123 $page->assign('binets', $binets);
124
125 $res = $globals->xdb->iterator(
126 'SELECT asso.diminutif, asso.nom
127 FROM groupex.asso
128 WHERE cat LIKE "%Promotions%"
129 ORDER BY diminutif');
130 $page->assign('promos', $res);
131
132 $res = $globals->xdb->iterator(
133 'SELECT asso.diminutif, asso.nom
134 FROM groupex.asso
135 WHERE FIND_IN_SET("Institutions", cat)
136 ORDER BY diminutif');
137 $page->assign('inst', $res);
138
139 return PL_OK;
140 }
141 }
142
143 ?>