diff --git a/Project/php/controller/TeacherController.php b/Project/php/controller/TeacherController.php index 6885de1..e333e35 100755 --- a/Project/php/controller/TeacherController.php +++ b/Project/php/controller/TeacherController.php @@ -56,6 +56,8 @@ class TeacherController extends UserController 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 extends UserController } 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/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(); 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