1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2024-12-25 17:42:24 +00:00
plateforme-tfjm2/server_files/tournoi.php
2019-08-21 22:56:46 +02:00

107 lines
4.5 KiB
PHP

<?php
include 'config.php';
$tournament_name = htmlspecialchars($_GET["nom"]);
$response = $DB->prepare("SELECT * FROM `tournaments` WHERE `name` = ? AND `year` = $YEAR;");
$response->execute([$tournament_name]);
$data = $response->fetch();
$orga_data = $DB->query("SELECT `surname`, `first_name` FROM `users` WHERE `id` = " . $data["organizer"] . " AND `year` = $YEAR;")->fetch();
$orga_name = $orga_data["first_name"] . " " . $orga_data["surname"];
$teams_response = $DB->query("SELECT `id`, `name`, `trigram`, `inscription_date`, `validation_status` FROM `teams` WHERE `tournament` = " . $data["id"] . " AND `year` = $YEAR;");
?>
<?php include "header.php" ?>
<h2>Tournoi de <?php echo $data["name"] ?></h2>
<strong>Organisateur :</strong> <?php echo $orga_name ?><br />
<strong>Nombre d'équipes maximal :</strong> <?php echo $data["size"] ?><br />
<strong>Lieu :</strong> <?php echo $data["place"] ?><br />
<strong>Prix par partipant :</strong> <?php echo $data["price"] == 0 ? "Gratuit" : $data["price"] . " €" ?><br />
<strong>Dates :</strong> Du <?php echo echo_date($data["date_start"]) ?> au <?php echo echo_date($data["date_end"]) ?><br />
<strong>Clôture des inscriptions :</strong> <?php echo echo_date($data["date_inscription"], true) ?><br />
<strong>Date limite d'envoi des solutions :</strong> <?php echo echo_date($data["date_solutions"], true) ?><br />
<strong>Date limite d'envoi des notes de synthèse :</strong> <?php echo echo_date($data["date_syntheses"], true) ?><br />
<strong>Description :</strong> <?php echo $data["description"] ?>
<h2>Équipes inscrites à ce tournoi :</h2>
<table style="border: 1px solid black; width: 100%;">
<thead>
<tr>
<th style="border: 1px solid black; text-align: center">
Équipe
</th>
<th style="border: 1px solid black; text-align: center">
Trigramme
</th>
<th style="border: 1px solid black; text-align: center">
Date d'inscription
</th>
<th style="border: 1px solid black; text-align: center">
État de validation de l'inscription
</th>
</tr>
</thead>
<tbody>
<?php
while (($team_data = $teams_response->fetch()) != false) {
?>
<tr>
<td style="border: 1px solid black; text-align: center">
<?php
if (isset($_SESSION["role"]) && ($_SESSION["role"] == "ADMIN" || ($_SESSION["role"] == "ORGANIZER" && $data["organizer"] == $_SESSION["user_id"])))
echo "<a href=\"$URL_BASE/equipe/" . $team_data["trigram"] . "\">" . $team_data["name"] . "</a>";
else
echo $team_data["name"];
?>
</td>
<td style="border: 1px solid black; text-align: center"><?php echo $team_data["trigram"] ?></td>
<td style="border: 1px solid black; text-align: center"><?php echo echo_date($team_data["inscription_date"]) ?></td>
<td style="border: 1px solid black; text-align: center">
<?php
switch ($team_data["validation_status"]) {
case "NOT_READY":
echo "Inscription non terminée";
break;
case "WAITING":
echo "En attente de validation";
break;
case "VALIDATED":
echo "Inscription validée";
break;
default:
echo "Statut inconnu";
break;
}
?>
</td>
</tr>
<?php
}
?>
</tbody>
<tfoot>
<tr>
<th style="border: 1px solid black; text-align: center">
Équipe
</th>
<th style="border: 1px solid black; text-align: center">
Trigramme
</th>
<th style="border: 1px solid black; text-align: center">
Date d'inscription
</th>
<th style="border: 1px solid black; text-align: center">
État de validation de l'inscription
</th>
</tr>
</tfoot>
</table>
<?php include "footer.php" ?>