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