mirror of
				https://gitlab.com/animath/si/plateforme-corres2math.git
				synced 2025-11-04 00:52:06 +01:00 
			
		
		
		
	Design phases 1 & 2
This commit is contained in:
		@@ -79,9 +79,9 @@ class Question
 | 
			
		||||
				null,
 | 
			
		||||
				null,
 | 
			
		||||
				null];
 | 
			
		||||
			for ($_ = 0; $_ < 6; ++$_) {
 | 
			
		||||
				$req = $DB->prepare("INSERT INTO `questions`(`from`, `to`, `problem`, `question`) VALUES (?, ?, ?, ?);");
 | 
			
		||||
				$req->execute([$from->getId(), $to->getId(), $from->getProblem(), $default_questions[$_]]);
 | 
			
		||||
			for ($i = 0; $i < 6; ++$i) {
 | 
			
		||||
				$req = $DB->prepare("INSERT INTO `questions`(`from`, `to`, `problem`, `number`, `question`) VALUES (?, ?, ?, ?, ?);");
 | 
			
		||||
				$req->execute([$from->getId(), $to->getId(), $from->getProblem(), $i, $default_questions[$i]]);
 | 
			
		||||
			}
 | 
			
		||||
			return self::getQuestions($from, $to);
 | 
			
		||||
		}
 | 
			
		||||
 
 | 
			
		||||
@@ -96,7 +96,7 @@ class Team
 | 
			
		||||
		$this->encadrant = $data["encadrant"];
 | 
			
		||||
		$this->participants = [$data["participant_1"], $data["participant_2"], $data["participant_3"], $data["participant_4"], $data["participant_5"]];
 | 
			
		||||
		$this->inscription_date = $data["inscription_date"];
 | 
			
		||||
		$this->allow_publish = $data["allow_publish"];
 | 
			
		||||
		$this->allow_publish = $data["allow_publish"] ? 1 : 0;
 | 
			
		||||
		$this->validation_status = ValidationStatus::fromName($data["validation_status"]);
 | 
			
		||||
		$this->video_team_ids = [$data["video_team1"], $data["video_team2"]];
 | 
			
		||||
		$this->access_code = $data["access_code"];
 | 
			
		||||
 
 | 
			
		||||
