diff --git a/actions/AbsencesAction.php b/actions/AbsencesAction.php index fb223dc..a8b7940 100644 --- a/actions/AbsencesAction.php +++ b/actions/AbsencesAction.php @@ -6,10 +6,6 @@ use YesWiki\Core\Service\UserManager; class AbsencesAction extends YesWikiAction { - private $formId = '6'; - private $eleveIdentifier = 'listefiche5bf_eleve'; - private $groupeEE = 'EquipeEducative'; - public function formatArguments($arg) { return []; @@ -17,14 +13,18 @@ class AbsencesAction extends YesWikiAction public function run() { + $formId = $this->params->get('meeo_formId'); + $eleveIdentifier = $this->params->get('meeo_eleveIdentifier'); + $groupeEE = $this->params->get('meeo_groupeEE'); + $entryManager = $this->getService(EntryManager::class); $userManager = $this->getService(UserManager::class); - if ( $userManager->isInGroup($this->groupeEE, admincheck: false) ) { - $entries = $entryManager->search(['formsIds' => $this->formId]); + if ( $userManager->isInGroup($groupeEE, admincheck: false) ) { + $entries = $entryManager->search(['formsIds' => $formId]); $grouped_entries = []; foreach ($entries as $entry) { - $identifier = $entry[$this->eleveIdentifier]; + $identifier = $entry[$eleveIdentifier]; $nom = $entryManager->getOne($identifier)['bf_nom']; if (!isset($grouped_entries[$identifier])) { $grouped_entries[$identifier] = [ @@ -40,7 +40,7 @@ class AbsencesAction extends YesWikiAction ]); } else { $username = $userManager->getLoggedUsername(); - $entries = $entryManager->search(['formsIds' => $this->formId, 'queries' => [ $this->eleveIdentifier => $username."2"]]); + $entries = $entryManager->search(['formsIds' => $formId, 'queries' => [ $eleveIdentifier => $username."2"]]); return $this->render('@meeo/eleve_absences.twig', [ "entries" => $entries, diff --git a/config.yaml b/config.yaml index 55c87fe..679834a 100644 --- a/config.yaml +++ b/config.yaml @@ -1,6 +1,7 @@ parameters: - Meeo: - my_param: 'this is a test param defined in tools/meeo/config.yaml. It can be ovewritten in wakka.config.php' + meeo_formId: '6' + meeo_eleveIdentifier: listefiche5bf_eleve + meeo_groupeEE: EquipeEducative services: _defaults: diff --git a/templates/edu_absences.twig b/templates/edu_absences.twig index 27c7104..2307006 100644 --- a/templates/edu_absences.twig +++ b/templates/edu_absences.twig @@ -11,4 +11,6 @@ {% endfor %} +{% else %} +