[Notes] 1ere passe

This commit is contained in:
mckmonster 2024-07-12 16:49:50 +02:00
parent 8279969780
commit 4f8b373bf0
5 changed files with 57 additions and 3 deletions

View file

@ -3,6 +3,9 @@
namespace YesWiki\Meeo;
use YesWiki\Core\YesWikiAction;
use YesWiki\Bazar\Service\EntryManager;
use YesWiki\Core\Service\UserManager;
use YesWiki\Bazar\Service\ListManager;
class NotesAction extends YesWikiAction
{
@ -13,6 +16,27 @@ class NotesAction extends YesWikiAction
public function run()
{
return $this->render('@meeo/notes.twig');
$meeo_config = $this->params->get('meeo');
$formId = $meeo_config['notes']['formId'];
$eleveIdentifier = 'listefiche'.$meeo_config['elevesFormId'].'bf_eleve';
$groupeEE = $meeo_config['groupeEE'];
$entryManager = $this->getService(EntryManager::class);
$userManager = $this->getService(UserManager::class);
$listManager = $this->getService(ListManager::class);
if ( $userManager->isInGroup($groupeEE, admincheck: false) ) {
$eleves = $entryManager->search(['formsIds' => $meeo_config['elevesFormId']]);
$entries = $entryManager->search(['formsIds' => $formId]);
$matieres = $listManager->getOne('ListeMatiere');
// echo var_dump($eleves);
echo var_dump($entries);
// echo var_dump($matieres);
return $this->render('@meeo/edu_notes.twig', [
"eleves" => $eleves,
"entries" => $entries,
"matieres" => $matieres,
]);
}
}
}

View file

@ -112,7 +112,8 @@ EOT,
"bn_sem_type" => "",
"bn_sem_use_template" => "1",
"bn_template" => <<<EOT
titre*** ***Titre Automatique***
titre***Note : {{bf_intitule}} - {{bf_eleve}} - {{bf_matiere}}***Titre Automatique***
texte***bf_intitule***Intitulé*** *** *** *** ***text***1*** *** *** * *** * *** *** *** ***
liste***ListeMatière***Matière*** *** *** ***bf_matiere*** ***1*** *** *** * *** * *** *** *** ***
listefiche***5***Elève*** *** *** ***bf_eleve*** ***1*** *** *** * *** * *** *** *** ***
texte***bf_note***Note***0***20*** *** ***number***1*** *** *** * *** * *** *** *** ***

14
templates/edu_notes.twig Normal file
View file

@ -0,0 +1,14 @@
<div id="accordion" class="panel-group" role="tablist" aria-multiselectable="true">
{% for identifier, eleve in eleves|sort %}
<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">{{ eleve['bf_nom'] }}</h4>
</button>
<div id="{{ identifier }}" class="panel-collapse collapse in" aria-expanded="false">
{% set filteredEntries = entries|filter(e => e['listefiche5bf_eleve'] == identifier) %}
{% include '@meeo/eleve_notes.twig' with { 'entries' : filteredEntries } %}
</div>
</div>
{% endfor %}
</div>

View file

@ -0,0 +1,16 @@
<div id="accordion" class="panel-group" role="tablist" aria-multiselectable="true">
{% for identifier, matiere in matieres['label'] %}
<div class="panel panel-primary">
<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 in" aria-expanded="false">
{% for idEntry, entry in entries|filter(e => e['listeListeMatièrebf_matiere'] == identifier) -%}
<div>
{{ entry['bf_intitule'] }} : {{ entry['bf_note'] }}
</div>
{% endfor %}
</div>
</div>
{% endfor %}
</div>

View file

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