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