- if ($promo == 'all') {
- // date de départ
- $depart = 1930;
-
- //recupere le nombre d'inscriptions par jour sur la plage concernée
- $res = XDB::iterRow("SELECT pe.entry_year AS promo, SUM(state = 'active') / COUNT(*) * 100
- 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))
- WHERE pe.entry_year >= {?} AND p.deathdate IS NULL
- GROUP BY promo", $depart);
-
- //genere des donnees compatibles avec GNUPLOT
- $inscrits='';
-
- // la première ligne contient le total des inscrits avant la date de départ
- list($annee, $nb) = $res->next();
-
- for ($i = $depart; $i <= date("Y"); $i++) {
- if ($annee < $i) {
- if(!list($annee, $nb) = $res->next()) {
- $annee = 0;
- $nb = 0;
- }
- }
- if ($nb > 0 || $i < date('Y'))
- $inscrits .= $i.' '.$nb."\n";
+ if (in_array($promo, array(Profile::DEGREE_X, Profile::DEGREE_M, Profile::DEGREE_D))) {
+ $cycle = Profile::$cycles[$promo] . 's';
+ $res = XDB::iterRow("SELECT pe.promo_year, SUM(a.state = 'active') / COUNT(*) * 100
+ 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.pid = ap.pid AND FIND_IN_SET('primary', pe.flags))
+ INNER JOIN profile_education_degree_enum AS ped ON (pe.degreeid = ped.id)
+ WHERE p.deathdate IS NULL AND ped.degree = {?}
+ GROUP BY pe.promo_year",
+ $promo);
+
+ list($promo, $count) = $res->next();
+ $first = $promo;
+ $registered = $promo . ' ' . $count . "\n";
+ while ($next = $res->next()) {
+ list($promo, $count) = $next;
+ $registered .= $promo . ' ' . $count . "\n";