mirror of
				https://gitlab.com/animath/si/plateforme-corres2math.git
				synced 2025-11-04 13:12:20 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			300 lines
		
	
	
		
			12 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			300 lines
		
	
	
		
			12 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
require_once "header.php";
 | 
						|
 | 
						|
if (!$has_error && isset($send_document))
 | 
						|
	echo "<h2>Le fichier a été correctement envoyé !</h2>";
 | 
						|
?>
 | 
						|
 | 
						|
    <h2>Informations sur l'équipe</h2>
 | 
						|
 | 
						|
    Nom de l'équipe : <?= $team->getName() ?><br/>
 | 
						|
    Trigramme : <?= $team->getTrigram() ?><br/>
 | 
						|
    Problème : <a href="/probleme/<?= $team->getProblem() ?>"><?= $team->getProblem() ?></a><br/>
 | 
						|
<?php
 | 
						|
if ($team->getEncadrantId() !== null) {
 | 
						|
	$encadrant = User::fromId($team->getEncadrantId());
 | 
						|
	$id = $encadrant->getId();
 | 
						|
	echo "Encadrant : <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 "Participant $i : <a href=\"$URL_BASE/informations/$id/" . $participant->getFirstName() . " " . $participant->getSurname() . "\">" . $participant->getFirstName() . " " . $participant->getSurname() . "</a><br />";
 | 
						|
}
 | 
						|
 | 
						|
?>
 | 
						|
    Code d'accès : <strong><?= $team->getAccessCode() ?></strong><br/>
 | 
						|
    <!--suppress HtmlUnknownTarget -->
 | 
						|
    Autorise Animath à diffuser mes vidéos : <?= $team->allowPublish() ? "oui" : "non" ?> (<a
 | 
						|
        href="/mon-equipe/diffusion-videos">changer</a>)<br/>
 | 
						|
 | 
						|
