From 9c3c01411784d2dceeeee7b19c432d3ba2b3e65f Mon Sep 17 00:00:00 2001 From: "patrick.brugiere" Date: Sun, 19 Nov 2023 15:34:22 +0100 Subject: [PATCH] avancement du quiz --- Project/php/controller/AbsController.php | 8 ++++ Project/php/controller/FrontController.php | 8 ++++ Project/php/controller/StudentController.php | 20 +++++++++ Project/php/templates/quizContainer.twig | 47 ++++++++++++++++++++ Project/php/templates/userContainer.twig | 0 5 files changed, 83 insertions(+) mode change 100644 => 100755 Project/php/controller/AbsController.php mode change 100644 => 100755 Project/php/templates/userContainer.twig diff --git a/Project/php/controller/AbsController.php b/Project/php/controller/AbsController.php old mode 100644 new mode 100755 index f364ce2..a3c582d --- a/Project/php/controller/AbsController.php +++ b/Project/php/controller/AbsController.php @@ -75,4 +75,12 @@ abstract class AbsController echo $twig->render('memory.html'); } + public function quiz(): void + { + global $twig; + $vocabId = $_GET['vocabID']; + $mdl = new TranslationGateway(); + $allTranslation = $mdl->findByIdVoc($vocabId); + echo $twig->render('quizzView.html', ['translations' => $allTranslation]); + } } \ No newline at end of file diff --git a/Project/php/controller/FrontController.php b/Project/php/controller/FrontController.php index 32b710d..1754329 100755 --- a/Project/php/controller/FrontController.php +++ b/Project/php/controller/FrontController.php @@ -51,6 +51,9 @@ class FrontController case 'disconnect': $this->disconnect(); break; + case 'quiz': + $this->quiz(); + break; default : if ($id != null && !$this->checkIdExist($id)) throw new Exception("identifiant invalide"); @@ -120,5 +123,10 @@ class FrontController $mdl->deconnection(); $this->home(); } + public function quiz(){ + $ctrl = new StudentController(); + $ctrl->quiz(); + } + } \ No newline at end of file diff --git a/Project/php/controller/StudentController.php b/Project/php/controller/StudentController.php index 3bec371..10dc1f6 100755 --- a/Project/php/controller/StudentController.php +++ b/Project/php/controller/StudentController.php @@ -3,6 +3,7 @@ namespace controller; use config\Validation; use model\MdlStudent; +use gateway\TranslationGateway; use Exception; class StudentController @@ -34,4 +35,23 @@ class StudentController $vocab = $mdl->getVocabByName($name); echo $twig->render('manageVocabView.html', ['vocabularies' => $vocab]); } + + public function quiz(): void + { + global $twig; + $vocabId = $_GET['vocabID']; + $mdl = new TranslationGateway(); + $allTranslation = $mdl->findByIdVoc($vocabId); + echo $twig->render('quizzView.html', ['translations' => $allTranslation]); + } + /* + public function flashcard(VocabularyList $v) { + $idVoc = $v->getId(); + $mdl = new TranslationGateway(); + $allTranslation = $mdl->findByIdVoc($idVoc); + while(1) { + + } + } + }*/ } \ No newline at end of file diff --git a/Project/php/templates/quizContainer.twig b/Project/php/templates/quizContainer.twig index 085b974..8a9d371 100755 --- a/Project/php/templates/quizContainer.twig +++ b/Project/php/templates/quizContainer.twig @@ -9,6 +9,53 @@ {{ row.word2 }} {{ row.listVocab }} + + + + + Manage groups + + + +
+

Quiz

+
+ {% if translations is defined %} + {% for translation in translations %} +

{{ translation.word1 }}

+ {% set answers = [translation.word2] %} + {% for i in 0..3 %} + {{ answers[i] }}
+ {% endfor %} + {% endfor %} + {% endif %} + +
+ +

Translator

+
+ {% if translations is defined %} + + + + + + + + {% for translation in translations %} + + + + + + + {% endfor %} +
IDWord 1Word 2List Vocabulary
{{ translation.id }}{{ translation.word1 }}{{ translation.word2 }}{{ translation.listVocab }}
+ {% endif %} +
+
+ + \ No newline at end of file diff --git a/Project/php/templates/userContainer.twig b/Project/php/templates/userContainer.twig old mode 100644 new mode 100755