1ere passe pour la creation de note

This commit is contained in:
mckmonster 2024-07-20 10:13:50 +02:00
parent 082e3232de
commit cd44b21a8a
8 changed files with 104 additions and 5 deletions

View file

@ -0,0 +1,20 @@
<?php
namespace YesWiki\Meeo;
use YesWiki\Core\YesWikiAction;
use YesWiki\Meeo\Service\NoteManager;
class ControleAction extends YesWikiAction
{
public function formatArguments($arg)
{
return [];
}
public function run()
{
$noteManager = $this->getService(NoteManager::class);
return $noteManager->viewControle();
}
}

View file

@ -15,7 +15,6 @@ class NotesAction extends YesWikiAction
public function run()
{
$noteManager = $this->getService(NoteManager::class);
// $noteManager->viewBulletins();
$noteManager->viewCreateNotes();
$noteManager->viewBulletins();
}
}

View file

@ -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

View file

@ -0,0 +1,18 @@
<?php
namespace YesWiki\MeeO\Controle\Controle;
class Control {
private $wiki;
private $intitule;
private $matiere;
private $coef;
private $eleves;
public function __construct($wiki, $intitule, $matiere, $coef) {
$this->wiki = $wiki;
$this->intitule = $intitule;
$this->matiere = $matiere;
$this->coef = $coef;
}
}

View file

@ -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 '<p>'.var_dump($eleves).'</p>';
$classes = $this->listManager->getOne('ListeClasses');

View file

@ -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]);
}
}

View file

@ -0,0 +1,46 @@
<form class="form-horizontal">
<div class="form-group">
<label class="control-label col-sm-2" for="intitule">Intitulé:</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="intitule">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="matiere">Matière:</label>
<div class="col-sm-10">
<select class="form-control" id="matiere">
{% for clef, matiere in matieres %}
<option value="{{ clef }}">{{ matiere }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="classe">Classe:</label>
<div class="col-sm-10">
<select class="form-control" id="classe">
{% for classe in classes %}
<option>{{ classe }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="coef">Coefficient:</label>
<div class="col-sm-10">
<input type="number" class="form-control" id="coef" value="1" min="0.5" max="10" step="0.5">
</div>
</div>
<div>
<h2>Eleves</h2>
{% for eleve in eleves %}
<div class="form-group">
<label class="control-label col-sm-2" for="{{ eleve['id_fiche'] }}">{{ eleve['bf_nom'] }}</label>
<div class="col-sm-10">
<input type="number" class="form-control" id="{{ eleve['id_fiche'] }}" min="0" max="20" step="0.1">
</div>
</div>
{% endfor %}
</div>
<button type="submit" class="btn btn-default">Envoyer</button>
</form>