157 lines
6.6 KiB
PHP
157 lines
6.6 KiB
PHP
<?php require_once "header.php" ?>
|
|
|
|
<div class="mt-4 mb-4">
|
|
<h1 class="display-4">Informations sur l'équipe</h1>
|
|
</div>
|
|
|
|
<div class="alert alert-info">
|
|
<strong>Nom de l'équipe :</strong> <?= $team->getName() ?>
|
|
</div>
|
|
<div class="alert alert-info">
|
|
<strong>Trigramme :</strong> <?= $team->getTrigram() ?>
|
|
</div>
|
|
|
|
<div class="alert alert-info">
|
|
<?php if ($team->getValidationStatus() == ValidationStatus::NOT_READY) { ?>
|
|
<label for="tournament">Tournoi :</label>
|
|
<form method="POST">
|
|
<select class="custom-select" id="tournament" name="select_tournament" onchange="this.form.submit()">
|
|
<option value="0">Pas de tournoi sélectionné</option>
|
|
<?php
|
|
foreach (Tournament::getAllTournaments(false, true) as $t) { ?>
|
|
<option value="<?= $t->getId() ?>" <?= $team->getTournamentId() == $t->getId() ? "selected" : "" ?>>
|
|
<?= $t->getName() ?>
|
|
</option>
|
|
<?php } ?>
|
|
</select>
|
|
</form>
|
|
<?php } else { ?>
|
|
<strong>Tournoi :</strong> <a href="<?= "/tournoi/" . $tournament->getName() ?>">
|
|
<?= $team->getTournamentId() == 0 ? "Pas de tournoi choisi" : $tournament->getName() ?>
|
|
</a>
|
|
<?php } ?>
|
|
</div>
|
|
|
|
<div class="alert alert-<?= $team->getValidationStatus() == ValidationStatus::VALIDATED ? "success" : ($team->getValidationStatus() == ValidationStatus::WAITING ? "warning" : "danger") ?>">
|
|
<strong>Validation de l'équipe
|
|
:</strong> <?= ValidationStatus::getTranslatedName($team->getValidationStatus()) ?>
|
|
</div>
|
|
<div class="alert alert-info">
|
|
<?php
|
|
for ($i = 1; $i <= 3; ++$i) {
|
|
if ($team->getEncadrants()[$i - 1] == NULL)
|
|
continue;
|
|
$encadrant = User::fromId($team->getEncadrants()[$i - 1]);
|
|
$id = $encadrant->getId();
|
|
echo "<strong>Encadrant :</strong> <a href=\"$URL_BASE/informations/$id/" . $encadrant->getFirstName() . " " . $encadrant->getSurname() . "\">" . $encadrant->getFirstName() . " " . $encadrant->getSurname() . "</a><br />";
|
|
}
|
|
for ($i = 1; $i <= 6; ++$i) {
|
|
if ($team->getParticipants()[$i - 1] == NULL)
|
|
continue;
|
|
$participant = User::fromId($team->getParticipants()[$i - 1]);
|
|
$id = $participant->getId();
|
|
echo "<strong>Participant $i :</strong> <a href=\"$URL_BASE/informations/$id/" . $participant->getFirstName() . " " . $participant->getSurname() . "\">" . $participant->getFirstName() . " " . $participant->getSurname() . "</a><br />";
|
|
}
|
|
if ($team->isSelectedForFinal()) {
|
|
$final_name = $FINAL->getName();
|
|
echo "<strong>Équipe sélectionnée pour la <a href=\"/tournoi/$final_name\">finale nationale</a>.</strong>";
|
|
}
|
|
?>
|
|
</div>
|
|
|
|
<?php if (isset($_GET["modifier"])) { ?>
|
|
|
|
<form method="POST">
|
|
<div class="form-row">
|
|
<div class="form-group col-md-6">
|
|
<label for="name">Nom :</label>
|
|
<input class="form-control" type="text" id="name" name="name" pattern="[A-Za-zÀ-ÿ ]+"
|
|
value="<?= $team->getName() ?>" required/>
|
|
</div>
|
|
|
|
<div class="form-group col-md-6">
|
|
<label for="trigram">Trigramme :</label>
|
|
<input class="form-control" type="text" id="trigram" name="trigram"
|
|
value="<?= $team->getTrigram() ?>" pattern="[A-Z]{3}" maxlength="3" required/>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group row">
|
|
<label for="tournament">Tournoi :</label>
|
|
<select id="tournament" name="tournament_id" class="custom-select">
|
|
<option value="0">Choisir un tournoi ...</option>
|
|
<?php
|
|
foreach (Tournament::getAllTournaments(false, true) as $tournament)
|
|
echo "<option value=\"" . $tournament->getId() . "\" "
|
|
. ($tournament->getId() == $team->getTournamentId() ? "selected" : "") . ">"
|
|
. $tournament->getName() . "</option>\n";
|
|
?>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="form-group row">
|
|
<input class="btn btn-primary btn-lg btn-block" name="team_edit" type="submit"
|
|
value="Modifier l'équipe"/>
|
|
</div>
|
|
</form>
|
|
|
|
<?php }
|
|
|
|
if ($team->getValidationStatus() != ValidationStatus::VALIDATED) { ?>
|
|
<hr/>
|
|
<a href="/equipe/<?= $team->getTrigram() ?>/modifier"><button class="btn btn-secondary btn-lg btn-block">Modifier l'équipe</button></a>
|
|
<?php } ?>
|
|
|
|
<hr/>
|
|
|
|
<h2>Documents</h2>
|
|
|
|
<?php printDocuments($documents) ?>
|
|
|
|
<form method="POST">
|
|
<input class="btn btn-secondary btn-lg btn-block" type="submit" name="download_zip" value="Télécharger l'archive"/>
|
|
</form>
|
|
|
|
<?php if ($team->isSelectedForFinal()) { ?>
|
|
<hr/>
|
|
<h2>Documents pour la finale</h2>
|
|
<?php printDocuments($documents_final) ?>
|
|
<form method="POST">
|
|
<input class="btn btn-secondary btn-lg btn-block" type="submit" name="download_zip_final" value="Télécharger l'archive"/>
|
|
</form>
|
|
<?php } ?>
|
|
|
|
<?php if ($team->getValidationStatus() == ValidationStatus::WAITING) { ?>
|
|
<form method="POST">
|
|
<div class="form-group row">
|
|
<label for="message">Message à adresser à l'équipe :</label>
|
|
<textarea class="form-control" id="message" name="message"></textarea>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<div class="form-group row col-mod-6">
|
|
<input type="submit" class="btn btn-secondary btn-lg btn-block" name="unvalidate"
|
|
value="Refuser l'équipe"/>
|
|
<input type="submit" class="btn btn-primary btn-lg btn-block" name="validate" value="Valider l'équipe"/>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
<?php
|
|
}
|
|
|
|
if (!$team->isSelectedForFinal() && $team->getValidationStatus() == ValidationStatus::VALIDATED) { ?>
|
|
<hr/>
|
|
<form method="POST">
|
|
<input class="btn btn-primary btn-lg btn-block" type="submit" name="select" value="Sélectionner pour la finale nationale"/>
|
|
</form>
|
|
<?php }
|
|
|
|
if ($team->getValidationStatus() == ValidationStatus::NOT_READY && $_SESSION["role"] == Role::ADMIN) { ?>
|
|
<hr/>
|
|
<form method="POST">
|
|
<input type="submit" class="btn btn-primary btn-lg btn-block" name="delete_team" value="Supprimer l'équipe"
|
|
style="background-color: #ff2e34"/>
|
|
</form>
|
|
<?php }?>
|
|
|
|
<?php require_once "footer.php" ?>
|