Récapitulatif de tout le tournoi dans l'onglet "Mon équipe"

This commit is contained in:
galaxyoyo 2019-09-24 10:42:20 +02:00
parent 32e47f73f3
commit 6f9fddd7a8
2 changed files with 174 additions and 7 deletions

View File

@ -45,6 +45,10 @@ if (isset($_POST["request_validation"])) {
$_SESSION["team"]->setValidationStatus(ValidationStatus::WAITING);
}
$documents = [];
/** @var Question[][] $questions_received */
$questions_received = [];
if (isset($_SESSION["user_id"]) && isset($_SESSION["team"]) && $_SESSION["team"] !== null) {
/**
* @var User $user
@ -54,6 +58,8 @@ if (isset($_SESSION["user_id"]) && isset($_SESSION["team"]) && $_SESSION["team"]
$team = $_SESSION["team"];
$documents = $user->getAllDocuments($team->getProblem());
$video = Video::getVideo(Reason::SOLUTION, $team);
$questions_received = Question::getQuestionsTo($team);
}
else
require_once "server_files/403.php";

View File

@ -25,12 +25,14 @@ for ($i = 1; $i <= 5; ++$i) {
}
?>
Code d'accès : <strong><?= $team->getAccessCode() ?></strong><br />
Code d'accès : <strong><?= $team->getAccessCode() ?></strong><br/>
<!--suppress HtmlUnknownTarget -->
Autorise Animath à diffuser mes vidéos : <?= $team->allowPublish() ? "oui" : "non" ?> (<a href="/mon-equipe/diffusion-videos">changer</a>)<br />
Autorise Animath à diffuser mes vidéos : <?= $team->allowPublish() ? "oui" : "non" ?> (<a
href="/mon-equipe/diffusion-videos">changer</a>)<br/>
<?php if (date("Y-m-d H:i:s") >= $CONFIG->getInscriptionDate() && $team->getValidationStatus() == ValidationStatus::NOT_READY) { ?>
<strong>La date limite d'inscription est dépassée, vous ne pouvez plus demander la validation de votre équipe.</strong>
<strong>La date limite d'inscription est dépassée, vous ne pouvez plus demander la validation de votre
équipe.</strong>
<?php } else {
if (isset($_GET["modifier"])) { ?>
@ -110,8 +112,6 @@ for ($i = 1; $i <= 5; ++$i) {
</tbody>
</table>
</form>
<?php } ?>
<?php if ($team->getValidationStatus() == ValidationStatus::NOT_READY) { ?>
<hr/>
<table style="width: 100%;">
<tr>
@ -125,13 +125,174 @@ for ($i = 1; $i <= 5; ++$i) {
if ($can_validate) { ?>
<td style="width: 50%;">
<form method="post">
<input type="checkbox" name="engage" id="engage" /> <label for="engage">Je m'engage à participer à l'intégralité des Correspondances</label><br />
<input style="width: 100%;" type="submit" name="request_validation" value="Demander la validation"/>
<input type="checkbox" name="engage" id="engage"/> <label for="engage">Je m'engage à
participer à l'intégralité des Correspondances</label><br/>
<input style="width: 100%;" type="submit" name="request_validation"
value="Demander la validation"/>
</form>
</td>
<?php } ?>
</tr>
</table>
<?php } else if (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 style="width: 100%;">
<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 style="width: 100%;">
<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 } ?>