First week fixes

This commit is contained in:
Yohann D'ANELLO 2020-05-05 01:06:57 +02:00
parent a064cc1817
commit 132481fda0
22 changed files with 541 additions and 59 deletions

BIN
assets/Fiche synthèse.pdf Normal file

Binary file not shown.

194
assets/Fiche synthèse.tex Normal file
View File

@ -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}

View File

@ -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"];

View File

@ -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()
{

View File

@ -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 = [];

View File

@ -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");

View File

@ -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);

View File

@ -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";

View File

@ -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());
}

View File

@ -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;

View File

@ -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;
}

View File

@ -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) {

View File

@ -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";

View File

@ -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;
}

View File

@ -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));
}

View File

@ -85,7 +85,7 @@ if (isset($tournament) && !$has_error) { ?>
value="<?= isset($tournament) ? $tournament->time_solutions: date('H:i') ?>"/>
</div>
<div class="form-group col-md-4">
<label for="date_syntheses">Date limite de remise des notes de synthèse :</label>
<label for="date_syntheses">Date limite de remise des notes de synthèse -- tour 1 :</label>
<input class="form-control" type="date" id="date_syntheses" name="date_syntheses"
value="<?= isset($tournament) ? $tournament->date_syntheses : date('Y-m-d') ?>"/>
<input class="form-control" type="time" id="time_syntheses" name="time_syntheses"
@ -93,6 +93,23 @@ if (isset($tournament) && !$has_error) { ?>
</div>
</div>
<div class="form-group row">
<div class="form-group col-md-6">
<label for="date_solutions_2">Date à partir de laquelle les solutions du tour 2 sont disponibles :</label>
<input class="form-control" type="date" id="date_solutions_2" name="date_solutions_2"
value="<?= isset($tournament) ? $tournament->date_solutions : date('Y-m-d') ?>"/>
<input class="form-control" type="time" id="time_solutions_2" name="time_solutions_2"
value="<?= isset($tournament) ? $tournament->time_solutions: date('H:i') ?>"/>
</div>
<div class="form-group col-md-6">
<label for="date_syntheses">Date limite de remise des notes de synthèse -- tour 2 :</label>
<input class="form-control" type="date" id="date_syntheses_2" name="date_syntheses_2"
value="<?= isset($tournament) ? $tournament->date_syntheses_2 : date('Y-m-d') ?>"/>
<input class="form-control" type="time" id="time_syntheses_2" name="time_syntheses_2"
value="<?= isset($tournament) ? $tournament->time_syntheses_2 : date('H:i') ?>"/>
</div>
</div>
<div class="form-group row">
<div class="form-group col-md-12">
<label for="description">Description :</label>

View File

@ -59,6 +59,10 @@
?>
</div>
<div class="alert alert-info">
<a href="mailto:contact@tfjm.org?subject=TFJM²%20<?= $YEAR ?>&bcc=<?= join(",", $emails) ?>">Envoyer un mail à toute l'équipe</a>
</div>
<?php if (isset($_GET["modifier"])) { ?>
<form method="POST">

View File

@ -82,10 +82,10 @@
<a class="nav-link" href="/paiement">Paiement</a>
</li> -->
<li class="nav-item active">
<a class="nav-link" href="/solutions"><i class="fas fa-lightbulb">Solutions</a>
<a class="nav-link" href="/solutions"><i class="fas fa-lightbulb"></i>Solutions</a>
</li>
<li class="nav-item active">
<a class="nav-link" href="/syntheses"><i class="fas fa-feather">Notes de synthèse</a>
<a class="nav-link" href="/syntheses"><i class="fas fa-feather"></i>Notes de synthèse</a>
</li>
<?php } ?>
<?php } ?>

View File

@ -146,4 +146,39 @@ require_once "header.php";
<?php } ?>
<?php } ?>
<?php if ($team->getValidationStatus() == ValidationStatus::VALIDATED) { ?>
<hr>
<h2>Solutions à opposer/rapporter</h2>
<div class="alert alert-warning">
Modèle vierge de note de synthèse (<a data-turbolinks="false" href="Note de synthèse.pdf">PDF</a> -- <a data-turbolinks="false" href="Note de synthèse.tex">TEX</a>)
</div>
<?php
if ($opposed_solution == null && $rapported_solution == null) { ?>
<div class="alert alert-warning">
Les solutions du tour 1 seront disponibles sur cette page peu après le tirage.
</div>
<?php } else if (date("Y-m-d H:i", true) < $tournament->getSolutionsDate2()) { ?>
<div class="alert alert-warning">
Les solutions du tour 2 pourront être téléchargées sur cette page à partir du <?= formatDate($tournament->getSolutionsDate2(), true) ?>.
</div>
<?php
}
foreach ([[$opposed_solution, DestType::OPPOSANT, 1], [$rapported_solution, DestType::RAPPORTEUR, 1],
[$opposed_solution_2, DestType::OPPOSANT, 2], [$rapported_solution_2, DestType::RAPPORTEUR, 2]] as $arr) {
$sol = $arr[0];
$source = $arr[1];
$round = $arr[2];
if ($sol === null)
continue;
$file_id = $sol->getFileId();
$problem = $sol->getProblem();
$t = Team::fromId($sol->getTeamId());
$trigram = $t->getTrigram();
echo "<div class=\"alert alert-" . ($round == 2 && date("Y-m-d H:i") < $tournament->getSolutionsDate2() ? "danger" : "info") . "\"><strong>Problème $problem "
. " de l'équipe $trigram " . ($source == DestType::OPPOSANT ? "opposé" : "rapporté") . ", tour $round</strong> : <a data-turbolinks=\"false\" href=\"/file/$file_id\">Télécharger</a></div>\n";
}
?>
<?php } ?>
<?php require_once "footer.php" ?>

