[Absences] Display "Aucune Absence" quand on n'a pas d'absence
Rajout de variable de configuration
This commit is contained in:
parent
3a74666a8f
commit
9f269a1c52
3 changed files with 13 additions and 10 deletions
|
@ -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,
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -11,4 +11,6 @@
|
|||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
<div>Aucune absences</div>
|
||||
{% endif %}
|
Loading…
Reference in a new issue