Lucie GOIGOUX 1 year ago
commit c56b077ea8

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 307 KiB

@ -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{
@ -49,7 +27,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;

@ -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();
@ -24,6 +30,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();

@ -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 %}

@ -7,10 +7,8 @@
<meta name="description" content="" />
<meta name="author" content="" />
<title>In English Please!</title>
<link rel="icon" type="image/x-icon" href="assets/favicon.ico" />
<!-- Font Awesome icons (free version)-->
<script src="https://use.fontawesome.com/releases/v6.3.0/js/all.js" crossorigin="anonymous"></script>
<!-- Google fonts-->
<link rel="icon" type="image/x-icon" href="{{base}}/assets/favicon.ico"/>
<!-- Font Awesome icons (free version)--><!-- Google fonts-->
<link href="https://fonts.googleapis.com/css?family=Varela+Round" rel="stylesheet" />
<link
href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i"
@ -158,10 +156,6 @@
<footer class="footer bg-black small text-center text-white-50">
<div class="container px-4 px-lg-5">Copyright &copy; SegWave</div>
</footer>
<!-- Bootstrap core JS-->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js"></script>
<!-- Core theme JS-->
<script src="{{base}}/js/scripts.js"></script>
</body>
</html>

@ -29,17 +29,30 @@
<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 %}
<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">

@ -27,8 +27,10 @@
<li class="nav-item"><a class="nav-link" href="{{ base }}/teacher/{{ userID }}/showAccountInfos">My account</a></li>
{% endif %}
{% if userRole is empty %}
<li class="nav-item"><a class="nav-link" href="#game">Game</a></li>
<li class="nav-item"><a class="nav-link" href="#download">Download</a></li>
<li class="nav-item"><a class="nav-link" href="{{base}}/visitor/login">Login</a></li>
{% else %}
{% else %}
<li class="nav-item"><a class="nav-link" href="{{ base }}/visitor/disconnect">Log out</a></li>
{% endif %}

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