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); $vocab = $mdl->removeVocById($id);
echo $twig->render('manageVocabListView.html', [ 'vocabularies' => $vocab, 'userID' => $user->getId(), 'userRole' => $user->getRoles() ]); 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 { public function showVocabListForm(): void {
global $twig; global $twig;
global $user; global $user;

@ -24,6 +24,11 @@ class MdlTeacher extends MdlUser
$res = $gtw->findByName($name); $res = $gtw->findByName($name);
return $res; return $res;
} }
public function findByIdVoc($id):array {
$gtw = new TranslationGateway();
return $gtw->findByIdVoc($id);
}
public function RemoveVocById(int $id):void{ public function RemoveVocById(int $id):void{
$gtw = new VocabularyListGateway(); $gtw = new VocabularyListGateway();

@ -29,11 +29,12 @@
<div class="content"> <div class="content">
<section class="VocabularyList"> <section class="VocabularyList">
<h2>My lists</h2> <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>
<section> <section>
<h2>Content</h2> <h2>Content</h2>
{% if content is defined %} {% if content is defined %}
<?php var_dump(content); ?>
{% endif %} {% endif %}
//for ou ça affiche chaque traduction french - english [remove] //for ou ça affiche chaque traduction french - english [remove]
</section> </section>

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

Loading…
Cancel
Save