1
0
mirror of https://gitlab.com/animath/si/plateforme-corres2math.git synced 2025-01-06 00:22:21 +00:00

"Vidéos solutions" => "Suivi tournoi"

This commit is contained in:
Yohann 2019-09-30 15:24:39 +02:00
parent e8340f2d2e
commit a2d602cd9e
5 changed files with 127 additions and 120 deletions

View File

@ -54,7 +54,7 @@ $ROUTES["^probleme/([1-4])/?$"] = ["server_files/controllers/probleme.php", "pro
$ROUTES["^profils-orphelins/?$"] = ["server_files/controllers/profils_orphelins.php"];
$ROUTES["^rejoindre-equipe/?$"] = ["server_files/controllers/rejoindre_equipe.php"];
$ROUTES["^repondre-questions-3$"] = ["server_files/controllers/repondre_questions.php"];
$ROUTES["^videos-solutions/?$"] = ["server_files/controllers/videos_solutions.php"];
$ROUTES["^suivi-tournoi/?$"] = ["server_files/controllers/suivi_tournoi.php"];
# Assets files

View File

@ -53,4 +53,4 @@ for ($problem = 1; $problem <= 4; ++$problem)
$videos[] = Video::getVideos(Reason::SOLUTION, $problem);
require_once "server_files/views/videos_solutions.php";
require_once "server_files/views/suivi_tournoi.php";

View File

@ -85,7 +85,7 @@
<a class="nav-link" href="/ajouter-admin">Ajouter un administrateur</a>
</li>
<li class="nav-item active">
<a class="nav-link" href="/videos-solutions">Vidéos des solutions</a>
<a class="nav-link" href="/suivi-tournoi">Suivi du tournoi</a>
</li>
<?php } ?>
<?php } ?>

View File

@ -0,0 +1,124 @@
<?php
require_once "header.php";
?>
<div class="mt-4 mb-4">
<h1 class="display-4">Suivi du tournoi</h1>
</div>
<hr />
<?php
for ($problem = 1; $problem <= 4; ++$problem) { ?>
<div class="mt-4 mb-4">
<h1 class="display-5">Vidéos pour le problème <?= $problem ?></h1>
</div>
<?php
/** @var Video $video */
foreach ($videos[$problem - 1] as $video) {
$link = $video->getLink();
$team = Team::fromId($video->getTeam());
$version = $video->getVersion();
?>
<div class="jumbotron" id="team-<?= $team->getTrigram() ?>">
<h2>
Équipe « <?= $team->getName() ?> » (<?= $team->getTrigram() ?>)
</h2>
<div class="alert alert-info">
<strong>Lien de la vidéo (version <?= $version ?>) :</strong> <a href="<?= $link ?>"><?= $link ?></a>
</div>
<?php
displayVideo($link);
if ($video->getValidation() == 0) { ?>
<form method="POST">
<input type="hidden" name="validate_video" value=""/>
<input type="hidden" name="video_id" value="<?= $video->getId() ?>"/>
<input class="btn btn-primary btn-lg" style="width: 49%;" type="submit" name="accept"
value="Accepter la vidéo"/>
<input class="btn btn-light btn-lg" style="width: 49%;" type="submit" name="reject"
value="Refuser la vidéo"/>
</form>
<br/>
<?php } else { ?>
<div class="alert alert-<?= $video->getValidation() == 1 ? "success" : "danger" ?>">
La vidéo a été <?= $video->getValidation() == 1 ? "acceptée" : "refusée" ?>.
</div>
<?php }
if ($video->getValidation() != Video::ACCEPTED) {
$last_validated_video = Video::getVideo(Reason::SOLUTION, $team, Video::ACCEPTED);
if ($last_validated_video !== null) {
$link = $last_validated_video->getLink(); ?>
<div class="alert alert-info">
<strong>Lien de la vidéo validée de cette équipe (version <?= $version ?>) :</strong>
<a href="<?= $link ?>"><?= $link ?></a>
</div>
<?php
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 "<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)
continue;
echo "<div class=\"alert alert-info\">\n";
echo "<strong>Question " . ($i + 1) . " :</strong> " . $question->getQuestion() . "<br />\n";
if ($question->getAttachedFile() != null)
echo "<em>Pièce jointe attachée :</em> <a href=\"/file/" . $question->getAttachedFile() . "\"><strong>Télécharger</strong></a><br />\n";
if ($question->getAnswer() != null)
echo "<strong>Réponse apportée :</strong> " . $question->getAnswer() . "<br />\n";
if ($question->getAttachedFileAnswer() != null)
echo "<em>Pièce jointe attachée pour la réponse :</em> <a href=\"/file/" . $question->getAttachedFileAnswer() . "\"><strong>Télécharger</strong></a><br />\n";
echo "</div>\n";
}
echo "<br />\n";
if (Phase::getCurrentPhase() >= Phase::PHASE4) {
$answer = Video::getVideo($from->getVideoTeamIds()[0] == $team->getId() ? Reason::ANSWER1 : Reason::ANSWER2, $from);
if ($answer == null)
continue;
$link = $answer->getLink();
$version = $answer->getVersion();
echo "<h5>Vidéo de réponse :</h5>\n";
echo "<strong>Lien de la vidéo (version $version) :</strong> <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 class="btn btn-primary btn-lg" style="width: 49%;" type="submit" name="accept"
value="Accepter la vidéo"/>
<input class="btn btn-light btn-lg" style="width: 49%;" type="submit" name="reject"
value="Refuser la vidéo"/>
</form>
<br />
<?php } else { ?>
<div class="alert alert-<?= $answer->getValidation() == 1 ? "success" : "danger" ?>">
La vidéo a été <?= $answer->getValidation() == 1 ? "acceptée" : "refusée" ?>.
</div>
<?php }
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 />\n<strong>Lien de la dernière vidéo validée de cette équipe :</strong> <a href=\"$link\">$link</a><br />\n";
displayVideo($link);
}
}
}
}
} ?>
</div>
<?php }
echo "<hr />\n";
}
require_once "footer.php";

