mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2025-06-25 20:57:25 +02:00
Améliorations du code
This commit is contained in:
@ -6,6 +6,7 @@ if (!isset($_SESSION["user_id"]) || $_SESSION["role"] != Role::ORGANIZER && $_SE
|
||||
$trigram = htmlspecialchars($_GET["trigram"]);
|
||||
|
||||
$team = Team::fromTrigram($trigram);
|
||||
$tournament = Tournament::fromId($team->getTournamentId());
|
||||
|
||||
if ($team === null)
|
||||
require_once "server_files/404.php";
|
||||
@ -35,20 +36,17 @@ if (isset($_POST["select"])) {
|
||||
|
||||
copy("$LOCAL_PATH/files/$old_id", "$LOCAL_PATH/files/$id");
|
||||
|
||||
$req = $DB->prepare("INSERT INTO `solutions`(`file_id`, `team`, `tournament`, `problem`)
|
||||
VALUES (?, ?, ?, ?);");
|
||||
$req = $DB->prepare("INSERT INTO `solutions`(`file_id`, `team`, `tournament`, `problem`) VALUES (?, ?, ?, ?);");
|
||||
$req->execute([$id, $team->getId(), $_SESSION["final_id"], $sol_data["problem"]]);
|
||||
}
|
||||
}
|
||||
|
||||
$documents_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_req->execute([$team->getId(), $team->getId()]);
|
||||
// TODO Télécharger en zip les documents personnels
|
||||
|
||||
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(), $FINAL->getId()]);
|
||||
}
|
||||
$documents = $tournament->getAllDocuments($team->getId());
|
||||
$documents_final = null;
|
||||
|
||||
$tournament = Tournament::fromId($team->getTournamentId());
|
||||
if ($team->isSelectedForFinal())
|
||||
$documents_final = $FINAL->getAllDocuments($team->getId());
|
||||
|
||||
require_once "server_files/views/equipe.php";
|
||||
|
Reference in New Issue
Block a user