From ea5f419ad0a4daf60584c9292d507d62c8b5170b Mon Sep 17 00:00:00 2001 From: "patrick.brugiere" Date: Mon, 20 Nov 2023 20:59:23 +0100 Subject: [PATCH] =?UTF-8?q?On=20peut=20enfin=20ajouter=20un=20vocabulaire?= =?UTF-8?q?=20=C3=A0=20partir=20de=20la=20vue?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Project/php/controller/TeacherController.php | 14 ++++----- .../php/templates/manageVocabListView.html | 2 +- .../php/templates/vocabularyContainer.twig | 31 ++++++++++++------- 3 files changed, 26 insertions(+), 21 deletions(-) diff --git a/Project/php/controller/TeacherController.php b/Project/php/controller/TeacherController.php index e333e35..fb51a9c 100755 --- a/Project/php/controller/TeacherController.php +++ b/Project/php/controller/TeacherController.php @@ -59,16 +59,14 @@ class TeacherController extends UserController global $user; $id = $user->getId(); $mdl = new MdlTeacher(); - $userID = Validation::filter_int($_GET['userID'] ?? null); $name = Validation::filter_str_simple($_GET['listName'] ?? null); $words = array(); - for ($i = 0; $i <= 1; $i++) { - $frenchWord = Validation::filter_str_simple($_GET['frenchWord'.$i] ?? null); - $englishWord = Validation::filter_str_simple($_GET['englishWord'.$i] ?? null); + $frenchWord = Validation::filter_str_simple($_GET['frenchWord'] ?? null); + $englishWord = Validation::filter_str_simple($_GET['englishWord'] ?? null); $words[] = array($frenchWord, $englishWord); - } - var_dump($words); - $mdl->addVocabList($userID, $name, "", $words); - echo $twig->render('addVocabList.html', [ 'userId' => $id ]); + var_dump($words); + $addvoc= $mdl->addVocabList($id, $name, "", $words); + echo $twig->render('manageVocabListView.html', [ 'vocabularies' => $addvoc ,'userId' => $id]); } + } \ No newline at end of file diff --git a/Project/php/templates/manageVocabListView.html b/Project/php/templates/manageVocabListView.html index 3fe2ddf..474b395 100755 --- a/Project/php/templates/manageVocabListView.html +++ b/Project/php/templates/manageVocabListView.html @@ -38,7 +38,7 @@

Add Vocabb

- {% include 'vocabularyContainer.twig' with { 'actions' : 'addVocabList' , 'userId' : userId } %} + {% include 'vocabularyContainer.twig' with { 'vocabularies' : vocabularies ,'actions' : 'addVocabList' , 'userId' : userId } %}
diff --git a/Project/php/templates/vocabularyContainer.twig b/Project/php/templates/vocabularyContainer.twig index cff1799..571e118 100755 --- a/Project/php/templates/vocabularyContainer.twig +++ b/Project/php/templates/vocabularyContainer.twig @@ -28,20 +28,27 @@ {% endif %} - {% endif %} + {% endif %} {% endfor %} +
+ {% if actions == 'addVocabList' %} - - - - - - - - - - - {% endif %} +
+ +

+ + +

+ + +

+ + +
+ + + {% endif %} +