84 lines
2.9 KiB
PHP
84 lines
2.9 KiB
PHP
<?php
|
|
|
|
include "config.php";
|
|
|
|
$trigram = htmlspecialchars($_GET["trigram"]);
|
|
|
|
if (isset($_POST["validate"])) {
|
|
$DB->exec("UPDATE `teams` SET `validation_status` = 'VALIDATED' WHERE `trigram` = '$trigram' AND `year` = $YEAR;");
|
|
}
|
|
|
|
$team_data = $DB->query("SELECT * FROM `teams` WHERE `trigram` = '$trigram' AND `year` = $YEAR;")->fetch();
|
|
|
|
if ($team_data === false)
|
|
include "404.php";
|
|
|
|
$tournament_data = $DB->query("SELECT `name`, `date_start` FROM `tournaments` WHERE `id` = '" . $team_data["tournament"] . "' AND `year` = '$YEAR';")->fetch();
|
|
|
|
$documents_req = $DB->prepare("SELECT `file_id`, `user`, `type`, COUNT(`type`) AS `version` FROM `documents` WHERE `team` = ? GROUP BY `user`, `type` ORDER BY `user`, `type` ASC, MAX(`uploaded_at`) DESC;");
|
|
$documents_req->execute([$team_data["id"]]);
|
|
|
|
?>
|
|
|
|
<?php include "header.php" ?>
|
|
|
|
<h2>Informations sur l'équipe</h2>
|
|
|
|
Nom de l'équipe : <?= $team_data["name"] ?><br />
|
|
Trigramme : <?= $team_data["trigram"] ?><br />
|
|
Tournoi : <a href="<?= $URL_BASE . "/tournoi/" . $tournament_data["name"] ?>"><?= $tournament_data["name"] ?></a><br />
|
|
<?php
|
|
for ($i = 1; $i <= 2; ++$i) {
|
|
if ($team_data["encadrant_" . $i] == NULL)
|
|
continue;
|
|
$user_data = $DB->query("SELECT `id`, `surname`, `first_name` FROM `users` WHERE `id` = " . $team_data["encadrant_" . $i] . " AND `year` = '$YEAR';")->fetch();
|
|
$id = $user_data["id"];
|
|
echo "Encadrant $i : <a href=\"$URL_BASE/informations/$id/" . $user_data["first_name"] . " " . $user_data["surname"] . "\">" . $user_data["first_name"] . " " . $user_data["surname"] . "</a><br />";
|
|
}
|
|
for ($i = 1; $i <= 6; ++$i) {
|
|
if ($team_data["participant_" . $i] == NULL)
|
|
continue;
|
|
$user_data = $DB->query("SELECT `id`, `surname`, `first_name` FROM `users` WHERE `id` = " . $team_data["participant_" . $i] . " AND `year` = '$YEAR';")->fetch();
|
|
$id = $user_data["id"];
|
|
echo "Participant $i : <a href=\"$URL_BASE/informations/$id/" . $user_data["first_name"] . " " . $user_data["surname"] . "\">" . $user_data["first_name"] . " " . $user_data["surname"] . "</a><br />";
|
|
}
|
|
?>
|
|
|
|
<hr />
|
|
|
|
<h2>Autorisations</h2>
|
|
|
|
<?php
|
|
while (($data = $documents_req->fetch()) !== false) {
|
|
$file_id = $data["file_id"];
|
|
$type = $data["type"];
|
|
$user_id = $data["user"];
|
|
$user_data = $DB->query("SELECT `surname`, `first_name` FROM `users` WHERE `id` = '$user_id';")->fetch();
|
|
$surname = $user_data["surname"];
|
|
$first_name = $user_data["first_name"];
|
|
$version = $data["version"];
|
|
switch ($data["type"]) {
|
|
case "PARENTAL_CONSENT":
|
|
$name = "Autorisation parentale";
|
|
break;
|
|
case "PHOTO_CONSENT":
|
|
$name = "Autorisation de droit à l'image";
|
|
break;
|
|
case "SANITARY_PLUG":
|
|
$name = "Fiche sanitaire";
|
|
break;
|
|
}
|
|
echo "$name de $first_name $surname : <a href=\"$URL_BASE/file/$file_id\">Télécharger</a><br />";
|
|
}
|
|
?>
|
|
|
|
<?php
|
|
|
|
if ($team_data["validation_status"] == "WAITING") { ?>
|
|
<form method="POST">
|
|
<input type="submit" name="validate" value="Valider l'équipe" />
|
|
</form>
|
|
<?php } ?>
|
|
|
|
<?php include "footer.php" ?>
|