Add public array
This commit is contained in:
parent
c5f96c8bb9
commit
e137e755c0
@ -232,4 +232,21 @@ class Team
|
|||||||
|
|
||||||
return $res['count_teams'];
|
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'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,12 +2,38 @@
|
|||||||
|
|
||||||
{block name=main}
|
{block name=main}
|
||||||
<div class="jumbotron">
|
<div class="jumbotron">
|
||||||
<h1>Example</h1>
|
|
||||||
<p><div id="test">This is a example</div></p>
|
<table class="table">
|
||||||
<p>This is a example</p>
|
<thead>
|
||||||
<p>This is a example</p>
|
<tr>
|
||||||
<p>This is a example</p>
|
<th></th>
|
||||||
<p>This is a example</p>
|
{for $i=1 to $nbExoMax}
|
||||||
<p>This is a example</p>
|
<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>
|
</div>
|
||||||
{/block}
|
{/block}
|
||||||
|
Loading…
Reference in New Issue
Block a user