1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2024-11-26 08:07:09 +00:00

Organisateurs multiples, modification des tournois

This commit is contained in:
galaxyoyo 2019-08-26 20:14:29 +02:00
parent 7a81d09b88
commit 8b90877088
5 changed files with 310 additions and 70 deletions

View File

@ -25,5 +25,6 @@ RewriteRule ^solutions$ server_files/solutions.php [L]
RewriteRule ^solutions_orga$ server_files/solutions_orga.php [L] RewriteRule ^solutions_orga$ server_files/solutions_orga.php [L]
RewriteRule ^syntheses$ server_files/syntheses.php [L] RewriteRule ^syntheses$ server_files/syntheses.php [L]
RewriteRule ^syntheses_orga$ server_files/syntheses_orga.php [L] RewriteRule ^syntheses_orga$ server_files/syntheses_orga.php [L]
RewriteRule ^tournoi/(.*?)/(.*?)$ server_files/tournoi.php?nom=$1&$2 [L]
RewriteRule ^tournoi/(.*?)$ server_files/tournoi.php?nom=$1 [L] RewriteRule ^tournoi/(.*?)$ server_files/tournoi.php?nom=$1 [L]
RewriteRule ^tournois$ server_files/tournois.php [L] RewriteRule ^tournois$ server_files/tournois.php [L]

View File

