diff --git a/Project/php/controller/TeacherController.php b/Project/php/controller/TeacherController.php index 95244c1..a24027a 100755 --- a/Project/php/controller/TeacherController.php +++ b/Project/php/controller/TeacherController.php @@ -49,7 +49,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..e618649 100755 --- a/Project/php/model/MdlTeacher.php +++ b/Project/php/model/MdlTeacher.php @@ -24,6 +24,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/manageVocabListView.html b/Project/php/templates/manageVocabListView.html index c46d76c..f67b2a2 100755 --- a/Project/php/templates/manageVocabListView.html +++ b/Project/php/templates/manageVocabListView.html @@ -29,11 +29,12 @@

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 %} + {% endif %} //for ou ça affiche chaque traduction french - english [remove]
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 %}