1
0
mirror of https://gitlab.com/animath/si/plateforme-corres2math.git synced 2025-03-16 09:27:31 +00:00

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

View File

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