@@ -32,7 +32,7 @@ class NewTeam {
 | 
			
		||||
 | 
			
		||||
		$this->trigram = strtoupper($this->trigram);
 | 
			
		||||
 | 
			
		||||
		$this->allow_publish = $this->allow_publish == "on";
 | 
			
		||||
		$this->allow_publish = $this->allow_publish == "on" ? 1 : 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public function makeVerifications() {
 | 
			
		||||
 
 | 
			
		||||
@@ -18,20 +18,20 @@
 | 
			
		||||
            :</strong> <?= ValidationStatus::getTranslatedName($team->getValidationStatus()) ?>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="alert alert-info">
 | 
			
		||||
        <?php
 | 
			
		||||
        if ($team->getEncadrantId() !== null) {
 | 
			
		||||
            $encadrant = User::fromId($team->getEncadrantId());
 | 
			
		||||
            $id = $encadrant->getId();
 | 
			
		||||
            echo "<strong>Encadrant :</strong> <a href=\"$URL_BASE/informations/$id/" . $encadrant->getFirstName() . " " . $encadrant->getSurname() . "\">" . $encadrant->getFirstName() . " " . $encadrant->getSurname() . "</a><br />";
 | 
			
		||||
        }
 | 
			
		||||
        for ($i = 1; $i <= 5; ++$i) {
 | 
			
		||||
            if ($team->getParticipants()[$i - 1] == NULL)
 | 
			
		||||
                continue;
 | 
			
		||||
            $participant = User::fromId($team->getParticipants()[$i - 1]);
 | 
			
		||||
            $id = $participant->getId();
 | 
			
		||||
            echo "<strong>Participant $i :</strong> <a href=\"$URL_BASE/informations/$id/" . $participant->getFirstName() . " " . $participant->getSurname() . "\">" . $participant->getFirstName() . " " . $participant->getSurname() . "</a><br />";
 | 
			
		||||
        }
 | 
			
		||||
        ?>
 | 
			
		||||
		<?php
 | 
			
		||||
		if ($team->getEncadrantId() !== null) {
 | 
			
		||||
			$encadrant = User::fromId($team->getEncadrantId());
 | 
			
		||||
			$id = $encadrant->getId();
 | 
			
		||||
			echo "<strong>Encadrant :</strong> <a href=\"$URL_BASE/informations/$id/" . $encadrant->getFirstName() . " " . $encadrant->getSurname() . "\">" . $encadrant->getFirstName() . " " . $encadrant->getSurname() . "</a><br />";
 | 
			
		||||
		}
 | 
			
		||||
		for ($i = 1; $i <= 5; ++$i) {
 | 
			
		||||
			if ($team->getParticipants()[$i - 1] == NULL)
 | 
			
		||||
				continue;
 | 
			
		||||
			$participant = User::fromId($team->getParticipants()[$i - 1]);
 | 
			
		||||
			$id = $participant->getId();
 | 
			
		||||
			echo "<strong>Participant $i :</strong> <a href=\"$URL_BASE/informations/$id/" . $participant->getFirstName() . " " . $participant->getSurname() . "\">" . $participant->getFirstName() . " " . $participant->getSurname() . "</a><br />";
 | 
			
		||||
		}
 | 
			
		||||
		?>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="alert alert-info">
 | 
			
		||||
        <strong>Autorise Animath à diffuser les vidéos :</strong> <?= $team->allowPublish() ? "oui" : "non" ?>
 | 
			
		||||
@@ -40,32 +40,36 @@
 | 
			
		||||
<?php
 | 
			
		||||
if ($_SESSION["role"] == Role::ADMIN) { ?>
 | 
			
		||||
    <hr/>
 | 
			
		||||
    <form method="POST">
 | 
			
		||||
        <div class="form-group row">
 | 
			
		||||
            <div class="form-group col-md-12">
 | 
			
		||||
                <label for="other_teams">L'équipe va recevoir les questions des équipes suivantes (merci d'en
 | 
			
		||||
                    sélectionner
 | 
			
		||||
                    exactement 2) :</label>
 | 
			
		||||
                <select class="custom-select" id="other_teams" name="other_teams[]" multiple>
 | 
			
		||||
                    <?php
 | 
			
		||||
                    /** @var Team $other_team */
 | 
			
		||||
                    foreach ($other_teams as $other_team) {
 | 
			
		||||
                        if ($other_team->getId() == $team->getId())
 | 
			
		||||
                            continue;
 | 
			
		||||
	<? if ($team->getValidationStatus() == ValidationStatus::VALIDATED) { ?>
 | 
			
		||||
        <form method="POST">
 | 
			
		||||
            <div class="form-group row">
 | 
			
		||||
                <div class="form-group col-md-12">
 | 
			
		||||
                    <label for="other_teams">L'équipe va recevoir les questions des équipes suivantes (merci d'en
 | 
			
		||||
                        sélectionner
 | 
			
		||||
                        exactement 2) :</label>
 | 
			
		||||
                    <select class="custom-select" id="other_teams" name="other_teams[]" multiple <?= Phase::getCurrentPhase() >= Phase::PHASE2 ? "disable" : "" ?>>
 | 
			
		||||
						<?php
 | 
			
		||||
						/** @var Team $other_team */
 | 
			
		||||
						foreach ($other_teams as $other_team) {
 | 
			
		||||
							if ($other_team->getId() == $team->getId())
 | 
			
		||||
								continue;
 | 
			
		||||
 | 
			
		||||
                        $team_name = $other_team->getName() . " (" . $other_team->getTrigram() . ")";
 | 
			
		||||
                        $team_id = $other_team->getId();
 | 
			
		||||
                        echo "<option value=\"$team_id\" " . (in_array($other_team->getId(), $team->getVideoTeamIds()) ? "selected" : "") . ">$team_name</option>\n";
 | 
			
		||||
                    }
 | 
			
		||||
                    ?>
 | 
			
		||||
                </select>
 | 
			
		||||
							$team_name = $other_team->getName() . " (" . $other_team->getTrigram() . ")";
 | 
			
		||||
							$team_id = $other_team->getId();
 | 
			
		||||
							echo "<option value=\"$team_id\" " . (in_array($other_team->getId(), $team->getVideoTeamIds()) ? "selected" : "") . ">$team_name</option>\n";
 | 
			
		||||
						}
 | 
			
		||||
						?>
 | 
			
		||||
                    </select>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="form-group row">
 | 
			
		||||
            <input type="submit" class="btn btn-secondary btn-lg btn-block" name="update_video_teams"
 | 
			
		||||
                   value="Mettre à jour"/>
 | 
			
		||||
        </div>
 | 
			
		||||
    </form>
 | 
			
		||||
            <div class="form-group row">
 | 
			
		||||
                <?php if (Phase::getCurrentPhase() < Phase::PHASE2) { ?>
 | 
			
		||||
                    <input type="submit" class="btn btn-secondary btn-lg btn-block" name="update_video_teams"
 | 
			
		||||
                           value="Mettre à jour"/>
 | 
			
		||||
                <?php } ?>
 | 
			
		||||
            </div>
 | 
			
		||||
        </form>
 | 
			
		||||
	<?php } ?>
 | 
			
		||||
<?php } ?>
 | 
			
		||||
 | 
			
		||||
    <hr/>
 | 
			
		||||
