avancement sur l'affichage le la liste de vocabulaire par user

php
Patrick BRUGIERE 1 year ago
parent cc8dc57ef2
commit c2f964fb86

@ -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;

@ -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();

@ -29,11 +29,12 @@
<div class="content">
<section class="VocabularyList">
<h2>My lists</h2>
{% include 'vocabularyContainer.twig' with {'actions' : ['affContent', 'delById'], 'vocabularies' : vocabularies } %}
{% include 'vocabularyContainer.twig' with {'actions' : ['affContent', 'delById', 'getContent' ], 'vocabularies' : vocabularies, 'vocabID' : vocabID, 'content' : content } %}
</section>
<section>
<h2>Content</h2>
{% if content is defined %}
<?php var_dump(content); ?>
{% endif %}
//for ou ça affiche chaque traduction french - english [remove]
</section>

@ -16,15 +16,19 @@
{% if actions is defined%}
<td>
{% if 'getByName' in actions %}
<a href="{{base}}/teacher/{{userId}}/getByName?listName={{selectedName}}">
{% if 'getContent' in actions %}
<a href="{{base}}/teacher/{{userID}}/getContent?vocabID={{row.id}}">
<input class="btn-black" type="button" value="aff content" />
</a>
{% endif %}
{% if 'delById' in actions %}
<a id="delButton" href="{{base}}/teacher/{{userId}}/delById?vocabID={{ row.id }}">
<a id="delButton" href="{{base}}/teacher/{{userID}}/delById?vocabID={{ row.id }}">
<input class="btn-black" type="button" value="delete from vocabulary" />
</a>
{% endif %}
{% endif %}
{% endfor %}

Loading…
Cancel
Save