Les organisateurs peuvent valider une équipe

This commit is contained in:
galaxyoyo 2019-08-24 11:45:18 +02:00
parent 311cb66cdd
commit 4604ddd758
1 changed files with 15 additions and 1 deletions

View File

@ -4,13 +4,19 @@ include "config.php";
$trigram = htmlspecialchars($_GET["trigram"]);
$team_data = $DB->query("SELECT * FROM `teams` WHERE `trigram` = '$trigram';")->fetch();
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();
$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 `type` ORDER BY `user`, `type` ASC, `uploaded_at` DESC;");
$documents_req->execute([$team_data["id"]]);
?>
<?php include "header.php" ?>
@ -61,4 +67,12 @@ while (($data = $documents_req->fetch()) !== false) {
}
?>
<?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" ?>