-
- $res = XDB::iterRow(
- "SELECT promo,COUNT(*)
- FROM auth_user_md5
- WHERE promo > 1900 AND perms IN ('admin','user') AND deces = 0
- GROUP BY promo
- ORDER BY promo");
- $max=0; $min=3000;
-
- while (list($p,$nb) = $res->next()) {
- $p = intval($p);
- if(!isset($nbpromo[$p/10])) {
- $nbpromo[$p/10] = Array('','','','','','','','','',''); // tableau de 10 cases vides
+ $cycles = array('X' => 'Polytechniciens', 'M' => 'Masters', 'D' => 'Docteurs');
+
+ $res = XDB::iterRow('SELECT pd.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 profiles AS p ON (p.pid = ap.pid)
+ INNER JOIN profile_display AS pd ON (pd.pid = ap.pid)
+ WHERE a.state = \'active\' AND p.deathdate IS NULL AND pd.promo != \'D (en cours)\'
+ GROUP BY pd.promo
+ ORDER BY pd.promo LIKE \'D%\', pd.promo LIKE \'M%\', pd.promo LIKE \'X%\', pd.promo');
+
+ $nbpromo = array();
+ while (list($promo, $count) = $res->next()) {
+ $prefix = substr($promo, 0, 4) . '-';
+ $unit = substr($promo, -1);
+ if(!isset($nbpromo[$cycles[$promo{0}]][$prefix])) {
+ $nbpromo[$cycles[$promo{0}]][$prefix] = array('', '', '', '', '', '', '', '', '', ''); // Empty array containing 10 cells.