<?php if (date("Y-m-d H:i:s") >= $CONFIG->getInscriptionDate() && $team->getValidationStatus() == ValidationStatus::NOT_READY) { ?>
 | 
						|
    <strong>La date limite d'inscription est dépassée, vous ne pouvez plus demander la validation de votre
 | 
						|
        équipe.</strong>
 | 
						|
<?php } else {
 | 
						|
	if (isset($_GET["modifier"])) { ?>
 | 
						|
 | 
						|
        <form method="POST">
 | 
						|
            <input type="hidden" name="team_edit" value="true"/>
 | 
						|
            <table >
 | 
						|
                <tbody>
 | 
						|
                <tr>
 | 
						|
                    <td style="width: 30%;">
 | 
						|
                        <label for="name">Nom :</label>
 | 
						|
                    </td>
 | 
						|
                    <td style="width: 70%;">
 | 
						|
                        <input type="text" id="name" name="name" value="<?= $team->getName() ?>"/>
 | 
						|
                    </td>
 | 
						|
                </tr>
 | 
						|
                <tr>
 | 
						|
                    <td>
 | 
						|
                        <label for="trigram">Trigramme :</label>
 | 
						|
                    </td>
 | 
						|
                    <td>
 | 
						|
                        <input type="text" id="trigram" name="trigram"
 | 
						|
                               value="<?= $team->getTrigram() ?>"/>
 | 
						|
                    </td>
 | 
						|
                </tr>
 | 
						|
                <tr>
 | 
						|
                    <td>
 | 
						|
                        <label for="problem">Problème :</label>
 | 
						|
                    </td>
 | 
						|
                    <td>
 | 
						|
                        <select id="problem" name="problem">
 | 
						|
							<?php
 | 
						|
							for ($i = 1; $i <= 4; ++$i)
 | 
						|
								echo "<option value=\"$i\" " . ($team->getProblem() == $i ? "selected" : "") . ">$i</option>\n";
 | 
						|
							?>
 | 
						|
                        </select>
 | 
						|
                    </td>
 | 
						|
                </tr>
 | 
						|
                <tr>
 | 
						|
                    <td colspan="2">
 | 
						|
                        <input type="submit" value="Modifier l'équipe"/>
 | 
						|
                    </td>
 | 
						|
                </tr>
 | 
						|
                </tbody>
 | 
						|
            </table>
 | 
						|
        </form>
 | 
						|
 | 
						|
	<?php } else { ?>
 | 
						|
 | 
						|
		<?php if ($team->getValidationStatus() == ValidationStatus::NOT_READY && date("Y-m-d H:i:s") <= $CONFIG->getInscriptionDate()) { ?>
 | 
						|
            <!--suppress HtmlUnknownTarget -->
 | 
						|
            <a href="/mon-equipe/modifier">Modifier mon équipe</a>
 | 
						|
		<?php } ?>
 | 
						|
        <hr/>
 | 
						|
        <h2>Autorisation de droit à l'image</h2>
 | 
						|
		<?php
 | 
						|
		printDocuments($documents);
 | 
						|
 | 
						|
		if ($team->getValidationStatus() == ValidationStatus::NOT_READY) { ?>
 | 
						|
            <hr/>
 | 
						|
            <form method="post" enctype="multipart/form-data">
 | 
						|
                <input type="hidden" name="type" value="photo_consent"/>
 | 
						|
                <table >
 | 
						|
                    <tbody>
 | 
						|
                    <tr>
 | 
						|
                        <td>
 | 
						|
                            <label for="file">Fichier :</label>
 | 
						|
                        </td>
 | 
						|
                        <td>
 | 
						|
                            <input type="file" id="file" name="document"/>
 | 
						|
                        </td>
 | 
						|
                    </tr>
 | 
						|
                    <tr>
 | 
						|
                        <td colspan="2">
 | 
						|
                            <input type="submit" name="send_document" value="Envoyer le document"/>
 | 
						|
                        </td>
 | 
						|
                    </tr>
 | 
						|
                    </tbody>
 | 
						|
                </table>
 | 
						|
            </form>
 | 
						|
            <hr/>
 | 
						|
            <table >
 | 
						|
                <tr>
 | 
						|
                    <td style="width: 50%;">
 | 
						|
                        <form method="post">
 | 
						|
                            <input type="submit" name="leave_team" value="Quitter l'équipe"/>
 | 
						|
                        </form>
 | 
						|
                    </td>
 | 
						|
					<?php
 | 
						|
					$can_validate = canValidate($team);
 | 
						|
					if ($can_validate) { ?>
 | 
						|
                        <td style="width: 50%;">
 | 
						|
                            <form method="post">
 | 
						|
                                <input type="checkbox" name="engage" id="engage"/> <label for="engage">Je m'engage à
 | 
						|
                                    participer à l'intégralité des Correspondances</label><br/>
 | 
						|
                                <input type="submit" name="request_validation"
 | 
						|
                                       value="Demander la validation"/>
 | 
						|
                            </form>
 | 
						|
                        </td>
 | 
						|
					<?php } ?>
 | 
						|
                </tr>
 | 
						|
            </table>
 | 
						|
		<?php } else if (Phase::getCurrentPhase() >= Phase::PHASE1) { ?>
 | 
						|
            <hr/>
 | 
						|
            <h2>Déroulement du tournoi</h2>
 | 
						|
			<?php if ($video != null) { ?>
 | 
						|
                <h4>Vidéo de solution proposée :</h4>
 | 
						|
                Lien de la vidéo : <a href="<?= $video->getLink() ?>"><?= $video->getLink() ?></a><br/>
 | 
						|
				<?php displayVideo($video->getLink()) ?>
 | 
						|
                <br/>
 | 
						|
				<?php if (Phase::getCurrentPhase() >= Phase::PHASE3) { ?>
 | 
						|
                    <h4>Questions reçues :</h4>
 | 
						|
					<?php
 | 
						|
					for ($i = 0; $i < 2; ++$i) {
 | 
						|
						if ($questions_received[$i] == null)
 | 
						|
							continue;
 | 
						|
						$asker = Team::fromId($questions_received[$i][0]->getFrom());
 | 
						|
						$answer = Video::getVideo($asker->getVideoTeamIds()[0] == $team->getId() ? Reason::ANSWER1 : Reason::ANSWER2, $asker);
 | 
						|
						?>
 | 
						|
                        <h5>Questions de l'équipe <?= $asker->getName() ?> (<?= $asker->getTrigram() ?>) :</h5>
 | 
						|
                        <table >
 | 
						|
                            <tbody>
 | 
						|
							<?php
 | 
						|
							for ($j = 0; $j < 6; ++$j) {
 | 
						|
								/** @var Question $question */
 | 
						|
								$question = $questions_received[$i][$j];
 | 
						|
								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 } ?>
 | 
						|
							<?php } ?>
 | 
						|
                            </tbody>
 | 
						|
                        </table>
 | 
						|
                        <br/>
 | 
						|
						<?php if (Phase::getCurrentPhase() >= Phase::PHASE4 && $answer != null) { ?>
 | 
						|
                            <h6>Vidéo de réponse proposée par l'équipe :</h6>
 | 
						|
                            Lien de la vidéo : <a href="<?= $answer->getLink() ?>"><?= $answer->getLink() ?></a><br/>
 | 
						|
							<?php displayVideo($answer->getLink()) ?>
 | 
						|
                            <br/>
 | 
						|
						<?php } ?>
 | 
						|
					<?php } ?>
 | 
						|
				<?php } ?>
 | 
						|
 | 
						|
                <hr/>
 | 
						|
 | 
						|
				<?php
 | 
						|
				if (Phase::getCurrentPhase() >= 2) {
 | 
						|
					for ($i = 0; $i < 2; ++$i) {
 | 
						|
						$defender = Team::fromId($team->getVideoTeamIds()[$i]);
 | 
						|
						if ($defender == null)
 | 
						|
							continue;
 | 
						|
						$sol = Video::getVideo(Reason::SOLUTION, $defender);
 | 
						|
						$answer = Video::getVideo($i == 0 ? Reason::ANSWER1 : Reason::ANSWER2, $team);
 | 
						|
						$questions = Question::getQuestions($team, $defender);
 | 
						|
						?>
 | 
						|
                        <h4>Vidéo de solution proposée par l'équipe <?= $defender->getName() ?>
 | 
						|
                            (<?= $defender->getTrigram() ?>) :</h4>
 | 
						|
                        Lien de la vidéo : <a href="<?= $sol->getLink() ?>"><?= $sol->getLink() ?></a><br/>
 | 
						|
						<?php displayVideo($sol->getLink()) ?>
 | 
						|
                        <br/>
 | 
						|
                        <h5>Vos questions :</h5>
 | 
						|
                        <br/>
 | 
						|
                        <table >
 | 
						|
                            <tbody>
 | 
						|
							<?php
 | 
						|
							for ($j = 0; $j < 6; ++$j) {
 | 
						|
								/** @var Question $question */
 | 
						|
								$question = $questions[$j];
 | 
						|
								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 } ?>
 | 
						|
								<?php if (Phase::getCurrentPhase() >= Phase::PHASE3) { ?>
 | 
						|
                                    <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 } ?>
 | 
						|
								<?php } ?>
 | 
						|
							<?php } ?>
 | 
						|
                            </tbody>
 | 
						|
                        </table>
 | 
						|
                        <br/>
 | 
						|
						<?php if (Phase::getCurrentPhase() >= Phase::PHASE4 && $answer != null) { ?>
 | 
						|
                            <h5>Votre vidéo de réponse :</h5>
 | 
						|
                            Lien de la vidéo : <a href="<?= $answer->getLink() ?>"><?= $answer->getLink() ?></a><br/>
 | 
						|
							<?php displayVideo($answer->getLink()) ?>
 | 
						|
                            <hr/>
 | 
						|
						<?php } ?>
 | 
						|
					<?php } ?>
 | 
						|
				<?php } ?>
 | 
						|
			<?php } ?>
 | 
						|
		<?php } ?>
 | 
						|
	<?php } ?>
 | 
						|
<?php } ?>
 | 
						|
 | 
						|
<?php require_once "footer.php" ?>
 |