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