1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-07-03 03:22:52 +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

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