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