312 lines
13 KiB
PHP
312 lines
13 KiB
PHP
<?php
|
|
require_once "header.php";
|
|
?>
|
|
|
|
<div class="mt-4 mb-4">
|
|
<h1 class="display-4">Mon équipe</h1>
|
|
</div>
|
|
|
|
<?php if (!$has_error && isset($send_document)) { ?>
|
|
<div class="alert alert-success">
|
|
Le fichier a été correctement envoyé !
|
|
</div>
|
|
<?php } ?>
|
|
|
|
<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() ?></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 -->
|
|
Autorise Animath à diffuser mes vidéos : <?= $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"
|
|
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">
|
|
<?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 } ?>
|
|
<hr/><div class="mt-4 mb-4">
|
|
<h1 class="display-5">Autorisation de droit à l'image</h1>
|
|
</div>
|
|
<?php
|
|
printDocuments($documents);
|
|
|
|
if ($team->getValidationStatus() == ValidationStatus::NOT_READY) { ?>
|
|
<form method="POST" enctype="multipart/form-data">
|
|
|
|
<div class="form-row">
|
|
<div class="form-group col-md-12">
|
|
<label for="document">Fichier :</label>
|
|
<input class="form-control" type="file" id="document" name="document" required/>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group row">
|
|
<input class="btn btn-primary btn-lg btn-block" type="submit" name="send_document"
|
|
value="Envoyer le document"/>
|
|
</div>
|
|
</form>
|
|
|
|
<hr/>
|
|
|
|
<form method="POST">
|
|
<input class="btn btn-primary btn-lg btn-block" type="submit" name="leave_team"
|
|
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 class="form-control" 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 } elseif (Phase::getCurrentPhase() >= Phase::PHASE1) { ?>
|
|
<hr/>
|
|
<h2>Déroulement du tournoi</h2>
|
|
<?php if ($video != null) { ?>
|
|
<h4>Vidéo de solution proposée :</h4>
|
|
Lien de la vidéo : <a href="<?= $video->getLink() ?>"><?= $video->getLink() ?></a><br/>
|
|
<?php displayVideo($video->getLink()) ?>
|
|
<br/>
|
|
<?php if (Phase::getCurrentPhase() >= Phase::PHASE3) { ?>
|
|
<h4>Questions reçues :</h4>
|
|
<?php
|
|
for ($i = 0; $i < 2; ++$i) {
|
|
if ($questions_received[$i] == null)
|
|
continue;
|
|
$asker = Team::fromId($questions_received[$i][0]->getFrom());
|
|
$answer = Video::getVideo($asker->getVideoTeamIds()[0] == $team->getId() ? Reason::ANSWER1 : Reason::ANSWER2, $asker);
|
|
?>
|
|
<h5>Questions de l'équipe <?= $asker->getName() ?> (<?= $asker->getTrigram() ?>) :</h5>
|
|
<table>
|
|
<tbody>
|
|
<?php
|
|
for ($j = 0; $j < 6; ++$j) {
|
|
/** @var Question $question */
|
|
$question = $questions_received[$i][$j];
|
|
if ($question->getQuestion() === null)
|
|
continue;
|
|
?>
|
|
<tr>
|
|
<td>
|
|
Question <?= $question->getNumber() ?> :
|
|
</td>
|
|
<td>
|
|
<?= $question->getQuestion() ?>
|
|
</td>
|
|
</tr>
|
|
<?php
|
|
if ($question->getAttachedFile() !== null) { ?>
|
|
<tr>
|
|
<td>
|
|
<em>Pièce jointe attachée :</em>
|
|
</td>
|
|
<td>
|
|
<a href="/file/<?= $question->getAttachedFile() ?>">Télécharger</a>
|
|
</td>
|
|
</tr>
|
|
<?php } ?>
|
|
<tr>
|
|
<td>
|
|
Réponse :
|
|
</td>
|
|
<td>
|
|
<?= $question->getAnswer() ?>
|
|
</td>
|
|
</tr>
|
|
<?php
|
|
if ($question->getAttachedFileAnswer() !== null) { ?>
|
|
<tr>
|
|
<td>
|
|
<em>Pièce jointe attachée :</em>
|
|
</td>
|
|
<td>
|
|
<a href="/file/<?= $question->getAttachedFileAnswer() ?>">Télécharger</a>
|
|
</td>
|
|
</tr>
|
|
<?php } ?>
|
|
<?php } ?>
|
|
</tbody>
|
|
</table>
|
|
<br/>
|
|
<?php if (Phase::getCurrentPhase() >= Phase::PHASE4 && $answer != null) { ?>
|
|
<h6>Vidéo de réponse proposée par l'équipe :</h6>
|
|
Lien de la vidéo : <a href="<?= $answer->getLink() ?>"><?= $answer->getLink() ?></a><br/>
|
|
<?php displayVideo($answer->getLink()) ?>
|
|
<br/>
|
|
<?php } ?>
|
|
<?php } ?>
|
|
<?php } ?>
|
|
|
|
<hr/>
|
|
|
|
<?php
|
|
if (Phase::getCurrentPhase() >= 2) {
|
|
for ($i = 0; $i < 2; ++$i) {
|
|
$defender = Team::fromId($team->getVideoTeamIds()[$i]);
|
|
if ($defender == null)
|
|
continue;
|
|
$sol = Video::getVideo(Reason::SOLUTION, $defender);
|
|
$answer = Video::getVideo($i == 0 ? Reason::ANSWER1 : Reason::ANSWER2, $team);
|
|
$questions = Question::getQuestions($team, $defender);
|
|
?>
|
|
<h4>Vidéo de solution proposée par l'équipe <?= $defender->getName() ?>
|
|
(<?= $defender->getTrigram() ?>) :</h4>
|
|
Lien de la vidéo : <a href="<?= $sol->getLink() ?>"><?= $sol->getLink() ?></a><br/>
|
|
<?php displayVideo($sol->getLink()) ?>
|
|
<br/>
|
|
<h5>Vos questions :</h5>
|
|
<br/>
|
|
<table>
|
|
<tbody>
|
|
<?php
|
|
for ($j = 0; $j < 6; ++$j) {
|
|
/** @var Question $question */
|
|
$question = $questions[$j];
|
|
if ($question->getQuestion() === null)
|
|
continue;
|
|
?>
|
|
<tr>
|
|
<td>
|
|
Question <?= $question->getNumber() ?> :
|
|
</td>
|
|
<td>
|
|
<?= $question->getQuestion() ?>
|
|
</td>
|
|
</tr>
|
|
<?php
|
|
if ($question->getAttachedFile() !== null) { ?>
|
|
<tr>
|
|
<td>
|
|
<em>Pièce jointe attachée :</em>
|
|
</td>
|
|
<td>
|
|
<a href="/file/<?= $question->getAttachedFile() ?>">Télécharger</a>
|
|
</td>
|
|
</tr>
|
|
<?php } ?>
|
|
<?php if (Phase::getCurrentPhase() >= Phase::PHASE3) { ?>
|
|
<tr>
|
|
<td>
|
|
Réponse :
|
|
</td>
|
|
<td>
|
|
<?= $question->getAnswer() ?>
|
|
</td>
|
|
</tr>
|
|
<?php
|
|
if ($question->getAttachedFileAnswer() !== null) { ?>
|
|
<tr>
|
|
<td>
|
|
<em>Pièce jointe attachée :</em>
|
|
</td>
|
|
<td>
|
|
<a href="/file/<?= $question->getAttachedFileAnswer() ?>">Télécharger</a>
|
|
</td>
|
|
</tr>
|
|
<?php } ?>
|
|
<?php } ?>
|
|
<?php } ?>
|
|
</tbody>
|
|
</table>
|
|
<br/>
|
|
<?php if (Phase::getCurrentPhase() >= Phase::PHASE4 && $answer != null) { ?>
|
|
<h5>Votre vidéo de réponse :</h5>
|
|
Lien de la vidéo : <a href="<?= $answer->getLink() ?>"><?= $answer->getLink() ?></a><br/>
|
|
<?php displayVideo($answer->getLink()) ?>
|
|
<hr/>
|
|
<?php } ?>
|
|
<?php } ?>
|
|
<?php } ?>
|
|
<?php } ?>
|
|
<?php } ?>
|
|
<?php } ?>
|
|
<?php } ?>
|
|
|
|
<?php require_once "footer.php" ?>
|