You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sae_2a_anglais/Project/php/templates/quizzView.html

48 lines
1.5 KiB

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Manage groups</title><!-- Vos liens de styles et de scripts -->
</head>
<body>
<section>
<h1>Quiz</h1>
{% if translations is defined %}
{% for translation in translations %}
<h2>{{ translation.word1 }}</h2>
{% set correctAnswer = translation.word2 %}
{% set otherTranslations = [translation.word2, translations[0].word2, translations[1].word2, translations[2].word2] %}
<input type="radio" name="answer" value="{{ correctAnswer }}"> {{ correctAnswer }}<br>
{% for otherTranslation in otherTranslations %}
{% if otherTranslation != correctAnswer %}
<input type="radio" name="answer" value="{{ otherAnswer }}"> {{ otherAnswer }}<br>
{% endif %}
{% endfor %}
{% endfor %}
{% endif %}
<input type="submit" value="Submit" name="submitForm">
</form>
{% if submitted %}
{% if isCorrect %}
<p>Correct answer!</p>
{% else %}
<p>Wrong answer!</p>
{% endif %}
{% endif %}
</section>
<h1>Translator</h1>
<form action="quiz" method="POST">
{% if translations is defined %}
{% for translation in translations %}
<label for="wordInput{{ translation.id }}">Traduire {{ translation.word1 }}</label>
<input type="text" id="wordInput{{ translation.id }}" name="wordInput{{ translation.id }}">
<input type="hidden" name="vocabID" value="{{ translation.listVocab }}">
<button type="submit">Translate</button>
{% endfor %}
{% endif %}
</form>
</section>
</body>
</html>