Compare commits

..

No commits in common. "3dbd7e7f30ae2df8e19f6305cb36f9b425b6f3ce" and "5b8898dfb989fcd4deaa87487ef27adce53ff941" have entirely different histories.

4 changed files with 2 additions and 57 deletions

View file

@ -1,15 +1,9 @@
<?php <?php
use YesWiki\Core\YesWikiAction; use YesWiki\Core\YesWikiAction;
use YesWiki\Bazar\Service\EntryManager;
use YesWiki\Core\Service\UserManager;
class AbsencesAction extends YesWikiAction class AbsencesAction extends YesWikiAction
{ {
private $formId = '6';
private $eleveIdentifier = 'listefiche5bf_eleve';
private $groupeEE = 'EquipeEducative';
public function formatArguments($arg) public function formatArguments($arg)
{ {
return []; return [];
@ -17,34 +11,6 @@ class AbsencesAction extends YesWikiAction
public function run() public function run()
{ {
$entryManager = $this->getService(EntryManager::class); return $this->render('@meeo/absences.twig');
$userManager = $this->getService(UserManager::class);
if ( $userManager->isInGroup($this->groupeEE, admincheck: false) ) {
$entries = $entryManager->search(['formsIds' => $this->formId]);
$grouped_entries = [];
foreach ($entries as $entry) {
$identifier = $entry[$this->eleveIdentifier];
$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,
]);
} else {
$username = $userManager->getLoggedUsername();
$entries = $entryManager->search(['formsIds' => $this->formId, 'queries' => [ $this->eleveIdentifier => $username."2"]]);
return $this->render('@meeo/eleve_absences.twig', [
"entries" => $entries,
]);
}
} }
} }

1
templates/absences.twig Normal file
View file

@ -0,0 +1 @@
<p>Absences</p>

View file

@ -1,12 +0,0 @@
<div id="accordion" class="panel-group" role="tablist" aria-multiselectable="true">
{% for identifier, group in groups %}
<div class="panel panel-default">
<button id="head_{{ identifier }}" class="panel-heading collapsed" data-parent="#accordion" data-target="#{{ identifier }}" data-toggle="collapse" aria-expanded="false">
<h4 class="panel-title">{{ group['nom'] }}</h4>
</button>
<div id="{{ identifier }}" class="panel-collapse collapse in" aria-expanded="false">
{% include '@meeo/eleve_absences.twig' with { 'entries' : group['entries'] } %}
</div>
</div>
{% endfor %}
</div>

View file

@ -1,10 +0,0 @@
<div class="panel-body">
{% for entry in entries %}
<div>
<h5>{{ entry['bf_date_debut_evenement'] }}</h5>
{% if entry['bf_commentaire']|default %}
<p>{{ entry['bf_commentaire'] }}</p>
{% endif %}
</div>
{% endfor %}
</div>