function handler_promos($page, $required_promo = null)
{
$page->changeTpl('stats/nb_by_promo.tpl');
+ $cycles = array('X' => 'Polytechniciens', 'M' => 'Masters', 'D' => 'Docteurs');
$res = XDB::iterRow('SELECT pd.promo, COUNT(*)
FROM accounts AS a
while (list($promo, $count) = $res->next()) {
$prefix = substr($promo, 0, 4) . '-';
$unit = substr($promo, -1);
- if(!isset($nbpromo[$prefix])) {
- $nbpromo[$prefix] = array('', '', '', '', '', '', '', '', '', ''); // Empty array containing 10 cells.
+ if(!isset($nbpromo[$cycles[$promo{0}]][$prefix])) {
+ $nbpromo[$cycles[$promo{0}]][$prefix] = array('', '', '', '', '', '', '', '', '', ''); // Empty array containing 10 cells.
}
- $nbpromo[$prefix][$unit] = array('promo' => $promo, 'nb' => $count);
+ $nbpromo[$cycles[$promo{0}]][$prefix][$unit] = array('promo' => $promo, 'nb' => $count);
}
$count = XDB::fetchOneCell('SELECT COUNT(*)
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)\'');
- $nbpromo['D (en cours)'][0] = array('promo' => 'D (en cours)', 'nb' => $count);
+ $nbpromo[$cycles['D']]['D (en cours)'][0] = array('promo' => 'D (en cours)', 'nb' => $count);
$page->assign_by_ref('nbs', $nbpromo);
$page->assign('promo', $required_promo);
</p>
<table class="bicol" cellpadding="3" cellspacing="0" summary="Statistiques">
+ {foreach from=$nbs key=cycle item=nb_cycle}
<tr>
- <th></th>
+ <th>{$cycle}</th>
<th>0</th><th>1</th><th>2</th><th>3</th><th>4</th>
<th>5</th><th>6</th><th>7</th><th>8</th><th>9</th>
</tr>
- {foreach item=nb10 key=lustre from=$nbs}
+ {foreach item=nb10 key=lustre from=$nb_cycle}
<tr>
<th>{$lustre}</th>
{foreach item=nb from=$nb10}
{/foreach}
</tr>
{/foreach}
+ {/foreach}
</table>
{if $promo}