Compare commits

..

2 commits

Author SHA1 Message Date
mckmonster
e2a83cd841 prepare to display eleve 2024-08-05 19:02:45 +02:00
mckmonster
e0371384b5 prepare to display eleve 2024-08-05 19:02:41 +02:00
4 changed files with 31 additions and 14 deletions

View file

@ -4,7 +4,7 @@ parameters:
absencesFormId: 7
notesFormId: 8
yunohostFormId: 5
groupeEE: 'EquipeEducative'
groupeEE: 'equipeeducative'
redirect:
eleveUpdate: '?Eleves'
controle: '?Bulletin'

View file

@ -21,6 +21,10 @@ class Eleve {
return $this->data['id_fiche'];
}
public function getUserId() {
return $this->user['bf_titre'];
}
public function getNom() {
if (empty($this->user['bf_nom'])) {
return $this->user['bf_titre'];

View file

@ -44,7 +44,6 @@ class EleveManager {
$eleves = [];
foreach ($this->entryManager->search(['formsIds' => $this->formId]) as $data)
{
$eleve = new Eleve($this->entryManager, $this->yunoshostFormId, $data);
// echo "<p>".var_dump($eleve)."</p>";
$eleves[] = $eleve;
@ -57,7 +56,12 @@ class EleveManager {
}
public function getCurrentEleve(string $username) {
return $this->entryManager->getOne(str_replace(".","", $username));
$all = $this->getAll();
foreach ($all as $eleve) {
echo "<p>".var_dump($eleve)."</p>";
if ($eleve->getUserId() == $username)
return $eleve;
}
}
public function view() {

View file

@ -5,6 +5,7 @@ use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use YesWiki\Bazar\Service\EntryManager;
use YesWiki\Bazar\Service\ListManager;
use YesWiki\Core\Controller\AuthController;
use YesWiki\Core\Service\UserManager;
use YesWiki\Wiki;
use YesWiki\Meeo\Bulletin\Bulletin;
use YesWiki\Meeo\Service\EleveManager;
@ -16,31 +17,35 @@ class NoteManager {
protected $listManager;
protected $formId;
protected $eleveFormId;
protected $eeGroup;
protected $authController;
protected $userManager;
public function __construct( Wiki $wiki, ParameterBagInterface $params, EntryManager $entryManager, ListManager $listManager, AuthController $authController)
public function __construct( Wiki $wiki, ParameterBagInterface $params, EntryManager $entryManager, ListManager $listManager, AuthController $authController, UserManager $userManager)
{
$this->wiki = $wiki;
$this->params = $params;
$this->entryManager = $entryManager;
$this->listManager = $listManager;
$this->authController = $authController;
$this->userManager = $userManager;
$meeo_config = $this->params->get('meeo');
$this->formId = $meeo_config['notesFormId'];
$this->eleveFormId = $meeo_config['elevesFormId'];
$this->eeGroup = $meeo_config['groupeEE'];
}
public function viewBulletins() {
$eleveManager = $this->wiki->services->get(EleveManager::class);
$username = $this->authController->getLoggedUserName();
// echo "<p>".$username."</p>";
include 'tools/meeo/libs/bulletin/Bulletin.lib.php';
$currentEleve = $eleveManager->getCurrentEleve($username);
// echo "<p>".var_dump($currentEleve)."</p>";
// if ($currentEleve == null) {
$loggedUser = $this->authController->getLoggedUser();
echo "<p>".var_dump($loggedUser)."</p>";
if ($this->userManager->isInGroup($this->eeGroup, $loggedUser['name'], false)) {
$eleves = $eleveManager->getAll();
$bulletins = [];
@ -53,12 +58,16 @@ class NoteManager {
return $this->wiki->render('@meeo/edu_notes.twig', [
"bulletins" => $bulletins,
]);
// } else {
// $bulletin = new Bulletin($this->wiki, $currentEleve);
// return $this->wiki->render('@meeo/eleve_notes.twig', [
// "bulletin" => $bulletin,
// ]);
// }
} else {
echo "Eleve";
$currentEleve = $eleveManager->getCurrentEleve($loggedUser['name']);
if ($currentEleve != null) {
$bulletin = new Bulletin($this->wiki, $currentEleve);
return $this->wiki->render('@meeo/eleve_notes.twig', [
"bulletin" => $bulletin,
]);
}
}
}
public function viewControle() {