Les admins ne verront plus les questions par défaut

This commit is contained in:
Yohann 2020-01-14 11:29:15 +01:00
parent 0d0d82a878
commit a5ef81ae24
1 changed files with 108 additions and 92 deletions

View File

@ -9,21 +9,25 @@ require_once "header.php";
<?php
if (sizeof($waiting_teams) > 0) { ?>
<div class="alert alert-warning">
<?= sizeof($waiting_teams) == 1 ? "L'équipe suivante n'a" : "Les équipes suivantes n'ont" ?> pas encore
participé à la phase en cours :
<?= sizeof($waiting_teams) == 1 ? "L'équipe suivante n'a" : "Les équipes suivantes n'ont" ?> pas encore participé à la phase en cours, ou leurs vidéos n'ont pas encore été validées :
<ul>
<?php
foreach ($waiting_teams as $team) { ?>
<?php
foreach ($waiting_teams as $team) { ?>
<li>
<a href="#team-<?= $team->getTrigram() ?>">
Équipe <?= $team->getName() ?> (<?= $team->getTrigram() ?>), problème <?= $team->getProblem() ?>
</a>
</li>
<?php } ?>
<?php } ?>
</ul>
<a href="mailto:contact@correspondances-maths.fr?<? foreach ($waiting_emails as $email) echo "bcc=" . $email . "&" ?>subject=Correspondances de Jeunes Mathématicien·ne·s" target="_blank">Leur envoyer un mail</a>
<a href="mailto:contact@correspondances-maths.fr?<? foreach ($waiting_emails as $email) echo "bcc=" . $email . "&" ?>subject=Correspondances de Jeunes Mathématicien·ne·s"
target="_blank">Leur envoyer un mail</a>
</div>
<?php } ?>
<hr/>
<a href="mailto:contact@correspondances-maths.fr?<? foreach ($all_emails as $email) echo "bcc=" . $email . "&" ?>subject=Correspondances de Jeunes Mathématicien·ne·s" target="_blank">
<button class="btn btn-block btn-primary">Envoyer un mail à tous les participants</button>
</a>
@ -35,13 +39,13 @@ 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();
?>
<?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>
<a style="color: black" href="/equipe/<?= $team->getTrigram() ?>">Équipe « <?= $team->getName() ?> » (<?= $team->getTrigram() ?>)</a>
@ -49,10 +53,10 @@ for ($problem = 1; $problem <= 4; ++$problem) { ?>
<div class="alert alert-info">
<strong>Lien de la vidéo (version <?= $version ?>) :</strong> <a href="<?= $link ?>"><?= $link ?></a>
</div>
<?php
displayVideo($link);
<?php
displayVideo($link);
if ($video->getValidation() <= 0) { ?>
if ($video->getValidation() <= 0) { ?>
<form method="POST">
<input type="hidden" name="validate_video" value=""/>
<input type="hidden" name="video_id" value="<?= $video->getId() ?>"/>
@ -62,103 +66,115 @@ for ($problem = 1; $problem <= 4; ++$problem) { ?>
<textarea class="form-control" id="message" name="message"></textarea>
</div>
<input class="btn btn-primary btn-lg" style="width: <?= $video->getValidation() == 0 ? 49 : 100 ?>%;" type="submit" name="accept"
<input class="btn btn-primary btn-lg"
style="width: <?= $video->getValidation() == 0 ? 49 : 100 ?>%;" type="submit" name="accept"
value="Accepter la vidéo"/>
<?php if ($video->getValidation() == 0) { ?>
<?php if ($video->getValidation() == 0) { ?>
<input class="btn btn-light btn-lg" style="width: 49%;" type="submit" name="reject"
value="Refuser la vidéo"/>
<?php } ?>
<?php } ?>
</form>
<br/>
<?php }
if ($video->getValidation() != 0) { ?>
<?php }
if ($video->getValidation() != 0) { ?>
<div class="alert alert-<?= $video->getValidation() == 1 ? "success" : "danger" ?>">
La vidéo a été <?= $video->getValidation() == 1 ? "acceptée" : "refusée" ?>.
</div>
<?php }
<?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(); ?>
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);
}
}
<?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 ($i > 0 && $question->getQuestion() == null)
continue;
if (Phase::getCurrentPhase() > Phase::PHASE1) {
/** @var Question[] $from_questions */
foreach (Question::getQuestionsTo($team) as $from_questions) {
echo "<div class=\"alert alert-info\">\n";
echo "<strong>" . ($i == 0 ? "Remarques générales :" : "Question " . $i . " :") . "</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);
$from = Team::fromId($from_questions[0]->getFrom());
echo "<h5>Questions posées par l'équipe " . $from->getName() . " (" . $from->getTrigram() . ") :</h5>\n";
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>
<?php } else {
for ($i = 0; $i < sizeof($from_questions); ++$i) {
$question = $from_questions[$i];
if ($i > 0 && $question->getQuestion() == null)
continue;
if ($answer->getValidation() == 0) { ?>
<form method="POST">
<input type="hidden" name="validate_video" value=""/>
<input type="hidden" name="video_id" value="<?= $answer->getId() ?>"/>
echo "<div class=\"alert alert-info\">\n";
echo "<strong>" . ($i == 0 ? "Remarques générales :" : "Question " . $i . " :") . "</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);
<div class="form-group row">
<label for="message">Message à adresser à l'équipe :</label>
<textarea class="form-control" id="message" name="message"></textarea>
if ($answer->getValidation() == 0) { ?>
<form method="POST">
<input type="hidden" name="validate_video" value=""/>
<input type="hidden" name="video_id" value="<?= $answer->getId() ?>"/>
<div class="form-group row">
<label for="message">Message à adresser à l'équipe :</label>
<textarea class="form-control" id="message" name="message"></textarea>
</div>
<input class="btn btn-primary btn-lg"
style="width: <?= $answer->getValidation() == 0 ? 49 : 100 ?>%;"
type="submit" name="accept" value="Accepter la vidéo"/>
<?php if ($answer->getValidation() == 0) { ?>
<input class="btn btn-light btn-lg" style="width: 49%;" type="submit"
name="reject"
value="Refuser la vidéo"/>
<?php } ?>
</form>
<br/>
<?php }
if ($answer->getValidation() != 0) { ?>
<div class="alert alert-<?= $answer->getValidation() == 1 ? "success" : "danger" ?>">
La vidéo a été <?= $answer->getValidation() == 1 ? "acceptée" : "refusée" ?>.
</div>
<input class="btn btn-primary btn-lg" style="width: <?= $answer->getValidation() == 0 ? 49 : 100 ?>%;"
type="submit" name="accept" value="Accepter la vidéo"/>
<?php if ($answer->getValidation() == 0) { ?>
<input class="btn btn-light btn-lg" style="width: 49%;" type="submit" name="reject"
value="Refuser la vidéo"/>
<?php } ?>
</form>
<br/>
<?php }
if ($answer->getValidation() != 0) { ?>
<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);
}
}
}
}
} ?>
<?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";
<?php }
echo "<hr />\n";
}
require_once "footer.php";