travail sur la vue pour teacher

php
Patrick BRUGIERE 1 year ago
parent 81b2877c31
commit ef6b71e19b

@ -21,6 +21,9 @@ class FrontController
);
private array $teacherActions = array(
'showAllGroup',
'showAllVocab',
'getVocabByName'
);
private array $studentActions = array(

@ -19,14 +19,18 @@ class TeacherController
$this->affAllStudent();
break;
case 'allVocab':
case 'showAllVocab':
$this->affAllVocab();
break;
case 'getVocabByName':
$this->getByName($_REQUEST['name']);
$this->getByName();
break;
case 'addVocab':
break;
case 'showAllGroup':
$this->findAllGroup();
break;
/* case 'delVoc':
$this->delById($_REQUEST['id']);
@ -66,12 +70,16 @@ class TeacherController
}
public function getByName($name): void
public function getByName(): void
{
global $twig;
$mdl = new MdlTeacher();
$vocab = $mdl->getVocabByName($name);
echo $twig->render('usersView.html', ['users' => $vocab]);
if (isset($_GET['name'])) {
// Get the 'name' parameter from the $_GET array
$name = $_GET['name'];
$vocab = $mdl->getVocabByName($name);
echo $twig->render('usersView.html', ['users' => $vocab,]);
}
}
@ -79,10 +87,17 @@ class TeacherController
global $twig;
$mdl = new MdlTeacher();
$vocab = $mdl->removeVocById($id);
echo $twig->render('usersView.html', ['users' => $vocab]);
echo $twig->render('usersView.html', ['vocab' => $vocab]);
}
public function findAllGroup(){
global $twig;
$mdl = new MdlTeacher();
$group = $mdl->getGroup();
$user = $mdl->getUnassignedUsers();
echo $twig->render('manageVocabListView.html', ['groups' => $group,'unassignedUsers' => $user]);
}
}

@ -2,8 +2,9 @@
namespace model;
use gateway\GroupGateway;
use gateway\UserGateway;
use gateway\VocabularyGateway;
use gateway\VocabularyListGateway;
class MdlTeacher extends AbsModel
{
@ -13,7 +14,7 @@ class MdlTeacher extends AbsModel
}
public function getAll():array{
$gtw = new VocabularyGateway();
$gtw = new VocabularyListGateway();
return $gtw->findAll();
}
@ -23,14 +24,24 @@ 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();
$res = $gtw->remove($id);
$gtw = new VocabularyListGateway();
$gtw->remove($id);
}
public function getGroup():array{
$gtw = new GroupGateway();
return $gtw->findAll();
}
public function getUnassignedUsers(): array {
$gtw = new UserGateway();
return $gtw->findUnassignedUsers();
}

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<div class="section">
<section class="groupList">
<h2>Group list</h2>
{% include 'groupContainer.twig' with {'actions' : 'showAllGroup'} %}
</section>
<section class="Vocabulaire">
<h2>Users of the group</h2>
{% include 'userContainer.twig' with {'users' : teacher, 'action' : 'showAllVocab'} %}
</section>
<section class="addGroupForm">
<h2>Add group</h2>
{% include 'addGroupForm.twig' %}
</section>
<section class="unassignedUsers">
<h1>Unassigned users</h1>
{% include 'userContainer.twig' with {'vocab' : teacher, 'action' : 'getVocabByName'} %}
</section>
</div>
</body>
</html>
Loading…
Cancel
Save