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 %} + + + + + + {% endif %} + + {% if 'addVocabToGroup' in actions %} + + + + + + {% endif %} + {% endif %} {% endfor %} diff --git a/Project/php/templates/home.html b/Project/php/templates/home.html index 0562ede..38284a5 100755 --- a/Project/php/templates/home.html +++ b/Project/php/templates/home.html @@ -7,10 +7,8 @@ In English Please! - - - - + +
Copyright © SegWave
- - - - \ No newline at end of file diff --git a/Project/php/templates/manageVocabListView.html b/Project/php/templates/manageVocabListView.html index c46d76c..2092693 100755 --- a/Project/php/templates/manageVocabListView.html +++ b/Project/php/templates/manageVocabListView.html @@ -29,17 +29,30 @@

My lists

- {% include 'vocabularyContainer.twig' with {'actions' : ['affContent', 'delById'], 'vocabularies' : vocabularies } %} + {% include 'vocabularyContainer.twig' with {'actions' : ['affContent', 'delById', 'getContent' ], 'vocabularies' : vocabularies, 'vocabID' : vocabID, 'content' : content } %}

Content

{% if content is defined %} + + + + + + {% for trad in content %} + + + + + {% endfor %} +
French wordEnglish word
trad.word1trad.word2
{% endif %} - //for ou ça affiche chaque traduction french - english [remove]

Groups

- //la liste des groupes [ajouter] ou [retirer] + {% if groups is defined %} + {% include 'groupContainer.twig' with {'actions' : ['addVocabToGroup', 'removeVocabFromGroup'] } %} + {% endif %}
diff --git a/Project/php/templates/navBar.twig b/Project/php/templates/navBar.twig index 71aec62..73a12af 100755 --- a/Project/php/templates/navBar.twig +++ b/Project/php/templates/navBar.twig @@ -27,8 +27,10 @@ {% endif %} {% if userRole is empty %} + + - {% else %} + {% else %} {% endif %} diff --git a/Project/php/templates/vocabularyContainer.twig b/Project/php/templates/vocabularyContainer.twig index 54da6ac..32ac29a 100755 --- a/Project/php/templates/vocabularyContainer.twig +++ b/Project/php/templates/vocabularyContainer.twig @@ -16,15 +16,19 @@ {% if actions is defined%} - {% if 'getByName' in actions %} - + {% if 'getContent' in actions %} + + + {% endif %} + {% if 'delById' in actions %} - + {% endif %} + {% endif %} {% endfor %}