forked from rebillar/site-accueil-insa
78 lines
2.2 KiB
PHP
78 lines
2.2 KiB
PHP
<?php
|
|
require_once 'classes/dao.php';
|
|
|
|
ob_start(); // Start reading html
|
|
|
|
|
|
function get_stats($team)
|
|
{
|
|
$dao = new Dao('');
|
|
foreach ($dao->get_score_team($team) as $row) {
|
|
$text = $row['text'];
|
|
$points = $row['points'];
|
|
if ($points > 0)
|
|
$id = "positive";
|
|
else
|
|
$id = "negative";
|
|
?>
|
|
<tr id="<?= $id ?>">
|
|
<td><?= $text ?></td>
|
|
<td><?= $points ?></td>
|
|
</tr>
|
|
<?php
|
|
}
|
|
}
|
|
|
|
?>
|
|
<h1>Stats</h1>
|
|
<p>
|
|
Les stats de la semaine.
|
|
<br>
|
|
Remporte le plus de points possible pour faire gagner ton équipe, mais attention à ne pas lui en faire perdre !
|
|
</p>
|
|
|
|
<div id="stats-container">
|
|
<table class="stats-table" id="stats-usa">
|
|
<tr>
|
|
<td colspan="2" class="edit-button-container">
|
|
<a href="edit_score/usa/edit.php" class="edit-button" id="button-usa">
|
|
Éditer les scores
|
|
</a>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<th colspan="2">USA</th>
|
|
</tr>
|
|
<tr>
|
|
<td class="stat-log">Log</td>
|
|
<td class="stat-points">Points</td>
|
|
</tr>
|
|
<?php get_stats('usa') ?>
|
|
</table>
|
|
<table class="stats-table" id="stats-urss">
|
|
<tr>
|
|
<td colspan="2" class="edit-button-container">
|
|
<a href="edit_score/urss/edit.php" class="edit-button" id="button-urss">
|
|
Éditer les scores
|
|
</a>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<th colspan="2">URSS</th>
|
|
</tr>
|
|
<tr>
|
|
<td class="stat-log">Log</td>
|
|
<td class="stat-points">Points</td>
|
|
</tr>
|
|
<?php get_stats('urss') ?>
|
|
</table>
|
|
</div>
|
|
<?php
|
|
$pageContent = ob_get_clean(); // Store html content in variable
|
|
$pageTitle = "Stats";
|
|
ob_start(); // Start reading html
|
|
?>
|
|
<link rel="stylesheet" type="text/css" media="screen" href="assets/css/stats.css">
|
|
<?php
|
|
$pageMeta = ob_get_clean(); // Store html content in variable
|
|
include("template.php"); // Display template with variable content
|