From 4f8b373bf0c1e90b4b99602fb697920102e59342 Mon Sep 17 00:00:00 2001 From: mckmonster Date: Fri, 12 Jul 2024 16:49:50 +0200 Subject: [PATCH] [Notes] 1ere passe --- actions/NotesAction.php | 26 +++++++++++++++++++++++++- commands/CreateFormsCommand.php | 3 ++- templates/edu_notes.twig | 14 ++++++++++++++ templates/eleve_notes.twig | 16 ++++++++++++++++ templates/notes.twig | 1 - 5 files changed, 57 insertions(+), 3 deletions(-) create mode 100644 templates/edu_notes.twig create mode 100644 templates/eleve_notes.twig delete mode 100644 templates/notes.twig diff --git a/actions/NotesAction.php b/actions/NotesAction.php index 2ff5615..5f2a0a5 100644 --- a/actions/NotesAction.php +++ b/actions/NotesAction.php @@ -3,6 +3,9 @@ namespace YesWiki\Meeo; use YesWiki\Core\YesWikiAction; +use YesWiki\Bazar\Service\EntryManager; +use YesWiki\Core\Service\UserManager; +use YesWiki\Bazar\Service\ListManager; class NotesAction extends YesWikiAction { @@ -13,6 +16,27 @@ class NotesAction extends YesWikiAction public function run() { - return $this->render('@meeo/notes.twig'); + $meeo_config = $this->params->get('meeo'); + $formId = $meeo_config['notes']['formId']; + $eleveIdentifier = 'listefiche'.$meeo_config['elevesFormId'].'bf_eleve'; + $groupeEE = $meeo_config['groupeEE']; + + $entryManager = $this->getService(EntryManager::class); + $userManager = $this->getService(UserManager::class); + $listManager = $this->getService(ListManager::class); + + if ( $userManager->isInGroup($groupeEE, admincheck: false) ) { + $eleves = $entryManager->search(['formsIds' => $meeo_config['elevesFormId']]); + $entries = $entryManager->search(['formsIds' => $formId]); + $matieres = $listManager->getOne('ListeMatiere'); + // echo var_dump($eleves); + echo var_dump($entries); + // echo var_dump($matieres); + return $this->render('@meeo/edu_notes.twig', [ + "eleves" => $eleves, + "entries" => $entries, + "matieres" => $matieres, + ]); + } } } diff --git a/commands/CreateFormsCommand.php b/commands/CreateFormsCommand.php index 8500083..dd288cb 100644 --- a/commands/CreateFormsCommand.php +++ b/commands/CreateFormsCommand.php @@ -112,7 +112,8 @@ EOT, "bn_sem_type" => "", "bn_sem_use_template" => "1", "bn_template" => << +{% for identifier, eleve in eleves|sort %} +
+ + +
+{% endfor %} + \ No newline at end of file diff --git a/templates/eleve_notes.twig b/templates/eleve_notes.twig new file mode 100644 index 0000000..6b2c17a --- /dev/null +++ b/templates/eleve_notes.twig @@ -0,0 +1,16 @@ +
+{% for identifier, matiere in matieres['label'] %} +
+ + +
+{% endfor %} +
\ No newline at end of file diff --git a/templates/notes.twig b/templates/notes.twig deleted file mode 100644 index ac39b0f..0000000 --- a/templates/notes.twig +++ /dev/null @@ -1 +0,0 @@ -

Notes

\ No newline at end of file