1
0
mirror of https://gitlab.com/animath/si/plateforme-corres2math.git synced 2025-06-25 13:37:22 +02:00

Flexibilité sur la validation des vidéos accrue

This commit is contained in:
galaxyoyo
2019-09-19 00:31:53 +02:00
parent 1e67b8569d
commit 5372350f46
13 changed files with 289 additions and 17 deletions

View File

@ -12,11 +12,24 @@ elseif (isset($new_video))
if ($video !== null) {
$link = $video->getLink();
echo "Lien de la vidéo déjà envoyée : <a href=\"$link\">$link</a> (version " . $video->getVersion() . ")<br />\n";
if (preg_match("#(https?\://|)(www\.|)youtube\.com\/watch\?v=(.*)#", $link, $matches)) {
$code = $matches[3];
echo "<center><iframe width=\"854px\" height=\"480px\" src=\"https://www.youtube.com/embed/$code\" frameborder=\"0\" allow=\"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe></center><br />\n";
displayVideo($link);
switch ($video->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 ($video_validated != null && $video_validated->getId() != $video->getId()) {
$link = $video_validated->getLink();
echo "<hr />\nLien de la dernière vidéo validée : <a href=\"$link\">$link</a><br />";
displayVideo($link);
}
?>
<form method="POST">
@ -30,6 +43,16 @@ if ($video !== null) {
<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" value="Envoyer la vidéo" />

View File

@ -60,6 +60,9 @@ elseif (isset($my_account) || isset($new_password)) {
<td><textarea style="width: 100%" id="description" name="description"><?= $user->getDescription() ?></textarea></td>
</tr>
<?php } ?>
<tr>
<td style="text-align: center;" colspan="2"><input type="checkbox" id="receive_animath_mails" name="receive_animath_mails" <?= $user->doReceiveAnimathMails() ? "checked" : "" ?> /> <label for="receive_animath_mails">J'accepte de recevoir des mails de la part d'Animath</label></td>
</tr>
<tr>
<td colspan="2"><input type="submit" style="width: 100%" value="Mettre à jour mes données"/></td>
</tr>

View File

@ -2,6 +2,10 @@
require_once "header.php";
if ($has_error) {
echo "<h2>Erreur : $error_message</h2>";
}
for ($problem = 1; $problem <= 4; ++$problem) {
echo "<h2>Vidéos pour le problème $problem</h2>\n";
/** @var Video $video */
@ -9,10 +13,26 @@ for ($problem = 1; $problem <= 4; ++$problem) {
$link = $video->getLink();
$team = Team::fromId($video->getTeam());
$version = $video->getVersion();
echo "Vidéo de présentation de l'équipe « " . $team->getName() . " » (" . $team->getTrigram() . "), version $version : <a href=\"$link\">$link</a>\n";
if (preg_match("#(https?\://|)(www\.|)youtube\.com\/watch\?v=(.*)#", $link, $matches)) {
$code = $matches[3];
echo "<center><iframe width=\"854px\" height=\"480px\" src=\"https://www.youtube.com/embed/$code\" frameborder=\"0\" allow=\"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe></center><br />\n";
echo "<h4>Vidéo de présentation de l'équipe « " . $team->getName() . " » (" . $team->getTrigram() . ") :</h4>\n";
echo "Lien de la vidéo (version $version) : <a href=\"$link\">$link</a>";
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 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é " . ($video->getValidation() == 1 ? "acceptée" : "refusée") . ".</h5><br />\n";
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);
}
}
echo "<hr />\n";