ynh_extension_meeo/actions/AbsencesAction.php
2024-07-04 09:01:12 +02:00

31 lines
790 B
PHP

<?php
use YesWiki\Core\YesWikiAction;
use YesWiki\Bazar\Service\EntryManager;
class AbsencesAction extends YesWikiAction
{
public function formatArguments($arg)
{
return [];
}
public function run()
{
$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,
]);
}
}