Compare commits
No commits in common. "3dbd7e7f30ae2df8e19f6305cb36f9b425b6f3ce" and "5b8898dfb989fcd4deaa87487ef27adce53ff941" have entirely different histories.
3dbd7e7f30
...
5b8898dfb9
4 changed files with 2 additions and 57 deletions
|
@ -1,15 +1,9 @@
|
|||
<?php
|
||||
|
||||
use YesWiki\Core\YesWikiAction;
|
||||
use YesWiki\Bazar\Service\EntryManager;
|
||||
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,34 +11,6 @@ class AbsencesAction extends YesWikiAction
|
|||
|
||||
public function run()
|
||||
{
|
||||
$entryManager = $this->getService(EntryManager::class);
|
||||
$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,
|
||||
]);
|
||||
}
|
||||
return $this->render('@meeo/absences.twig');
|
||||
}
|
||||
}
|
||||
|
|
1
templates/absences.twig
Normal file
1
templates/absences.twig
Normal file
|
@ -0,0 +1 @@
|
|||
<p>Absences</p>
|
|
@ -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>
|
|
@ -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>
|
Loading…
Reference in a new issue