diff --git a/assets/Fiche synthèse.pdf b/assets/Fiche synthèse.pdf new file mode 100644 index 0000000..af8ed1c Binary files /dev/null and b/assets/Fiche synthèse.pdf differ diff --git a/assets/Fiche synthèse.tex b/assets/Fiche synthèse.tex new file mode 100644 index 0000000..bc2daa9 --- /dev/null +++ b/assets/Fiche synthèse.tex @@ -0,0 +1,194 @@ +\documentclass{article} + +\usepackage[utf8]{inputenc} +\usepackage[french]{babel} +\usepackage{graphicx} + +\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry} % marges + +\usepackage{amsthm} +\usepackage{amsmath} +\usepackage{amsfonts} +\usepackage{amssymb} +\usepackage{tikz} + +\newcommand{\N}{{\bf N}} +\newcommand{\Z}{{\bf Z}} +\newcommand{\Q}{{\bf Q}} +\newcommand{\R}{{\bf R}} +\newcommand{\C}{{\bf C}} +\newcommand{\A}{{\bf A}} + +\newtheorem{theo}{Théorème} +\newtheorem{theo-defi}[theo]{Théorème-Définition} +\newtheorem{defi}[theo]{Définition} +\newtheorem{lemme}[theo]{Lemme} +\newtheorem{slemme}[theo]{Sous-lemme} +\newtheorem{prop}[theo]{Proposition} +\newtheorem{coro}[theo]{Corollaire} +\newtheorem{conj}[theo]{Conjecture} + +\title{Note de synthèse} + +\begin{document} +\pagestyle{empty} + +\begin{center} +\begin{Huge} +$\mathbb{TFJM}^2$ +\end{Huge} + +\bigskip + +\begin{Large} +NOTE DE SYNTHESE +\end{Large} +\end{center} + +Tour \underline{~~~~} poule \underline{~~~~} + +\medskip + +Problème \underline{~~~~} défendu par l'équipe \underline{~~~~~~~~~~~~~~~~~~~~~~~~} + +\medskip + +Synthèse par l'équipe \underline{~~~~~~~~~~~~~~~~~~~~~~~~} dans le rôle de : ~ $\square$ Opposant ~ $\square$ Rapporteur + +\section*{Questions traitées} + +\begin{tabular}{r c l} + \begin{tabular}{|c|c|c|c|c|c|} + \hline + Question ~ & ER & ~PR~ & QE & NT \\ + \hline + & & & & \\ + \hline + & & & & \\ + \hline + & & & & \\ + \hline + & & & & \\ + \hline + & & & & \\ + \hline + & & & & \\ + \hline + & & & & \\ + \hline + & & & & \\ + \hline + & & & & \\ + \hline + & & & & \\ + \hline + \end{tabular} +& ~~ & + \begin{tabular}{|c|c|c|c|c|c|} + \hline + Question ~ & ER & ~PR~ & QE & NT \\ + \hline + & & & & \\ + \hline + & & & & \\ + \hline + & & & & \\ + \hline + & & & & \\ + \hline + & & & & \\ + \hline + & & & & \\ + \hline + & & & & \\ + \hline + & & & & \\ + \hline + & & & & \\ + \hline + & & & & \\ + \hline + \end{tabular} \\ + + & & \\ + +ER : entièrement résolue & & PR : partiellement résolue \\ + +\smallskip + +QE : quelques éléments de réponse & & NT : non traitée +\end{tabular} + +~ + +\smallskip + +Remarque : il est possible de cocher entre les cases pour un cas intermédiaire. + +\section*{Evaluation qualitative de la solution} + +Donnez votre avis concernant la solution. Mettez notamment en valeur les points positifs (des idées +importantes, originales, etc.) et précisez ce qui aurait pu améliorer la solution. + +\vfill + +\textbf{Evaluation générale :} ~ $\square$ Excellente ~ $\square$ Bonne ~ $\square$ Suffisante ~ $\square$ Passable + +\newpage + +\section*{Erreurs et imprécisions} + +Listez ci-dessous les cinq erreurs et/ou imprécisions les plus importantes selon vous, par ordre d'importance, en précisant la +question concernée, la page, le paragraphe et le type de remarque. + +\bigskip + +1. Question \underline{~~~~} Page \underline{~~~~} Paragraphe \underline{~~~~} + +$\square$ Erreur majeure ~ $\square$ Erreur mineure ~ $\square$ Imprécision ~ $\square$ Autre : \underline{~~~~~~~~} + +Description : + +\vfill + +2. Question \underline{~~~~} Page \underline{~~~~} Paragraphe \underline{~~~~} + +$\square$ Erreur majeure ~ $\square$ Erreur mineure ~ $\square$ Imprécision ~ $\square$ Autre : \underline{~~~~~~~~} + +Description : + +\vfill + +3. Question \underline{~~~~} Page \underline{~~~~} Paragraphe \underline{~~~~} + +$\square$ Erreur majeure ~ $\square$ Erreur mineure ~ $\square$ Imprécision ~ $\square$ Autre : \underline{~~~~~~~~} + +Description : + +\vfill + +4. Question \underline{~~~~} Page \underline{~~~~} Paragraphe \underline{~~~~} + +$\square$ Erreur majeure ~ $\square$ Erreur mineure ~ $\square$ Imprécision ~ $\square$ Autre : \underline{~~~~~~~~} + +Description : + +\vfill + +5. Question \underline{~~~~} Page \underline{~~~~} Paragraphe \underline{~~~~} + +$\square$ Erreur majeure ~ $\square$ Erreur mineure ~ $\square$ Imprécision ~ $\square$ Autre : \underline{~~~~~~~~} + +Description : + +\vfill + +\section*{Remarques formelles (facultatif)} + +Donnez votre avis concernant la présentation de la solution (lisibilité, etc.). + +\vfill + + + +\end{document} diff --git a/dispatcher.php b/dispatcher.php index 17a7c94..1f4106f 100644 --- a/dispatcher.php +++ b/dispatcher.php @@ -66,6 +66,8 @@ $ROUTES["^Instructions.pdf$"] = ["server_files/controllers/instructions.php"]; $ROUTES["^favicon\.ico$"] = ["assets/favicon.ico", "image/x-icon"]; $ROUTES["^Fiche sanitaire\.pdf$"] = ["assets/Fiche_sanitaire.pdf", "application/pdf"]; +$ROUTES["^Note de synthèse.pdf$"] = ["assets/Fiche synthèse.pdf", "application/pdf"]; +$ROUTES["^Note de synthèse.tex"] = ["assets/Fiche synthèse.tex", "text/plain"]; $ROUTES["^logo\.svg$"] = ["assets/logo.svg", "image/svg+xml"]; $ROUTES["^style\.css$"] = ["assets/style.css", "text/css"]; diff --git a/server_files/classes/Document.php b/server_files/classes/Document.php index 47897be..74b2fb2 100644 --- a/server_files/classes/Document.php +++ b/server_files/classes/Document.php @@ -157,6 +157,7 @@ class Synthesis private $team_id; private $tournament_id; private $dest; + private $round; private $uploaded_at; private $version; @@ -187,7 +188,8 @@ class Synthesis $this->file_id = $data["file_id"]; $this->team_id = $data["team"]; $this->tournament_id = $data["tournament"]; - $this->dest = DestType::fromName($data["dest"]); + $this->dest = $data["dest"]; + $this->round = $data["round"]; $this->uploaded_at = $data["uploaded_at"]; $this->version = isset($data["version"]) ? $data["version"] : 1; } @@ -207,10 +209,15 @@ class Synthesis return $this->tournament_id; } - public function getDest() - { - return $this->dest; - } + public function getDest() + { + return $this->dest; + } + + public function getRound() + { + return $this->round; + } public function getUploadedAt() { diff --git a/server_files/classes/Tournament.php b/server_files/classes/Tournament.php index e404e7d..6860bad 100644 --- a/server_files/classes/Tournament.php +++ b/server_files/classes/Tournament.php @@ -12,7 +12,9 @@ class Tournament private $date_start, $date_end; private $date_inscription; private $date_solutions; - private $date_syntheses; + private $date_syntheses; + private $date_solutions_2; + private $date_syntheses_2; private $final; private $organizers = []; private $year; @@ -98,8 +100,10 @@ class Tournament $this->date_start = $data["date_start"]; $this->date_end = $data["date_end"]; $this->date_inscription = $data["date_inscription"]; - $this->date_solutions = $data["date_solutions"]; - $this->date_syntheses = $data["date_syntheses"]; + $this->date_solutions = $data["date_solutions"]; + $this->date_solutions_2 = $data["date_solutions_2"]; + $this->date_syntheses = $data["date_syntheses"]; + $this->date_syntheses_2 = $data["date_syntheses_2"]; $this->final = $data["final"] == true; $this->year = $data["year"]; @@ -224,17 +228,41 @@ class Tournament $DB->prepare("UPDATE `tournaments` SET `date_solutions` = ? WHERE `id` = ?;")->execute([$date, $this->id]); } - public function getSynthesesDate() - { - return $this->date_syntheses; - } + public function getSynthesesDate() + { + return $this->date_syntheses; + } - public function setSynthesesDate($date) - { - global $DB; - $this->date_syntheses = $date; - $DB->prepare("UPDATE `tournaments` SET `date_syntheses` = ? WHERE `id` = ?;")->execute([$date, $this->id]); - } + public function setSynthesesDate($date) + { + global $DB; + $this->date_syntheses = $date; + $DB->prepare("UPDATE `tournaments` SET `date_syntheses` = ? WHERE `id` = ?;")->execute([$date, $this->id]); + } + + public function getSolutionsDate2() + { + return $this->date_solutions_2; + } + + public function setSolutionsDate2($date) + { + global $DB; + $this->date_solutions_2 = $date; + $DB->prepare("UPDATE `tournaments` SET `date_solutions_2` = ? WHERE `id` = ?;")->execute([$date, $this->id]); + } + + public function getSynthesesDate2() + { + return $this->date_syntheses_2; + } + + public function setSynthesesDate2($date) + { + global $DB; + $this->date_syntheses_2 = $date; + $DB->prepare("UPDATE `tournaments` SET `date_syntheses_2` = ? WHERE `id` = ?;")->execute([$date, $this->id]); + } public function isFinal() { @@ -343,9 +371,9 @@ class Tournament global $DB; $req = $DB->query("SELECT * FROM `syntheses` AS `t1` " - . "INNER JOIN (SELECT `team`, `dest`, `tournament`, MAX(`uploaded_at`) AS `last_upload`, COUNT(`team`) AS `version` FROM `syntheses` GROUP BY `tournament`, `team`, `dest`) `t2` " - . "ON `t1`.`team` = `t2`.`team` AND `t1`.`dest` = `t2`.`dest` AND `t1`.`tournament` = `t2`.`tournament` " - . "WHERE `t1`.`uploaded_at` = `t2`.`last_upload` AND `t1`.`tournament` = $this->id " . ($team_id == -1 ? "" : "AND `t1`.`team` = $team_id") . " ORDER BY `t1`.`team`, `t1`.`dest`;"); + . "INNER JOIN (SELECT `team`, `dest`, `round`, `tournament`, MAX(`uploaded_at`) AS `last_upload`, COUNT(`team`) AS `version` FROM `syntheses` GROUP BY `tournament`, `team`, `dest`, `round`) `t2` " + . "ON `t1`.`team` = `t2`.`team` AND `t1`.`dest` = `t2`.`dest` AND `t1`.`tournament` = `t2`.`tournament` AND `t1`.`round` = `t2`.`round` " + . "WHERE `t1`.`uploaded_at` = `t2`.`last_upload` AND `t1`.`tournament` = $this->id " . ($team_id == -1 ? "" : "AND `t1`.`team` = $team_id") . " ORDER BY `t1`.`team`, `t1`.`round`, `t1`.`dest`;"); $syntheses = []; diff --git a/server_files/config.php b/server_files/config.php index 00b9ff3..7fba1c6 100644 --- a/server_files/config.php +++ b/server_files/config.php @@ -25,5 +25,7 @@ catch (Exception $ex) { die("Erreur lors de la connexion à la base de données : " . $ex->getMessage()); } +date_default_timezone_set("Europe/Paris"); + session_start(); setlocale(LC_ALL, "fr_FR.utf8"); diff --git a/server_files/controllers/ajouter_tournoi.php b/server_files/controllers/ajouter_tournoi.php index 4efc6f2..6618de7 100644 --- a/server_files/controllers/ajouter_tournoi.php +++ b/server_files/controllers/ajouter_tournoi.php @@ -30,8 +30,12 @@ class NewTournament { public $time_inscription; public $date_solutions; public $time_solutions; - public $date_syntheses; - public $time_syntheses; + public $date_syntheses; + public $time_syntheses; + public $date_solutions_2; + public $time_solutions_2; + public $date_syntheses_2; + public $time_syntheses_2; public $description; public $final; public $tournament; @@ -72,7 +76,9 @@ class NewTournament { ensure(dateWellFormed($this->date_end), "La date de fin n'est pas valide."); ensure(dateWellFormed($this->date_inscription . " " . $this->time_inscription), "La date de clôture des inscriptions n'est pas valide."); ensure(dateWellFormed($this->date_solutions . " " . $this->time_solutions), "La date limite de remise des solutions n'est pas valide."); - ensure(dateWellFormed($this->date_syntheses . " " . $this->time_syntheses), "La date limite de remise des notes de synthèse n'est pas valide."); + ensure(dateWellFormed($this->date_syntheses . " " . $this->time_syntheses), "La date limite de remise des notes de synthèse pour le tour 1 n'est pas valide."); + ensure(dateWellFormed($this->date_solutions_2 . " " . $this->time_solutions_2), "La date limite de visibilité des solutions du tour 2 n'est pas valide."); + ensure(dateWellFormed($this->date_syntheses . " " . $this->time_syntheses), "La date limite de remise des notes de synthèse pour le tour 2 n'est pas valide."); $this->final = $this->final ? 1 : 0; @@ -84,10 +90,13 @@ class NewTournament { global $DB, $YEAR; $req = $DB->prepare("INSERT INTO `tournaments` (`name`, `size`, `place`, `price`, `description`, - `date_start`, `date_end`, `date_inscription`, `date_solutions`, `date_syntheses`, `final`, `year`) - VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);"); + `date_start`, `date_end`, `date_inscription`, `date_solutions`, `date_syntheses`, + `date_solutions_2`, `date_syntheses_2`, `final`, `year`) + VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);"); $req->execute([$this->name, $this->size, $this->place, $this->price, $this->description, $this->date_start, $this->date_end, - "$this->date_inscription $this->time_inscription", "$this->date_solutions $this->time_solutions", "$this->date_syntheses $this->time_syntheses", $this->final ? 1 : 0, $YEAR]); + "$this->date_inscription $this->time_inscription", "$this->date_solutions $this->time_solutions", + "$this->date_syntheses $this->time_syntheses", "$this->date_solutions_2 $this->time_solutions_2", + "$this->date_syntheses_2 $this->time_syntheses_2", $this->final ? 1 : 0, $YEAR]); $this->tournament = Tournament::fromName($this->name); diff --git a/server_files/controllers/equipe.php b/server_files/controllers/equipe.php index 9e9a2eb..d50748e 100644 --- a/server_files/controllers/equipe.php +++ b/server_files/controllers/equipe.php @@ -37,7 +37,7 @@ elseif (isset($_POST["unvalidate"])) { if (isset($_POST["select"])) { $team->selectForFinal(true); - $team->setValidationStatus(ValidationStatus::NOT_READY); + # $team->setValidationStatus(ValidationStatus::NOT_READY); $sols = $tournament->getAllSolutions($team->getId()); /** @var Solution $sol */ foreach ($sols as $sol) { @@ -49,7 +49,7 @@ 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->execute([$id, $team->getId(), $FINAL->getId(), $sol->getFileId()]); + $req->execute([$id, $team->getId(), $FINAL->getId(), $sol->getProblem()]); } } @@ -86,6 +86,19 @@ if (isset($_POST["select_tournament"])) { $tournament = $new_tournament; } +if (isset($_POST["delete_team"])) { + foreach ($team->getEncadrants() as $encadrant_id) { + quitTeam($encadrant_id); + } + foreach ($team->getParticipants() as $participant_id) { + quitTeam($participant_id); + } + + header("Location: /"); + return; + +} + class EditTeam { public $name; @@ -136,4 +149,25 @@ $documents_final = null; if ($team->isSelectedForFinal()) $documents_final = $FINAL->getAllDocuments($team->getId()); +$emails = []; + +if ($_SESSION["role"] == Role::ORGANIZER || $_SESSION["role"] == Role::ADMIN) { + foreach ($team->getEncadrants() as $encadrant_id) { + $encadrant = User::fromId($encadrant_id); + if ($encadrant != null) { + $emails[] = $encadrant->getEmail(); + } + } + + foreach ($team->getParticipants() as $participant_id) { + $participant = User::fromId($participant_id); + if ($participant != null) { + $emails[] = $participant->getEmail(); + if ($participant->getResponsibleEmail() != null) { + $emails[] = $participant->getResponsibleEmail(); + } + } + } +} + require_once "server_files/views/equipe.php"; diff --git a/server_files/controllers/informations.php b/server_files/controllers/informations.php index b45e68a..cdb0047 100644 --- a/server_files/controllers/informations.php +++ b/server_files/controllers/informations.php @@ -23,7 +23,8 @@ if ($user === null) require_once "server_files/404.php"; if ($team != null) { - $documents = $user->getAllDocuments($team->getTournamentId()); + $documents = $user->getAllDocuments($team->getTournamentId()); + $documents_final = $user->getAllDocuments($FINAL->getId()); $payment = $user->getPayment(); $tournament = Tournament::fromId($team->getTournamentId()); } diff --git a/server_files/controllers/mon_equipe.php b/server_files/controllers/mon_equipe.php index f83957c..e165dcb 100644 --- a/server_files/controllers/mon_equipe.php +++ b/server_files/controllers/mon_equipe.php @@ -47,6 +47,94 @@ if (isset($_POST["request_validation"])) { } } +$DUMPS = [ + ["TKT", 6, "PGA", 3, "IRD", 1], + ["OUI", 8, "LEP", 1, "REX", 7], + ["ASP", 1, "ABC", 3, "TDP", 6], + ["GIF", 8, "ETM", 1, "LPC", 3], + ["MST", 6, "LQF", 1, "WAL", 2], +]; + +$DUMPS_2 = [ + ["TKT", 4, "PGA", 1, "IRD", 6], + ["LEP", 6, "OUI", 5, "REX", 8], + ["ASP", 5, "ABC", 8, "TDP", 4], + ["ETM", 8, "LPC", 4, "GIF", 6], + ["MST", 5, "LQF", 4, "WAL", 8], +]; + +foreach ($DUMPS as $dump) { + $team1 = Team::fromTrigram($dump[0]); + $team2 = Team::fromTrigram($dump[2]); + $team3 = Team::fromTrigram($dump[4]); + $problem1 = $dump[1]; + $problem2 = $dump[3]; + $problem3 = $dump[5]; + + $req1 = $DB->prepare("SELECT * FROM `solutions` WHERE `team` = ? AND `problem` = ? ORDER BY uploaded_at DESC LIMIT 1"); + $req1->execute([$team1->getId(), $problem1]); + $data1 = $req1->fetch(); + $sol1 = Solution::fromData($data1); + $req2 = $DB->prepare("SELECT * FROM `solutions` WHERE `team` = ? AND `problem` = ? ORDER BY uploaded_at DESC LIMIT 1"); + $req2->execute([$team2->getId(), $problem2]); + $data2 = $req2->fetch(); + $sol2 = Solution::fromData($data2); + $req3 = $DB->prepare("SELECT * FROM `solutions` WHERE `team` = ? AND `problem` = ? ORDER BY uploaded_at DESC LIMIT 1"); + $req3->execute([$team3->getId(), $problem3]); + $data3 = $req3->fetch(); + $sol3 = Solution::fromData($data3); + + $req1 = $DB->prepare("UPDATE `teams` SET `opposed_problem` = ?, `rapported_problem` = ? WHERE `id` = ?;"); + $req1->execute([$sol2->getFileId(), $sol3->getFileId(), $team1->getId()]); + + $req2 = $DB->prepare("UPDATE `teams` SET `opposed_problem` = ?, `rapported_problem` = ? WHERE `id` = ?;"); + $req2->execute([$sol3->getFileId(), $sol1->getFileId(), $team2->getId()]); + + $req3 = $DB->prepare("UPDATE `teams` SET `opposed_problem` = ?, `rapported_problem` = ? WHERE `id` = ?;"); + $req3->execute([$sol1->getFileId(), $sol2->getFileId(), $team3->getId()]); +} + +foreach ($DUMPS_2 as $dump) { + $team1 = Team::fromTrigram($dump[0]); + $team2 = Team::fromTrigram($dump[2]); + $team3 = Team::fromTrigram($dump[4]); + $problem1 = $dump[1]; + $problem2 = $dump[3]; + $problem3 = $dump[5]; + + $req1 = $DB->prepare("SELECT * FROM `solutions` WHERE `team` = ? AND `problem` = ? ORDER BY uploaded_at DESC LIMIT 1"); + $req1->execute([$team1->getId(), $problem1]); + $data1 = $req1->fetch(); + $sol1 = Solution::fromData($data1); + $req2 = $DB->prepare("SELECT * FROM `solutions` WHERE `team` = ? AND `problem` = ? ORDER BY uploaded_at DESC LIMIT 1"); + $req2->execute([$team2->getId(), $problem2]); + $data2 = $req2->fetch(); + $sol2 = Solution::fromData($data2); + $req3 = $DB->prepare("SELECT * FROM `solutions` WHERE `team` = ? AND `problem` = ? ORDER BY uploaded_at DESC LIMIT 1"); + $req3->execute([$team3->getId(), $problem3]); + $data3 = $req3->fetch(); + $sol3 = Solution::fromData($data3); + + $req1 = $DB->prepare("UPDATE `teams` SET `opposed_problem_2` = ?, `rapported_problem_2` = ? WHERE `id` = ?;"); + $req1->execute([$sol2->getFileId(), $sol3->getFileId(), $team1->getId()]); + + $req2 = $DB->prepare("UPDATE `teams` SET `opposed_problem_2` = ?, `rapported_problem_2` = ? WHERE `id` = ?;"); + $req2->execute([$sol3->getFileId(), $sol1->getFileId(), $team2->getId()]); + + $req3 = $DB->prepare("UPDATE `teams` SET `opposed_problem_2` = ?, `rapported_problem_2` = ? WHERE `id` = ?;"); + $req3->execute([$sol1->getFileId(), $sol2->getFileId(), $team3->getId()]); +} + + +$req = $DB->prepare("SELECT opposed_problem, rapported_problem, opposed_problem_2, rapported_problem_2 FROM teams WHERE id = ?;"); +$req->execute([$team->getId()]); +$data = $req->fetch(); + +$opposed_solution = Solution::fromId($data["opposed_problem"]); +$rapported_solution = Solution::fromId($data["rapported_problem"]); +$opposed_solution_2 = Solution::fromId($data["opposed_problem_2"]); +$rapported_solution_2 = Solution::fromId($data["rapported_problem_2"]); + class MyTeam { public $name; diff --git a/server_files/controllers/syntheses.php b/server_files/controllers/syntheses.php index 38be9cf..804618d 100644 --- a/server_files/controllers/syntheses.php +++ b/server_files/controllers/syntheses.php @@ -29,19 +29,24 @@ if ($team->isSelectedForFinal()) class SaveSynthesis { private $dest; + private $round; private $file; public function __construct() { $this->file = $_FILES["synthese"]; + $this->round = htmlspecialchars($_POST["round"]); $this->dest = DestType::fromName(strtoupper(htmlspecialchars($_POST["dest"]))); } public function makeVerifications() { - global $LOCAL_PATH; + global $LOCAL_PATH, $tournament; - ensure($this->dest != DestType::DEFENSEUR, "Le destinataire est invalide."); + ensure($this->dest != DestType::DEFENSEUR, "La source est invalide."); + ensure($this->round == 1 || $this->round == 2, "Le tour est invalide."); + $now = date("Y-m-d H:i"); + ensure($this->round == 1 && $now < $tournament->getSynthesesDate() || $this->round == 2 && $now < $tournament->getSynthesesDate2(), "Vous ne pouvez plus rendre de note de synthèse pour le tour $this->round."); ensure($this->file["size"] <= 2e6, "Le fichier doit peser moins que 2 Mo."); ensure(!$this->file["error"], "Une erreur est survenue."); ensure(finfo_file(finfo_open(FILEINFO_MIME_TYPE), $this->file["tmp_name"]) == "application/pdf", "Le fichier doit être au format PDF."); @@ -58,8 +63,8 @@ class SaveSynthesis if (!rename($this->file["tmp_name"], "$LOCAL_PATH/files/$id")) throw new AssertionError("Une erreur est survenue lors de l'envoi du fichier."); - $req = $DB->prepare("INSERT INTO `syntheses`(`file_id`, `team`, `tournament`, `dest`) VALUES (?, ?, ?, ?);"); - $req->execute([$id, $team->getId(), $team->isSelectedForFinal() ? $FINAL->getId() : $tournament->getId(), $this->dest]); + $req = $DB->prepare("INSERT INTO `syntheses`(`file_id`, `team`, `tournament`, `round`, `dest`) VALUES (?, ?, ?, ?, ?);"); + $req->execute([$id, $team->getId(), $team->isSelectedForFinal() ? $FINAL->getId() : $tournament->getId(), $this->round, $this->dest]); return false; } diff --git a/server_files/controllers/tournoi.php b/server_files/controllers/tournoi.php index 0cc0155..e34bb9a 100644 --- a/server_files/controllers/tournoi.php +++ b/server_files/controllers/tournoi.php @@ -39,8 +39,12 @@ class UpdateTournament public $time_inscription; public $date_solutions; public $time_solutions; - public $date_syntheses; - public $time_syntheses; + public $date_syntheses; + public $time_syntheses; + public $date_solutions_2; + public $time_solutions_2; + public $date_syntheses_2; + public $time_syntheses_2; public $description; public $final; @@ -89,7 +93,9 @@ class UpdateTournament ensure(dateWellFormed($this->date_end), "La date de fin n'est pas valide."); ensure(dateWellFormed($this->date_inscription . " " . $this->time_inscription), "La date de clôture des inscriptions n'est pas valide."); ensure(dateWellFormed($this->date_solutions . " " . $this->time_solutions), "La date limite de remise des solutions n'est pas valide."); - ensure(dateWellFormed($this->date_syntheses . " " . $this->time_syntheses), "La date limite de remise des notes de synthèse n'est pas valide."); + ensure(dateWellFormed($this->date_syntheses . " " . $this->time_syntheses), "La date limite de remise des notes de synthèse pour le tour 1 n'est pas valide."); + ensure(dateWellFormed($this->date_solutions_2 . " " . $this->time_solutions_2), "La date limite de visibilité des solutions du tour 2 n'est pas valide."); + ensure(dateWellFormed($this->date_syntheses_2 . " " . $this->time_syntheses_2), "La date limite de remise des notes de synthèse pour le tour 2 n'est pas valide."); } public function updateTournament() @@ -104,7 +110,9 @@ class UpdateTournament $tournament->setEndDate($this->date_end); $tournament->setInscriptionDate("$this->date_inscription $this->time_inscription"); $tournament->setSolutionsDate("$this->date_solutions $this->time_solutions"); - $tournament->setSynthesesDate("$this->date_syntheses $this->time_syntheses"); + $tournament->setSynthesesDate("$this->date_syntheses $this->time_syntheses"); + $tournament->setSolutionsDate2("$this->date_solutions_2 $this->time_solutions_2"); + $tournament->setSynthesesDate2("$this->date_syntheses_2 $this->time_syntheses_2"); $tournament->setDescription($this->description); foreach ($this->organizers as $organizer) { diff --git a/server_files/controllers/view_file.php b/server_files/controllers/view_file.php index 98c2dcc..cdc4904 100644 --- a/server_files/controllers/view_file.php +++ b/server_files/controllers/view_file.php @@ -34,12 +34,19 @@ if ($file !== null) { $problem = $file->getProblem(); $name = "Problème $problem $trigram"; - if (($_SESSION["role"] == Role::PARTICIPANT || $_SESSION["role"] == Role::ENCADRANT) && (!isset($_SESSION["team"]) || $_SESSION["team"]->getId() != $team->getId())) - require_once "server_files/403.php"; + if (($_SESSION["role"] == Role::PARTICIPANT || $_SESSION["role"] == Role::ENCADRANT) && (!isset($_SESSION["team"]) || $_SESSION["team"]->getId() != $team->getId())) { + $req = $DB->prepare("SELECT opposed_problem, rapported_problem, opposed_problem_2, rapported_problem_2 FROM teams WHERE id = ?;"); + $req->execute([$_SESSION["team"]->getId()]); + $data = $req->fetch(); + if ($id != $data["opposed_problem"] && $id != $data["rapported_problem"]) { + if (date("Y-m-d H:i") < $tournament->getSolutionsDate2() || ($id != $data["opposed_problem_2"] && $id != $data["rapported_problem_2"])) + require_once "server_files/403.php"; + } + } } else if ($type == DocumentType::SYNTHESIS) { $dest = $file->getDest(); - $name = "Note de synthèse $trigram pour " . ($dest == DestType::OPPOSANT ? "l'opposant" : "le rapporteur"); + $name = "Note de synthèse $trigram " . ($dest == DestType::OPPOSANT ? "de l'opposant" : "du rapporteur"); if (($_SESSION["role"] == Role::PARTICIPANT || $_SESSION["role"] == Role::ENCADRANT) && (!isset($_SESSION["team"]) || $_SESSION["team"]->getId() != $team->getId())) require_once "server_files/403.php"; diff --git a/server_files/model.php b/server_files/model.php index a292815..e650c24 100644 --- a/server_files/model.php +++ b/server_files/model.php @@ -166,6 +166,8 @@ function canValidate(Team $team, Tournament $tournament) $d = $req->fetch(); $can_validate &= $d["version"] > 0;*/ + $can_validate &= date("Y-m-d H:i:s") <= $tournament->getInscriptionDate(); + return $can_validate; } diff --git a/server_files/utils.php b/server_files/utils.php index 3fa8116..2bc4ce5 100644 --- a/server_files/utils.php +++ b/server_files/utils.php @@ -9,7 +9,7 @@ function ensure($bool, $error_msg = "") function formatDate($date = NULL, $with_time = false) { if ($date == NULL) - $date = date("Y-m-d H:i:s"); + $date = date("Y-m-d H:i"); return strftime("%d %B %G" . ($with_time ? " %H:%M" : ""), strtotime($date)); } diff --git a/server_files/views/ajouter_tournoi.php b/server_files/views/ajouter_tournoi.php index bf5ae09..2570da3 100644 --- a/server_files/views/ajouter_tournoi.php +++ b/server_files/views/ajouter_tournoi.php @@ -85,7 +85,7 @@ if (isset($tournament) && !$has_error) { ?> value="time_solutions: date('H:i') ?>"/>
- +
+
+
+ + + +
+
+ + + +
+
+
diff --git a/server_files/views/equipe.php b/server_files/views/equipe.php index 3cdc9b4..6744110 100644 --- a/server_files/views/equipe.php +++ b/server_files/views/equipe.php @@ -59,6 +59,10 @@ ?>
+
+ ">Envoyer un mail à toute l'équipe +
+
diff --git a/server_files/views/header.php b/server_files/views/header.php index b00d87e..f503e23 100644 --- a/server_files/views/header.php +++ b/server_files/views/header.php @@ -82,10 +82,10 @@ Paiement --> diff --git a/server_files/views/mon_equipe.php b/server_files/views/mon_equipe.php index b9eb97e..b86b5d7 100644 --- a/server_files/views/mon_equipe.php +++ b/server_files/views/mon_equipe.php @@ -146,4 +146,39 @@ require_once "header.php"; +getValidationStatus() == ValidationStatus::VALIDATED) { ?> +
+

Solutions à opposer/rapporter

+
+ Modèle vierge de note de synthèse (PDF -- TEX) +
+ +
+ Les solutions du tour 1 seront disponibles sur cette page peu après le tirage. +
+ getSolutionsDate2()) { ?> +
+ Les solutions du tour 2 pourront être téléchargées sur cette page à partir du getSolutionsDate2(), true) ?>. +
+getFileId(); + $problem = $sol->getProblem(); + $t = Team::fromId($sol->getTeamId()); + $trigram = $t->getTrigram(); + echo "
getSolutionsDate2() ? "danger" : "info") . "\">Problème $problem " + . " de l'équipe $trigram " . ($source == DestType::OPPOSANT ? "opposé" : "rapporté") . ", tour $round : Télécharger
\n"; + } + ?> + + + \ No newline at end of file diff --git a/server_files/views/syntheses.php b/server_files/views/syntheses.php index f423615..3b746a3 100644 --- a/server_files/views/syntheses.php +++ b/server_files/views/syntheses.php @@ -12,19 +12,33 @@ if (isset($save_synthesis) && !$has_error) { ?>
-getSynthesesDate()) { ?> +getSynthesesDate2()) { + if (date("Y-m-d H:i:s") < $tournament->getSynthesesDate()) { + ?> +
+ Attention : la date butoir de soumission des notes de synthèse pour le tour 1 est passée. Les prochaines notes de synthèses compteront pour le second tour. +
+
-
- +
+
-
+
+ + +
+ +
@@ -43,8 +57,9 @@ if (isset($save_synthesis) && !$has_error) { ?> foreach ($syntheses as $synthesis) { $file_id = $synthesis->getFileId(); $dest = $synthesis->getDest(); + $round = $synthesis->getRound(); $version = $synthesis->getVersion(); - echo "
Note de synthèse pour " . ($dest == DestType::OPPOSANT ? "l'opposant" : "le rapporteur") . " (version $version) : Télécharger
"; + echo "
Note de synthèse " . ($dest == DestType::OPPOSANT ? "de l'opposant" : "du rapporteur") . ", tour $round (version $version) : Télécharger
"; } if ($team->isSelectedForFinal()) { ?> @@ -56,8 +71,9 @@ if ($team->isSelectedForFinal()) { ?> foreach ($syntheses_final as $synthesis) { $file_id = $synthesis->getFileId(); $dest = $synthesis->getDest(); + $round = $synthesis->getRound(); $version = $synthesis->getVersion(); - echo "
Note de synthèse pour " . ($dest == DestType::OPPOSANT ? "l'opposant" : "le rapporteur") . " (version $version) : Télécharger
"; + echo "
Note de synthèse " . ($dest == DestType::OPPOSANT ? "de l'opposant" : "du rapporteur") . ", tour $round (version $version) : Télécharger
"; } } diff --git a/server_files/views/syntheses_orga.php b/server_files/views/syntheses_orga.php index 477c143..9106b65 100644 --- a/server_files/views/syntheses_orga.php +++ b/server_files/views/syntheses_orga.php @@ -15,12 +15,13 @@ foreach ($tournaments as $tournament) { foreach ($syntheses as $synthesis) { $file_id = $synthesis->getFileId(); $dest = $synthesis->getDest(); + $round = $synthesis->getRound(); $version = $synthesis->getVersion(); $team = Team::fromId($synthesis->getTeamId()); $team_name = $team->getName(); $team_trigram = $team->getTrigram(); echo "
Note de synthèse de l'équipe $team_name ($team_trigram) pour " . ($dest == DestType::OPPOSANT ? "l'opposant" : "le rapporteur") - . ", version $version : Télécharger
"; + . ", tour $round, version $version : Télécharger
"; } echo "\n"; diff --git a/server_files/views/tournoi.php b/server_files/views/tournoi.php index 52190a7..9b54849 100644 --- a/server_files/views/tournoi.php +++ b/server_files/views/tournoi.php @@ -48,7 +48,13 @@ Date limite d'envoi des solutions : getSolutionsDate(), true) ?>
- Date limite d'envoi des notes de synthèse : getSynthesesDate(), true) ?> + Date limite d'envoi des notes de synthèse - tour 1 : getSynthesesDate(), true) ?> +
+
+ Date à partir de laquelle les solutions du tour 2 sont disponibles : getSolutionsDate2(), true) ?> +
+
+ Date limite d'envoi des notes de synthèse - tour 2 : getSynthesesDate2(), true) ?>
Description : getDescription() ?> @@ -60,8 +66,8 @@ if ($tournament->isFinal()) organize($_SESSION["user_id"]))) { ?> @@ -186,21 +192,37 @@ else {
- +
- +
- + + value="getSynthesesDate(), 11, 5) ?>" required/> +
+
+ +
+
+ + + +
+ +
+ + +