Support de la finale
This commit is contained in:
parent
10da20f2c0
commit
39abeec4e6
|
@ -81,11 +81,16 @@ function registerTournament() {
|
|||
|
||||
$description = htmlspecialchars($_POST["description"]);
|
||||
|
||||
$final = isset($_POST["final"]) && $_POST["final"];
|
||||
|
||||
if ($final && $DB->query("SELECT `id` FROM `tournaments` WHERE `final` = true AND `year` = $YEAR;")->fetch() !== false)
|
||||
return "Une finale est déjà enregistrée.";
|
||||
|
||||
$req = $DB->prepare("INSERT INTO `tournaments` (`name`, `size`, `place`, `price`, `description`,
|
||||
`date_start`, `date_end`, `date_inscription`, `date_solutions`, `date_syntheses`, `year`)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);");
|
||||
`date_start`, `date_end`, `date_inscription`, `date_solutions`, `date_syntheses`, `final`, `year`)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);");
|
||||
$req->execute([$name, $size, $place, $price, $description, $date_start, $date_end,
|
||||
"$date_inscription $time_inscription", "$date_solutions $time_solutions", "$date_syntheses $time_syntheses", $YEAR]);
|
||||
"$date_inscription $time_inscription", "$date_solutions $time_solutions", "$date_syntheses $time_syntheses", $final, $YEAR]);
|
||||
|
||||
$req = $DB->query("SELECT `id` FROM `tournaments` WHERE `name` = '$name' AND `year` = $YEAR;");
|
||||
$tournament_id = $req->fetch()["id"];
|
||||
|
@ -175,7 +180,8 @@ if (!isset($_SESSION["role"]) or $_SESSION["role"] != "ADMIN") {
|
|||
<label for="date_start">Dates :</label>
|
||||
</td>
|
||||
<td>
|
||||
Du <input style="width: 45%;" type="date" id="date_start" name="date_start" required /> au <input style="width: 45%;" type="date" id="date_end" name="date_end" required />
|
||||
Du <input style="width: 45%;" type="date" id="date_start" name="date_start" required /> au <!--suppress HtmlFormInputWithoutLabel -->
|
||||
<input style="width: 45%;" type="date" id="date_end" name="date_end" required />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -184,6 +190,7 @@ if (!isset($_SESSION["role"]) or $_SESSION["role"] != "ADMIN") {
|
|||
</td>
|
||||
<td>
|
||||
<input style="width: 49%;" type="date" id="date_inscription" name="date_inscription" required />
|
||||
<!--suppress HtmlFormInputWithoutLabel -->
|
||||
<input style="width: 49%;" type="time" id="time_inscription" name="time_inscription" required />
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -193,6 +200,7 @@ if (!isset($_SESSION["role"]) or $_SESSION["role"] != "ADMIN") {
|
|||
</td>
|
||||
<td>
|
||||
<input style="width: 49%;" type="date" id="date_solutions" name="date_solutions" required />
|
||||
<!--suppress HtmlFormInputWithoutLabel -->
|
||||
<input style="width: 49%;" type="time" id="time_solutions" name="time_solutions" required />
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -202,6 +210,7 @@ if (!isset($_SESSION["role"]) or $_SESSION["role"] != "ADMIN") {
|
|||
</td>
|
||||
<td>
|
||||
<input style="width: 49%;" type="date" id="date_syntheses" name="date_syntheses" required />
|
||||
<!--suppress HtmlFormInputWithoutLabel -->
|
||||
<input style="width: 49%;" type="time" id="time_syntheses" name="time_syntheses" required />
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -213,6 +222,14 @@ if (!isset($_SESSION["role"]) or $_SESSION["role"] != "ADMIN") {
|
|||
<textarea style="width: 100%;" name="description" id="description" required></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="final">Ce tournoi est la finale nationale :</label>
|
||||
</td>
|
||||
<td>
|
||||
<input style="width: 100%;" type="checkbox" id="final" name="final" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<input style="width: 100%;" type="submit" value="Ajouter un tournoi" />
|
||||
|
|
|
@ -41,11 +41,18 @@ if (isset($_SESSION["user_id"])) {
|
|||
}
|
||||
|
||||
if (isset($_SESSION["user_id"]) && isset($_SESSION["team_id"]) && $_SESSION["team_id"] != NULL) {
|
||||
$response = $DB->query("SELECT `tournament`, `validation_status` FROM `teams` WHERE `id` ='" . $_SESSION["team_id"] . "' AND `year` = '$YEAR';");
|
||||
$response = $DB->query("SELECT `tournament`, `validation_status`, `final_selection` FROM `teams` WHERE `id` ='" . $_SESSION["team_id"] . "' AND `year` = '$YEAR';");
|
||||
$data = $response->fetch();
|
||||
$_SESSION["tournament_id"] = $data["tournament"];
|
||||
$_SESSION["team_validation_status"] = $data["validation_status"];
|
||||
}
|
||||
|
||||
if ((isset($data["final_selection"]) && $data["final_selection"]) || $_SESSION["role"] == "ADMIN" || $_SESSION["role"] == "ORGANIZER") {
|
||||
$response = $DB->query("SELECT `id`, `name` FROM `tournaments` WHERE `final` AND `year` = $YEAR;");
|
||||
$data = $response->fetch();
|
||||
$_SESSION["final_id"] = $data["id"];
|
||||
$_SESSION["final_name"] = $data["name"];
|
||||
}
|
||||
}
|
||||
|
||||
setlocale(LC_ALL, "fr_FR.utf8");
|
||||
|
|
|
@ -10,13 +10,67 @@ if (isset($_POST["validate"])) {
|
|||
|
||||
$team_data = $DB->query("SELECT * FROM `teams` WHERE `trigram` = '$trigram' AND `year` = $YEAR;")->fetch();
|
||||
|
||||
if (isset($_POST["select"])) {
|
||||
$DB->exec("UPDATE `teams` SET `final_selection` = true, `validation_status` = 'NOT_READY' WHERE `trigram` = '$trigram' AND `year` = $YEAR;");
|
||||
$team_data["validation_status"] = "NOT_READY";
|
||||
$team_data["final_selection"] = true;
|
||||
$final_id = $_SESSION["final_id"];
|
||||
$team_id = $team_data["id"];
|
||||
|
||||
$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;");
|
||||
$sols_req->execute([$team_data["id"], $team_data["tournament"]]);
|
||||
while (($sol_data = $sols_req->fetch()) !== false) {
|
||||
$old_id = $sol_data["file_id"];
|
||||
$alphabet = "abcdefghijklmnopqrstuvwxyz0123456789";
|
||||
|
||||
do {
|
||||
$id = "";
|
||||
for ($i = 0; $i < 64; ++$i) {
|
||||
$id .= $alphabet[rand(0, strlen($alphabet) - 1)];
|
||||
}
|
||||
}
|
||||
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_id, $_SESSION["final_id"], $sol_data["problem"]]);
|
||||
}
|
||||
|
||||
$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_data["id"], $team_data["tournament"]]);
|
||||
while (($synthese_data = $syntheses_req->fetch()) !== false) {
|
||||
$old_id = $synthese_data["file_id"];
|
||||
$alphabet = "abcdefghijklmnopqrstuvwxyz0123456789";
|
||||
|
||||
do {
|
||||
$id = "";
|
||||
for ($i = 0; $i < 64; ++$i) {
|
||||
$id .= $alphabet[rand(0, strlen($alphabet) - 1)];
|
||||
}
|
||||
}
|
||||
while (file_exists("$LOCAL_PATH/files/$id"));
|
||||
|
||||
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_id, $_SESSION["final_id"], $synthese_data["dest"]]);
|
||||
}
|
||||
}
|
||||
|
||||
if ($team_data === false)
|
||||
include "404.php";
|
||||
|
||||
$tournament_data = $DB->query("SELECT `name`, `date_start` FROM `tournaments` WHERE `id` = '" . $team_data["tournament"] . "' AND `year` = '$YEAR';")->fetch();
|
||||
|
||||
$documents_req = $DB->prepare("SELECT `file_id`, `user`, `type`, COUNT(`type`) AS `version` FROM `documents` WHERE `team` = ? GROUP BY `user`, `type` ORDER BY `user`, `type` ASC, MAX(`uploaded_at`) DESC;");
|
||||
$documents_req->execute([$team_data["id"]]);
|
||||
$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_data["id"], $team_data["tournament"]]);
|
||||
|
||||
if ($team_data["final_selection"]) {
|
||||
$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_data["id"], $_SESSION["final_id"]]);
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
@ -42,6 +96,10 @@ for ($i = 1; $i <= 6; ++$i) {
|
|||
$id = $user_data["id"];
|
||||
echo "Participant $i : <a href=\"$URL_BASE/informations/$id/" . $user_data["first_name"] . " " . $user_data["surname"] . "\">" . $user_data["first_name"] . " " . $user_data["surname"] . "</a><br />";
|
||||
}
|
||||
if ($team_data["final_selection"]) {
|
||||
$final_name = $_SESSION["final_name"];
|
||||
echo "<strong>Équipe sélectionnée pour la <a href=\"$URL_BASE/tournoi/$final_name\">finale nationale</a>.</strong>";
|
||||
}
|
||||
?>
|
||||
|
||||
<hr />
|
||||
|
@ -72,11 +130,43 @@ while (($data = $documents_req->fetch()) !== false) {
|
|||
}
|
||||
?>
|
||||
|
||||
<?php if ($team_data["final_selection"]) { ?>
|
||||
<hr />
|
||||
<h2>Autorisations pour la finale</h2>
|
||||
<?php
|
||||
while (($data = $documents_req->fetch()) !== false) {
|
||||
$file_id = $data["file_id"];
|
||||
$type = $data["type"];
|
||||
$user_id = $data["user"];
|
||||
$user_data = $DB->query("SELECT `surname`, `first_name` FROM `users` WHERE `id` = '$user_id';")->fetch();
|
||||
$surname = $user_data["surname"];
|
||||
$first_name = $user_data["first_name"];
|
||||
$version = $data["version"];
|
||||
switch ($data["type"]) {
|
||||
case "PARENTAL_CONSENT":
|
||||
$name = "Autorisation parentale";
|
||||
break;
|
||||
case "PHOTO_CONSENT":
|
||||
$name = "Autorisation de droit à l'image";
|
||||
break;
|
||||
case "SANITARY_PLUG":
|
||||
$name = "Fiche sanitaire";
|
||||
break;
|
||||
}
|
||||
echo "$name de $first_name $surname : <a href=\"$URL_BASE/file/$file_id\">Télécharger</a><br />";
|
||||
}
|
||||
}
|
||||
|
||||
if ($team_data["validation_status"] == "WAITING" && $_SESSION["role"] == "ADMIN") { ?>
|
||||
<form method="POST">
|
||||
<input type="submit" name="validate" value="Valider l'équipe" />
|
||||
<input style="width: 100%;" type="submit" name="validate" value="Valider l'équipe" />
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
|
||||
if (!$team_data["final_selection"]) { ?>
|
||||
<form method="POST">
|
||||
<input style="width: 100%;" type="submit" name="select" value="Sélectionner pour la finale nationale" />
|
||||
</form>
|
||||
<?php } ?>
|
||||
|
||||
|
|
|
@ -56,8 +56,8 @@ if (isset($_SESSION["user_id"]) && isset($_SESSION["team_id"])) {
|
|||
|
||||
$tournament_data = $DB->query("SELECT `name`, `date_start` FROM `tournaments` WHERE `id` = '" . $team_data["tournament"] . "' AND `year` = '$YEAR';")->fetch();
|
||||
|
||||
$documents_req = $DB->prepare("SELECT `file_id`, `type`, COUNT(`type`) AS `version` FROM `documents` WHERE `user` = ? GROUP BY `type`, `uploaded_at` ORDER BY `type`, `uploaded_at` DESC;");
|
||||
$documents_req->execute([$_SESSION["user_id"]]);
|
||||
$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[isset($_SESSION["final_id"]) ? "final_id" : "tournament_id"]]);
|
||||
}
|
||||
|
||||
if (isset($_POST["team_edit"])) {
|
||||
|
@ -97,7 +97,7 @@ function sendDocument()
|
|||
|
||||
$req = $DB->prepare("INSERT INTO `documents`(`file_id`, `user`, `team`, `tournament`, `type`)
|
||||
VALUES (?, ?, ?, ?, ?);");
|
||||
$req->execute([$id, $_SESSION["user_id"], $_SESSION["team_id"], $_SESSION["tournament_id"], $type]);
|
||||
$req->execute([$id, $_SESSION["user_id"], $_SESSION["team_id"], $_SESSION[isset($_SESSION["final_id"]) ? "final_id" : "tournament_id"], $type]);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -143,7 +143,8 @@ function updateTeam()
|
|||
return false;
|
||||
}
|
||||
|
||||
function checkCanValidate() {
|
||||
function checkCanValidate()
|
||||
{
|
||||
global $DB, $team_data, $tournament_data, $YEAR;
|
||||
$can_validate = $team_data["validation_status"] == "NOT_READY";
|
||||
$can_validate &= $team_data["encadrant_1"] != NULL;
|
||||
|
@ -226,6 +227,10 @@ for ($i = 1; $i <= 6; ++$i) {
|
|||
}
|
||||
?>
|
||||
Code d'accès : <strong><?php echo $team_data["access_code"] ?></strong><br/>
|
||||
<?php if (isset($_SESSION["final_id"])) {
|
||||
$final_name = $_SESSION["final_name"];
|
||||
echo "<strong>Équipe sélectionnée pour la <a href=\"$URL_BASE/tournoi/$final_name\">finale nationale</a>.</strong><br />";
|
||||
} ?>
|
||||
|
||||
<?php if (isset($_GET["modifier"])) { ?>
|
||||
|
||||
|
@ -278,6 +283,7 @@ Code d'accès : <strong><?php echo $team_data["access_code"] ?></strong><br/>
|
|||
<?php if ($_SESSION["team_validation_status"] == "NOT_READY") { ?>
|
||||
<!--suppress HtmlUnknownTarget -->
|
||||
<a href="<?= $URL_BASE ?>/mon_equipe/modifier">Modifier mon équipe</a>
|
||||
<?php } ?>
|
||||
<hr/>
|
||||
<h2>Mes autorisations</h2>
|
||||
<?php
|
||||
|
@ -298,8 +304,7 @@ Code d'accès : <strong><?php echo $team_data["access_code"] ?></strong><br/>
|
|||
}
|
||||
echo "$name : <a href=\"$URL_BASE/file/$file_id\">Télécharger</a><br />";
|
||||
}
|
||||
?>
|
||||
|
||||
if ($team_data["validation_status"] == "NOT_READY") { ?>
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="MAX_FILE_SIZE" value="5000000"/>
|
||||
<table style="width: 100%;">
|
||||
|
@ -334,6 +339,7 @@ Code d'accès : <strong><?php echo $team_data["access_code"] ?></strong><br/>
|
|||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
<?php } ?>
|
||||
<hr/>
|
||||
<?php if ($team_data["validation_status"] == "NOT_READY") { ?>
|
||||
<table style="width: 100%;">
|
||||
|
@ -357,6 +363,5 @@ Code d'accès : <strong><?php echo $team_data["access_code"] ?></strong><br/>
|
|||
</table>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
|
||||
<?php include "footer.php" ?>
|
||||
|
|
|
@ -9,11 +9,11 @@ if (isset($_POST["send_solution"])) {
|
|||
$error_message = saveSolution();
|
||||
}
|
||||
|
||||
$solutions_req = $DB->prepare("SELECT `file_id`, `problem`, COUNT(`problem`) AS `version` FROM `solutions` WHERE `team` = ? GROUP BY `problem`, `uploaded_at` ORDER BY `problem`, `uploaded_at` DESC;");
|
||||
$solutions_req->execute([$_SESSION["team_id"]]);
|
||||
$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([$_SESSION["team_id"], $_SESSION[isset($_SESSION["final_id"]) ? "final_id" : "tournament_id"]]);
|
||||
|
||||
$tournament_req = $DB->prepare("SELECT `date_solutions` FROM `tournaments` WHERE `id` = ?;");
|
||||
$tournament_req->execute([$_SESSION["tournament_id"]]);
|
||||
$tournament_req->execute([$_SESSION[isset($_SESSION["final_id"]) ? "final_id" : "tournament_id"]]);
|
||||
$tournament_data = $tournament_req->fetch();
|
||||
|
||||
function saveSolution() {
|
||||
|
@ -52,8 +52,7 @@ function saveSolution() {
|
|||
if (!rename($file["tmp_name"], "$LOCAL_PATH/files/$id"))
|
||||
return "Une erreur est survenue lors de l'envoi du fichier.";
|
||||
|
||||
$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, $_SESSION["team_id"], $_SESSION["tournament_id"], $problem]);
|
||||
|
||||
return false;
|
||||
|
@ -74,14 +73,14 @@ function saveSolution() {
|
|||
<?php if (date("yyyy-mm-dd") < $tournament_data["date_solutions"]) { ?>
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="MAX_FILE_SIZE" value="5000000" />
|
||||
<table>
|
||||
<table style="width: 100%;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="problem">Problème :</label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="problem" name="problem">
|
||||
<select style="width: 100%;" id="problem" name="problem">
|
||||
<?php
|
||||
for ($i = 1; $i <= 9; ++$i) {
|
||||
echo "<option value=\"$i\">$i</option>\n";
|
||||
|
|
|
@ -54,7 +54,7 @@ $req = $DB->query("SELECT `tournaments`.`id`, `name` FROM `tournaments` JOIN `or
|
|||
while (($data_tournament = $req->fetch()) !== false) {
|
||||
echo "<h1>Tournoi de " . $data_tournament["name"] . "</h1>\n";
|
||||
$id = $data_tournament["id"];
|
||||
$files_req = $DB->query("SELECT *, COUNT(`problem`) AS `version` FROM `solutions` WHERE `tournament` = '$id' GROUP BY `team`, `problem` ORDER BY `team`, `problem`, `uploaded_at` DESC;");
|
||||
$files_req = $DB->query("SELECT *, COUNT(`problem`) AS `version` FROM `solutions` WHERE `tournament` = '$id' GROUP BY `team` ORDER BY `team`, `problem`, `uploaded_at` DESC;");
|
||||
while (($data_file = $files_req->fetch()) !== false) {
|
||||
$file_id = $data_file["file_id"];
|
||||
$problem = $data_file["problem"];
|
||||
|
@ -70,8 +70,9 @@ while (($data_tournament = $req->fetch()) !== false) {
|
|||
<form method="POST">
|
||||
<input type="hidden" name="tournament" value="<?= $id ?>" />
|
||||
<input type="hidden" name="tournament_name" value="<?= $data_tournament["name"] ?>" />
|
||||
<input type="submit" name="download_zip" value="Télécharger l'archive" />
|
||||
<input style="width: 100%" type="submit" name="download_zip" value="Télécharger l'archive" />
|
||||
</form>
|
||||
<hr />
|
||||
<?php
|
||||
}
|
||||
|
||||
|
|
|
@ -9,11 +9,11 @@ if (isset($_POST["send_synthese"])) {
|
|||
$error_message = saveSynthese();
|
||||
}
|
||||
|
||||
$syntheses_req = $DB->prepare("SELECT `file_id`, `dest`, COUNT(`dest`) AS `version` FROM `syntheses` WHERE `team` = ? GROUP BY `dest`, `uploaded_at` ORDER BY `dest`, `uploaded_at` DESC;");
|
||||
$syntheses_req->execute([$_SESSION["team_id"]]);
|
||||
$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([$_SESSION["team_id"], $_SESSION[isset($_SESSION["final_id"]) ? "final_id" : "tournament_id"]]);
|
||||
|
||||
$tournament_req = $DB->prepare("SELECT `date_solutions`, `date_syntheses` FROM `tournaments` WHERE `id` = ?;");
|
||||
$tournament_req->execute([$_SESSION["tournament_id"]]);
|
||||
$tournament_req->execute([$_SESSION[isset($_SESSION["final_id"]) ? "final_id" : "tournament_id"]]);
|
||||
$tournament_data = $tournament_req->fetch();
|
||||
|
||||
function saveSynthese() {
|
||||
|
@ -48,8 +48,7 @@ function saveSynthese() {
|
|||
if (!rename($file["tmp_name"], "$LOCAL_PATH/files/$id"))
|
||||
return "Une erreur est survenue lors de l'envoi du fichier.";
|
||||
|
||||
$req = $DB->prepare("INSERT INTO `syntheses`(`file_id`, `team`, `tournament`, `dest`)
|
||||
VALUES (?, ?, ?, ?);");
|
||||
$req = $DB->prepare("INSERT INTO `syntheses`(`file_id`, `team`, `tournament`, `dest`) VALUES (?, ?, ?, ?);");
|
||||
$req->execute([$id, $_SESSION["team_id"], $_SESSION["tournament_id"], $dest]);
|
||||
|
||||
return false;
|
||||
|
@ -77,14 +76,14 @@ if (isset($error_message)) {
|
|||
<?php if (date("yyyy-mm-dd") < $tournament_data["date_syntheses"]) { ?>
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="MAX_FILE_SIZE" value="5000000" />
|
||||
<table>
|
||||
<table style="width: 100%;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="dest">Destination de la note de synthèse :</label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="dest" name="dest">
|
||||
<select style="width: 100%;" id="dest" name="dest">
|
||||
<option value="opposant">Opposant</option>
|
||||
<option value="rapporteur">Rapporteur</option>
|
||||
</select>
|
||||
|
|
|
@ -70,8 +70,9 @@ while (($data_tournament = $req->fetch()) !== false) {
|
|||
<form method="POST">
|
||||
<input type="hidden" name="tournament" value="<?= $id ?>" />
|
||||
<input type="hidden" name="tournament_name" value="<?= $data_tournament["name"] ?>" />
|
||||
<input type="submit" name="download_zip" value="Télécharger l'archive" />
|
||||
<input style="width: 100%;" type="submit" name="download_zip" value="Télécharger l'archive" />
|
||||
</form>
|
||||
<hr />
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -26,6 +26,9 @@ if (isset($_POST["edit_tournament"])) {
|
|||
$error_message = updateTournament();
|
||||
}
|
||||
|
||||
if ($data["final"])
|
||||
$teams_response = $DB->query("SELECT `id`, `name`, `trigram`, `inscription_date`, `validation_status` FROM `teams` WHERE `final_selection` AND `year` = $YEAR;");
|
||||
else
|
||||
$teams_response = $DB->query("SELECT `id`, `name`, `trigram`, `inscription_date`, `validation_status` FROM `teams` WHERE `tournament` = " . $data["id"] . " AND `year` = $YEAR;");
|
||||
|
||||
$orgas_response = $DB->query("SELECT `id`, `surname`, `first_name` FROM `users` WHERE (`role` = 'ORGANIZER' OR `role` = 'ADMIN') AND `year` = '$YEAR';");
|
||||
|
@ -152,6 +155,10 @@ function updateTournament() {
|
|||
<strong>Date limite d'envoi des solutions :</strong> <?php echo echo_date($data["date_solutions"], true) ?><br />
|
||||
<strong>Date limite d'envoi des notes de synthèse :</strong> <?php echo echo_date($data["date_syntheses"], true) ?><br />
|
||||
<strong>Description :</strong> <?php echo $data["description"] ?><br />
|
||||
<?php
|
||||
if ($data["final"])
|
||||
echo "<strong>Ce tournoi est la finale nationale du TFJM² 2020.</strong><br />";
|
||||
?>
|
||||
|
||||
<?php if (!isset($_GET["modifier"]) && ($_SESSION["role"] == "ADMIN" || $_SESSION["role"] == "ORGANIZER" && in_array($_SESSION["user_id"], $orgas_id))) { ?>
|
||||
<a href="<?= $URL_BASE ?>/tournoi/<?= $data["name"] ?>/modifier">Éditer le tournoi</a>
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
include 'config.php';
|
||||
|
||||
$response = $DB->query("SELECT `name`, `date_start`, `date_end`, `date_inscription`, `date_solutions`, `size` FROM `tournaments`
|
||||
WHERE `year` = '$YEAR' ORDER BY `date_start`, `name`;");
|
||||
WHERE `year` = '$YEAR' AND `final` = false ORDER BY `date_start`, `name`;");
|
||||
$final_data = $DB->query("SELECT `name`, `date_start`, `date_end`, `date_solutions`, `size` FROM `tournaments` WHERE `final` AND `year` = $YEAR;")->fetch();
|
||||
|
||||
?>
|
||||
|
||||
|
@ -35,6 +36,13 @@ $response = $DB->query("SELECT `name`, `date_start`, `date_end`, `date_inscripti
|
|||
<?php
|
||||
}
|
||||
?>
|
||||
<tr style="border: 1px solid black">
|
||||
<td style="border: 1px solid black; text-align: center"><a href="<?= $URL_BASE ?>/tournoi/<?= $final_data["name"] ?>"><?= $final_data["name"] ?></a></td>
|
||||
<td colspan="2" style="border: 1px solid black; text-align: center">Du <?php echo echo_date($final_data["date_start"]) ?> au <?php echo echo_date($final_data["date_end"]) ?></td>
|
||||
<!-- <td style="border: 1px solid black; text-align: center"><?php echo echo_date($final_data["date_inscription"]) ?></td> -->
|
||||
<td style="border: 1px solid black; text-align: center"><?php echo echo_date($final_data["date_solutions"]) ?></td>
|
||||
<td style="border: 1px solid black; text-align: center"><?php echo $final_data["size"] ?></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot style="border: 1px solid black">
|
||||
<tr>
|
||||
|
|
Loading…
Reference in New Issue