Add public array

This commit is contained in:
Quentin Grosyeux 2013-11-25 21:12:01 +01:00
parent c5f96c8bb9
commit e137e755c0
2 changed files with 50 additions and 7 deletions

View File

@ -232,4 +232,21 @@ class Team
return $res['count_teams'];
}
public static function first_to_solve_exercice($id_exercice)
{
$db = new BDD();
$res = $db->unique_query("SELECT t3.team_name as result
FROM solved AS t1
INNER JOIN (
SELECT MIN(s.time) AS minTime
FROM solved AS s
WHERE s.id_exercice = ".$id_exercice."
) AS t2
INNER JOIN teams AS t3 ON t1.id_team = t3.id
WHERE t1.time = t2.minTime");
$db->deconnexion();
return $res['result'];
}
}

View File

@ -2,12 +2,38 @@
{block name=main}
<div class="jumbotron">
<h1>Example</h1>
<p><div id="test">This is a example</div></p>
<p>This is a example</p>
<p>This is a example</p>
<p>This is a example</p>
<p>This is a example</p>
<p>This is a example</p>
<table class="table">
<thead>
<tr>
<th></th>
{for $i=1 to $nbExoMax}
<th class="text-center">Exercice {$i}</th>
{/for}
</tr>
</thead>
<tbody>
{$total=0}
{foreach from=$themes item=theme}
<tr>
<th>{$theme->get_name()}</th>
{$themeID=$theme->get_id()}
{foreach from=$theme->get_exercices_ordered() item=exo}
{$teamName=""}
{for $i=0 to $nbExoMax}
{$teamName=Team::first_to_solve_exercice($exo->get_id())}
{/for}
{if $teamName != ""}
<td class="success text-center">{$teamName}</td>
{else}
<td class="danger text-center"></td>
{/if}
{/foreach}
</tr>
{/foreach}
</tbody>
</table>
</div>
{/block}