@@ -84,12 +88,13 @@ if ($_SESSION["role"] == Role::ADMIN) { ?>
 | 
			
		||||
    <form method="POST">
 | 
			
		||||
        <div class="form-group">
 | 
			
		||||
            <div class="form-group row col-mod-6">
 | 
			
		||||
                <input type="submit" class="btn btn-secondary btn-lg btn-block" name="unvalidate" value="Refuser l'équipe"/>
 | 
			
		||||
                <input type="submit" class="btn btn-secondary btn-lg btn-block" name="unvalidate"
 | 
			
		||||
                       value="Refuser l'équipe"/>
 | 
			
		||||
                <input type="submit" class="btn btn-primary btn-lg btn-block" name="validate" value="Valider l'équipe"/>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
    </form>
 | 
			
		||||
    <?php
 | 
			
		||||
	<?php
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
require_once "footer.php" ?>
 | 
			
		||||
@@ -2,66 +2,86 @@
 | 
			
		||||
require_once "header.php";
 | 
			
		||||
?>
 | 
			
		||||
 | 
			
		||||
<h1>Veuillez toujours enregistrer votre travail ailleurs que sur la plateforme !</h1>
 | 
			
		||||
<hr />
 | 
			
		||||
    <div class="mt-4 mb-4">
 | 
			
		||||
        <h1 class="display-4">Poser des questions</h1>
 | 
			
		||||
    </div>
 | 
			
		||||
 | 
			
		||||
<?php
 | 
			
		||||
if (isset($give_questions) && !$has_error) { ?>
 | 
			
		||||
    <div class="alert alert-success">
 | 
			
		||||
        Vos questions ont bien été mises à jour !
 | 
			
		||||
    </div>
 | 
			
		||||
<?php } ?>
 | 
			
		||||
 | 
			
		||||
    <div class="alert alert-warning">
 | 
			
		||||
        <h1>Veuillez toujours enregistrer votre travail ailleurs que sur la plateforme !</h1>
 | 
			
		||||
    </div>
 | 
			
		||||
 | 
			
		||||
<?php
 | 
			
		||||
for ($i = 0; $i < 2; ++$i) {
 | 
			
		||||
	$receiver = $receivers[$i];
 | 
			
		||||
	$video = $videos[$i]; ?>
 | 
			
		||||
    <h2>Questions pour l'équipe <?= $receiver->getName() ?> (<?= $receiver->getTrigram() ?>) :</h2>
 | 
			
		||||
    Lien de la vidéo : <a href="<?= $video->getLink() ?>"><?= $video->getLink() ?></a><br/>
 | 
			
		||||
	<?php displayVideo($video->getLink()) ?>
 | 
			
		||||
    <br/>
 | 
			
		||||
    <form method="POST" enctype="multipart/form-data">
 | 
			
		||||
        <input type="hidden" name="to" value="<?= $receiver->getTrigram() ?>"/>
 | 
			
		||||
        <table >
 | 
			
		||||
            <tbody>
 | 
			
		||||
    <div class="jumbotron">
 | 
			
		||||
        <h2>Questions pour l'équipe <?= $receiver->getName() ?> (<?= $receiver->getTrigram() ?>) :</h2>
 | 
			
		||||
        <div class="alert alert-info">
 | 
			
		||||
            Lien de la vidéo : <a href="<?= $video->getLink() ?>"><?= $video->getLink() ?></a>
 | 
			
		||||
        </div>
 | 
			
		||||
		<?php displayVideo($video->getLink()) ?>
 | 
			
		||||
        <br/>
 | 
			
		||||
        <form method="POST" enctype="multipart/form-data">
 | 
			
		||||
            <input type="hidden" name="to" value="<?= $receiver->getTrigram() ?>"/>
 | 
			
		||||
 | 
			
		||||
			<?php
 | 
			
		||||
			for ($j = 0; $j < 6; ++$j) {
 | 
			
		||||
			    $question = $questions[$i][$j]; ?>
 | 
			
		||||
				<tr>
 | 
			
		||||
					<td style="width: 30%;">
 | 
			
		||||
						<label for="question_<?= $j + 1 ?>">Question <?= $j + 1 ?> <?= $j >= 3 ? "(<em>facultatif</em>)" : "" ?> :</label>
 | 
			
		||||
					</td>
 | 
			
		||||
					<td style="width: 70%;">
 | 
			
		||||
						<textarea id="question_<?= $j + 1 ?>" name="question_<?= $j + 1 ?>"><?= $question->getQuestion() ?></textarea>
 | 
			
		||||
					</td>
 | 
			
		||||
				</tr>
 | 
			
		||||
				<?php
 | 
			
		||||
				if ($question->getAttachedFile() != null) { ?>
 | 
			
		||||
                    <tr>
 | 
			
		||||
                        <td>
 | 
			
		||||
                            Pièce jointe :
 | 
			
		||||
                        </td>
 | 
			
		||||
                        <td>
 | 
			
		||||
                            <a href=/file/<?= $question->getAttachedFile() ?>">Télécharger</a>
 | 
			
		||||
                        </td>
 | 
			
		||||
                    </tr>
 | 
			
		||||
				<?php } ?>
 | 
			
		||||
                <tr>
 | 
			
		||||
                    <td>
 | 
			
		||||
                        <label for="file_<?= $j + 1 ?>">Ajouter une pièce jointe (<em>facultatif</em>) :</label>
 | 
			
		||||
                    </td>
 | 
			
		||||
                    <td>
 | 
			
		||||
                        <input type="file" name="file_<?= $j + 1 ?>" id="file_<?= $j + 1 ?>" />
 | 
			
		||||
                    </td>
 | 
			
		||||
                </tr>
 | 
			
		||||
				$question = $questions[$i][$j];
 | 
			
		||||
 | 
			
		||||
				if ($question->getQuestion() == null && $j) { ?>
 | 
			
		||||
                    <a id="button_<?= $i ?>_<?= $j ?>" class="btn btn-secondary btn-lg btn-block"
 | 
			
		||||
                       style="display: <?= $j == 0 || $questions[$i][$j - 1]->getQuestion() != null ? "block" : "none" ?>"
 | 
			
		||||
                       onclick="addQuestion(<?= $i ?>, <?= $j ?>)">Ajouter une question</a>
 | 
			
		||||
                    <br/>
 | 
			
		||||
					<?php
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				?>
 | 
			
		||||
                <div id="block_<?= $i ?>_<?= $j ?>" style="display: <?= $question->getQuestion() == null ? "none" : "block" ?>;">
 | 
			
		||||
                    <div class="form-group-row">
 | 
			
		||||
                        <label for="question_<?= $j + 1 ?>_<?= $i ?>">Question <?= $j + 1 ?> :</label>
 | 
			
		||||
                        <textarea class="form-control" id="question_<?= $j + 1 ?>_<?= $i ?>"
 | 
			
		||||
                                  name="question_<?= $j + 1 ?>"><?= $question->getQuestion() ?></textarea>
 | 
			
		||||
                    </div>
 | 
			
		||||
 | 
			
		||||
					<?php
 | 
			
		||||
					if ($question->getAttachedFile() != null) { ?>
 | 
			
		||||
                        <br/>
 | 
			
		||||
                        <div class="alert alert-info">
 | 
			
		||||
                            Pièce jointe : <a href="/file/<?= $question->getAttachedFile() ?>">Télécharger</a>
 | 
			
		||||
                        </div>
 | 
			
		||||
					<?php } ?>
 | 
			
		||||
 | 
			
		||||
                    <div class="form-group-row">
 | 
			
		||||
                        <label for="file_<?= $j + 1 ?>_<?= $i ?>">Ajouter une pièce jointe (<em>facultatif</em>)
 | 
			
		||||
                            :</label>
 | 
			
		||||
                        <input type="file" name="file_<?= $j + 1 ?>" id="file_<?= $j + 1 ?>"/>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
 | 
			
		||||
			<?php } ?>
 | 
			
		||||
            <tr>
 | 
			
		||||
                <td style="text-align: center" colspan="2">
 | 
			
		||||
                    <input type="checkbox" name="no_drawing" id="no_drawing" /> <label for="no_drawing">Je confirme que mes pièces jointes ne contiennent pas de texte.</label>
 | 
			
		||||
                </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
			<tr>
 | 
			
		||||
				<td colspan="2">
 | 
			
		||||
					<input type="submit" name="give_questions" value="Poser les questions" />
 | 
			
		||||
				</td>
 | 
			
		||||
			</tr>
 | 
			
		||||
            </tbody>
 | 
			
		||||
        </table>
 | 
			
		||||
    </form>
 | 
			
		||||
    <hr/>
 | 
			
		||||
 | 
			
		||||
            <input type="checkbox" name="no_drawing" id="no_drawing_<?= $i ?>"/> <label for="no_drawing_<?= $i ?>">Je
 | 
			
		||||
                confirme que mes pièces jointes ne contiennent pas de texte.</label>
 | 
			
		||||
            <input class="btn btn-primary btn-lg btn-block" type="submit" name="give_questions"
 | 
			
		||||
                   value="Poser les questions"/>
 | 
			
		||||
        </form>
 | 
			
		||||
    </div>
 | 
			
		||||
 | 
			
		||||
    <script>
 | 
			
		||||
        function addQuestion(i, j) {
 | 
			
		||||
            document.getElementById("button_" + i + "_" + j).style.display = "none";
 | 
			
		||||
            document.getElementById("block_" + i + "_" + j).style.display = "block";
 | 
			
		||||
            document.getElementById("button_" + i + "_" + (j + 1)).style.display = "block";
 | 
			
		||||
        }
 | 
			
		||||
    </script>
 | 
			
		||||
<?php }
 | 
			
		||||
 | 
			
		||||
require_once "footer.php";
 | 
			
		||||
@@ -2,87 +2,108 @@
 | 
			
		||||
 | 
			
		||||
require_once "header.php";
 | 
			
		||||
 | 
			
		||||
for ($problem = 1; $problem <= 4; ++$problem) {
 | 
			
		||||
	echo "<h2>Vidéos pour le problème $problem</h2>\n";
 | 
			
		||||
for ($problem = 1; $problem <= 4; ++$problem) { ?>
 | 
			
		||||
    <div class="mt-4 mb-4">
 | 
			
		||||
        <h1 class="display-4">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();
 | 
			
		||||
		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);
 | 
			
		||||
		?>
 | 
			
		||||
        <div class="jumbotron">
 | 
			
		||||
            <h2>
 | 
			
		||||
                Équipe « <?= $team->getName() ?> » (<?= $team->getTrigram() ?>)
 | 
			
		||||
            </h2>
 | 
			
		||||
            <div class="alert alert-info">
 | 
			
		||||
                Lien de la vidéo (version <?= $version ?>) : <a href="<?= $link ?>"><?= $link ?></a>
 | 
			
		||||
            </div>
 | 
			
		||||
			<?php
 | 
			
		||||
			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() == 0) { ?>
 | 
			
		||||
                <form method="POST">
 | 
			
		||||
                    <input type="hidden" name="validate_video" value=""/>
 | 
			
		||||
                    <input type="hidden" name="video_id" value="<?= $video->getId() ?>"/>
 | 
			
		||||
                    <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>
 | 
			
		||||
                <br/>a
 | 
			
		||||
			<?php } else { ?>
 | 
			
		||||
                <div class="alert alert-<?= $video->getValidation() == 1 ? "success" : "danger" ?>">
 | 
			
		||||
                    La vidéo a été <?= $video->getValidation() == 1 ? "acceptée" : "refusée" ?>.
 | 
			
		||||
                </div>
 | 
			
		||||
			<?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();
 | 
			
		||||
				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=\"/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=\"/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>";
 | 
			
		||||
			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">
 | 
			
		||||
                        Lien de la vidéo validée de cette équipe (version <?= $version ?>) : <a
 | 
			
		||||
                                href="<?= $link ?>"><?= $link ?></a>
 | 
			
		||||
                    </div>
 | 
			
		||||
					<?php
 | 
			
		||||
					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 (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;
 | 
			
		||||
 | 
			
		||||
					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 "<div class=\"alert alert-info\">\n";
 | 
			
		||||
						echo "<strong>Question " . ($i + 1) . " :</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);
 | 
			
		||||
						$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);
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			} ?>
 | 
			
		||||
        </div>
 | 
			
		||||
	<?php }
 | 
			
		||||
	echo "<hr />\n";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user