From c1fdd1100c02205e0e770227f98110caafde7758 Mon Sep 17 00:00:00 2001 From: mckmonster Date: Thu, 4 Jul 2024 09:01:12 +0200 Subject: [PATCH] First step to create AbsenceAction --- actions/AbsencesAction.php | 17 ++++++++++++++++- templates/absences.twig | 24 +++++++++++++++++++++++- 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/actions/AbsencesAction.php b/actions/AbsencesAction.php index 2aa68c3..a5cd9d7 100644 --- a/actions/AbsencesAction.php +++ b/actions/AbsencesAction.php @@ -1,6 +1,7 @@ render('@meeo/absences.twig'); + $entryManager = $this->getService(EntryManager::class); + $entries = $entryManager->search(['formsIds' => '6']); + + $grouped_entries = []; + foreach ($entries as $entry) { + $identifier = $entry['listefiche5bf_eleve']; + if (!isset($grouped_entries[$identifier])) { + $grouped_entries[$identifier] = []; + } + $grouped_entries[$identifier][] = $entry; + } + + return $this->render('@meeo/absences.twig', [ + "groups" => $grouped_entries, + ]); } } diff --git a/templates/absences.twig b/templates/absences.twig index 103f624..9c69bc1 100644 --- a/templates/absences.twig +++ b/templates/absences.twig @@ -1 +1,23 @@ -

Absences

\ No newline at end of file +
+{% for identifier, entries in groups %} +
+ + +
+{% endfor %} +
\ No newline at end of file