ynh_extension_meeo/actions/AbsencesAction.php

35 lines
958 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'];
$nom = $entryManager->getOne($identifier)['bf_nom'];
if (!isset($grouped_entries[$identifier])) {
$grouped_entries[$identifier] = [
'nom' => $nom,
'entries' => []
];
}
$grouped_entries[$identifier]['entries'][] = $entry;
}
return $this->render('@meeo/edu_absences.twig', [
"groups" => $grouped_entries,
]);
}
}