Affichage pour les équipes qui n'ont pas de réponse à fournir

This commit is contained in:
Yohann 2020-01-20 12:16:49 +01:00
parent 0dd0f8461b
commit 72f8637fb2
3 changed files with 118 additions and 100 deletions

View File

@ -25,75 +25,83 @@ require_once "header.php";
<?php
for ($i = 0; $i < 2; ++$i) {
/** @var Team $answer_team */
$answer_team = $teams[$i];
/** @var Video $sol */
$sol = $sols[$i];
/** @var Video $answer */
$answer = $answers[$i];
/** @var Video $answer_validated */
$answer_validated = $answers_validated[$i];
/** @var Question[] $questions */
$questions = Question::getQuestions($team, $answer_team);
?>
/** @var Team $answer_team */
$answer_team = $teams[$i];
/** @var Video $sol */
$sol = $sols[$i];
/** @var Video $answer */
$answer = $answers[$i];
/** @var Video $answer_validated */
$answer_validated = $answers_validated[$i];
/** @var Question[] $questions */
$questions = Question::getQuestions($team, $answer_team);
?>
<div class="jumbotron">
<h2>Vidéo de l'équipe <?= $answer_team->getName() ?> (<?= $answer_team->getTrigram() ?>) :</h2>
<div class="alert alert-info">
<strong>Lien de la vidéo de présentation de la solution au problème :</strong>
<a href="<?= $sol->getLink() ?>"><?= $sol->getLink() ?></a>
</div>
<?php displayVideo($sol->getLink()) ?>
<h2>Vidéo de l'équipe <?= $answer_team->getName() ?> (<?= $answer_team->getTrigram() ?>) :</h2>
<div class="alert alert-info">
<strong>Lien de la vidéo de présentation de la solution au problème :</strong>
<a href="<?= $sol->getLink() ?>"><?= $sol->getLink() ?></a>
</div>
<?php displayVideo($sol->getLink()) ?>
<h5>Questions échangées :</h5>
<?php
for ($j = 0; $j <= 6; ++$j) {
/** @var Question $question */
$question = $questions[$j];
if ($j > 0 && $question->getQuestion() === null)
continue;
?>
<h5>Questions échangées :</h5>
<?php
if (!strcmp($questions[1]->getQuestion(), Question::DEFAULT_QUESTIONS[0])
&& !strcmp($questions[2]->getQuestion(), Question::DEFAULT_QUESTIONS[1])
&& !strcmp($questions[3]->getQuestion(), Question::DEFAULT_QUESTIONS[2])) { ?>
<div class="alert alert-danger">
L'équipe n'a malheureusement transmis aucune question. Vous n'avez donc pas de réponse à donner.
</div>
<?php } else {
for ($j = 0; $j <= 6; ++$j) {
/** @var Question $question */
$question = $questions[$j];
if ($j > 0 && $question->getQuestion() === null)
continue;
?>
<div class="alert alert-info">
<strong><?= $j == 0 ? "Remarques générales :" : "Question " . $question->getNumber() . " :" ?></strong>
<?= $question->getQuestion() ?><br/>
<?php
if ($question->getAttachedFile() !== null) { ?>
<?= $question->getQuestion() ?><br/>
<?php
if ($question->getAttachedFile() !== null) { ?>
<em>Pièce jointe attachée :</em>
<a href="/file/<?= $question->getAttachedFile() ?>"><strong>Télécharger</strong></a><br/>
<?php } ?>
<?php } ?>
<strong>Réponse :</strong> <?= $question->getAnswer() ?><br/>
<?php
if ($question->getAttachedFileAnswer() !== null) { ?>
<?php
if ($question->getAttachedFileAnswer() !== null) { ?>
<em>Pièce jointe attachée :</em>
<a href="/file/<?= $question->getAttachedFileAnswer() ?>"><strong>Télécharger</strong></a><br/>
<?php } ?>
<?php } ?>
</div>
<?php } ?>
<?php } ?>
<br/>
<h5>Vidéo de réponse :</h5>
<?php
if ($answer !== null) {
$link = $answer->getLink();
echo "<div class=\"alert alert-info\"><strong>Lien de la vidéo déjà envoyée :</strong> <a href=\"$link\">$link</a> (version " . $answer->getVersion() . ")</div>\n";
displayVideo($link);
switch ($answer->getValidation()) {
case 0:
echo "<div class=\"alert alert-warning\">La vidéo n'a pas encore été vérifiée par l'équipe d'organisation.</div>";
break;
case 1:
echo "<div class=\"alert alert-success\">La vidéo a été acceptée par l'équipe d'organisation.</div>";
break;
case -1:
echo "<div class=\"alert alert-danger\">La vidéo a été rejetée par l'équipe d'organisation.</div>";
break;
}
}
if ($answer_validated != null && $answer_validated->getId() != $answer->getId()) {
$link = $answer_validated->getLink();
echo "<hr />\n<div class=\"alert alert-info\">Lien de la dernière vidéo validée : <a href=\"$link\">$link</a></div>\n";
displayVideo($link);
}
?>
<?php
if ($answer !== null) {
$link = $answer->getLink();
echo "<div class=\"alert alert-info\"><strong>Lien de la vidéo déjà envoyée :</strong> <a href=\"$link\">$link</a> (version " . $answer->getVersion() . ")</div>\n";
displayVideo($link);
switch ($answer->getValidation()) {
case 0:
echo "<div class=\"alert alert-warning\">La vidéo n'a pas encore été vérifiée par l'équipe d'organisation.</div>";
break;
case 1:
echo "<div class=\"alert alert-success\">La vidéo a été acceptée par l'équipe d'organisation.</div>";
break;
case -1:
echo "<div class=\"alert alert-danger\">La vidéo a été rejetée par l'équipe d'organisation.</div>";
break;
}
}
if ($answer_validated != null && $answer_validated->getId() != $answer->getId()) {
$link = $answer_validated->getLink();
echo "<hr />\n<div class=\"alert alert-info\">Lien de la dernière vidéo validée : <a href=\"$link\">$link</a></div>\n";
displayVideo($link);
}
?>
<form method="POST">
<input type="hidden" name="team" value="<?= $i + 1 ?>"/>
@ -115,8 +123,9 @@ for ($i = 0; $i < 2; ++$i) {
<input class="btn btn-primary btn-lg btn-block" type="submit" name="upload_answer"
value="Envoyer la vidéo"/>
</form>
</div>
<?php
</div>
<?php
}
}
require_once "footer.php";

View File

@ -34,50 +34,59 @@ foreach ($questions as $questions_team) {
$from = Team::fromId($questions_team[0]->getFrom());
$remark = $questions_team[0];
echo "<h4>Questions de l'équipe " . $from->getName() . " (" . $from->getTrigram() . ") :</h4>\n";
?>
<form method="POST" enctype="multipart/form-data">
<input type="hidden" name="from" value="<?= $from->getTrigram() ?>"/>
if (!strcmp($questions_team[1]->getQuestion(), Question::DEFAULT_QUESTIONS[0])
&& !strcmp($questions_team[2]->getQuestion(), Question::DEFAULT_QUESTIONS[1])
&& !strcmp($questions_team[3]->getQuestion(), Question::DEFAULT_QUESTIONS[2])) { ?>
<div class="alert alert-danger">
L'équipe n'a malheureusement transmis aucune question. Vous n'avez donc pas de réponse à donner.
</div>
<?php }
else {
?>
<form method="POST" enctype="multipart/form-data">
<input type="hidden" name="from" value="<?= $from->getTrigram() ?>"/>
<?php
for ($i = 0; $i < sizeof($questions_team); ++$i) {
$question = $questions_team[$i];
if ($i > 0 && $question->getQuestion() == null)
continue;
?>
<div class="alert alert-info">
<strong><?= $i == 0 ? "Remarques générales :" : "Question " . $question->getNumber() . " :" ?></strong>
<?= $question->getQuestion() ?><br/>
<?php
if ($question->getAttachedFile() != null) { ?>
Pièce jointe :
<a href="/file/<?= $question->getAttachedFile() ?>"><strong>Télécharger</strong></a><br/>
<?php } ?>
<div class="form-group row">
<div class="form-group col-md-12">
<label for="answer_<?= $i ?>"><strong>Réponse :</strong></label>
<textarea class="form-control" id="answer_<?= $i ?>"
name="answer_<?= $i ?>"><?= $question->getAnswer() ?></textarea>
<?php
for ($i = 0; $i < sizeof($questions_team); ++$i) {
$question = $questions_team[$i];
if ($i > 0 && $question->getQuestion() == null)
continue;
?>
<div class="alert alert-info">
<strong><?= $i == 0 ? "Remarques générales :" : "Question " . $question->getNumber() . " :" ?></strong>
<?= $question->getQuestion() ?><br/>
<?php
if ($question->getAttachedFile() != null) { ?>
Pièce jointe :
<a href="/file/<?= $question->getAttachedFile() ?>"><strong>Télécharger</strong></a><br/>
<?php } ?>
<div class="form-group row">
<div class="form-group col-md-12">
<label for="answer_<?= $i ?>"><strong>Réponse :</strong></label>
<textarea class="form-control" id="answer_<?= $i ?>"
name="answer_<?= $i ?>"><?= $question->getAnswer() ?></textarea>
</div>
</div>
<?php
if ($question->getAttachedFileAnswer() != null) { ?>
Pièce jointe :
<a href="/file/<?= $question->getAttachedFileAnswer() ?>"><strong>Télécharger</strong></a>
<?php } ?>
<div class="form-group row">
<div class="form-group col-md-12">
<label for="file_<?= $i ?>">Ajouter une pièce jointe (<em>facultatif</em>) :</label>
<input type="file" name="file_<?= $i ?>" id="file_<?= $i ?>"/>
</div>
</div>
</div>
<?php
if ($question->getAttachedFileAnswer() != null) { ?>
Pièce jointe :
<a href="/file/<?= $question->getAttachedFileAnswer() ?>"><strong>Télécharger</strong></a>
<?php } ?>
<div class="form-group row">
<div class="form-group col-md-12">
<label for="file_<?= $i ?>">Ajouter une pièce jointe (<em>facultatif</em>) :</label>
<input type="file" name="file_<?= $i ?>" id="file_<?= $i ?>"/>
</div>
</div>
</div>
<?php } ?>
<input type="checkbox" name="no_drawing" id="no_drawing_<?= $from->getTrigram() ?>"/> <label for="no_drawing_<?= $from->getTrigram() ?>">Je confirme que mes
pièces jointes ne contiennent pas de texte.</label>
<?php } ?>
<input type="checkbox" name="no_drawing" id="no_drawing_<?= $from->getTrigram() ?>"/> <label for="no_drawing_<?= $from->getTrigram() ?>">Je confirme que mes
pièces jointes ne contiennent pas de texte.</label>
<input class="btn btn-primary btn-lg btn-block" type="submit" name="answer" value="Répondre aux questions posées"/>
</form>
<hr />
<input class="btn btn-primary btn-lg btn-block" type="submit" name="answer" value="Répondre aux questions posées"/>
</form>
<hr />
<?php } ?>
<?php } ?>
<?php

View File

@ -104,8 +104,8 @@ for ($problem = 1; $problem <= 4; ++$problem) { ?>
if (!strcmp($from_questions[1]->getQuestion(), Question::DEFAULT_QUESTIONS[0])
&& !strcmp($from_questions[2]->getQuestion(), Question::DEFAULT_QUESTIONS[1])
&& !strcmp($from_questions[3]->getQuestion(), Question::DEFAULT_QUESTIONS[2])) { ?>
<div class="alert alert-warning">
Cette équipe n'a pas encore envoyé ses questions.
<div class="alert alert-<?= Phase::getCurrentPhase() == Phase::PHASE2 ? "warning" : "danger" ?>">
Cette équipe n'a pas <?= Phase::getCurrentPhase() == Phase::PHASE2 ? "encore" : "" ?> envoyé ses questions.
</div>
<?php } else {
for ($i = 0; $i < sizeof($from_questions); ++$i) {