php
Anthony RICHARD 1 year ago
parent cc8dc57ef2
commit 6b01bcf4a1

@ -8,31 +8,5 @@ use Exception;
class StudentController extends UserController
{
public function affAllVocab(): void
{
global $twig;
$mdl = new MdlStudent();
$voc = $mdl->getAll();
echo $twig->render('manageVocabListView.html', ['vocabularies' => $voc]);
}
public function affAllStudent(): void
{
global $twig;
$mdl = new MdlStudent();
$student = $mdl->getAll();
echo $twig->render('usersView.html', ['users' => $student]);
}
public function getByName(): void
{
global $twig;
$mdl = new MdlStudent();
$name = Validation::filter_str_simple($_GET['listName'] ?? null);
$vocab = $mdl->getVocabByName($name);
echo $twig->render('manageVocabView.html', ['vocabularies' => $vocab]);
}
}

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

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

@ -35,6 +35,22 @@
</td>
{% endif %}
{% if 'removeVocabFromGroup' in actions %}
<td>
<a href="{{base}}/teacher/{{userID}}/removeVocabFromGroup&vocabID={{ vocabID }}&selectedGroup={{ row.id }}">
<input class="btn-black" type="button" value="Remove from group"/>
</a>
</td>
{% endif %}
{% if 'addVocabToGroup' in actions %}
<td>
<a href="{{base}}/admin/{{userID}}/addVocabToGroup?vocabID={{ vocabID }}&selectedGroup={{ row.id }}">
<input class="btn-black" type="button" value="Add to group"/>
</a>
</td>
{% endif %}
{% endif %}
</tr>
{% endfor %}

@ -34,12 +34,25 @@
<section>
<h2>Content</h2>
{% if content is defined %}
<table>
<tr>
<td>French word</td>
<td>English word</td>
</tr>
{% for trad in content %}
<tr>
<td>trad.word1</td>
<td>trad.word2</td>
</tr>
{% endfor %}
</table>
{% endif %}
//for ou ça affiche chaque traduction french - english [remove]
</section>
<section>
<h2>Groups</h2>
//la liste des groupes [ajouter] ou [retirer]
{% if groups is defined %}
{% include 'groupContainer.twig' with {'actions' : ['addVocabToGroup', 'removeVocabFromGroup'] } %}
{% endif %}
</section>
</section>
<a href="{{base}}/teacher/{{userID}}/showVocabListForm">

Loading…
Cancel
Save