1
0
mirror of https://gitlab.com/animath/si/plateforme-corres2math.git synced 2025-06-26 12:47:40 +02:00

Phase 4 & fin des correspondances

This commit is contained in:
galaxyoyo
2019-09-24 00:12:33 +02:00
parent b0ea84c4c0
commit 22c90369e8
15 changed files with 340 additions and 24 deletions

View File

@ -0,0 +1,132 @@
<?php
require_once "header.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);
?>
<h2>Vidéo de l'équipe <?= $answer_team->getName() ?> (<?= $answer_team->getTrigram() ?>) :</h2>
<h5>Lien de la vidéo de présentation de la solution au problème : <a href="<?= $sol->getLink() ?>"><?= $sol->getLink() ?></a></h5>
<?php displayVideo($sol->getLink()) ?>
<h5>Questions échangées :</h5>
<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="<?= $URL_BASE ?>/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="<?= $URL_BASE ?>/file/<?= $question->getAttachedFileAnswer() ?>">Télécharger</a>
</td>
</tr>
<?php } ?>
<?php } ?>
</tbody>
</table>
<br />
<h5>Vidéo de réponse :</h5>
<?php
if ($answer !== null) {
$link = $answer->getLink();
echo "Lien de la vidéo déjà envoyée : <a href=\"$link\">$link</a> (version " . $answer->getVersion() . ")<br />\n";
displayVideo($link);
switch ($answer->getValidation()) {
case 0:
echo "La vidéo n'a pas encore été contrôlée.<br />";
break;
case 1:
echo "La vidéo a été acceptée.<br />";
break;
case -1:
echo "La vidéo a été rejetée.<br />";
break;
}
}
if ($answer_validated != null && $answer_validated->getId() != $answer->getId()) {
$link = $answer_validated->getLink();
echo "<hr />\nLien de la dernière vidéo validée : <a href=\"$link\">$link</a><br />";
displayVideo($link);
}
?>
<form method="POST">
<input type="hidden" name="team" value="<?= $i + 1 ?>" />
<table style="width: 100%;">
<tbody>
<tr>
<td style="width: 30%;">
<label for="link">Lien de la vidéo à soumettre :</label>
</td>
<td style="width: 70%;">
<input style="width: 100%;" type="url" id="link" name="link" />
</td>
</tr>
<tr>
<td style="text-align: center;" colspan="2">
<input type="checkbox" name="valid_link" id="valid_link" required /> <label for="valid_link">Je confirme que le lien est valide</label>
</td>
</tr>
<tr>
<td style="text-align: center;" colspan="2">
<input type="checkbox" name="no_change" id="no_change" required /> <label for="no_change">Je m'engage à ne pas changer le contenu du lien et de la vidéo</label>
</td>
</tr>
<tr>
<td colspan="2">
<input style="width: 100%;" type="submit" name="upload_answer" value="Envoyer la vidéo" />
</td>
</tr>
</tbody>
</table>
</form>
<hr />
<?php
}
require_once "footer.php";

View File

@ -66,6 +66,9 @@
case Phase::PHASE3: ?>
<li><a href="<?= $URL_BASE ?>/repondre-questions-3">Répondre aux questions (phase 3)</a></li>
<?php break;
case Phase::PHASE4: ?>
<li><a href="<?= $URL_BASE ?>/commenter-echange-4">Commenter l'échange (phase 4)</a></li>
<?php break;
}
} ?>
<?php } ?>

View File

@ -26,16 +26,18 @@ for ($problem = 1; $problem <= 4; ++$problem) {
if ($video->getValidation() != Video::ACCEPTED) {
$last_validated_video = Video::getVideo(Reason::SOLUTION, $team, Video::ACCEPTED);
$link = $last_validated_video->getLink();
echo "\nLien de la dernière vidéo validée de cette équipe : <a href=\"$link\">$link</a><br />\n";
displayVideo($link);
if ($last_validated_video !== null) {
$link = $last_validated_video->getLink();
echo "\n<br />\nLien de la dernière vidéo validée de cette équipe : <a href=\"$link\">$link</a><br />\n";
displayVideo($link);
}
}
if (Phase::getCurrentPhase() > Phase::PHASE1) {
/** @var Question[] $from_questions */
foreach (Question::getQuestionsTo($team) as $from_questions) {
$from = Team::fromId($from_questions[0]->getFrom());
echo "<hr />\n<h5>Questions posées par l'équipe " . $from->getName() . " (" . $from->getTrigram() . ") :</h5>\n";
echo "<h5>Questions posées par l'équipe " . $from->getName() . " (" . $from->getTrigram() . ") :</h5>\n";
for ($i = 0; $i < sizeof($from_questions); ++$i) {
$question = $from_questions[$i];
if ($question->getQuestion() == null)
@ -49,6 +51,35 @@ for ($problem = 1; $problem <= 4; ++$problem) {
if ($question->getAttachedFileAnswer() != null)
echo "<em>Pièce jointe attachée pour la réponse :</em> <a href=\"$URL_BASE/file/" . $question->getAttachedFileAnswer() . "\">Télécharger</a><br />\n";
}
echo "<br />\n";
if (Phase::getCurrentPhase() >= Phase::PHASE4) {
$answer = Video::getVideo($from->getVideoTeamIds()[0] == $team->getId() ? Reason::ANSWER1 : Reason::ANSWER2, $from);
$link = $answer->getLink();
$version = $answer->getVersion();
echo "<h5>Vidéo de réponse :</h5>\n";
echo "Lien de la vidéo (version $version) : <a href=\"$link\">$link</a>";
displayVideo($link);
if ($answer->getValidation() == 0) { ?>
<form method="POST">
<input type="hidden" name="validate_video" value="" />
<input type="hidden" name="video_id" value="<?= $answer->getId() ?>" />
<input style="width: 49%;" type="submit" name="accept" value="Accepter la vidéo" />
<input style="width: 49%;" type="submit" name="reject" value="Refuser la vidéo" />
</form>
<?php }
else
echo "<h5>La vidéo a été " . ($answer->getValidation() == 1 ? "acceptée" : "refusée") . ".</h5><br />\n";
if ($answer->getValidation() != Video::ACCEPTED) {
$last_validated_answer = Video::getVideo($from->getVideoTeamIds()[0] == $team->getId() ? Reason::ANSWER1 : Reason::ANSWER2, $team, Video::ACCEPTED);
if ($last_validated_answer !== null) {
$link = $last_validated_answer->getLink();
echo "\n<br />\nLien de la dernière vidéo validée de cette équipe : <a href=\"$link\">$link</a><br />\n";
displayVideo($link);
}
}
}
}
}
}