1
0
mirror of https://gitlab.com/animath/si/plateforme-corres2math.git synced 2024-12-26 05:02:21 +00:00
plateforme-corres2math/server_files/views/mon_equipe.php
2019-10-06 14:03:02 +02:00

128 lines
5.4 KiB
PHP

<?php
require_once "header.php";
?>
<div class="mt-4 mb-4">
<h1 class="display-4">Mon é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">
<strong>Problème :</strong> <a href="/probleme/<?= $team->getProblem() ?>">
<?= $team->getProblem() == 0 ? "Pas de problème choisi" : $team->getProblem() ?></a>
</div>
<div class="alert alert-info">
<?php
if ($team->getEncadrantId() !== null) {
$encadrant = User::fromId($team->getEncadrantId());
$id = $encadrant->getId();
if ($_SESSION["role"] == Role::ADMIN)
echo "<strong>Encadrant :</strong> <a href=\"$URL_BASE/informations/$id/" . $encadrant->getFirstName()
. " " . $encadrant->getSurname() . "\">" . $encadrant->getFirstName() . " " . $encadrant->getSurname() . "</a><br />";
else
echo "<strong>Encadrant :</strong> " . $encadrant->getFirstName() . " " . $encadrant->getSurname() . "<br />";
}
for ($i = 1; $i <= 5; ++$i) {
if ($team->getParticipants()[$i - 1] == NULL)
continue;
$participant = User::fromId($team->getParticipants()[$i - 1]);
$id = $participant->getId();
if ($_SESSION["role"] == Role::ADMIN)
echo "<strong>Participant $i :</strong> <a href=\"$URL_BASE/informations/$id/" . $participant->getFirstName()
. " " . $participant->getSurname() . "\">" . $participant->getFirstName() . " " . $participant->getSurname() . "</a><br />";
else
echo "<strong>Participant $i :</strong> " . $participant->getFirstName() . " " . $participant->getSurname() . "<br />";
}
?>
</div>
<div class="alert alert-info">
Code d'accès : <strong><?= $team->getAccessCode() ?></strong>
</div>
<div class="alert alert-info">
<!--suppress HtmlUnknownTarget -->
<strong>Autorise Animath à diffuser mes vidéos à la fin du tournoi :</strong>
<?= $team->allowPublish() ? "oui" : "non" ?> (<a href="/mon-equipe/diffusion-videos">changer</a>)
</div>
<?php if (date("Y-m-d H:i:s") >= $CONFIG->getInscriptionDate() && $team->getValidationStatus() == ValidationStatus::NOT_READY) { ?>
<div class="alert alert-danger">
La date limite d'inscription est dépassée, vous ne pouvez plus demander la validation de votre équipe.
</div>
<?php } else {
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="problem">Problème :</label>
<select id="problem" name="problem" class="custom-select">
<option value="0">Choisir un problème (peut être choisi plus tard)</option>
<?php
for ($i = 1; $i <= 4; ++$i)
echo "<option value='$i' " . ($team->getProblem() == $i ? "selected" : "") . ">$i</option>";
?>
</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 } else { ?>
<?php if ($team->getValidationStatus() == ValidationStatus::NOT_READY && date("Y-m-d H:i:s") <= $CONFIG->getInscriptionDate()) { ?>
<!--suppress HtmlUnknownTarget -->
<a href="/mon-equipe/modifier">
<button class="btn btn-secondary btn-lg btn-block">Modifier mon équipe</button>
</a>
<?php } ?>
<?php if ($team->getValidationStatus() == ValidationStatus::NOT_READY) { ?>
<hr/>
<form method="POST">
<input class="btn btn-primary btn-lg btn-block" type="submit" name="leave_team" style="background-color: #ff2e34"
value="Quitter l'équipe"/>
</form>
<?php
$can_validate = canValidate($team);
if ($can_validate) { ?>
<hr />
<form method="post">
<label for="engage">Je m'engage à participer à l'intégralité des Correspondances</label>
<input type="checkbox" name="engage" id="engage"/>
<input class="btn btn-primary btn-lg btn-block" type="submit" name="request_validation"
value="Demander la validation"/>
</form>
<?php } ?>
<?php }
elseif ($team->getValidationStatus() == ValidationStatus::WAITING) { ?>
<div class="alert alert-warning">
Votre équipe est en attente de validation.
</div>
<?php } ?>
<?php } ?>
<?php } ?>
<?php require_once "footer.php" ?>