From cd44b21a8a4f52debc0ea0c680d13991e3bbfc19 Mon Sep 17 00:00:00 2001 From: mckmonster Date: Sat, 20 Jul 2024 10:13:50 +0200 Subject: [PATCH] 1ere passe pour la creation de note --- actions/ControleAction.php | 20 ++++++++++++++ actions/NotesAction.php | 3 +-- actions/documentation.yaml | 3 +++ libs/controle/Controle.lib.php | 18 +++++++++++++ services/EleveManager.php | 6 ++++- services/NoteManager.php | 13 ++++++++-- templates/edu_controle.twig | 46 +++++++++++++++++++++++++++++++++ templates/edu_create_notes.twig | 0 8 files changed, 104 insertions(+), 5 deletions(-) create mode 100644 actions/ControleAction.php create mode 100644 libs/controle/Controle.lib.php create mode 100644 templates/edu_controle.twig delete mode 100644 templates/edu_create_notes.twig diff --git a/actions/ControleAction.php b/actions/ControleAction.php new file mode 100644 index 0000000..65a181a --- /dev/null +++ b/actions/ControleAction.php @@ -0,0 +1,20 @@ +getService(NoteManager::class); + return $noteManager->viewControle(); + } +} \ No newline at end of file diff --git a/actions/NotesAction.php b/actions/NotesAction.php index e306fce..46b409e 100644 --- a/actions/NotesAction.php +++ b/actions/NotesAction.php @@ -15,7 +15,6 @@ class NotesAction extends YesWikiAction public function run() { $noteManager = $this->getService(NoteManager::class); - // $noteManager->viewBulletins(); - $noteManager->viewCreateNotes(); + $noteManager->viewBulletins(); } } diff --git a/actions/documentation.yaml b/actions/documentation.yaml index 5fa4167..b1bc44d 100644 --- a/actions/documentation.yaml +++ b/actions/documentation.yaml @@ -9,4 +9,7 @@ actions: eleves: label: Eleves description: Liste des élèves + controle: + label: Controle + description: Affiche les informations d'un controle # La liste des actions de ce groupe \ No newline at end of file diff --git a/libs/controle/Controle.lib.php b/libs/controle/Controle.lib.php new file mode 100644 index 0000000..21c40bb --- /dev/null +++ b/libs/controle/Controle.lib.php @@ -0,0 +1,18 @@ +wiki = $wiki; + $this->intitule = $intitule; + $this->matiere = $matiere; + $this->coef = $coef; + } +} \ No newline at end of file diff --git a/services/EleveManager.php b/services/EleveManager.php index 65fa12b..9fb68c3 100644 --- a/services/EleveManager.php +++ b/services/EleveManager.php @@ -31,8 +31,12 @@ class EleveManager { return $this->entryManager->update($id, ['listeListeClassesbf_classe' => $classe, 'antispam' => true]); } + public function getAll() { + return $this->entryManager->search(['formsIds' => $this->formId]); + } + public function view() { - $eleves = $this->entryManager->search(['formsIds' => $this->formId]); + $eleves = $this->getAll(); // echo '

'.var_dump($eleves).'

'; $classes = $this->listManager->getOne('ListeClasses'); diff --git a/services/NoteManager.php b/services/NoteManager.php index ebf3d94..035eb01 100644 --- a/services/NoteManager.php +++ b/services/NoteManager.php @@ -8,6 +8,7 @@ use YesWiki\Bazar\Service\ListManager; use YesWiki\Core\Service\UserManager; use YesWiki\Wiki; use YesWiki\Meeo\Bulletin\Bulletin; +use YesWiki\Meeo\Service\EleveManager; class NoteManager { protected $wiki; @@ -39,6 +40,7 @@ class NoteManager { $bulletins = []; foreach ( $eleves as $eleve) { + //TODO enlever "Passerelle" $bulletins[] = new Bulletin($this->wiki, $eleve, "Passerelle"); } // echo var_dump($eleves); @@ -56,7 +58,14 @@ class NoteManager { } } - public function viewCreateNotes() { - return $this->wiki->render('@meeo/edu_create_notes.twig', []); + public function viewControle() { + $eleves = $this->wiki->services->get(EleveManager::class)->getAll(); + // echo var_dump($eleves); + $matieres = $this->listManager->getOne('ListeMatiere'); + // echo var_dump($matieres); + $classes = $this->listManager->getOne('ListeClasses'); + // echo var_dump($classes); + + return $this->wiki->render('@meeo/edu_controle.twig', ['matieres' => $matieres['label'], 'classes' => $classes['label'], 'eleves' => $eleves]); } } \ No newline at end of file diff --git a/templates/edu_controle.twig b/templates/edu_controle.twig new file mode 100644 index 0000000..cf1c5ea --- /dev/null +++ b/templates/edu_controle.twig @@ -0,0 +1,46 @@ +
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+

Eleves

+ {% for eleve in eleves %} +
+ +
+ +
+
+ {% endfor %} +
+ +
\ No newline at end of file diff --git a/templates/edu_create_notes.twig b/templates/edu_create_notes.twig deleted file mode 100644 index e69de29..0000000