<?php
/***************************************************************************
- * Copyright (C) 2003-2010 Polytechnique.org *
+ * Copyright (C) 2003-2011 Polytechnique.org *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
);
}
- function handler_stats(&$page)
+ function handler_stats($page)
{
$page->changeTpl('stats/index.tpl');
}
- function handler_evolution(&$page, $jours = 365)
+ function handler_evolution($page, $jours = 365)
{
$page->changeTpl('stats/evolution_inscrits.tpl');
$page->assign('jours', $jours);
}
- function handler_graph_evo(&$page, $jours = 365)
+ function handler_graph_evo($page, $jours = 365)
{
define('DUREEJOUR', 24 * 3600);
$res = XDB::iterRow('SELECT IF(registration_date > DATE_SUB(NOW(), INTERVAL {?} DAY),
TO_DAYS(registration_date) - TO_DAYS(NOW()),
-{?}) AS jour,
- COUNT(uid) AS nb
+ COUNT(a.uid) AS nb
FROM accounts AS a
- LEFT JOIN account_profiles AS ap ON(ap.uid = a.uid AND FIND_IN_SET(\'owner\', ap.flags))
+ LEFT JOIN account_profiles AS ap ON (ap.uid = a.uid AND FIND_IN_SET(\'owner\', ap.perms))
LEFT JOIN profiles AS p ON (ap.pid = p.pid)
WHERE state = \'active\' AND p.deathdate IS NULL
GROUP BY jour', (int)$jours, 1 + (int)$jours);
exit;
}
- function handler_graph(&$page, $promo = null)
+ function handler_graph($page, $promo = null)
{
if ($promo == 'all') {
// date de départ
FROM accounts AS a
INNER JOIN account_profiles AS ap ON (ap.uid = a.uid AND FIND_IN_SET('owner', ap.perms))
INNER JOIN profiles AS p ON (p.pid = ap.pid)
- INNER JOIN profile_education AS pe ON (pe.uid = ap.pid AND FIND_IN_SET('primary', pe.flags))
+ INNER JOIN profile_education AS pe ON (pe.pid = ap.pid AND FIND_IN_SET('primary', pe.flags))
WHERE pe.entry_year >= {?} AND p.deathdate IS NULL
GROUP BY promo", $depart);
$res = XDB::query("SELECT MIN(TO_DAYS(a.registration_date) - TO_DAYS(NOW()))
FROM accounts AS a
INNER JOIN account_profiles AS ap ON (ap.uid = a.uid AND FIND_IN_SET('owner', ap.perms))
- INNER JOIN profile_education AS pe ON (pe.uid = ap.pid AND FIND_IN_SET('primary', pe.flags))
+ INNER JOIN profile_education AS pe ON (pe.pid = ap.pid AND FIND_IN_SET('primary', pe.flags))
WHERE pe.entry_year = {?} AND a.state = 'active'", (int)$promo);
$jours = -$res->fetchOneCell();
COUNT(a.uid) AS nb
FROM accounts AS a
INNER JOIN account_profiles AS ap ON (ap.uid = a.uid AND FIND_IN_SET('owner', ap.perms))
- INNER JOIN profile_education AS pe ON (pe.uid = ap.pid AND FIND_IN_SET('primary', pe.flags))
+ INNER JOIN profile_education AS pe ON (pe.pid = ap.pid AND FIND_IN_SET('primary', pe.flags))
WHERE pe.entry_year = {?} AND a.state = 'active'
GROUP BY jour", (int)$jours, 1 + (int)$jours, (int)$promo);
exit;
}
- function handler_promos(&$page, $promo = null)
+ function handler_promos($page, $promo = null)
{
$page->changeTpl('stats/nb_by_promo.tpl');
$res = XDB::iterRow('SELECT pe.entry_year AS promo, COUNT(*)
FROM accounts AS a
INNER JOIN account_profiles AS ap ON (ap.uid = a.uid AND FIND_IN_SET(\'owner\', ap.perms))
- INNER JOIN profile_education AS pe ON (pe.uid = ap.pid AND FIND_IN_SET(\'primary\', pe.flags))
+ INNER JOIN profile_education AS pe ON (pe.pid = ap.pid AND FIND_IN_SET(\'primary\', pe.flags))
WHERE pe.entry_year >= 1900 AND a.state = \'active\'
GROUP BY promo
ORDER BY promo');
$page->assign('promo', $promo);
}
- function handler_coupures(&$page, $cp_id = null)
+ function handler_coupures($page, $cp_id = null)
{
$page->changeTpl('stats/coupure.tpl');