View File

@ -12,19 +12,33 @@ if (isset($save_synthesis) && !$has_error) { ?>
</div>
<?php } ?>
<?php if (date("Y-m-d H:i:s") < $tournament->getSynthesesDate()) { ?>
<?php if (date("Y-m-d H:i:s") < $tournament->getSynthesesDate2()) {
if (date("Y-m-d H:i:s") < $tournament->getSynthesesDate()) {
?>
<div class="alert alert-warning">
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.
</div>
<?php } ?>
<form method="post" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="5000000"/>
<div class="form-row">
<div class="form-group col-md-6">
<label for="dest">Destination de la note de synthèse :</label>
<div class="form-group col-md-4">
<label for="dest">Rôle :</label>
<select class="custom-select" id="dest" name="dest">
<option value="opposant">Opposant</option>
<option value="rapporteur">Rapporteur</option>
</select>
</div>
<div class="form-group col-md-6">
<div class="form-group col-md-4">
<label for="round">Tour :</label>
<select class="custom-select" id="round" name="round">
<option value="1">Tour 1</option>
<option value="2" <?= date("Y-m-d H:i") >= $tournament->getSynthesesDate() ? "selected" : "" ?>>Tour 2</option>
</select>
</div>
<div class="form-group col-md-4">
<label for="file">Fichier :</label>
<input class="form-control" type="file" id="file" name="synthese" />
</div>
@ -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 "<div class=\"alert alert-info\"><strong>Note de synthèse pour " . ($dest == DestType::OPPOSANT ? "l'opposant" : "le rapporteur") . "</strong> (version $version) : <a href=\"/file/$file_id\">Télécharger</a></div>";
echo "<div class=\"alert alert-info\"><strong>Note de synthèse " . ($dest == DestType::OPPOSANT ? "de l'opposant" : "du rapporteur") . ", tour $round</strong> (version $version) : <a data-turbolinks=\"false\" href=\"/file/$file_id\">Télécharger</a></div>";
}
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 "<div class=\"alert alert-info\"><strong>Note de synthèse pour " . ($dest == DestType::OPPOSANT ? "l'opposant" : "le rapporteur") . "</strong> (version $version) : <a href=\"/file/$file_id\">Télécharger</a></div>";
echo "<div class=\"alert alert-info\"><strong>Note de synthèse " . ($dest == DestType::OPPOSANT ? "de l'opposant" : "du rapporteur") . ", tour $round</strong> (version $version) : <a data-turbolinks=\"false\" href=\"/file/$file_id\">Télécharger</a></div>";
}
}

View File

@ -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 "<div class=\"alert alert-info\"><strong>Note de synthèse de l'équipe $team_name ($team_trigram) pour " . ($dest == DestType::OPPOSANT ? "l'opposant" : "le rapporteur")
. "</strong>, version $version : <a data-turbolinks=\"false\" href=\"/file/$file_id\">Télécharger</a></div>";
. ", tour $round</strong>, version $version : <a data-turbolinks=\"false\" href=\"/file/$file_id\">Télécharger</a></div>";
}
echo "<form method=\"POST\">\n";

View File

