Summary table done.
This commit is contained in:
parent
bf36486bf3
commit
8758598104
@ -53,6 +53,11 @@ class Exercice
|
||||
}
|
||||
}
|
||||
|
||||
function get_id()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
// retourne le nombre d'equipes qui ont résolues l'exercice
|
||||
// trié par date
|
||||
function get_solved()
|
||||
|
@ -169,11 +169,30 @@ class Team
|
||||
return $res['solved'];
|
||||
}
|
||||
|
||||
function get_solvedExercices()
|
||||
function get_solvedExercices($id_theme=-1)
|
||||
{
|
||||
if ($id_theme != -1)
|
||||
{
|
||||
$db = new BDD();
|
||||
$ids = $db->query("");
|
||||
$ids = $db->query("SELECT id_theme, id_exercice
|
||||
FROM `solved`
|
||||
LEFT OUTER JOIN exercices ON `solved`.id_exercice = `exercices`.id
|
||||
WHERE id_user =".$this->id." AND id_theme =".$id_theme);
|
||||
$db->deconnexion();
|
||||
|
||||
$array = array();
|
||||
$i = 0;
|
||||
if ($ids)
|
||||
{
|
||||
foreach ($ids as $id){
|
||||
$array[] = new Exercice($id['id_exercice']);
|
||||
}
|
||||
}
|
||||
|
||||
return $array;
|
||||
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
function authenticate($certificate)
|
||||
|
@ -2,7 +2,12 @@
|
||||
|
||||
if(!defined('ONYX')) exit;
|
||||
|
||||
$team = new Team($TEAM);
|
||||
//$solvedExercices = $team->get_solvedExercices();
|
||||
|
||||
$template->assign("themes", Theme::get_themes());
|
||||
$template->assign("nbExoMax", Exercice::get_nbExoMax());
|
||||
$template->assign("team", $team);
|
||||
//$template->assign("solvedExercices", $solvedExercices);
|
||||
|
||||
return "teams/summary";
|
||||
|
@ -25,8 +25,17 @@
|
||||
<tr>
|
||||
<th>{$theme->get_name()}</th>
|
||||
{$sum=0}
|
||||
{$themeID=$theme->get_id()}
|
||||
{$solvedExercices=$team->get_solvedExercices($themeID)} {*TODO: This line give a Warning*}
|
||||
{foreach from=$theme->get_exercicesOrdered() item=exo}
|
||||
{$pts=$exo->points}{$sum=$sum + $pts}
|
||||
{$pts=0}
|
||||
{for $i=0 to $nbExoMax}
|
||||
{if !empty($solvedExercices.$i)}
|
||||
{if $solvedExercices.$i->get_id() == $exo->get_id()}
|
||||
{$pts=$solvedExercices.$i->points}{$sum=$sum + $pts}
|
||||
{/if}
|
||||
{/if}
|
||||
{/for}
|
||||
<td>{$pts}</td>
|
||||
{/foreach}
|
||||
<td>{$sum}</td>
|
||||
|
Loading…
Reference in New Issue
Block a user