ynh_extension_meeo/actions/AbsencesAction.php

37 lines
963 B
PHP
Raw Normal View History

2024-07-04 05:32:34 +00:00
<?php
use YesWiki\Core\YesWikiAction;
2024-07-04 07:01:12 +00:00
use YesWiki\Bazar\Service\EntryManager;
2024-07-04 05:32:34 +00:00
class AbsencesAction extends YesWikiAction
{
public function formatArguments($arg)
{
return [];
}
public function run()
{
2024-07-04 07:01:12 +00:00
$entryManager = $this->getService(EntryManager::class);
$entries = $entryManager->search(['formsIds' => '6']);
2024-07-04 07:27:29 +00:00
2024-07-04 07:01:12 +00:00
$grouped_entries = [];
foreach ($entries as $entry) {
$identifier = $entry['listefiche5bf_eleve'];
2024-07-04 07:27:29 +00:00
$nom = $entryManager->getOne($identifier)['bf_nom'];
2024-07-04 07:01:12 +00:00
if (!isset($grouped_entries[$identifier])) {
2024-07-04 07:27:29 +00:00
$grouped_entries[$identifier] = [
'nom' => $nom,
'entries' => []
];
2024-07-04 07:01:12 +00:00
}
2024-07-04 07:27:29 +00:00
$grouped_entries[$identifier]['entries'][] = $entry;
2024-07-04 07:01:12 +00:00
}
return $this->render('@meeo/absences.twig', [
"groups" => $grouped_entries,
]);
2024-07-04 05:32:34 +00:00
}
}