"ajout de la vue pour les vocabulaire et de son manager (encore du travail dessus)"

php
Patrick BRUGIERE 1 year ago
parent 1cc1128b00
commit 7bdb345e12

@ -3,6 +3,7 @@
namespace controller;
use config\Validation;
use model\MdlTeacher;
use gateway\VocabularyListGateway;
use Exception;
class TeacherController
@ -20,8 +21,8 @@ class TeacherController
{
global $twig;
$mdl = new MdlTeacher();
$student = $mdl->getAll();
echo $twig->render('usersView.html', ['users' => $student]);
$vocabularies = $mdl->getAll();
echo $twig->render('manageVocabListView.html', ['vocabularies' => $vocabularies]);
}
public function getByName($name): void
@ -29,7 +30,7 @@ class TeacherController
global $twig;
$mdl = new MdlTeacher();
$vocab = $mdl->getVocabByName($name);
echo $twig->render('usersView.html', ['users' => $vocab]);
echo $twig->render('usersView.html', ['users' => $vocab, 'selectedName' => $name]);
}

@ -16,7 +16,7 @@ class MdlTeacher extends AbsModel
}
public function getAll():array{
$gtw = new VocabularyGateway();
$gtw = new VocabularyListGateway();
return $gtw->findAll();
}
@ -26,13 +26,13 @@ class MdlTeacher extends AbsModel
}
public function getVocabByName(string $name):array{
$gtw = new VocabularyGateway();
$gtw = new VocabularyListGateway();
$res = $gtw->findByName($name);
return $res;
}
public function RemoveVocById(int $id):void{
$gtw = new VocabularyGateway();
$gtw = new VocabularyListGateway();
$res = $gtw->remove($id);
}

@ -6,25 +6,25 @@
</head>
<body>
<div class="section">
<section class="groupList">
<h2>Group list</h2>
{% include 'groupContainer.twig' with {'actions' : 'showAllGroup'} %}
<section class="VocabularyList">
<h2>Vocab list</h2>
{% include 'vocabularyContainer.twig' with {'actions' : 'affAllVocab', 'vocabularies' : vocabularies } %}
</section>
<section class="Vocabulaire">
<h2>Users of the group</h2>
{% include 'userContainer.twig' with {'users' : teacher, 'action' : 'showAllVocab'} %}
<h2>Vocab of the user</h2>
{% include 'vocabularyContainer.twig' with {'vocabularies' : vocabularies , 'actions' : 'getByName', 'selectedName' : selectedName } %}
</section>
<section class="addGroupForm">
<h2>Add group</h2>
<h2>Add Vocab</h2>
{% include 'addGroupForm.twig' %}
</section>
<section class="unassignedUsers">
<h1>Unassigned users</h1>
{% include 'userContainer.twig' with {'vocab' : teacher, 'action' : 'getVocabByName'} %}
<h1>Unassigned vocab</h1>
{% include 'vocabularyContainer.twig' with {'vocabularies' : vocabularies , 'actions' : 'getVocabByName'} %}
</section>
</div>
</body>
</html>

@ -0,0 +1,34 @@
<table>
<tr>
<td>ID</td>
<td>Name</td>
<td>Image</td>
<td>Author</td>
</tr>
{% if vocabularies is defined %}
{% for row in vocabularies %}
<tr>
<td>{{ row.id }}</td>
<td>{{ row.name }}</td>
<td>{{ row.image }}</td>
<td>{{ row.author }}</td>
{% if actions is defined %}
<td>
{% if actions == 'affAllVocab' %}
<a href="affAllVocab">
<input class="btn-black" type="button" value="Delete from group"/>
</a>
{% elseif actions == 'getByName' %}
<a href="getByName?name={{ selectedName }}">
<input class="btn-black" type="button" value="Delete from group"/>
</a>
{% endif %}
</td>
{% endif %}
</tr>
{% endfor %}
{% endif %}
</table>
Loading…
Cancel
Save