1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2024-12-25 06:22:22 +00:00

Le tournoi de la finale nationale est désormais une variable globale

This commit is contained in:
galaxyoyo 2019-09-07 14:31:28 +02:00
parent cb760cb059
commit 25a31b7f40
7 changed files with 15 additions and 15 deletions

View File

@ -17,9 +17,9 @@ if (isset($_POST["validate"])) {
if (isset($_POST["select"])) {
$team->selectForFinal(true);
$team->setValidationStatus(ValidationStatus::NOT_READY);
$_SESSION["final"] = Tournament::getFinalTournament();
$sols_req = $DB->prepare("SELECT `file_id`, `problem`, COUNT(`problem`) AS `version` FROM `solutions` WHERE `team` = ? AND `tournament` = ? GROUP BY `problem`, `uploaded_at` ORDER BY `problem`, `uploaded_at` DESC;");
/** @noinspection SqlAggregates */
$sols_req = $DB->prepare("SELECT `file_id`, `problem`, COUNT(`problem`) AS `version` FROM `solutions` WHERE `team` = ? AND `tournament` = ? GROUP BY `problem` ORDER BY `problem`, `uploaded_at` DESC;");
$sols_req->execute([$team->getId(), $team->getTournamentId()]);
while (($sol_data = $sols_req->fetch()) !== false) {
$old_id = $sol_data["file_id"];
@ -57,7 +57,7 @@ if (isset($_POST["select"])) {
copy("$LOCAL_PATH/files/$old_id", "$LOCAL_PATH/files/$id");
$req = $DB->prepare("INSERT INTO `syntheses`(`file_id`, `team`, `tournament`, `dest`) VALUES (?, ?, ?, ?);");
$req->execute([$id, $team->getId(), $_SESSION["final"]->getId(), $synthese_data["dest"]]);
$req->execute([$id, $team->getId(), $FINAL->getId(), $synthese_data["dest"]]);
}
}
@ -66,7 +66,7 @@ $documents_req->execute([$team->getId(), $team->getId()]);
if ($team->isSelectedForFinal()) {
$documents_final_req = $DB->prepare("SELECT `file_id`, `user`, `type`, COUNT(`type`) AS `version` FROM `documents` WHERE `team` = ? AND `tournament` != ? GROUP BY `user`, `type` ORDER BY `user`, `type` ASC, MAX(`uploaded_at`) DESC;");
$documents_final_req->execute([$team->getId(), $_SESSION["final"]->getId()]);
$documents_final_req->execute([$team->getId(), $FINAL->getId()]);
}
$tournament = Tournament::fromId($team->getTournamentId());

View File

@ -25,7 +25,7 @@ if (isset($_SESSION["user_id"]) && isset($_SESSION["team"]) && $_SESSION["team"]
$tournament = Tournament::fromId($team->getTournamentId());
$documents_req = $DB->prepare("SELECT `file_id`, `type`, COUNT(`type`) AS `version` FROM `documents` WHERE `user` = ? AND `tournament` = ? GROUP BY `type`, `uploaded_at` ORDER BY `type`, `uploaded_at` DESC;");
$documents_req->execute([$_SESSION["user_id"], $_SESSION[$team->isSelectedForFinal() ? $_SESSION["final"]->getId() : $tournament->getId()]]);
$documents_req->execute([$_SESSION["user_id"], $_SESSION[$team->isSelectedForFinal() ? $FINAL->getId() : $tournament->getId()]]);
}
else
require_once "server_files/403.php";

View File

@ -11,9 +11,9 @@ if (isset($_POST["send_solution"])) {
$team = $_SESSION["team"];
$solutions_req = $DB->prepare("SELECT `file_id`, `problem`, COUNT(`problem`) AS `version` FROM `solutions` WHERE `team` = ? AND `tournament` = ? GROUP BY `problem`, `uploaded_at` ORDER BY `problem`, `uploaded_at` DESC;");
$solutions_req->execute([$team->getId(), $_SESSION[$team->isSelectedForFinal() ? $_SESSION["final"]->getId() : $team->getTournamentId()]]);
$solutions_req->execute([$team->getId(), $_SESSION[$team->isSelectedForFinal() ? $FINAL->getId() : $team->getTournamentId()]]);
$tournament = Tournament::fromId($team->isSelectedForFinal() ? $_SESSION["final"]->getId() : $team->getTournamentId());
$tournament = Tournament::fromId($team->isSelectedForFinal() ? $FINAL->getId() : $team->getTournamentId());
function saveSolution() {
global $LOCAL_PATH, $DB;

View File

@ -11,9 +11,9 @@ if (isset($_POST["send_synthese"])) {
$team = $_SESSION["team"];
$syntheses_req = $DB->prepare("SELECT `file_id`, `dest`, COUNT(`dest`) AS `version` FROM `syntheses` WHERE `team` = ? AND `tournament` = ? GROUP BY `dest`, `uploaded_at` ORDER BY `dest`, `uploaded_at` DESC;");
$syntheses_req->execute([$team->getId(), $_SESSION[$team->isSelectedForFinal() ? $_SESSION["final"]->getId() : $team->getTournamentId()]]);
$syntheses_req->execute([$team->getId(), $_SESSION[$team->isSelectedForFinal() ? $FINAL->getId() : $team->getTournamentId()]]);
$tournament = Tournament::fromId($team->isSelectedForFinal() ? $_SESSION["final"]->getId() : $team->getTournamentId());
$tournament = Tournament::fromId($team->isSelectedForFinal() ? $FINAL->getId() : $team->getTournamentId());
function saveSynthese() {
global $LOCAL_PATH, $DB;

View File

@ -1,8 +1,8 @@
<?php
function loadUserValues() {
$_SESSION["final"] = Tournament::getFinalTournament();
$FINAL = Tournament::getFinalTournament();
function loadUserValues() {
$_SESSION["user"] = $_SESSION["team"] = $_SESSION["tournament"] = null;
unset($_SESSION["user"]);
unset($_SESSION["role"]);

View File

@ -21,7 +21,7 @@ for ($i = 1; $i <= 6; ++$i) {
echo "Participant $i : <a href=\"$URL_BASE/informations/$id/" . $participant->getFirstName() . " " . $participant->getSurname() . "\">" . $participant->getFirstName() . " " . $participant->getSurname() . "</a><br />";
}
if ($team->isSelectedForFinal()) {
$final_name = $_SESSION["final"]->getName();
$final_name = $FINAL->getName();
echo "<strong>Équipe sélectionnée pour la <a href=\"$URL_BASE/tournoi/$final_name\">finale nationale</a>.</strong>";
}
?>

View File

@ -33,7 +33,7 @@ for ($i = 1; $i <= 6; ++$i) {
?>
Code d'accès : <strong><?= $team->getAccessCode() ?></strong><br/>
<?php if ($team->isSelectedForFinal()) {
$final_name = $_SESSION["final"]->getName();
$final_name = $FINAL->getName();
echo "<strong>Équipe sélectionnée pour la <a href=\"$URL_BASE/tournoi/$final_name\">finale nationale</a>.</strong><br />";
} ?>
@ -120,7 +120,7 @@ Code d'accès : <strong><?= $team->getAccessCode() ?></strong><br/>
</td>
<td>
<select style="width: 100%;" id="type" name="type">
<?php if ($_SESSION["user"]->getBirthDate() > strval($YEAR - 18) . substr($tournament_data["date_start"], 4)) { ?>
<?php if ($_SESSION["user"]->getBirthDate() > strval($YEAR - 18) . substr($tournament->getStartDate(), 4)) { ?>
<option value="parental_consent">Autorisation parentale</option>
<?php } ?>
<option value="photo_consent">Autorisation de droit à l'image</option>