1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2024-12-27 11:02:22 +00:00
plateforme-tfjm2/server_files/views/equipe.php

157 lines
6.6 KiB
PHP
Raw Normal View History

<?php require_once "header.php" ?>
2019-12-19 12:02:01 +00:00
<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">
2020-04-13 01:41:15 +00:00
<?php if ($team->getValidationStatus() != ValidationStatus::VALIDATED) { ?>
2019-12-19 12:02:01 +00:00
<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
2020-02-18 14:33:55 +00:00
for ($i = 1; $i <= 3; ++$i) {
2019-12-26 21:30:42 +00:00
if ($team->getEncadrants()[$i - 1] == NULL)
2019-12-19 12:02:01 +00:00
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>
2019-09-06 11:48:50 +00:00
2020-02-18 15:33:55 +00:00
<?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 } ?>
2019-09-07 23:35:05 +00:00
<hr/>
2019-09-06 11:48:50 +00:00
2020-01-22 21:06:53 +00:00
<h2>Documents</h2>
2019-09-06 11:48:50 +00:00
2019-09-07 23:35:05 +00:00
<?php printDocuments($documents) ?>
<form method="POST">
2019-12-19 12:02:01 +00:00
<input class="btn btn-secondary btn-lg btn-block" type="submit" name="download_zip" value="Télécharger l'archive"/>
2019-09-07 23:35:05 +00:00
</form>
2019-09-06 11:48:50 +00:00
<?php if ($team->isSelectedForFinal()) { ?>
2019-09-07 23:35:05 +00:00
<hr/>
2020-01-22 21:06:53 +00:00
<h2>Documents pour la finale</h2>
2019-12-19 12:02:01 +00:00
<?php printDocuments($documents_final) ?>
2019-09-07 23:35:05 +00:00
<form method="POST">
2019-12-19 12:02:01 +00:00
<input class="btn btn-secondary btn-lg btn-block" type="submit" name="download_zip_final" value="Télécharger l'archive"/>
2019-09-07 23:35:05 +00:00
</form>
<?php } ?>
2019-09-06 11:48:50 +00:00
<?php if ($team->getValidationStatus() == ValidationStatus::WAITING) { ?>
2019-09-07 23:35:05 +00:00
<form method="POST">
2019-12-19 12:02:01 +00:00
<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>
2019-09-07 23:35:05 +00:00
</form>
2019-12-19 12:02:01 +00:00
<?php
2019-09-06 11:48:50 +00:00
}
if (!$team->isSelectedForFinal() && $team->getValidationStatus() == ValidationStatus::VALIDATED) { ?>
2019-09-07 23:35:05 +00:00
<hr/>
<form method="POST">
2020-01-16 22:27:18 +00:00
<input class="btn btn-primary btn-lg btn-block" type="submit" name="select" value="Sélectionner pour la finale nationale"/>
2019-09-07 23:35:05 +00:00
</form>
2019-12-19 12:02:01 +00:00
<?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" ?>