6f94a0929ddc31db3c75cda01b4db7938493ac9f
[platal.git] / htdocs / marketing / index.php
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_admin_page('marketing/index.tpl');
24
25 # Quelques statistiques
26
27 $res = $globals->xdb->query(
28 "SELECT COUNT(*) AS vivants,
29 COUNT(NULLIF(perms!='pending', 0)) AS inscrits,
30 100*COUNT(NULLIF(perms!='pending', 0))/COUNT(*) AS ins_rate,
31 COUNT(NULLIF(promo >= 1972, 0)) AS vivants72,
32 COUNT(NULLIF(promo >= 1972 AND perms!='pending', 0)) AS inscrits72,
33 100 * COUNT(NULLIF(promo >= 1972 AND perms!='pending', 0)) /
34 COUNT(NULLIF(promo >= 1972, 0)) AS ins72_rate,
35 COUNT(NULLIF(FIND_IN_SET('femme', flags), 0)) AS vivantes,
36 COUNT(NULLIF(FIND_IN_SET('femme', flags) AND perms!='pending', 0)) AS inscrites,
37 100 * COUNT(NULLIF(FIND_IN_SET('femme', flags) AND perms!='pending', 0)) /
38 COUNT(NULLIF(FIND_IN_SET('femme', flags), 0)) AS inse_rate
39 FROM auth_user_md5
40 WHERE deces = 0");
41 $stats = $res->fetchOneAssoc();
42 $page->assign('stats', $stats);
43
44 $res = $globals->xdb->query("SELECT count(*) FROM auth_user_md5 WHERE date_ins > ".date('Ymd000000', strtotime('1 week ago')));
45 $page->assign('nbInsSem', $res->fetchOneCell());
46
47 $res = $globals->xdb->query("SELECT count(*) FROM register_pending WHERE hash != 'INSCRIT'");
48 $page->assign('nbInsEnCours', $res->fetchOneCell());
49
50 $res = $globals->xdb->query("SELECT count(*) FROM register_marketing");
51 $page->assign('nbInsMarket', $res->fetchOneCell());
52
53 $res = $globals->xdb->query("SELECT count(*) FROM register_mstats WHERE TO_DAYS(NOW()) - TO_DAYS(success) <= 7");
54 $page->assign('nbInsMarkOK', $res->fetchOneCell());
55
56 $page->run();
57 ?>