1
0
mirror of https://gitlab.com/animath/si/plateforme-corres2math.git synced 2024-12-26 03:42:20 +00:00
plateforme-corres2math/server_files/views/poser_questions.php
2019-09-27 23:37:12 +02:00

87 lines
3.4 KiB
PHP

<?php
require_once "header.php";
?>
<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]; ?>
<div class="jumbotron">
<h2>Questions pour l'équipe <?= $receiver->getName() ?> (<?= $receiver->getTrigram() ?>) :</h2>
<div class="alert alert-info">
<strong>Lien de la vidéo :</strong> <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];
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 } ?>
<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";