Anthony RICHARD 1 year ago
commit 1a391d93d5

@ -20,27 +20,32 @@ class TeacherController extends UserController
public function affAllVocab(): void
{
global $twig;
global $user;
$id = $user->getId();
$mdl = new MdlTeacher();
$vocabularies = $mdl->getAll();
echo $twig->render('manageVocabListView.html', ['vocabularies' => $vocabularies]);
echo $twig->render('manageVocabListView.html', ['vocabularies' => $vocabularies, 'userId' => $id]);
}
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]);
echo $twig->render('manageVocabListView.html', ['vocabularies' => $vocab, 'selectedName' => $name, 'userId' => $id ]);
}
public function DelById():void{
global $twig;
global $user;
$mdl = new MdlTeacher();
$id = Validation::filter_int($_GET['vocabID'] ?? null);
$id = $user->getId();
$vocab = $mdl->removeVocById($id);
echo $twig->render('manageVocabListView.html', [ 'vocabularies' => $vocab]);
echo $twig->render('manageVocabListView.html', [ 'vocabularies' => $vocab, 'userId' => $id ]);
}
public function showVocabListForm(): void {

@ -8,12 +8,12 @@
<div class="section">
<section class="VocabularyList">
<h2>Vocab list</h2>
{% include 'vocabularyContainer.twig' with {'actions' : 'affAllVocab', 'vocabularies' : vocabularies } %}
{% include 'vocabularyContainer.twig' with {'actions' : 'affAllVocab', 'vocabularies' : vocabularies , 'userId' : userId} %}
</section>
<section class="Vocabulaire">
<h2>Vocab of the user</h2>
{% include 'vocabularyContainer.twig' with {'vocabularies' : vocabularies , 'actions' : 'getByName', 'selectedName' : 'selectedName' } %}
{% include 'vocabularyContainer.twig' with {'vocabularies' : vocabularies , 'actions' : 'getByName', 'selectedName' : 'selectedName', 'userId' : userId } %}
</section>
<section class="addGroupForm">
@ -23,7 +23,7 @@
<section class="unassignedUsers">
<h1>Unassigned vocab</h1>
{% include 'vocabularyContainer.twig' with {'vocabularies' : vocabularies , 'actions' : 'delById'} %}
{% include 'vocabularyContainer.twig' with {'vocabularies' : vocabularies , 'actions' : 'delById', 'userId' : userId } %}
</section>
</div>
</body>

@ -17,14 +17,14 @@
{% if actions is defined %}
<td>
{% if actions == 'affAllVocab' %}
<a href="affAllVocab">
<a href="{{base}}/teacher/{{ userId }}/affAllVocab">
</a>
{% elseif actions == 'getByName' %}
<a href="getByName?listName={{ selectedName }}">
<a href="{{base}}/teacher/{{userId}}/getByName?VocabID={{selectedName}}">
</a>
{% elseif actions == 'delById' %}
<a id="delButton" href="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 %}

Loading…
Cancel
Save