mirror of
https://gitlab.com/animath/si/plateforme-corres2math.git
synced 2025-07-01 12:01:15 +02:00
Adaptation de la plateforme aux besoins des correspondances (en cours)
This commit is contained in:
@ -6,7 +6,6 @@ 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";
|
||||
@ -15,29 +14,10 @@ if (isset($_POST["validate"])) {
|
||||
$team->setValidationStatus(ValidationStatus::VALIDATED);
|
||||
}
|
||||
|
||||
if (isset($_POST["select"])) {
|
||||
$team->selectForFinal(true);
|
||||
$team->setValidationStatus(ValidationStatus::NOT_READY);
|
||||
$sols = $tournament->getAllSolutions($team->getId());
|
||||
/** @var Solution $sol */
|
||||
foreach ($sols as $sol) {
|
||||
$old_id = $sol->getFileId();
|
||||
do
|
||||
$id = genRandomPhrase(64);
|
||||
while (file_exists("$LOCAL_PATH/files/$id"));
|
||||
|
||||
copy("$LOCAL_PATH/files/$old_id", "$LOCAL_PATH/files/$id");
|
||||
|
||||
$req = $DB->prepare("INSERT INTO `solutions`(`file_id`, `team`, `tournament`, `problem`) VALUES (?, ?, ?, ?);");
|
||||
$req->execute([$id, $team->getId(), $FINAL->getId(), $sol->getFileId()]);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_POST["download_zip"])) {
|
||||
$final = isset($_POST["final"]);
|
||||
$tournament_dest = $final ? $FINAL : $tournament;
|
||||
|
||||
$file_name = getZipFile(DocumentType::PARENTAL_CONSENT, $tournament_dest->getId(), $team->getId());
|
||||
$file_name = getZipFile(DocumentType::PARENTAL_CONSENT, $tournament->getId(), $team->getId());
|
||||
|
||||
header("Content-Type: application/zip");
|
||||
header("Content-Disposition: attachment; filename=\"Documents de l'équipe " . $team->getTrigram() . ".zip\"");
|
||||
@ -51,7 +31,4 @@ if (isset($_POST["download_zip"])) {
|
||||
$documents = $tournament->getAllDocuments($team->getId());
|
||||
$documents_final = null;
|
||||
|
||||
if ($team->isSelectedForFinal())
|
||||
$documents_final = $FINAL->getAllDocuments($team->getId());
|
||||
|
||||
require_once "server_files/views/equipe.php";
|
||||
|
Reference in New Issue
Block a user