1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-06-25 07:40:32 +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,10 +1,7 @@
<?php if (!isset($_SESSION["role"]) or ($_SESSION["role"] != "PARTICIPANT" && $_SESSION["role"] != "ENCADRANT")) {
?>
<h2>Vous devez être participant ou encadrant pour pouvoir ajouter une équipe.</h2>
<?php } else if ($_SESSION["team_id"] != NULL) { ?>
<?php if ($_SESSION["team"] != NULL) { ?>
<h2>Vous êtes déjà dans une équipe.</h2>
<?php } else if (isset($access_code)) { ?>
Votre équipe a bien été créée ! Voici le code d'accès à transmettre aux autres membres de votre équipe : <strong><?php echo $access_code ?></strong>
Votre équipe a bien été créée ! Voici le code d'accès à transmettre aux autres membres de votre équipe : <strong><?= $access_code ?></strong>
<?php } else { ?>
<?php if (isset($error_message) && $error_message) echo "<h2>Erreur : " . $error_message . "</h2>"; ?>

View File

@ -50,4 +50,4 @@ if (isset($error_message)) {
</tr>
</tbody>
</table>
</form>
</form>

View File

@ -1,25 +1,25 @@
<h2>Informations sur l'équipe</h2>
Nom de l'équipe : <?= $team_data["name"] ?><br />
Trigramme : <?= $team_data["trigram"] ?><br />
Tournoi : <a href="<?= $URL_BASE . "/tournoi/" . $tournament_data["name"] ?>"><?= $tournament_data["name"] ?></a><br />
Nom de l'équipe : <?= $team->getName() ?><br />
Trigramme : <?= $team->getTrigram() ?><br />
Tournoi : <a href="<?= $URL_BASE . "/tournoi/" . $tournament->getName() ?>"><?= $tournament->getName() ?></a><br />
<?php
for ($i = 1; $i <= 2; ++$i) {
if ($team_data["encadrant_" . $i] == NULL)
if ($team->getEncadrants()[$i] == NULL)
continue;
$user_data = $DB->query("SELECT `id`, `surname`, `first_name` FROM `users` WHERE `id` = " . $team_data["encadrant_" . $i] . " AND `year` = '$YEAR';")->fetch();
$id = $user_data["id"];
echo "Encadrant $i : <a href=\"$URL_BASE/informations/$id/" . $user_data["first_name"] . " " . $user_data["surname"] . "\">" . $user_data["first_name"] . " " . $user_data["surname"] . "</a><br />";
$encadrant = User::fromId($team->getEncadrants()[$i - 1]);
$id = $encadrant->getId();
echo "Encadrant $i : <a href=\"$URL_BASE/informations/$id/" . $encadrant->getFirstName() . " " . $encadrant->getSurname() . "\">" . $encadrant->getFirstName() . " " . $encadrant->getSurname() . "</a><br />";
}
for ($i = 1; $i <= 6; ++$i) {
if ($team_data["participant_" . $i] == NULL)
if ($team->getParticipants()[$i - 1] == NULL)
continue;
$user_data = $DB->query("SELECT `id`, `surname`, `first_name` FROM `users` WHERE `id` = " . $team_data["participant_" . $i] . " AND `year` = '$YEAR';")->fetch();
$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 />";
$participant = User::fromId($team->getParticipants()[$i - 1]);
$id = $participant->getId();
echo "Participant $i : <a href=\"$URL_BASE/informations/$id/" . $participant->getFirstName() . " " . $participant->getSurname() . "\">" . $participant->getFirstName() . " " . $participant->getSurname() . "</a><br />";
}
if ($team_data["final_selection"]) {
$final_name = $_SESSION["final_name"];
if ($team->isSelectedForFinal()) {
$final_name = $_SESSION["final"]->getName();
echo "<strong>Équipe sélectionnée pour la <a href=\"$URL_BASE/tournoi/$final_name\">finale nationale</a>.</strong>";
}
?>
@ -52,7 +52,7 @@ while (($data = $documents_req->fetch()) !== false) {
}
?>
<?php if ($team_data["final_selection"]) { ?>
<?php if ($team->isSelectedForFinal()) { ?>
<hr />
<h2>Autorisations pour la finale</h2>
<?php
@ -79,14 +79,14 @@ while (($data = $documents_req->fetch()) !== false) {
}
}
if ($team_data["validation_status"] == "WAITING" && $_SESSION["role"] == "ADMIN") { ?>
if ($team->getValidationStatus() == ValidationStatus::WAITING && $_SESSION["role"] == Role::ADMIN) { ?>
<form method="POST">
<input style="width: 100%;" type="submit" name="validate" value="Valider l'équipe" />
</form>
<?php
}
if (!$team_data["final_selection"]) { ?>
if (!$team->isSelectedForFinal() && isset($_SESSION["user_id"]) && $_SESSION["role"] == Role::ADMIN) { ?>
<form method="POST">
<input style="width: 100%;" type="submit" name="select" value="Sélectionner pour la finale nationale" />
</form>

View File

@ -30,40 +30,40 @@
<li><a href="<?= $URL_BASE ?>/inscription">Inscription</a></li>
<?php } else { ?>
<li><a href="<?= $URL_BASE ?>/mon_compte">Mon compte</a></li>
<?php if ($_SESSION["role"] == "ENCADRANT" || $_SESSION["role"] == "PARTICIPANT") { ?>
<?php if ($_SESSION["team_id"] == NULL) { ?>
<?php if ($_SESSION["role"] == Role::ENCADRANT || $_SESSION["role"] == Role::PARTICIPANT) { ?>
<?php if ($_SESSION["team"] == NULL) { ?>
<li><a href="<?= $URL_BASE ?>/ajouter_equipe">Ajouter une équipe</a></li>
<li><a href="<?= $URL_BASE ?>/rejoindre_equipe">Rejoindre une équipe</a></li>
<?php } else { ?>
<li><a href="<?= $URL_BASE ?>/mon_equipe">Mon équipe</a></li>
<?php if ($_SESSION["team_validation_status"] == "VALIDATED" || true) { ?>
<?php if ($_SESSION["team"]->getValidationStatus() == ValidationStatus::VALIDATED || true) { ?>
<li><a href="https://paypal.me/galaxyoyo42">Paiement</a></li>
<li><a href="<?= $URL_BASE ?>/solutions">Solutions</a></li>
<li><a href="<?= $URL_BASE ?>/syntheses">Notes de synthèse</a></li>
<?php } ?>
<?php } ?>
<?php } ?>
<?php if ($_SESSION["role"] == "ADMIN") { ?>
<?php if ($_SESSION["role"] == Role::ADMIN) { ?>
<li><a href="<?= $URL_BASE ?>/ajouter_tournoi">Ajouter un tournoi</a></li>
<li><a href="<?= $URL_BASE ?>/ajouter_organisateur">Ajouter un organisateur</a></li>
<?php } ?>
<?php if ($_SESSION["role"] == "ADMIN" || $_SESSION["role"] == "ORGANIZER") { ?>
<?php if ($_SESSION["role"] == Role::ADMIN || $_SESSION["role"] == Role::ORGANIZER) { ?>
<li><a href="<?= $URL_BASE ?>/solutions_orga">Solutions</a></li>
<li><a href="<?= $URL_BASE ?>/syntheses_orga">Notes de synthèse</a></li>
<?php } ?>
<li><a href="<?= $URL_BASE ?>/deconnexion">Déconnexion</a></li>
<hr />
<?php
if ($_SESSION["role"] != "ADMIN") {
if ($_SESSION["role"] != Role::ADMIN) {
echo "<li><a href=\"?be-admin=1\">Devenir administrateur</a></li>";
}
if ($_SESSION["role"] != "ORGANIZER") {
if ($_SESSION["role"] != Role::ORGANIZER) {
echo "<li><a href=\"?be-organizer=1\">Devenir organisateur</a></li>";
}
if ($_SESSION["role"] != "PARTICIPANT") {
if ($_SESSION["role"] != Role::PARTICIPANT) {
echo "<li><a href=\"?be-participant=1\">Devenir participant</a></li>";
}
if ($_SESSION["role"] != "ENCADRANT") {
if ($_SESSION["role"] != Role::ENCADRANT) {
echo "<li><a href=\"?be-encadrant=1\">Devenir encadrant</a></li>";
}
?>

View File

@ -1,17 +1,17 @@
<h1><?= $user_data["first_name"] . " " . $user_data["surname"] ?></h1>
<h1><?= $user->getFirstName() . " " . $user->getSurname() ?></h1>
<?php if ($user_data["role"] == "PARTICIPANT" || $user_data["role"] == "ENCADRANT") { ?>
Équipe : <?= $team_data === false ? "Pas d'équipe" : "<a href=\"$URL_BASE/equipe/" . $team_data["trigram"] . "\">" . $team_data["name"] . " (" . $team_data["trigram"] . ")</a>" ?><br />
<?php if ($user->getRole() == Role::PARTICIPANT || $user->getRole() == Role::ENCADRANT) { ?>
Équipe : <?= $team === null ? "Pas d'équipe" : "<a href=\"$URL_BASE/equipe/" . $team->getTrigram() . "\">" . $team->getName() . " (" . $team->getTrigram() . ")</a>" ?><br />
<?php } ?>
Date de naissance : <?= echoDate($user_data["birth_date"]) ?><br />
Sexe : <?= $user_data["gender"] == "M" ? "Masculin" : "Féminin" ?><br />
Adresse : <?= $user_data["address"] . ", " . $user_data["postal_code"] . " " . $user_data["city"] . ($user_data["country"] == "France" ? "" : ", " . $user_data["country"]) ?><br />
Adresse e-mail : <a href="mailto:<?= $user_data["email"] ?>"><?= $user_data["email"] ?></a><br />
Numéro de téléphone : <?= $user_data["phone_number"] ?><br />
Date de naissance : <?= echoDate($user->getBirthDate()) ?><br />
Sexe : <?= $user->getGender() == "M" ? "Masculin" : "Féminin" ?><br />
Adresse : <?= $user->getAddress() . ", " . $user->getPostalCode() . " " . $user->getCity() . ($user->getCountry() == "France" ? "" : ", " . $user->getCountry()) ?><br />
Adresse e-mail : <a href="mailto:<?= $user->getEmail() ?>"><?= $user->getEmail() ?></a><br />
Numéro de téléphone : <?= $user->getPhoneNumber() ?><br />
<?php if ($user_data["role"] == "PARTICIPANT") { ?>
Lycée : <?= $user_data["school"] ?><br />
Classe : <?php switch ($user_data["class"]) {
<?php if ($user->getRole() == Role::PARTICIPANT) { ?>
Lycée : <?= $user->getSchool() ?><br />
Classe : <?php switch ($user->getClass()) {
case "TERMINALE":
echo "Terminale";
break;
@ -26,22 +26,21 @@ Numéro de téléphone : <?= $user_data["phone_number"] ?><br />
break;
}
?><br />
Nom du responsable légal : <?= $user_data["responsible_name"] ?><br />
Numéro de téléphone du responsable légal : <?= $user_data["responsible_phone"] ?><br />
Adresse e-mail du responsable légal : <a href="mailto:<?= $user_data["responsible_email"] ?>"><?= $user_data["responsible_email"] ?></a>
<?php } elseif ($user_data["description"] != "") { ?>
Description : <?= $user_data["description"] ?><br />
Nom du responsable légal : <?= $user->getResponsibleName() ?><br />
Numéro de téléphone du responsable légal : <?= $user->getResponsiblePhone() ?><br />
Adresse e-mail du responsable légal : <a href="mailto:<?= $user->getResponsibleEmail() ?>"><?= $user->getResponsibleEmail() ?></a>
<?php } elseif ($user->getDescription() != "") { ?>
Description : <?= $user->getDescription() ?><br />
<?php }
echo "<hr />";
if ($user_data["role"] == "ADMIN" || $user_data["role"] == "ORGANIZER") {
if ($user->getRole() == Role::ADMIN || $user->getRole() == Role::ORGANIZER) {
while (($tournament_data = $tournaments_req->fetch()) !== false) {
echo "Organise le tournoi <a href=\"$URL_BASE/tournoi/" . $tournament_data["name"] . "\">" . $tournament_data["name"] . "</a><br />";
}
}
elseif ($user_data["role"] == "PARTICIPANT" || $user_data["role"] == "ENCADRANT") { ?>
<hr />
elseif ($user->getRole() == Role::PARTICIPANT || $user->getRole() == Role::ENCADRANT) { ?>
<h2>Autorisations</h2>
<?php
while (($data = $documents_req->fetch()) !== false) {

View File

@ -5,9 +5,7 @@ if (isset($error_message) && $error_message === FALSE) {
?>
Votre inscription est validée ! Merci désormais de confirmer votre boîte mail pour valider votre adresse.
<?php } else if (isset($_SESSION["user_id"])) { ?>
<h2>Vous êtes déjà connecté !</h2>
<?php } else { ?>
<form method="POST">
@ -56,7 +54,7 @@ if (isset($error_message) && $error_message === FALSE) {
</tr>
<tr>
<td><label for="country">Pays :</label></td>
<td><input style="width: 100%;" type="text" id="country" name="country" value="<?php echo isset($_POST["country"]) ? $_POST["country"] : "France" ?>" required /></td>
<td><input style="width: 100%;" type="text" id="country" name="country" value="<?= isset($_POST["country"]) ? $_POST["country"] : "France" ?>" required /></td>
</tr>
<tr>
<td><label for="phone_number">Numéro de téléphone :</label></td>

View File

@ -16,76 +16,76 @@ if (isset($error_message) && $error_message === FALSE) {
<table style="width: 100%">
<tr>
<td style="width: 30%"><label for="email">E-mail :</label></td>
<td style="width: 70%"><?php echo $user_data["email"] ?></td>
<td style="width: 70%"><?= $user->getEmail() ?></td>
</tr>
<tr>
<td colspan="2"><input style="width: 100%" type="email" id="email" name="email"/></td>
</tr>
<tr>
<td><label for="surname">Nom :</label></td>
<td><?php echo $user_data["surname"] ?></td>
<td><?= $user->getSurname() ?></td>
</tr>
<tr>
<td colspan="2"><input style="width: 100%" type="text" id="surname" name="surname"/></td>
</tr>
<tr>
<td><label for="firstname">Prénom :</label></td>
<td><?php echo $user_data["first_name"] ?></td>
<td><?= $user->getFirstName() ?></td>
</tr>
<tr>
<td colspan="2"><input style="width: 100%" type="text" id="firstname" name="firstname"/></td>
</tr>
<tr>
<td><label for="birth_date">Date de naissance :</label></td>
<td><?php echo echoDate($user_data["birth_date"]) ?></td>
<td><?= echoDate($user->getBirthDate()) ?></td>
</tr>
<tr>
<td colspan="2"><input style="width: 100%" type="date" id="birth_date" name="birth_date"/></td>
</tr>
<tr>
<td><label for="gender">Sexe :</label></td>
<td><input type="radio" id="male" name="gender" value="M" <?php if ($user_data["gender"] == "M") echo "checked" ?> /><label for="male">Homme</label>
<input type="radio" id="female" name="gender" value="F" <?php if ($user_data["gender"] == "F") echo "checked" ?> /><label for="female">Femme</label></td>
<td><input type="radio" id="male" name="gender" value="M" <?php if ($user->getGender() == "M") echo "checked" ?> /><label for="male">Homme</label>
<input type="radio" id="female" name="gender" value="F" <?php if ($user->getGender() == "F") echo "checked" ?> /><label for="female">Femme</label></td>
</tr>
<tr>
<td><label for="address">Adresse :</label></td>
<td><?php echo $user_data["address"] ?></td>
<td><?= $user->getAddress() ?></td>
</tr>
<tr>
<td colspan="2"><input style="width: 100%" type="text" id="address" name="address"/></td>
</tr>
<tr>
<td><label for="postal_code">Code postal :</label></td>
<td><?php echo $user_data["postal_code"] ?></td>
<td><?= $user->getPostalCode() ?></td>
</tr>
<tr>
<td colspan="2"><input style="width: 100%" type="number" id="postal_code" name="postal_code" min="1000" max="95999"/></td>
</tr>
<tr>
<td><label for="city">Ville :</label></td>
<td><?php echo $user_data["city"] ?></td>
<td><?= $user->getCity() ?></td>
</tr>
<tr>
<td colspan="2"><input style="width: 100%" type="text" id="city" name="city"/></td>
</tr>
<tr>
<td><label for="country">Pays :</label></td>
<td><?php echo $user_data["country"] ?></td>
<td><?= $user->getCountry() ?></td>
</tr>
<tr>
<td colspan="2"><input style="width: 100%" type="text" id="country" name="country"/></td>
</tr>
<tr>
<td><label for="phone_number">Numéro de téléphone :</label></td>
<td><?php echo $user_data["phone_number"] ?></td>
<td><?= $user->getPhoneNumber() ?></td>
</tr>
<tr>
<td colspan="2"><input style="width: 100%" type="text" id="phone_number" name="phone_number"/></td>
</tr>
<?php if ($user_data["role"] == "PARTICIPANT") { ?>
<?php if ($user->getRole() == Role::PARTICIPANT) { ?>
<tr>
<td><label for="school">Établissement dans lequel l'élève étudie :</label></td>
<td><?php echo $user_data["school"] ?></td>
<td><?= $user->getSchool() ?></td>
</tr>
<tr>
<td colspan="2"><input style="width: 100%" type="text" id="school" name="school"/></td>
@ -93,9 +93,9 @@ if (isset($error_message) && $error_message === FALSE) {
<tr>
<td><label for="class">Classe :</label></td>
<td><select style="width: 100%" id="class" name="class">
<option value="terminale" <?php if ($user_data["class"] == "terminale") echo "selected" ?>>Terminale</option>
<option value="premiere" <?php if ($user_data["class"] == "premiere") echo "selected" ?>>Première</option>
<option value="seconde" <?php if ($user_data["class"] == "seconde") echo "selected" ?>>Seconde ou inférieur</option>
<option value="terminale" <?php if ($user->getClass() == "TERMINALE") echo "selected" ?>>Terminale</option>
<option value="premiere" <?php if ($user->getClass() == "PREMIERE") echo "selected" ?>>Première</option>
<option value="seconde" <?php if ($user->getClass() == "SECONDE") echo "selected" ?>>Seconde ou inférieur</option>
</select></td>
</tr>
<tr>
@ -103,7 +103,7 @@ if (isset($error_message) && $error_message === FALSE) {
<label for="responsible_name">Nom du responsable légal :</label>
</td>
<td>
<?php echo $user_data["responsible_name"] ?>
<?= $user->getResponsibleName() ?>
</td>
</tr>
<tr>
@ -116,7 +116,7 @@ if (isset($error_message) && $error_message === FALSE) {
<label for="responsible_phone">Téléphone du responsable légal :</label>
</td>
<td>
<?php echo $user_data["responsible_phone"] ?>
<?= $user->getResponsiblePhone() ?>
</td>
</tr>
<tr>
@ -129,7 +129,7 @@ if (isset($error_message) && $error_message === FALSE) {
<label for="responsible_email">Email du responsable légal :</label>
</td>
<td>
<?php echo $user_data["responsible_email"] ?>
<?= $user->getResponsibleEmail() ?>
</td>
</tr>
<tr>
@ -140,7 +140,7 @@ if (isset($error_message) && $error_message === FALSE) {
<?php } else { ?>
<tr>
<td><label for="description">Description :</label></td>
<td><textarea style="width: 100%" id="description" name="description"><?php echo $user_data["description"] ?></textarea></td>
<td><textarea style="width: 100%" id="description" name="description"><?= $user->getDescription() ?></textarea></td>
</tr>
<?php } ?>
<tr>

View File

@ -8,26 +8,28 @@
<h2>Informations sur l'équipe</h2>
Nom de l'équipe : <?= $team_data["name"] ?><br/>
Trigramme : <?= $team_data["trigram"] ?><br/>
Tournoi : <a href="<?= $tournament_data["name"] ?>"><?= $tournament_data["name"] ?></a><br/>
Nom de l'équipe : <?= $team->getName() ?><br/>
Trigramme : <?= $team->getTrigram() ?><br/>
Tournoi : <a href="<?= $tournament->getName() ?>"><?= $tournament->getName() ?></a><br/>
<?php
for ($i = 1; $i <= 2; ++$i) {
if ($team_data["encadrant_" . $i] == NULL)
if ($team->getEncadrants()[$i] == NULL)
continue;
$user_data = $DB->query("SELECT `surname`, `first_name` FROM `users` WHERE `id` = " . $team_data["encadrant_" . $i] . " AND `year` = '$YEAR';")->fetch();
echo "Encadrant $i : " . $user_data["first_name"] . " " . $user_data["surname"] . "<br />";
$encadrant = User::fromId($team->getEncadrants()[$i - 1]);
$id = $encadrant->getId();
echo "Encadrant $i : <a href=\"$URL_BASE/informations/$id/" . $encadrant->getFirstName() . " " . $encadrant->getSurname() . "\">" . $encadrant->getFirstName() . " " . $encadrant->getSurname() . "</a><br />";
}
for ($i = 1; $i <= 6; ++$i) {
if ($team_data["participant_" . $i] == NULL)
if ($team->getParticipants()[$i - 1] == NULL)
continue;
$user_data = $DB->query("SELECT `surname`, `first_name` FROM `users` WHERE `id` = " . $team_data["participant_" . $i] . " AND `year` = '$YEAR';")->fetch();
echo "Participant $i : " . $user_data["first_name"] . " " . $user_data["surname"] . "<br />";
$participant = User::fromId($team->getParticipants()[$i - 1]);
$id = $participant->getId();
echo "Participant $i : <a href=\"$URL_BASE/informations/$id/" . $participant->getFirstName() . " " . $participant->getSurname() . "\">" . $participant->getFirstName() . " " . $participant->getSurname() . "</a><br />";
}
?>
Code d'accès : <strong><?php echo $team_data["access_code"] ?></strong><br/>
<?php if (isset($_SESSION["final_id"])) {
$final_name = $_SESSION["final_name"];
Code d'accès : <strong><?= $team->getAccessCode() ?></strong><br/>
<?php if ($team->isSelectedForFinal()) {
$final_name = $_SESSION["final"]->getName();
echo "<strong>Équipe sélectionnée pour la <a href=\"$URL_BASE/tournoi/$final_name\">finale nationale</a>.</strong><br />";
} ?>
@ -42,7 +44,7 @@ Code d'accès : <strong><?php echo $team_data["access_code"] ?></strong><br/>
<label for="name">Nom :</label>
</td>
<td style="width: 70%;">
<input style="width: 100%;" type="text" id="name" name="name" value="<?= $team_data["name"] ?>"/>
<input style="width: 100%;" type="text" id="name" name="name" value="<?= $team->getName() ?>"/>
</td>
</tr>
<tr>
@ -51,7 +53,7 @@ Code d'accès : <strong><?php echo $team_data["access_code"] ?></strong><br/>
</td>
<td>
<input style="width: 100%;" type="text" id="trigram" name="trigram"
value="<?= $team_data["trigram"] ?>"/>
value="<?= $team->getTrigram() ?>"/>
</td>
</tr>
<tr>
@ -79,7 +81,7 @@ Code d'accès : <strong><?php echo $team_data["access_code"] ?></strong><br/>
<?php } else { ?>
<?php if ($_SESSION["team_validation_status"] == "NOT_READY") { ?>
<?php if ($_SESSION["team_validation_status"] == ValidationStatus::NOT_READY) { ?>
<!--suppress HtmlUnknownTarget -->
<a href="<?= $URL_BASE ?>/mon_equipe/modifier">Modifier mon équipe</a>
<?php } ?>
@ -103,7 +105,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") { ?>
if ($team->getValidationStatus() == ValidationStatus::NOT_READY) { ?>
<form method="post" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="5000000"/>
<table style="width: 100%;">
@ -114,7 +116,7 @@ Code d'accès : <strong><?php echo $team_data["access_code"] ?></strong><br/>
</td>
<td>
<select style="width: 100%;" id="type" name="type">
<?php if ($_SESSION["birth_date"] > strval($YEAR - 18) . substr($tournament_data["date_start"], 4)) { ?>
<?php if ($_SESSION["user"]->getBirthDate() > strval($YEAR - 18) . substr($tournament_data["date_start"], 4)) { ?>
<option value="parental_consent">Autorisation parentale</option>
<?php } ?>
<option value="photo_consent">Autorisation de droit à l'image</option>
@ -140,7 +142,7 @@ Code d'accès : <strong><?php echo $team_data["access_code"] ?></strong><br/>
</form>
<?php } ?>
<hr/>
<?php if ($team_data["validation_status"] == "NOT_READY") { ?>
<?php if ($team->getValidationStatus() == ValidationStatus::NOT_READY) { ?>
<table style="width: 100%;">
<tr>
<td style="width: 50%;">

View File

@ -1,11 +1,5 @@
<?php
if (!isset($_SESSION["role"]) or ($_SESSION["role"] != "PARTICIPANT" && $_SESSION["role"] != "ENCADRANT")) {
?>
<h2>Vous devez être participant ou encadrant pour pouvoir rejoindre une équipe.</h2>
<?php } else if (isset($access_code)) { ?>
Vous avez bien rejoint l'équipe <?php echo $data["name"] ?> !
<?php } else if ($_SESSION["team_id"] != NULL) { ?>
<h2>Vous êtes déjà dans une équipe.</h2>
<?php if (isset($error_message) && $error_message === false) { ?>
Vous avez bien rejoint l'équipe <?= $_SESSION["team"]->getName() ?> !
<?php } else { ?>
<?php if (isset($error_message) && $error_message) echo "<h2>Erreur : " . $error_message . "</h2>"; ?>

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>