plateforme-tfjm2/server_files/views/mon_equipe.php

161 lines
5.9 KiB
PHP
Raw Normal View History

<?php
require_once "header.php";
2019-09-09 21:28:03 +00:00
if ($has_error)
echo "<h2>Erreur : " . $error_message . "</h2>";
elseif (isset($send_document))
2019-09-06 11:48:50 +00:00
echo "<h2>Le fichier a été correctement envoyé !</h2>";
?>
2019-09-06 11:48:50 +00:00
2019-09-07 23:35:05 +00:00
<h2>Informations sur l'équipe</h2>
2019-09-06 11:48:50 +00:00
2019-09-07 23:35:05 +00:00
Nom de l'équipe : <?= $team->getName() ?><br/>
Trigramme : <?= $team->getTrigram() ?><br/>
Tournoi : <a href="<?= $tournament->getName() ?>"><?= $tournament->getName() ?></a><br/>
2019-09-06 11:48:50 +00:00
<?php
for ($i = 1; $i <= 2; ++$i) {
if ($team->getEncadrants()[$i] == NULL)
2019-09-06 11:48:50 +00:00
continue;
$encadrant = User::fromId($team->getEncadrants()[$i - 1]);
$id = $encadrant->getId();
echo "Encadrant $i : <a href=\"/informations/$id/" . $encadrant->getFirstName() . " " . $encadrant->getSurname() . "\">" . $encadrant->getFirstName() . " " . $encadrant->getSurname() . "</a><br />";
2019-09-06 11:48:50 +00:00
}
for ($i = 1; $i <= 6; ++$i) {
if ($team->getParticipants()[$i - 1] == NULL)
2019-09-06 11:48:50 +00:00
continue;
$participant = User::fromId($team->getParticipants()[$i - 1]);
$id = $participant->getId();
echo "Participant $i : <a href=\"/informations/$id/" . $participant->getFirstName() . " " . $participant->getSurname() . "\">" . $participant->getFirstName() . " " . $participant->getSurname() . "</a><br />";
2019-09-06 11:48:50 +00:00
}
?>
2019-09-07 23:35:05 +00:00
Code d'accès : <strong><?= $team->getAccessCode() ?></strong><br/>
<?php if ($team->isSelectedForFinal()) {
$final_name = $FINAL->getName();
echo "<strong>Équipe sélectionnée pour la <a href=\"/tournoi/$final_name\">finale nationale</a>.</strong><br />";
2019-09-06 11:48:50 +00:00
} ?>
<?php if (isset($_GET["modifier"])) { ?>
2019-09-07 23:35:05 +00:00
<form method="POST">
<input type="hidden" name="team_edit" 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="<?= $team->getName() ?>"/>
</td>
</tr>
<tr>
<td>
<label for="trigram">Trigramme :</label>
</td>
<td>
<input style="width: 100%;" type="text" id="trigram" name="trigram"
value="<?= $team->getTrigram() ?>"/>
</td>
</tr>
<tr>
<td>
<label for="tournament">Tournoi :</label>
</td>
<td>
2019-09-09 21:28:03 +00:00
<select style="width: 100%;" id="tournament" name="tournament_id">
2019-09-06 11:48:50 +00:00
<?php
2019-09-07 23:35:05 +00:00
foreach ($tournaments as $tournament)
echo "<option value=\"" . $tournament->getId() . "\">" . $tournament->getName() . "</option>\n";
2019-09-06 11:48:50 +00:00
?>
2019-09-07 23:35:05 +00:00
</select>
</td>
</tr>
<tr>
<td colspan="2">
<input style="width: 100%;" type="submit" value="Modifier l'équipe"/>
</td>
</tr>
</tbody>
</table>
</form>
2019-09-06 11:48:50 +00:00
<?php } else { ?>
<?php if ($_SESSION["team_validation_status"] == ValidationStatus::NOT_READY) { ?>
2019-09-07 23:35:05 +00:00
<!--suppress HtmlUnknownTarget -->
<a href="/mon_equipe/modifier">Modifier mon équipe</a>
2019-09-06 11:48:50 +00:00
<?php } ?>
2019-09-07 23:35:05 +00:00
<hr/>
<h2>Mes autorisations</h2>
2019-09-06 11:48:50 +00:00
<?php
2019-09-07 23:35:05 +00:00
printDocuments($documents);
if ($team->isSelectedForFinal()) { ?>
<hr/>
<h2>Mes autorisations pour la finale</h2>
<?php
printDocuments($documents_final);
2019-09-06 11:48:50 +00:00
}
2019-09-07 23:35:05 +00:00
if ($team->getValidationStatus() == ValidationStatus::NOT_READY) { ?>
2019-09-07 23:35:05 +00:00
<hr />
<form method="post" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="5000000"/>
<table style="width: 100%;">
<tbody>
<tr>
<td>
<label for="type">Type de document :</label>
</td>
<td>
<select style="width: 100%;" id="type" name="type">
<?php if ($_SESSION["user"]->getBirthDate() > strval($YEAR - 18) . substr($tournament->getStartDate(), 4)) { ?>
2019-09-07 23:35:05 +00:00
<option value="parental_consent">Autorisation parentale</option>
2019-09-06 11:48:50 +00:00
<?php } ?>
2019-09-07 23:35:05 +00:00
<option value="photo_consent">Autorisation de droit à l'image</option>
<option value="sanitary_plug">Fiche sanitaire</option>
</select>
</td>
</tr>
<tr>
<td>
<label for="file">Fichier :</label>
</td>
<td>
<input style="width: 100%;" type="file" id="file" name="document"/>
</td>
</tr>
<tr>
<td colspan="2">
<input style="width: 100%;" type="submit" name="send_document" value="Envoyer le document"/>
</td>
</tr>
</tbody>
</table>
</form>
2019-09-06 11:48:50 +00:00
<?php } ?>
<?php if ($team->getValidationStatus() == ValidationStatus::NOT_READY) { ?>
2019-09-07 23:35:05 +00:00
<hr/>
<table style="width: 100%;">
<tr>
<td style="width: 50%;">
<form method="post">
<input style="width: 100%;" type="submit" name="leave_team" value="Quitter l'équipe"/>
</form>
</td>
2019-09-06 11:48:50 +00:00
<?php
2019-09-09 21:28:03 +00:00
$can_validate = canValidate($team, $tournament);
2019-09-06 11:48:50 +00:00
if ($can_validate) { ?>
2019-09-07 23:35:05 +00:00
<td style="width: 50%;">
<form method="post">
<input style="width: 100%;" type="submit" name="request_validation"
value="Demander la validation"/>
</form>
</td>
2019-09-06 11:48:50 +00:00
<?php } ?>
2019-09-07 23:35:05 +00:00
</tr>
</table>
2019-09-06 11:48:50 +00:00
<?php } ?>
<?php } ?>
<?php require_once "footer.php" ?>