1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-06-25 18:17:28 +02:00

Utilisation des nouvelles classes, amélioration du code

This commit is contained in:
galaxyoyo
2019-09-07 01:33:05 +02:00
parent b5d567e364
commit bffaf4b360
30 changed files with 472 additions and 440 deletions

View File

@ -1,33 +1,36 @@
<h2>Tournoi de <?php echo $data["name"] ?></h2>
<h2>Tournoi de <?= $tournament->getName() ?></h2>
<strong>Organisateur<?= sizeof($orgas) >= 2 ? 's' : '' ?> :</strong>
<?php
$s = "";
for ($i = 0; $i < sizeof($orgas); ++$i) {
if ($_SESSION["role"] == "ORGANIZER" || $_SESSION["role"] == "ADMIN")
$s .= "<a href=\"$URL_BASE/informations/$orgas_id[$i]/$orgas[$i]\">$orgas[$i]</a>";
/** @var User $orga */
foreach ($orgas as $orga) {
$orga_id = $orga->getId();
$orga_name = $orga->getFirstName() . " " . $orga->getSurname();
if ($_SESSION["role"] == Role::ORGANIZER || $_SESSION["role"] == Role::ADMIN)
$s .= "<a href=\"$URL_BASE/informations/$orga_id/$orga_name\">$orga_name</a>";
else
$s .= $orgas[$i];
$s .= $orga_name;
$s .= ", ";
}
echo substr($s, 0, -2);
?>
<br />
<strong>Nombre d'équipes maximal :</strong> <?php echo $data["size"] ?><br />
<strong>Lieu :</strong> <?php echo $data["place"] ?><br />
<strong>Prix par partipant :</strong> <?php echo $data["price"] == 0 ? "Gratuit" : $data["price"] . " €" ?><br />
<strong>Dates :</strong> Du <?php echo echoDate($data["date_start"]) ?> au <?php echo echoDate($data["date_end"]) ?><br />
<strong>Clôture des inscriptions :</strong> <?php echo echoDate($data["date_inscription"], true) ?><br />
<strong>Date limite d'envoi des solutions :</strong> <?php echo echoDate($data["date_solutions"], true) ?><br />
<strong>Date limite d'envoi des notes de synthèse :</strong> <?php echo echoDate($data["date_syntheses"], true) ?><br />
<strong>Description :</strong> <?php echo $data["description"] ?><br />
<strong>Nombre d'équipes maximal :</strong> <?= $tournament->getSize() ?><br />
<strong>Lieu :</strong> <?= $tournament->getPlace() ?><br />
<strong>Prix par partipant :</strong> <?= $tournament->getPrice() == 0 ? "Gratuit" : $tournament->getPrice() . " €" ?><br />
<strong>Dates :</strong> Du <?= echoDate($tournament->getStartDate()) ?> au <?= echoDate($tournament->getEndDate()) ?><br />
<strong>Clôture des inscriptions :</strong> <?= echoDate($tournament->getInscriptionDate(), true) ?><br />
<strong>Date limite d'envoi des solutions :</strong> <?= echoDate($tournament->getSolutionsDate(), true) ?><br />
<strong>Date limite d'envoi des notes de synthèse :</strong> <?= echoDate($tournament->getSynthesesDate(), true) ?><br />
<strong>Description :</strong> <?= $tournament->getDescription() ?><br />
<?php
if ($data["final"])
if ($tournament->isFinal())
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>
<?php if (!isset($_GET["modifier"]) && ($_SESSION["role"] == Role::ADMIN || $_SESSION["role"] == Role::ORGANIZER && in_array($_SESSION["user_id"], $orgas_id))) { ?>
<a href="<?= $URL_BASE ?>/tournoi/<?= $tournament->getName() ?>/modifier">Éditer le tournoi</a>
<?php } ?>
@ -55,29 +58,30 @@ if ($data["final"])
</thead>
<tbody>
<?php
/** @noinspection PhpUndefinedVariableInspection */
while (($team_data = $teams_response->fetch()) != false) {
?>
<tr>
<td style="border: 1px solid black; text-align: center">
<?php
if (isset($_SESSION["role"]) && ($_SESSION["role"] == "ADMIN" || ($_SESSION["role"] == "ORGANIZER" && in_array($_SESSION["user_id"], $orgas_id))))
if (isset($_SESSION["role"]) && ($_SESSION["role"] == Role::ADMIN || ($_SESSION["role"] == Role::ORGANIZER && in_array($_SESSION["user_id"], $orgas_id))))
echo "<a href=\"$URL_BASE/equipe/" . $team_data["trigram"] . "\">" . $team_data["name"] . "</a>";
else
echo $team_data["name"];
?>
</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 echoDate($team_data["inscription_date"]) ?></td>
<td style="border: 1px solid black; text-align: center"><?= $team_data["trigram"] ?></td>
<td style="border: 1px solid black; text-align: center"><?= echoDate($team_data["inscription_date"]) ?></td>
<td style="border: 1px solid black; text-align: center">
<?php
switch ($team_data["validation_status"]) {
case "NOT_READY":
switch (ValidationStatus::fromName($team_data["validation_status"])) {
case ValidationStatus::NOT_READY:
echo "Inscription non terminée";
break;
case "WAITING":
case ValidationStatus::WAITING:
echo "En attente de validation";
break;
case "VALIDATED":
case ValidationStatus::VALIDATED:
echo "Inscription validée";
break;
default:
@ -122,10 +126,10 @@ else {
<label for="name">Nom :</label>
</td>
<td style="width: 70%;">
<input style="width: 100%;" type="text" id="name" name="name" value="<?= $data["name"] ?>" required />
<input style="width: 100%;" type="text" id="name" name="name" value="<?= $tournament->getName() ?>" required />
</td>
</tr>
<?php if ($_SESSION["role"] == "ADMIN") { ?>
<?php if ($_SESSION["role"] == Role::ADMIN) { ?>
<tr>
<td>
<label for="organizer">Organisateur :</label>
@ -134,7 +138,7 @@ else {
<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" : "")
echo "<option value=\"" . $orga_data["id"] . "\" " . (in_array($orga_data["id"], $orgas_id) ? "selected" : "")
. ">" . $orga_data["first_name"] . " " . $orga_data["surname"] . "</option>\n";
}
?>
@ -147,7 +151,7 @@ else {
<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 />
<input style="width: 100%;" type="number" id="size" name="size" min="3" max="12" value="<?= $tournament->getSize() ?>" required />
</td>
</tr>
<tr>
@ -155,7 +159,7 @@ else {
<label for="place">Lieu :</label>
</td>
<td>
<input style="width: 100%;" type="text" id="place" name="place" value="<?= $data["place"] ?>" required />
<input style="width: 100%;" type="text" id="place" name="place" value="<?= $tournament->getPlace() ?>" required />
</td>
</tr>
<tr>
@ -163,7 +167,7 @@ else {
<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 />
<input style="width: 100%;" type="number" id="price" name="price" min="0" max="21" value="<?= $tournament->getPrice() ?>" required />
</td>
</tr>
<tr>
@ -171,8 +175,8 @@ else {
<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 />
Du <input style="width: 45%;" type="date" id="date_start" name="date_start" value="<?= $tournament->getStartDate() ?>" required />
au <input style="width: 45%;" type="date" id="date_end" name="date_end" value="<?= $tournament->getEndDate() ?>" required />
</td>
</tr>
<tr>
@ -180,8 +184,8 @@ else {
<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 />
<input style="width: 49%;" type="date" id="date_inscription" name="date_inscription" value="<?= substr($tournament->getInscriptionDate(), 0, 10) ?>" required />
<input style="width: 49%;" type="time" id="time_inscription" name="time_inscription" value="<?= substr($tournament->getInscriptionDate(), 11) ?>" required />
</td>
</tr>
<tr>
@ -189,8 +193,8 @@ else {
<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 />
<input style="width: 49%;" type="date" id="date_solutions" name="date_solutions" value="<?= substr($tournament->getSolutionsDate(), 0, 10) ?>" required />
<input style="width: 49%;" type="time" id="time_solutions" name="time_solutions" value="<?= substr($tournament->getSolutionsDate(),11) ?>" required />
</td>
</tr>
<tr>
@ -198,8 +202,8 @@ else {
<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 />
<input style="width: 100%;" type="date" id="date_syntheses" name="date_syntheses" value="<?= substr($tournament->getSynthesesDate(), 0, 10) ?>" required />
<input style="width: 100%;" type="time" id="time_syntheses" name="time_syntheses" value="<?= substr($tournament->getSynthesesDate(), 11) ?>" required />
</td>
</tr>
<tr>
@ -207,7 +211,7 @@ else {
<label for="description">Description :</label>
</td>
<td>
<textarea style="width: 100%;" name="description" id="description" required><?= $data["description"] ?></textarea>
<textarea style="width: 100%;" name="description" id="description" required><?= $tournament->getDescription() ?></textarea>
</td>
</tr>
<tr>