View File

@ -1,117 +0,0 @@
<?php
require_once "header.php";
for ($problem = 1; $problem <= 4; ++$problem) { ?>
<div class="mt-4 mb-4">
<h1 class="display-4">Vidéos pour le problème <?= $problem ?></h1>
</div>
<?php
/** @var Video $video */
foreach ($videos[$problem - 1] as $video) {
$link = $video->getLink();
$team = Team::fromId($video->getTeam());
$version = $video->getVersion();
?>
<div class="jumbotron" id="team-<?= $team->getTrigram() ?>">
<h2>
Équipe « <?= $team->getName() ?> » (<?= $team->getTrigram() ?>)
</h2>
<div class="alert alert-info">
<strong>Lien de la vidéo (version <?= $version ?>) :</strong> <a href="<?= $link ?>"><?= $link ?></a>
</div>
<?php
displayVideo($link);
if ($video->getValidation() == 0) { ?>
<form method="POST">
<input type="hidden" name="validate_video" value=""/>
<input type="hidden" name="video_id" value="<?= $video->getId() ?>"/>
<input class="btn btn-primary btn-lg" style="width: 49%;" type="submit" name="accept"
value="Accepter la vidéo"/>
<input class="btn btn-light btn-lg" style="width: 49%;" type="submit" name="reject"
value="Refuser la vidéo"/>
</form>
<br/>
<?php } else { ?>
<div class="alert alert-<?= $video->getValidation() == 1 ? "success" : "danger" ?>">
La vidéo a été <?= $video->getValidation() == 1 ? "acceptée" : "refusée" ?>.
</div>
<?php }
if ($video->getValidation() != Video::ACCEPTED) {
$last_validated_video = Video::getVideo(Reason::SOLUTION, $team, Video::ACCEPTED);
if ($last_validated_video !== null) {
$link = $last_validated_video->getLink(); ?>
<div class="alert alert-info">
<strong>Lien de la vidéo validée de cette équipe (version <?= $version ?>) :</strong>
<a href="<?= $link ?>"><?= $link ?></a>
</div>
<?php
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 "<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)
continue;
echo "<div class=\"alert alert-info\">\n";
echo "<strong>Question " . ($i + 1) . " :</strong> " . $question->getQuestion() . "<br />\n";
if ($question->getAttachedFile() != null)
echo "<em>Pièce jointe attachée :</em> <a href=\"/file/" . $question->getAttachedFile() . "\"><strong>Télécharger</strong></a><br />\n";
if ($question->getAnswer() != null)
echo "<strong>Réponse apportée :</strong> " . $question->getAnswer() . "<br />\n";
if ($question->getAttachedFileAnswer() != null)
echo "<em>Pièce jointe attachée pour la réponse :</em> <a href=\"/file/" . $question->getAttachedFileAnswer() . "\"><strong>Télécharger</strong></a><br />\n";
echo "</div>\n";
}
echo "<br />\n";
if (Phase::getCurrentPhase() >= Phase::PHASE4) {
$answer = Video::getVideo($from->getVideoTeamIds()[0] == $team->getId() ? Reason::ANSWER1 : Reason::ANSWER2, $from);
if ($answer == null)
continue;
$link = $answer->getLink();
$version = $answer->getVersion();
echo "<h5>Vidéo de réponse :</h5>\n";
echo "<strong>Lien de la vidéo (version $version) :</strong> <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 class="btn btn-primary btn-lg" style="width: 49%;" type="submit" name="accept"
value="Accepter la vidéo"/>
<input class="btn btn-light btn-lg" style="width: 49%;" type="submit" name="reject"
value="Refuser la vidéo"/>
</form>
<br />
<?php } else { ?>
<div class="alert alert-<?= $answer->getValidation() == 1 ? "success" : "danger" ?>">
La vidéo a été <?= $answer->getValidation() == 1 ? "acceptée" : "refusée" ?>.
</div>
<?php }
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 />\n<strong>Lien de la dernière vidéo validée de cette équipe :</strong> <a href=\"$link\">$link</a><br />\n";
displayVideo($link);
}
}
}
}
} ?>
</div>
<?php }
echo "<hr />\n";
}
require_once "footer.php";