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.
57 lines
1.7 KiB
57 lines
1.7 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 %}
|
|
{% if randomtranslations is defined %}
|
|
{% set otherTranslations = [correctAnswer] %}
|
|
{% for randomtranslation in randomtranslations %}
|
|
{% if randomtranslation.word2 != correctAnswer and otherTranslations|length <= 3 %}
|
|
{% set otherTranslations = otherTranslations|merge([randomtranslation.word2]) %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
|
|
|
|
|
|
{# Affichage des réponses sous forme de radio buttons #}
|
|
<input type="radio" name="answer" value="{{ correctAnswer }}"> {{ correctAnswer }}<br>
|
|
{% for otherTranslation in otherTranslations %}
|
|
<input type="radio" name="answer" value="{{ otherTranslation }}"> {{ otherTranslation }}<br>
|
|
{% endfor %}
|
|
{% endif %}
|
|
{% 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> |