diff --git a/Project/php/assets/favicon.ico b/Project/php/assets/favicon.ico index 9356735..61db0e4 100755 Binary files a/Project/php/assets/favicon.ico and b/Project/php/assets/favicon.ico differ diff --git a/Project/php/controller/TeacherController.php b/Project/php/controller/TeacherController.php index 95244c1..dac863e 100755 --- a/Project/php/controller/TeacherController.php +++ b/Project/php/controller/TeacherController.php @@ -9,36 +9,14 @@ use model\MdlUser; class TeacherController extends UserController { - public function affAllStudent(): void - { - global $twig; - global $user; - $mdl = new MdlTeacher(); - $student = $mdl->getAllStudent(); - echo $twig->render('usersView.html', ['users' => $student, 'userID' => $user->getId(), 'userRole' => $user->getRoles()]); - - } - public function affAllVocab(): void { global $twig; global $user; - $id = $user->getId(); $mdl = new MdlTeacher(); $vocabularies = $mdl->getAll(); - echo $twig->render('manageVocabListView.html', ['vocabularies' => $vocabularies, 'userID' => $user->getId(), 'userRole' => $user->getRoles()]); - } - - public function getByName(): void - { - global $twig; - global $user; - $mdl = new MdlTeacher(); - $id = $user->getId(); - $name = Validation::filter_str_simple($_GET['listName'] ?? null); - $vocab = $mdl->getVocabByName($name); - echo $twig->render('manageVocabListView.html', ['vocabularies' => $vocab, 'selectedName' => $name, 'userID' => $user->getId(), 'userRole' => $user->getRoles() ]); - + $groups = $mdl->getAllGroups(); + echo $twig->render('manageVocabListView.html', ['vocabularies' => $vocabularies, 'groups' => $groups, 'userID' => $user->getId(), 'userRole' => $user->getRoles()]); } public function DelById():void{ @@ -49,7 +27,15 @@ class TeacherController extends UserController $vocab = $mdl->removeVocById($id); echo $twig->render('manageVocabListView.html', [ 'vocabularies' => $vocab, 'userID' => $user->getId(), 'userRole' => $user->getRoles() ]); } + public function getContent(){ + global $twig; + global $user; + $mdl = new MdlTeacher(); + $name = Validation::filter_str_simple($_GET['vocabID'] ?? null); + $content= $mdl->findByIdVoc($name); + echo $twig->render('manageVocabListView.html', ['content' => $content, 'userID' => $user->getId(), 'userRole' => $user->getRoles() ]); + } public function showVocabListForm(): void { global $twig; global $user; diff --git a/Project/php/model/MdlTeacher.php b/Project/php/model/MdlTeacher.php index dd0d273..992b86a 100755 --- a/Project/php/model/MdlTeacher.php +++ b/Project/php/model/MdlTeacher.php @@ -2,6 +2,7 @@ namespace model; +use gateway\GroupGateway; use gateway\TranslationGateway; use gateway\UserGateway; use gateway\VocabularyGateway; @@ -14,6 +15,11 @@ class MdlTeacher extends MdlUser return $gtw->findAll(); } + public function getAllGroups(): array { + $gtw = new GroupGateway(); + return $gtw->findAll(); + } + public function getAllStudent():array { $gtw = new UserGateway(); return $gtw->findAll(); @@ -24,6 +30,11 @@ class MdlTeacher extends MdlUser $res = $gtw->findByName($name); return $res; } + public function findByIdVoc($id):array { + $gtw = new TranslationGateway(); + return $gtw->findByIdVoc($id); + + } public function RemoveVocById(int $id):void{ $gtw = new VocabularyListGateway(); diff --git a/Project/php/templates/groupContainer.twig b/Project/php/templates/groupContainer.twig index 411f51a..45cb379 100755 --- a/Project/php/templates/groupContainer.twig +++ b/Project/php/templates/groupContainer.twig @@ -35,6 +35,22 @@ {% endif %} + {% if 'removeVocabFromGroup' in actions %} +