mirror of
				https://gitlab.com/animath/si/plateforme-corres2math.git
				synced 2025-10-31 10:59:54 +01:00 
			
		
		
		
	Design phase 4
This commit is contained in:
		| @@ -7,10 +7,10 @@ if (!isset($_SESSION["user_id"]) || $_SESSION["role"] != Role::PARTICIPANT && $_ | ||||
| 	require_once "server_files/403.php"; | ||||
|  | ||||
| if (isset($_POST["upload_answer"])) { | ||||
| 	$new_video = new NewAnswer($_POST); | ||||
| 	$new_answer = new NewAnswer($_POST); | ||||
| 	try { | ||||
| 		$new_video->makeVerifications(); | ||||
| 		$new_video->uploadVideo(); | ||||
| 		$new_answer->makeVerifications(); | ||||
| 		$new_answer->uploadVideo(); | ||||
| 	} catch (AssertionError $e) { | ||||
| 		$has_error = true; | ||||
| 		$error_message = $e->getMessage(); | ||||
|   | ||||
| @@ -1,6 +1,18 @@ | ||||
| <?php | ||||
| require_once "header.php"; | ||||
| ?> | ||||
|  | ||||
|     <div class="mt-4 mb-4"> | ||||
|         <h1 class="display-4">Répondre aux questions</h1> | ||||
|     </div> | ||||
|  | ||||
| <?php if (isset($new_answer) && !$has_error) { ?> | ||||
|     <div class="alert alert-success"> | ||||
|         Votre vidéo a bien été envoyée ! | ||||
|     </div> | ||||
| <?php } ?> | ||||
|  | ||||
| <?php | ||||
| for ($i = 0; $i < 2; ++$i) { | ||||
| 	/** @var Team $answer_team */ | ||||
| 	$answer_team = $teams[$i]; | ||||
| @@ -13,13 +25,15 @@ for ($i = 0; $i < 2; ++$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()) ?> | ||||
|     <div class="jumbotron"> | ||||
|         <h2>Vidéo de l'équipe <?= $answer_team->getName() ?> (<?= $answer_team->getTrigram() ?>) :</h2> | ||||
|         <div class="alert alert-info"> | ||||
|             <strong>Lien de la vidéo de présentation de la solution au problème :</strong> | ||||
|             <a href="<?= $sol->getLink() ?>"><?= $sol->getLink() ?></a> | ||||
|         </div> | ||||
| 		<?php displayVideo($sol->getLink()) ?> | ||||
|  | ||||
| 	<h5>Questions échangées :</h5> | ||||
| 	<table > | ||||
| 		<tbody> | ||||
|         <h5>Questions échangées :</h5> | ||||
| 		<?php | ||||
| 		for ($j = 0; $j < 6; ++$j) { | ||||
| 			/** @var Question $question */ | ||||
| @@ -27,105 +41,66 @@ for ($i = 0; $i < 2; ++$i) { | ||||
| 			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="/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="/file/<?= $question->getAttachedFileAnswer() ?>">Télécharger</a> | ||||
| 					</td> | ||||
| 				</tr> | ||||
| 			<?php } ?> | ||||
|             <div class="alert alert-info"> | ||||
|                 <strong>Question <?= $question->getNumber() + 1 ?> :</strong> <?= $question->getQuestion() ?><br /> | ||||
| 				<?php | ||||
| 				if ($question->getAttachedFile() !== null) { ?> | ||||
|                     <em>Pièce jointe attachée :</em> | ||||
|                     <a href="/file/<?= $question->getAttachedFile() ?>"><strong>Télécharger</strong></a><br /> | ||||
| 				<?php } ?> | ||||
|                 <strong>Réponse :</strong> <?= $question->getAnswer() ?><br /> | ||||
| 				<?php | ||||
| 				if ($question->getAttachedFile() !== null) { ?> | ||||
|                     <em>Pièce jointe attachée :</em> | ||||
|                     <a href="/file/<?= $question->getAttachedFileAnswer() ?>"><strong>Télécharger</strong></a><br /> | ||||
| 				<?php } ?> | ||||
|             </div> | ||||
| 		<?php } ?> | ||||
| 		</tbody> | ||||
| 	</table> | ||||
| 	<br /> | ||||
| 	<h5>Vidéo de réponse :</h5> | ||||
|         <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; | ||||
| 		<?php | ||||
| 		if ($answer !== null) { | ||||
| 			$link = $answer->getLink(); | ||||
| 			echo "<div class=\"alert alert-info\"><strong>Lien de la vidéo déjà envoyée :</strong> <a href=\"$link\">$link</a> (version " . $answer->getVersion() . ")</div>\n"; | ||||
| 			displayVideo($link); | ||||
| 			switch ($answer->getValidation()) { | ||||
| 				case 0: | ||||
| 					echo "<div class=\"alert alert-warning\">La vidéo n'a pas encore été contrôlée.</div>"; | ||||
| 					break; | ||||
| 				case 1: | ||||
| 					echo "<div class=\"alert alert-success\">La vidéo a été acceptée.</div>"; | ||||
| 					break; | ||||
| 				case -1: | ||||
| 					echo "<div class=\"alert alert-danger\">La vidéo a été rejetée.</div>"; | ||||
| 					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); | ||||
| 	} | ||||
| 	?> | ||||
| 		if ($answer_validated != null && $answer_validated->getId() != $answer->getId()) { | ||||
| 			$link = $answer_validated->getLink(); | ||||
| 			echo "<hr />\n<div class=\"alert alert-info\">Lien de la dernière vidéo validée : <a href=\"$link\">$link</a></div>\n"; | ||||
| 			displayVideo($link); | ||||
| 		} | ||||
| 		?> | ||||
|  | ||||
| 	<form method="POST"> | ||||
| 		<input type="hidden" name="team" value="<?= $i + 1 ?>" /> | ||||
| 		<table > | ||||
| 			<tbody> | ||||
| 			<tr> | ||||
| 				<td style="width: 30%;"> | ||||
| 					<label for="link">Lien de la vidéo à soumettre :</label> | ||||
| 				</td> | ||||
| 				<td style="width: 70%;"> | ||||
| 					<input 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 type="submit" name="upload_answer" value="Envoyer la vidéo" /> | ||||
| 				</td> | ||||
| 			</tr> | ||||
| 			</tbody> | ||||
| 		</table> | ||||
| 	</form> | ||||
| 	<hr /> | ||||
|         <form method="POST"> | ||||
|             <input type="hidden" name="team" value="<?= $i + 1 ?>"/> | ||||
|             <div class="form-row"> | ||||
|                 <div class="form-group col-md-12"> | ||||
|                     <label for="link_<?= $i ?>">Lien de la vidéo à soumettre :</label> | ||||
|                     <input class="form-control" type="url" id="link_<?= $i ?>" name="link"/> | ||||
|                 </div> | ||||
|             </div> | ||||
|  | ||||
|             <input type="checkbox" name="valid_link" id="valid_link_<?= $i ?>" required/> <label for="valid_link_<?= $i ?>">Je | ||||
|                 confirme que le lien est valide</label><br/> | ||||
|  | ||||
|             <input type="checkbox" name="no_change" id="no_change_<?= $i ?>" required/> <label for="no_change_<?= $i ?>">Je m'engage | ||||
|                 à ne pas changer le contenu du lien et de la vidéo</label> | ||||
|  | ||||
|             <input class="btn btn-primary btn-lg btn-block" type="submit" name="upload_answer" value="Envoyer la vidéo"/> | ||||
|         </form> | ||||
|     </div> | ||||
| 	<?php | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -32,7 +32,7 @@ for ($problem = 1; $problem <= 4; ++$problem) { ?> | ||||
|                     <input class="btn btn-light btn-lg" style="width: 49%;" type="submit" name="reject" | ||||
|                            value="Refuser la vidéo"/> | ||||
|                 </form> | ||||
|                 <br/>a | ||||
|                 <br/> | ||||
| 			<?php } else { ?> | ||||
|                 <div class="alert alert-<?= $video->getValidation() == 1 ? "success" : "danger" ?>"> | ||||
|                     La vidéo a été <?= $video->getValidation() == 1 ? "acceptée" : "refusée" ?>. | ||||
| @@ -75,6 +75,8 @@ for ($problem = 1; $problem <= 4; ++$problem) { ?> | ||||
| 					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"; | ||||
| @@ -85,12 +87,17 @@ for ($problem = 1; $problem <= 4; ++$problem) { ?> | ||||
|                             <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"/> | ||||
|                                 <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> | ||||
| 						<?php } else | ||||
| 							echo "<h5>La vidéo a été " . ($answer->getValidation() == 1 ? "acceptée" : "refusée") . ".</h5><br />\n"; | ||||
|  | ||||
|                             <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) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user