Bug 130: Les pages ont toutes un titre different.
[platal.git] / htdocs / trombipromo.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("xorg.inc.php");
23new_skinned_page('trombipromo.tpl', AUTH_COOKIE);
24require_once("trombi.inc.php");
d9a33f98 25$page->assign('xorg_title','Polytechnique.org - Trombi Promo');
0337d704 26
27function getList($offset,$limit) {
28 global $globals;
29
30 $xpromo = Env::getInt('xpromo');
31 $where = ( $xpromo>0 ? "WHERE promo='$xpromo'" : "" );
32
33 $res = $globals->xdb->query(
34 "SELECT COUNT(*)
35 FROM auth_user_md5 AS u
36 RIGHT JOIN photo AS p ON u.user_id=p.uid
37 $where");
38 $pnb = $res->fetchOneCell();
39
40 $res = $globals->xdb->query(
41 "SELECT promo,user_id,a.alias AS forlife,nom,prenom
42 FROM photo AS p
43 INNER JOIN auth_user_md5 AS u ON u.user_id=p.uid
44 INNER JOIN aliases AS a ON ( u.user_id=a.id AND a.type='a_vie' )
45 $where
46 ORDER BY promo,nom,prenom LIMIT {?}, {?}", $offset*$limit, $limit);
47
48 return Array($pnb, $res->fetchAllAssoc());
49}
50
51if (Env::has('xpromo')) {
52 $xpromo = Env::getInt('xpromo');
53
54 if ( $xpromo<1900 || $xpromo>date('Y') || ($xpromo == -1 && Session::get('perms')!="admin") ) {
55 $page->trig("Promotion incorrecte (saisir au format YYYY). Recommence.");
56 $page->assign('error', true);
57 } else {
58 $trombi = new Trombi('getList');
59 $trombi->hidePromo();
60 $trombi->setAdmin();
61 $page->assign_by_ref('trombi',$trombi);
62 }
0c17d715 63} else {
64 $tmp = new Trombi();
65 $page->assign("limit", $tmp->limit);
0337d704 66}
67
68$page->run();
69
70?>