diff --git a/Project/php/controller/AbsController.php b/Project/php/controller/AbsController.php old mode 100644 new mode 100755 index a1c6e27..606567d --- a/Project/php/controller/AbsController.php +++ b/Project/php/controller/AbsController.php @@ -92,4 +92,12 @@ abstract class AbsController throw new Exception("Erreur"); } } + 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 4865e1a..b2597d3 100755 --- a/Project/php/controller/FrontController.php +++ b/Project/php/controller/FrontController.php @@ -55,6 +55,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"); @@ -125,5 +128,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