@ -17,20 +17,21 @@ function registerTournament() {
if ($result->fetch()) if ($result->fetch())
return "Un tournoi existe déjà avec ce nom."; return "Un tournoi existe déjà avec ce nom.";
try { if (!isset($_POST["organizer"]) || sizeof($_POST["organizer"]) == 0)
$organizer_id = intval(htmlspecialchars($_POST["organizer"])); return "Aucun organisateur n'a été choisi.";
}
catch (Exception $ex) {
return "Un problème a eu lieu concernant le choix de l'organisateur. Merci de ne pas formuler vous-même vos requêtes.";
}
$result = $DB->query("SELECT `role`, `email` FROM `users` WHERE `id` = '" . $organizer_id . "' AND `year` = '$YEAR';"); $organizers = $_POST["organizer"];
$data = $result->fetch(); $orga_mails = [];
if ($data === FALSE)
return "L'organisateur spécifié n'existe pas."; foreach ($organizers as $orga) {
if ($data["role"] != "ORGANIZER" && $data["role"] != "ADMIN") $result = $DB->query("SELECT `role`, `email` FROM `users` WHERE `id` = '" . $orga . "' AND `year` = '$YEAR';");
return "L'organisateur indiqué ne peut pas organiser de tournoi."; $data = $result->fetch();
$organize_mail = $data["email"]; if ($data === FALSE)
return "L'organisateur spécifié n'existe pas.";
if ($data["role"] != "ORGANIZER" && $data["role"] != "ADMIN")
return "L'organisateur indiqué ne peut pas organiser de tournoi.";
$orga_mails[] = $data["email"];
}
try { try {
$size = intval(htmlspecialchars($_POST["size"])); $size = intval(htmlspecialchars($_POST["size"]));
@ -80,13 +81,22 @@ function registerTournament() {
$description = htmlspecialchars($_POST["description"]); $description = htmlspecialchars($_POST["description"]);
$req = $DB->prepare("INSERT INTO `tournaments` (`name`, `organizer`, `size`, `place`, `description`, $req = $DB->prepare("INSERT INTO `tournaments` (`name`, `size`, `place`, `price`, `description`,
`date_start`, `date_end`, `date_inscription`, `date_solutions`, `date_syntheses`, `year`) `date_start`, `date_end`, `date_inscription`, `date_solutions`, `date_syntheses`, `year`)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);"); VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);");
$result = $req->execute([$name, $organizer_id, $size, $place, $description, $date_start, $date_end, $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", $YEAR]);
mail($organize_mail, "Organisateur TFJM² " . $name, "Vous venez d'être promu organisateur du tournoi " . $name . " pour le TFJM² $YEAR !", "From: $MAIL_ADDRESS"); $req = $DB->query("SELECT `id` FROM `tournaments` WHERE `name` = '$name' AND `year` = $YEAR;");
$tournament_id = $req->fetch()["id"];
foreach ($organizers as $orga) {
$req = $DB->prepare("INSERT INTO `organizers`(`organizer`, `tournament`) VALUES(?, ?);");
$req->execute([$orga, $tournament_id]);
}
foreach ($orga_mails as $orga_mail)
mail($orga_mail, "Organisateur TFJM² " . $name, "Vous venez d'être promu organisateur du tournoi " . $name . " pour le TFJM² $YEAR !", "From: $MAIL_ADDRESS");
return false; return false;
} }
@ -112,14 +122,14 @@ if (!isset($_SESSION["role"]) or $_SESSION["role"] != "ADMIN") {
<form method="POST"> <form method="POST">
<input type="hidden" name="submitted" value="true" /> <input type="hidden" name="submitted" value="true" />
<table> <table style="width: 100%;">
<tbody> <tbody>
<tr> <tr>
<td> <td style="width: 30%;">
<label for="name">Nom :</label> <label for="name">Nom :</label>
</td> </td>
<td> <td style="width: 70%;">
<input type="text" id="name" name="name" /> <input style="width: 100%;" type="text" id="name" name="name" required />
</td> </td>
</tr> </tr>
<tr> <tr>
@ -127,7 +137,7 @@ if (!isset($_SESSION["role"]) or $_SESSION["role"] != "ADMIN") {
<label for="organizer">Organisateur :</label> <label for="organizer">Organisateur :</label>
</td> </td>
<td> <td>
<select id="organizer" name="organizer"> <select style="width: 100%;" id="organizer" name="organizer[]" multiple size="4" required>
<?php <?php
while (($data = $orgas_response->fetch()) !== FALSE) { while (($data = $orgas_response->fetch()) !== FALSE) {
echo "<option value=\"" . $data["id"] . "\">" . $data["first_name"] . " " . $data["surname"] . "</option>\n"; echo "<option value=\"" . $data["id"] . "\">" . $data["first_name"] . " " . $data["surname"] . "</option>\n";
@ -141,7 +151,7 @@ if (!isset($_SESSION["role"]) or $_SESSION["role"] != "ADMIN") {
<label for="size">Nombre d'équipes :</label> <label for="size">Nombre d'équipes :</label>
</td> </td>
<td> <td>
<input type="number" id="size" name="size" min="3" max="12" value="6" /> <input style="width: 100%;" type="number" id="size" name="size" min="3" max="12" value="6" required />
</td> </td>
</tr> </tr>
<tr> <tr>
@ -149,7 +159,7 @@ if (!isset($_SESSION["role"]) or $_SESSION["role"] != "ADMIN") {
<label for="place">Lieu :</label> <label for="place">Lieu :</label>
</td> </td>
<td> <td>
<input type="text" id="place" name="place" /> <input style="width: 100%;" type="text" id="place" name="place" required />
</td> </td>
</tr> </tr>
<tr> <tr>
@ -157,7 +167,7 @@ if (!isset($_SESSION["role"]) or $_SESSION["role"] != "ADMIN") {
<label for="price">Prix par participant</label> <label for="price">Prix par participant</label>
</td> </td>
<td> <td>
<input type="number" id="price" name="price" min="0" max="21" value="21" /> <input style="width: 100%;" type="number" id="price" name="price" min="0" max="21" value="21" required />
</td> </td>
</tr> </tr>
<tr> <tr>
@ -165,7 +175,7 @@ if (!isset($_SESSION["role"]) or $_SESSION["role"] != "ADMIN") {
<label for="date_start">Dates :</label> <label for="date_start">Dates :</label>
</td> </td>
<td> <td>
Du <input type="date" id="date_start" name="date_start" /> au <input type="date" id="date_end" name="date_end" /> 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 />
</td> </td>
</tr> </tr>
<tr> <tr>
@ -173,8 +183,8 @@ if (!isset($_SESSION["role"]) or $_SESSION["role"] != "ADMIN") {
<label for="date_inscription">Date limite d'inscription :</label> <label for="date_inscription">Date limite d'inscription :</label>
</td> </td>
<td> <td>
<input type="date" id="date_inscription" name="date_inscription" /> <input style="width: 49%;" type="date" id="date_inscription" name="date_inscription" required />
<input type="time" id="time_inscription" name="time_inscription" /> <input style="width: 49%;" type="time" id="time_inscription" name="time_inscription" required />
</td> </td>
</tr> </tr>
<tr> <tr>
@ -182,8 +192,8 @@ if (!isset($_SESSION["role"]) or $_SESSION["role"] != "ADMIN") {
<label for="date_solutions">Date limite pour rendre les solutions :</label> <label for="date_solutions">Date limite pour rendre les solutions :</label>
</td> </td>
<td> <td>
<input type="date" id="date_solutions" name="date_solutions" /> <input style="width: 49%;" type="date" id="date_solutions" name="date_solutions" required />
<input type="time" id="time_solutions" name="time_solutions" /> <input style="width: 49%;" type="time" id="time_solutions" name="time_solutions" required />
</td> </td>
</tr> </tr>
<tr> <tr>
@ -191,8 +201,8 @@ if (!isset($_SESSION["role"]) or $_SESSION["role"] != "ADMIN") {
<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 :</label>
</td> </td>
<td> <td>
<input type="date" id="date_syntheses" name="date_syntheses" /> <input style="width: 49%;" type="date" id="date_syntheses" name="date_syntheses" required />
<input type="time" id="time_syntheses" name="time_syntheses" /> <input style="width: 49%;" type="time" id="time_syntheses" name="time_syntheses" required />
</td> </td>
</tr> </tr>
<tr> <tr>
@ -200,12 +210,12 @@ if (!isset($_SESSION["role"]) or $_SESSION["role"] != "ADMIN") {
<label for="description">Description :</label> <label for="description">Description :</label>
</td> </td>
<td> <td>
<textarea name="description" id="description"></textarea> <textarea style="width: 100%;" name="description" id="description" required></textarea>
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td colspan="2">
<input type="submit" /> <input style="width: 100%;" type="submit" value="Ajouter un tournoi" />
</td> </td>
</tr> </tr>
</tbody> </tbody>

View File

@ -44,9 +44,9 @@ if (isset($_POST["download_zip"])) {
<?php <?php
$req = $DB->query("SELECT `id`, `name` FROM `tournaments` WHERE " $req = $DB->query("SELECT `tournaments`.`id`, `name` FROM `tournaments` JOIN `organizers` ON `tournament` = `tournaments`.`id` WHERE "
. ($_SESSION["role"] == "ADMIN" ? "" : "`organizer` = '" . $_SESSION["user_id"] . "' AND ") . ($_SESSION["role"] == "ADMIN" ? "" : "`organizer` = '" . $_SESSION["user_id"] . "' AND ")
. "`year` = $YEAR ORDER BY `name`;"); . "`year` = $YEAR GROUP BY `tournament` ORDER BY `name`;");
while (($data_tournament = $req->fetch()) !== false) { while (($data_tournament = $req->fetch()) !== false) {
echo "<h1>Tournoi de " . $data_tournament["name"] . "</h1>\n"; echo "<h1>Tournoi de " . $data_tournament["name"] . "</h1>\n";

View File

@ -44,9 +44,9 @@ if (isset($_POST["download_zip"])) {
<?php <?php
$req = $DB->query("SELECT `id`, `name` FROM `tournaments` WHERE " $req = $DB->query("SELECT `tournaments`.`id`, `name` FROM `tournaments` JOIN `organizers` ON `tournament` = `tournaments`.`id` WHERE "
. ($_SESSION["role"] == "ADMIN" ? "" : "`organizer` = '" . $_SESSION["user_id"] . "' AND ") . ($_SESSION["role"] == "ADMIN" ? "" : "`organizer` = '" . $_SESSION["user_id"] . "' AND ")
. "`year` = $YEAR ORDER BY `name`;"); . "`year` = $YEAR GROUP BY `tournament` ORDER BY `name`;");
while (($data_tournament = $req->fetch()) !== false) { while (($data_tournament = $req->fetch()) !== false) {
echo "<h1>Tournoi de " . $data_tournament["name"] . "</h1>\n"; echo "<h1>Tournoi de " . $data_tournament["name"] . "</h1>\n";

View File

@ -8,18 +8,129 @@ $response = $DB->prepare("SELECT * FROM `tournaments` WHERE `name` = ? AND `year
$response->execute([$tournament_name]); $response->execute([$tournament_name]);
$data = $response->fetch(); $data = $response->fetch();
$orga_data = $DB->query("SELECT `surname`, `first_name` FROM `users` WHERE `id` = " . $data["organizer"] . " AND `year` = $YEAR;")->fetch(); $orgas_req = $DB->query("SELECT `surname`, `first_name` FROM `users` JOIN `organizers` ON `users`.`id` = `organizer` WHERE `tournament` = " . $data["id"] . ";");
$orga_name = $orga_data["first_name"] . " " . $orga_data["surname"]; $orgas = [];
while (($orga_data = $orgas_req->fetch()) !== false) {
$orgas[] = $orga_data["first_name"] . " " . $orga_data["surname"];
}
if (isset($_POST["edit_tournament"])) {
$error_message = updateTournament();
}
$teams_response = $DB->query("SELECT `id`, `name`, `trigram`, `inscription_date`, `validation_status` FROM `teams` WHERE `tournament` = " . $data["id"] . " AND `year` = $YEAR;"); $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';");
function updateTournament() {
global $DB, $URL_BASE, $YEAR, $MAIL_ADDRESS, $data;
$tournament_id = $data["id"];
$name = htmlspecialchars($_POST["name"]);
$result = $DB->query("SELECT `id` FROM `tournaments` WHERE `name` = '" . $name . "' AND `id` != $tournament_id AND `year` = '$YEAR';");
if ($result->fetch())
return "Un tournoi existe déjà avec ce nom.";
if (!isset($_POST["organizer"]) || sizeof($_POST["organizer"]) == 0)
return "Aucun organisateur n'a été choisi.";
if ($_SESSION["role"] == "ADMIN") {
$organizers = $_POST["organizer"];
$orga_mails = [];
foreach ($organizers as $orga) {
$result = $DB->query("SELECT `role`, `email` FROM `users` WHERE `id` = '" . $orga . "' AND `year` = '$YEAR';");
$data = $result->fetch();
if ($data === FALSE)
return "L'organisateur spécifié n'existe pas.";
if ($data["role"] != "ORGANIZER" && $data["role"] != "ADMIN")
return "L'organisateur indiqué ne peut pas organiser de tournoi.";
$orga_mails[] = $data["email"];
}
}
try {
$size = intval(htmlspecialchars($_POST["size"]));
}
catch (Exception $ex) {
return "Le nombre d'équipes indiqué n'est pas un entier valide.";
}
if ($size < 3 || $size > 12)
return "Un tournoi doit comporter entre 3 et 12 équipes.";
$place = htmlspecialchars($_POST["place"]);
try {
$price = intval(htmlspecialchars($_POST["price"]));
}
catch (Throwable $t) {
return "Le tarif pour les participants n'est pas un nombre valide.";
}
if ($price < 0)
return "Le TFJM² ne va pas payer les élèves pour venir.";
if ($price > 50)
return "Soyons raisonnable sur le prix.";
$date_start = htmlspecialchars($_POST["date_start"]);
$date_start_parsed = date_parse_from_format("yyyy-mm-dd", $date_start);
$date_end = htmlspecialchars($_POST["date_end"]);
$date_end_parsed = date_parse_from_format("yyyy-mm-dd", $date_end);
$date_inscription = htmlspecialchars($_POST["date_inscription"]);
$time_inscription = htmlspecialchars($_POST["time_inscription"]);
$date_inscription_parsed = date_parse_from_format("yyyy-mm-dd", $date_inscription . ' ' . $time_inscription);
$date_solutions = htmlspecialchars($_POST["date_solutions"]);
$time_solutions = htmlspecialchars($_POST["time_solutions"]);
$date_solutions_parsed = date_parse_from_format("yyyy-mm-dd", $date_solutions . ' ' . $time_solutions);
$date_syntheses = htmlspecialchars($_POST["date_syntheses"]);
$time_syntheses = htmlspecialchars($_POST["time_syntheses"]);
$date_syntheses_parsed = date_parse_from_format("yyyy-mm-dd", $date_syntheses . ' ' . $time_syntheses);
if (!$date_start_parsed || !$date_end_parsed || !$date_inscription_parsed || !$date_solutions_parsed || !$date_syntheses_parsed)
return "Une date est mal formée.";
$description = htmlspecialchars($_POST["description"]);
$req = $DB->prepare("UPDATE `tournaments` SET `name` = ?, `size` = ?, `place` = ?, `price` = ?, `description` = ?,
`date_start` = ?, `date_end` = ?, `date_inscription` = ?, `date_solutions` = ?, `date_syntheses` = ?
WHERE `id` = $tournament_id;");
$req->execute([$name, $size, $place, $price, $description, $date_start, $date_end,
"$date_inscription $time_inscription", "$date_solutions $time_solutions", "$date_syntheses $time_syntheses"]);
if ($_SESSION["role"] == "ADMIN") {
$DB->exec("DELETE FROM `organizers` WHERE `tournament` = $tournament_id;");
foreach ($organizers as $orga) {
$req = $DB->prepare("INSERT INTO `organizers`(`organizer`, `tournament`) VALUES(?, ?);");
$req->execute([$orga, $tournament_id]);
}
}
header("Location: $URL_BASE/tournoi/" . $name);
exit();
}
?> ?>
<?php include "header.php" ?> <?php include "header.php" ?>
<h2>Tournoi de <?php echo $data["name"] ?></h2> <h2>Tournoi de <?php echo $data["name"] ?></h2>
<strong>Organisateur :</strong> <?php echo $orga_name ?><br /> <strong>Organisateur<?= sizeof($orgas) >= 2 ? 's' : '' ?> :</strong>
<?php
$s = "";
foreach ($orgas as $orga)
$s .= $orga . ", ";
echo substr($s, 0, -2);
?>
<br />
<strong>Nombre d'équipes maximal :</strong> <?php echo $data["size"] ?><br /> <strong>Nombre d'équipes maximal :</strong> <?php echo $data["size"] ?><br />
<strong>Lieu :</strong> <?php echo $data["place"] ?><br /> <strong>Lieu :</strong> <?php echo $data["place"] ?><br />
<strong>Prix par partipant :</strong> <?php echo $data["price"] == 0 ? "Gratuit" : $data["price"] . "" ?><br /> <strong>Prix par partipant :</strong> <?php echo $data["price"] == 0 ? "Gratuit" : $data["price"] . "" ?><br />
@ -27,7 +138,12 @@ $teams_response = $DB->query("SELECT `id`, `name`, `trigram`, `inscription_date`
<strong>Clôture des inscriptions :</strong> <?php echo echo_date($data["date_inscription"], true) ?><br /> <strong>Clôture des inscriptions :</strong> <?php echo echo_date($data["date_inscription"], true) ?><br />
<strong>Date limite d'envoi des solutions :</strong> <?php echo echo_date($data["date_solutions"], true) ?><br /> <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>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"] ?> <strong>Description :</strong> <?php echo $data["description"] ?><br />
<?php if (!isset($_GET["modifier"])) { ?>
<a href="<?= $URL_BASE ?>/tournoi/<?= $data["name"] ?>/modifier">Éditer le tournoi</a>
<hr/>
<h2>Équipes inscrites à ce tournoi :</h2> <h2>Équipes inscrites à ce tournoi :</h2>
@ -49,42 +165,42 @@ $teams_response = $DB->query("SELECT `id`, `name`, `trigram`, `inscription_date`
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php <?php
while (($team_data = $teams_response->fetch()) != false) { while (($team_data = $teams_response->fetch()) != false) {
?> ?>
<tr> <tr>
<td style="border: 1px solid black; text-align: center"> <td style="border: 1px solid black; text-align: center">
<?php <?php
if (isset($_SESSION["role"]) && ($_SESSION["role"] == "ADMIN" || ($_SESSION["role"] == "ORGANIZER" && $data["organizer"] == $_SESSION["user_id"]))) if (isset($_SESSION["role"]) && ($_SESSION["role"] == "ADMIN" || ($_SESSION["role"] == "ORGANIZER" && $data["organizer"] == $_SESSION["user_id"])))
echo "<a href=\"$URL_BASE/equipe/" . $team_data["trigram"] . "\">" . $team_data["name"] . "</a>"; echo "<a href=\"$URL_BASE/equipe/" . $team_data["trigram"] . "\">" . $team_data["name"] . "</a>";
else else
echo $team_data["name"]; echo $team_data["name"];
?> ?>
</td> </td>
<td style="border: 1px solid black; text-align: center"><?php echo $team_data["trigram"] ?></td> <td style="border: 1px solid black; text-align: center"><?php echo $team_data["trigram"] ?></td>
<td style="border: 1px solid black; text-align: center"><?php echo echo_date($team_data["inscription_date"]) ?></td> <td style="border: 1px solid black; text-align: center"><?php echo echo_date($team_data["inscription_date"]) ?></td>
<td style="border: 1px solid black; text-align: center"> <td style="border: 1px solid black; text-align: center">
<?php <?php
switch ($team_data["validation_status"]) { switch ($team_data["validation_status"]) {
case "NOT_READY": case "NOT_READY":
echo "Inscription non terminée"; echo "Inscription non terminée";
break; break;
case "WAITING": case "WAITING":
echo "En attente de validation"; echo "En attente de validation";
break; break;
case "VALIDATED": case "VALIDATED":
echo "Inscription validée"; echo "Inscription validée";
break; break;
default: default:
echo "Statut inconnu"; echo "Statut inconnu";
break; break;
} }
?> ?>
</td> </td>
</tr> </tr>
<?php <?php
} }
?> ?>
</tbody> </tbody>
<tfoot> <tfoot>
<tr> <tr>
@ -104,4 +220,117 @@ $teams_response = $DB->query("SELECT `id`, `name`, `trigram`, `inscription_date`
</tfoot> </tfoot>
</table> </table>
<?php
}
else {
?>
<form method="POST">
<input type="hidden" name="submitted" value="true" />
<table style="width: 100%;">
<tbody>
<tr>
<td style="width: 30%;">
<label for="name">Nom :</label>
</td>
<td style="width: 70%;">
<input style="width: 100%;" type="text" id="name" name="name" value="<?= $data["name"] ?>" required />
</td>
</tr>
<?php if ($_SESSION["role"] == "ADMIN") { ?>
<tr>
<td>
<label for="organizer">Organisateur :</label>
</td>
<td>
<select style="width: 100%;" id="organizer" name="organizer[]" multiple size="4" required>
<?php
while (($orga_data = $orgas_response->fetch()) !== FALSE) {
echo "<option value=\"" . $orga_data["id"] . "\" " . (in_array($orga_data["first_name"] . " " . $orga_data["surname"], $orgas) ? "selected" : "")
. ">" . $orga_data["first_name"] . " " . $orga_data["surname"] . "</option>\n";
}
?>
</select>
</td>
</tr>
<?php } ?>
<tr>
<td>
<label for="size">Nombre d'équipes :</label>
</td>
<td>
<input style="width: 100%;" type="number" id="size" name="size" min="3" max="12" value="<?= $data["size"] ?>" required />
</td>
</tr>
<tr>
<td>
<label for="place">Lieu :</label>
</td>
<td>
<input style="width: 100%;" type="text" id="place" name="place" value="<?= $data["place"] ?>" required />
</td>
</tr>
<tr>
<td>
<label for="price">Prix par participant</label>
</td>
<td>
<input style="width: 100%;" type="number" id="price" name="price" min="0" max="21" value="<?= $data["price"] ?>" required />
</td>
</tr>
<tr>
<td>
<label for="date_start">Dates :</label>
</td>
<td>
Du <input style="width: 45%;" type="date" id="date_start" name="date_start" value="<?= $data["date_start"] ?>" required />
au <input style="width: 45%;" type="date" id="date_end" name="date_end" value="<?= $data["date_end"] ?>" required />
</td>
</tr>
<tr>
<td>
<label for="date_inscription">Date limite d'inscription :</label>
</td>
<td>
<input style="width: 49%;" type="date" id="date_inscription" name="date_inscription" value="<?= substr($data["date_inscription"], 0, 10) ?>" required />
<input style="width: 49%;" type="time" id="time_inscription" name="time_inscription" value="<?= substr($data["date_inscription"], 11) ?>" required />
</td>
</tr>
<tr>
<td>
<label for="date_solutions">Date limite pour rendre les solutions :</label>
</td>
<td>
<input style="width: 49%;" type="date" id="date_solutions" name="date_solutions" value="<?= substr($data["date_solutions"], 0, 10) ?>" required />
<input style="width: 49%;" type="time" id="time_solutions" name="time_solutions" value="<?= substr($data["date_solutions"],11) ?>" required />
</td>
</tr>
<tr>
<td>
<label for="date_syntheses">Date limite pour rendre les notes de synthèse :</label>
</td>
<td>
<input style="width: 100%;" type="date" id="date_syntheses" name="date_syntheses" value="<?= substr($data["date_syntheses"], 0, 10) ?>" required />
<input style="width: 100%;" type="time" id="time_syntheses" name="time_syntheses" value="<?= substr($data["date_syntheses"], 11) ?>" required />
</td>
</tr>
<tr>
<td>
<label for="description">Description :</label>
</td>
<td>
<textarea style="width: 100%;" name="description" id="description" required><?= $data["description"] ?></textarea>
</td>
</tr>
<tr>
<td colspan="2">
<input style="width: 100%;" type="submit" name="edit_tournament" value="Modifier le tournoi" />
</td>
</tr>
</tbody>
</table>
</form>
<?php
}
?>
<?php include "footer.php" ?> <?php include "footer.php" ?>