First step to create AbsenceAction
This commit is contained in:
parent
5b8898dfb9
commit
c1fdd1100c
2 changed files with 39 additions and 2 deletions
|
@ -1,6 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
use YesWiki\Core\YesWikiAction;
|
use YesWiki\Core\YesWikiAction;
|
||||||
|
use YesWiki\Bazar\Service\EntryManager;
|
||||||
|
|
||||||
class AbsencesAction extends YesWikiAction
|
class AbsencesAction extends YesWikiAction
|
||||||
{
|
{
|
||||||
|
@ -11,6 +12,20 @@ class AbsencesAction extends YesWikiAction
|
||||||
|
|
||||||
public function run()
|
public function run()
|
||||||
{
|
{
|
||||||
return $this->render('@meeo/absences.twig');
|
$entryManager = $this->getService(EntryManager::class);
|
||||||
|
$entries = $entryManager->search(['formsIds' => '6']);
|
||||||
|
|
||||||
|
$grouped_entries = [];
|
||||||
|
foreach ($entries as $entry) {
|
||||||
|
$identifier = $entry['listefiche5bf_eleve'];
|
||||||
|
if (!isset($grouped_entries[$identifier])) {
|
||||||
|
$grouped_entries[$identifier] = [];
|
||||||
|
}
|
||||||
|
$grouped_entries[$identifier][] = $entry;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->render('@meeo/absences.twig', [
|
||||||
|
"groups" => $grouped_entries,
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1,23 @@
|
||||||
<p>Absences</p>
|
<div id="accordion" class="panel-group" role="tablist" aria-multiselectable="true">
|
||||||
|
{% for identifier, entries in groups %}
|
||||||
|
<div class="panel">
|
||||||
|
<button id="head_{{ identifier }}" class="panel-heading collapsed" data-parent="#accordion" data-target="#{{ identifier }}" data-toggle="collapse" aria-expanded="false">
|
||||||
|
<h4 class="panel-title">{{ identifier }}</h4>
|
||||||
|
</button>
|
||||||
|
<div id="{{ identifier }}" class="panel-collapse collapse" aria-expanded="false">
|
||||||
|
<div class="panel-body">
|
||||||
|
<ul>
|
||||||
|
{% for entry in entries %}
|
||||||
|
<li>
|
||||||
|
<div>
|
||||||
|
{{ entry['bf_date_debut_evenement'] }}
|
||||||
|
<p>{{ entry['bf_commentaire'] }}</p>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
Loading…
Reference in a new issue