<?php
require_once "header.php";
?>

<h1>Veuillez toujours enregistrer votre travail ailleurs que sur la plateforme !</h1>
<hr />

<?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 style="width: 100%;">
            <tbody>
			<?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 style="width: 100%;" 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="<?= $URL_BASE . "/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 style="width: 100%;" type="file" name="file_<?= $j + 1 ?>" id="file_<?= $j + 1 ?>" />
                    </td>
                </tr>
			<?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 style="width: 100%;" type="submit" name="give_questions" value="Poser les questions" />
				</td>
			</tr>
            </tbody>
        </table>
    </form>
    <hr/>
<?php }

require_once "footer.php";