mirror of
				https://gitlab.com/animath/si/plateforme-corres2math.git
				synced 2025-11-04 09:42:13 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			89 lines
		
	
	
		
			4.2 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			89 lines
		
	
	
		
			4.2 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
 | 
						|
require_once "header.php";
 | 
						|
 | 
						|
for ($problem = 1; $problem <= 4; ++$problem) {
 | 
						|
	echo "<h2>Vidéos pour le problème $problem</h2>\n";
 | 
						|
	/** @var Video $video */
 | 
						|
	foreach ($videos[$problem - 1] as $video) {
 | 
						|
		$link = $video->getLink();
 | 
						|
		$team = Team::fromId($video->getTeam());
 | 
						|
		$version = $video->getVersion();
 | 
						|
		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);
 | 
						|
			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 "<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 "Question " . ($i + 1) . " : " . $question->getQuestion() . "<br />\n";
 | 
						|
		            if ($question->getAttachedFile() != null)
 | 
						|
		                echo "<em>Pièce jointe attachée :</em> <a href=\"$URL_BASE/file/" . $question->getAttachedFile() . "\">Télécharger</a><br />\n";
 | 
						|
		            if ($question->getAnswer() != null)
 | 
						|
		                echo "Réponse apportée : " . $question->getAnswer() . "<br />\n";
 | 
						|
					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);
 | 
						|
                        }
 | 
						|
					}
 | 
						|
                }
 | 
						|
            }
 | 
						|
        }
 | 
						|
	}
 | 
						|
	echo "<hr />\n";
 | 
						|
}
 | 
						|
 | 
						|
require_once "footer.php";
 |