@ -48,7 +48,13 @@
<strong>Date limite d'envoi des solutions :</strong> <?= formatDate($tournament->getSolutionsDate(), true) ?>
</div>
<div class="alert alert-info">
<strong>Date limite d'envoi des notes de synthèse :</strong> <?= formatDate($tournament->getSynthesesDate(), true) ?>
<strong>Date limite d'envoi des notes de synthèse - tour 1 :</strong> <?= formatDate($tournament->getSynthesesDate(), true) ?>
</div>
<div class="alert alert-info">
<strong>Date à partir de laquelle les solutions du tour 2 sont disponibles :</strong> <?= formatDate($tournament->getSolutionsDate2(), true) ?>
</div>
<div class="alert alert-info">
<strong>Date limite d'envoi des notes de synthèse - tour 2 :</strong> <?= formatDate($tournament->getSynthesesDate2(), true) ?>
</div>
<div class="alert alert-info">
<strong>Description :</strong> <?= $tournament->getDescription() ?>
@ -60,8 +66,8 @@ if ($tournament->isFinal())
<?php if (!isset($_GET["modifier"]) && ($_SESSION["role"] == Role::ADMIN || $_SESSION["role"] == Role::ORGANIZER && $tournament->organize($_SESSION["user_id"]))) { ?>
<div class="alert alert-info">
<a href="mailto:contact@tfjm.org?<? foreach ($emails as $email) echo "bcc=" . $email . "&" ?>subject=TFJM² <?= $YEAR ?>" target="_blank">Envoyer un mail à toutes les personnes inscrites au tournoi</a><br>
<a href="mailto:contact@tfjm.org?<? foreach ($emails_validated as $email) echo "bcc=" . $email . "&" ?>subject=TFJM² <?= $YEAR ?>" target="_blank">Envoyer un mail à toutes les personnes inscrites au tournoi dans une équipe validée</a>
<a href="mailto:contact@tfjm.org?bcc=<?= join(",", $emails) ?>&subject=TFJM² <?= $YEAR ?>" target="_blank">Envoyer un mail à toutes les personnes inscrites au tournoi</a><br>
<a href="mailto:contact@tfjm.org?bcc=<?= join(",", $emails) ?>&subject=TFJM² <?= $YEAR ?>" target="_blank">Envoyer un mail à toutes les personnes inscrites au tournoi dans une équipe validée</a>
</div>
<a href="/tournoi/<?= $tournament->getName() ?>/modifier"><button class="btn btn-secondary btn-lg btn-block">Éditer le tournoi</button></a>
@ -186,21 +192,37 @@ else {
<div class="form-group col-md-4">
<label for="date_inscription">Date limite d'inscription :</label>
<input class="form-control" type="date" id="date_inscription" name="date_inscription" value="<?= substr($tournament->getInscriptionDate(), 0, 10) ?>" required />
<input class="form-control" type="time" id="time_inscription" name="time_inscription" value="<?= substr($tournament->getInscriptionDate(), 11) ?>" required />
<input class="form-control" type="time" id="time_inscription" name="time_inscription" value="<?= substr($tournament->getInscriptionDate(), 11, 5) ?>" required />
</div>
<div class="form-group col-md-4">
<label for="date_solutions">Date limite pour rendre les solutions :</label>
<input class="form-control" type="date" id="date_solutions" name="date_solutions" value="<?= substr($tournament->getSolutionsDate(), 0, 10) ?>" required />
<input class="form-control" type="time" id="time_solutions" name="time_solutions" value="<?= substr($tournament->getSolutionsDate(),11) ?>" required />
<input class="form-control" type="time" id="time_solutions" name="time_solutions" value="<?= substr($tournament->getSolutionsDate(),11, 5) ?>" required />
</div>
<div class="form-group col-md-4">
<label for="date_syntheses">Date limite pour rendre les notes de synthèse :</label>
<label for="date_syntheses">Date limite pour rendre les notes de synthèse -- tour 1 :</label>
<input class="form-control" type="date" id="date_syntheses" name="date_syntheses"
value="<?= substr($tournament->getSynthesesDate(), 0, 10) ?>" required/>
<input class="form-control" type="time" id="time_syntheses" name="time_syntheses"
value="<?= substr($tournament->getSynthesesDate(), 11) ?>" required/>
value="<?= substr($tournament->getSynthesesDate(), 11, 5) ?>" required/>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-6">
<label for="date_solutions">Date à partir de laquelle les solutions du tour 2 sont disponibles :</label>
<input class="form-control" type="date" id="date_solutions" name="date_solutions_2" value="<?= substr($tournament->getSolutionsDate2(), 0, 10) ?>" required />
<input class="form-control" type="time" id="time_solutions" name="time_solutions_2" value="<?= substr($tournament->getSolutionsDate2(),11, 5) ?>" required />
</div>
<div class="form-group col-md-6">
<label for="date_syntheses">Date limite pour rendre les notes de synthèse -- tour 2 :</label>
<input class="form-control" type="date" id="date_syntheses" name="date_syntheses_2"
value="<?= substr($tournament->getSynthesesDate2(), 0, 10) ?>" required/>
<input class="form-control" type="time" id="time_syntheses" name="time_syntheses_2"
value="<?= substr($tournament->getSynthesesDate2(), 11, 5) ?>" required/>
</div>
</div>