From d023a0ca52bc341919ec867d636e9932fa384edc Mon Sep 17 00:00:00 2001 From: "anthony.richard" Date: Mon, 20 Nov 2023 17:14:46 +0100 Subject: [PATCH 1/2] routes --- Project/php/model/MdlAdmin.php | 2 +- Project/php/model/MdlStudent.php | 2 +- Project/php/model/MdlTeacher.php | 2 +- Project/php/model/MdlUser.php | 6 +----- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/Project/php/model/MdlAdmin.php b/Project/php/model/MdlAdmin.php index c37b577..a78a7d4 100755 --- a/Project/php/model/MdlAdmin.php +++ b/Project/php/model/MdlAdmin.php @@ -5,7 +5,7 @@ namespace model; use gateway\GroupGateway; use gateway\UserGateway; -class MdlAdmin extends AbsModel +class MdlAdmin extends MdlUser { public function __construct() { diff --git a/Project/php/model/MdlStudent.php b/Project/php/model/MdlStudent.php index 98bf2fd..4333d12 100755 --- a/Project/php/model/MdlStudent.php +++ b/Project/php/model/MdlStudent.php @@ -6,7 +6,7 @@ use gateway\UserGateway; use gateway\VocabularyGateway; use gateway\VocabularyListGateway; -class MdlStudent extends AbsModel +class MdlStudent extends MdlUser { public function __construct() diff --git a/Project/php/model/MdlTeacher.php b/Project/php/model/MdlTeacher.php index 5fc3a4b..2ee07b0 100755 --- a/Project/php/model/MdlTeacher.php +++ b/Project/php/model/MdlTeacher.php @@ -7,7 +7,7 @@ use gateway\UserGateway; use gateway\VocabularyGateway; use gateway\VocabularyListGateway; -class MdlTeacher extends AbsModel +class MdlTeacher extends MdlUser { public function __construct() diff --git a/Project/php/model/MdlUser.php b/Project/php/model/MdlUser.php index 294f1fd..6d95345 100755 --- a/Project/php/model/MdlUser.php +++ b/Project/php/model/MdlUser.php @@ -4,11 +4,7 @@ namespace model; use gateway\UserGateway; -public class MdlUser extends AbsModel { - public function getUser(int $id): User{ - $gtw = new UserGateway(); - return $gtw->findById($id); - } +class MdlUser extends AbsModel { public function modifyNickname(int $id, string $newNickname): void{ $gtw = new UserGateway(); From 31572ccfb6fadf011fff758c22ce92a64fc3fb60 Mon Sep 17 00:00:00 2001 From: "patrick.brugiere" Date: Mon, 20 Nov 2023 17:22:07 +0100 Subject: [PATCH 2/2] modification de la view --- Project/php/controller/TeacherController.php | 4 +++- .../php/templates/manageVocabListView.html | 4 ++-- .../php/templates/vocabularyContainer.twig | 19 ++++++++++++++++--- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/Project/php/controller/TeacherController.php b/Project/php/controller/TeacherController.php index b0a06ba..de30673 100755 --- a/Project/php/controller/TeacherController.php +++ b/Project/php/controller/TeacherController.php @@ -56,6 +56,8 @@ class TeacherController public function addVocabList():void { global $twig; + global $user; + $id = $user->getId(); $mdl = new MdlTeacher(); $userID = Validation::filter_int($_GET['userID'] ?? null); $name = Validation::filter_str_simple($_GET['listName'] ?? null); @@ -67,6 +69,6 @@ class TeacherController } var_dump($words); $mdl->addVocabList($userID, $name, "", $words); - echo $twig->render('addVocabList.html'); + echo $twig->render('addVocabList.html', [ 'userId' => $id ]); } } \ No newline at end of file diff --git a/Project/php/templates/manageVocabListView.html b/Project/php/templates/manageVocabListView.html index 9e668f6..b5e5820 100755 --- a/Project/php/templates/manageVocabListView.html +++ b/Project/php/templates/manageVocabListView.html @@ -17,8 +17,8 @@
-

Add Vocab

- {% include 'addGroupForm.twig' %} +

Add Vocabb

+ {% include 'vocabularyContainer.twig' with { 'actions' : 'addVocabList' , 'userId' : userId } %}
diff --git a/Project/php/templates/vocabularyContainer.twig b/Project/php/templates/vocabularyContainer.twig index 3e3c453..cff1799 100755 --- a/Project/php/templates/vocabularyContainer.twig +++ b/Project/php/templates/vocabularyContainer.twig @@ -21,17 +21,30 @@ {% elseif actions == 'getByName' %} - + {% elseif actions == 'delById' %} {% endif %} - {% endif %} + {% endfor %} + {% if actions == 'addVocabList' %} + + + + + + + + + + + {% endif %} + - {% endfor %} + {% endif %} \ No newline at end of file