Add sumarry
This commit is contained in:
parent
a0657ff619
commit
bf36486bf3
@ -205,4 +205,16 @@ class Exercice
|
||||
"sha1" => $sha1
|
||||
);
|
||||
}
|
||||
|
||||
public static function get_nbExoMax()
|
||||
{
|
||||
$db = new BDD();
|
||||
$res = $db->unique_query("SELECT count(id) AS max FROM exercices
|
||||
GROUP BY id_theme
|
||||
ORDER BY max DESC
|
||||
LIMIT 1");
|
||||
$db->deconnexion();
|
||||
|
||||
return $res['max'];
|
||||
}
|
||||
}
|
||||
|
@ -169,6 +169,13 @@ class Team
|
||||
return $res['solved'];
|
||||
}
|
||||
|
||||
function get_solvedExercices()
|
||||
{
|
||||
$db = new BDD();
|
||||
$ids = $db->query("");
|
||||
$db->deconnexion();
|
||||
}
|
||||
|
||||
function authenticate($certificate)
|
||||
{
|
||||
//TODO
|
||||
|
@ -131,6 +131,9 @@ class Theme
|
||||
}
|
||||
}
|
||||
|
||||
foreach($res as &$r)
|
||||
$r = new Exercice($r["id"]);
|
||||
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
|
@ -2,5 +2,7 @@
|
||||
|
||||
if(!defined('ONYX')) exit;
|
||||
|
||||
$template->assign("themes", Theme::get_themes());
|
||||
$template->assign("nbExoMax", Exercice::get_nbExoMax());
|
||||
|
||||
return "teams/summary";
|
||||
|
@ -8,4 +8,38 @@
|
||||
<h1>
|
||||
THIS IS SUMMARY
|
||||
</h1>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
{for $i=1 to $nbExoMax}
|
||||
<th>exo{$i}</th>
|
||||
{/for}
|
||||
<th>Points</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{$total=0}
|
||||
{foreach from=$themes item=theme}
|
||||
<tr>
|
||||
<th>{$theme->get_name()}</th>
|
||||
{$sum=0}
|
||||
{foreach from=$theme->get_exercicesOrdered() item=exo}
|
||||
{$pts=$exo->points}{$sum=$sum + $pts}
|
||||
<td>{$pts}</td>
|
||||
{/foreach}
|
||||
<td>{$sum}</td>
|
||||
</tr>
|
||||
{$total=$total+$sum}
|
||||
{/foreach}
|
||||
<tr>
|
||||
{for $i=1 to $nbExoMax}
|
||||
<td></td>
|
||||
{/for}
|
||||
<td>Total :</td>
|
||||
<td>{$total}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
{/block}
|
||||
|
Loading…
Reference in New Issue
Block a user