diff --git a/src/Controleur/UserControler.php b/src/Controleur/UserControler.php index 2c437e9..32c58a3 100644 --- a/src/Controleur/UserControler.php +++ b/src/Controleur/UserControler.php @@ -142,10 +142,12 @@ class UserControler { $gw = new QuizGateway($co); $mdl = new QuizModel($gw); - + $nbQuestion = $this->getNumberOfQuestion($id_quiz); if ($mdl->getQuiz($id_quiz + 1)){ + $next = true; require_once $vues['endQuiz']; } + $next = false; require_once $vues['endQuiz']; } @@ -195,6 +197,7 @@ class UserControler { $q = $this->GetQuestion($id); $question = $q[$num] ?? $q[0]; $idquestion = $question->getIdQuestion(); + $nbQuestion = $this->getNumberOfQuestion($id); require_once $vues['quiz']; //echo $twig->render('quiz.html.twig', ['question' => $question,'id'=>$idquestion]); diff --git a/vue/endQuiz.php b/vue/endQuiz.php index 8d4d68c..2c09dee 100644 --- a/vue/endQuiz.php +++ b/vue/endQuiz.php @@ -12,7 +12,11 @@ echo $twig->render('head.html.twig', [ // Rendu du bandeau echo $twig->render('bandeau.html.twig'); -echo $twig->render('endQuiz.html.twig', ['score' => $score, 'nextquiz' => $id_quiz + 1]) +echo $twig->render('endQuiz.html.twig', + ['score' => $score, + 'isNextQuiz' => $next, + 'nextquiz' => $id_quiz + 1, + 'nb' => $nbQuestion]); ?> diff --git a/vue/quiz.php b/vue/quiz.php index cb0514c..e0cfbb2 100644 --- a/vue/quiz.php +++ b/vue/quiz.php @@ -12,6 +12,11 @@ echo $twig->render('head.html.twig', [ // Rendu du bandeau echo $twig->render('bandeau.html.twig'); -echo $twig->render('quiz.html.twig', ['idQuiz'=>$id , 'question' => $question,'id'=>$idquestion]); +echo $twig->render('quiz.html.twig', [ + 'idQuiz'=>$id , + 'question' => $question, + 'id'=>$idquestion, + 'nb' => $num + 1, + 'nbFinal' => $nbQuestion]); ?> diff --git a/vue/templates/endQuiz.html.twig b/vue/templates/endQuiz.html.twig index c0dd01a..3944b2e 100644 --- a/vue/templates/endQuiz.html.twig +++ b/vue/templates/endQuiz.html.twig @@ -1,10 +1,13 @@

Résultat

nombre de réponse juste : {{ score }}

-

nombre de réponse fausse : {{ 10 - score }}

- - - +

nombre de réponse fausse : {{ nb - score }}

+

pourcentage de réusite : {{ (100 * score) / nb }}%

+ {% if nextquiz %} + + + + {% endif %}

diff --git a/vue/templates/profil.html.twig b/vue/templates/profil.html.twig index ae4a1ee..f6d4fa9 100644 --- a/vue/templates/profil.html.twig +++ b/vue/templates/profil.html.twig @@ -26,7 +26,7 @@
- Ajouter une citation + Ajouter une citation
diff --git a/vue/templates/quiz.html.twig b/vue/templates/quiz.html.twig index 72531de..8615c60 100644 --- a/vue/templates/quiz.html.twig +++ b/vue/templates/quiz.html.twig @@ -1,7 +1,6 @@

Quiz

{{ question.question }}

- 10 seconds left ..
@@ -20,6 +19,7 @@
+ {{ nb }}/{{ nbFinal }}