diff --git a/Project/php/controller/TeacherController.php b/Project/php/controller/TeacherController.php index 5900a5c..26c4cfb 100755 --- a/Project/php/controller/TeacherController.php +++ b/Project/php/controller/TeacherController.php @@ -3,6 +3,7 @@ namespace controller; use config\Validation; use model\MdlTeacher; +use gateway\VocabularyListGateway; use Exception; class TeacherController @@ -20,8 +21,8 @@ class TeacherController { global $twig; $mdl = new MdlTeacher(); - $student = $mdl->getAll(); - echo $twig->render('usersView.html', ['users' => $student]); + $vocabularies = $mdl->getAll(); + echo $twig->render('manageVocabListView.html', ['vocabularies' => $vocabularies]); } public function getByName($name): void @@ -29,7 +30,7 @@ class TeacherController global $twig; $mdl = new MdlTeacher(); $vocab = $mdl->getVocabByName($name); - echo $twig->render('usersView.html', ['users' => $vocab]); + echo $twig->render('usersView.html', ['users' => $vocab, 'selectedName' => $name]); } diff --git a/Project/php/model/MdlTeacher.php b/Project/php/model/MdlTeacher.php index d28f15e..452b54a 100755 --- a/Project/php/model/MdlTeacher.php +++ b/Project/php/model/MdlTeacher.php @@ -16,7 +16,7 @@ class MdlTeacher extends AbsModel } public function getAll():array{ - $gtw = new VocabularyGateway(); + $gtw = new VocabularyListGateway(); return $gtw->findAll(); } @@ -26,13 +26,13 @@ class MdlTeacher extends AbsModel } public function getVocabByName(string $name):array{ - $gtw = new VocabularyGateway(); + $gtw = new VocabularyListGateway(); $res = $gtw->findByName($name); return $res; } public function RemoveVocById(int $id):void{ - $gtw = new VocabularyGateway(); + $gtw = new VocabularyListGateway(); $res = $gtw->remove($id); } diff --git a/Project/php/templates/manageVocabListView.html b/Project/php/templates/manageVocabListView.html index ff505ff..501176b 100755 --- a/Project/php/templates/manageVocabListView.html +++ b/Project/php/templates/manageVocabListView.html @@ -6,25 +6,25 @@
- -
-

Group list

- {% include 'groupContainer.twig' with {'actions' : 'showAllGroup'} %} +
+

Vocab list

+ {% include 'vocabularyContainer.twig' with {'actions' : 'affAllVocab', 'vocabularies' : vocabularies } %}
-

Users of the group

- {% include 'userContainer.twig' with {'users' : teacher, 'action' : 'showAllVocab'} %} +

Vocab of the user

+ {% include 'vocabularyContainer.twig' with {'vocabularies' : vocabularies , 'actions' : 'getByName', 'selectedName' : selectedName } %}
+
-

Add group

+

Add Vocab

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

Unassigned users

- {% include 'userContainer.twig' with {'vocab' : teacher, 'action' : 'getVocabByName'} %} +

Unassigned vocab

+ {% include 'vocabularyContainer.twig' with {'vocabularies' : vocabularies , 'actions' : 'getVocabByName'} %}
- - \ No newline at end of file + diff --git a/Project/php/templates/vocabularyContainer.twig b/Project/php/templates/vocabularyContainer.twig new file mode 100755 index 0000000..e5b2392 --- /dev/null +++ b/Project/php/templates/vocabularyContainer.twig @@ -0,0 +1,34 @@ + + + + + + + + + {% if vocabularies is defined %} + {% for row in vocabularies %} + + + + + + + {% if actions is defined %} + + {% endif %} + + + {% endfor %} + {% endif %} +
IDNameImageAuthor
{{ row.id }}{{ row.name }}{{ row.image }}{{ row.author }} + {% if actions == 'affAllVocab' %} + + + + {% elseif actions == 'getByName' %} + + + + {% endif %} +
\ No newline at end of file