Prendre en compte l'info dans la config pour la liste des élèves
This commit is contained in:
parent
0664776352
commit
4b0e9c3d1f
4 changed files with 25 additions and 25 deletions
|
@ -16,11 +16,14 @@ use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||||
class CreateFormsCommand extends Command
|
class CreateFormsCommand extends Command
|
||||||
{
|
{
|
||||||
protected $wiki;
|
protected $wiki;
|
||||||
|
protected $eleveFormId;
|
||||||
|
|
||||||
public function __construct(Wiki &$wiki)
|
public function __construct(Wiki &$wiki)
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->wiki = $wiki;
|
$this->wiki = $wiki;
|
||||||
|
$meeo_config = $this->wiki->params->get('meeo');
|
||||||
|
$this->eleveFormId = $meeo_config['elevesFormId'];
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function configure()
|
protected function configure()
|
||||||
|
@ -73,7 +76,7 @@ class CreateFormsCommand extends Command
|
||||||
"bn_sem_use_template" => "1",
|
"bn_sem_use_template" => "1",
|
||||||
"bn_template" => <<<EOT
|
"bn_template" => <<<EOT
|
||||||
titre***Absence : {{bf_eleve}} - {{bf_date_debut_evenement}}***Titre Automatique***
|
titre***Absence : {{bf_eleve}} - {{bf_date_debut_evenement}}***Titre Automatique***
|
||||||
listefiche***6***Elève*** *** *** *** *** ***1*** *** *** * *** * *** *** *** ***
|
listefiche***$this->eleveFormId***Elève*** *** *** *** *** ***1*** *** *** * *** * *** *** *** ***
|
||||||
listedatedeb***bf_date_debut***Debut*** *** ***today*** *** ***1*** *** *** * *** * *** *** *** ***
|
listedatedeb***bf_date_debut***Debut*** *** ***today*** *** ***1*** *** *** * *** * *** *** *** ***
|
||||||
listedatedeb***bf_date_fin***Fin*** *** ***today*** *** ***1*** *** *** * *** * *** *** *** ***
|
listedatedeb***bf_date_fin***Fin*** *** ***today*** *** ***1*** *** *** * *** * *** *** *** ***
|
||||||
textelong***bf_commentaire***Commentaire*** *** *** *** ***wiki***0*** *** *** * *** * *** *** *** ***
|
textelong***bf_commentaire***Commentaire*** *** *** *** ***wiki***0*** *** *** * *** * *** *** *** ***
|
||||||
|
@ -118,7 +121,7 @@ EOT,
|
||||||
titre***Note : {{bf_intitule}} - {{bf_eleve}} - {{bf_matiere}}***Titre Automatique***
|
titre***Note : {{bf_intitule}} - {{bf_eleve}} - {{bf_matiere}}***Titre Automatique***
|
||||||
texte***bf_intitule***Intitulé*** *** *** *** ***text***1*** *** *** * *** * *** *** *** ***
|
texte***bf_intitule***Intitulé*** *** *** *** ***text***1*** *** *** * *** * *** *** *** ***
|
||||||
liste***ListeMatiere***Matière*** *** *** ***bf_matiere*** ***1*** *** *** * *** * *** *** *** ***
|
liste***ListeMatiere***Matière*** *** *** ***bf_matiere*** ***1*** *** *** * *** * *** *** *** ***
|
||||||
listefiche***6***Elève*** *** *** ***bf_eleve*** ***1*** *** *** * *** * *** *** *** ***
|
listefiche***$this->eleveFormId***Elève*** *** *** ***bf_eleve*** ***1*** *** *** * *** * *** *** *** ***
|
||||||
texte***bf_note***Note***0***20*** *** ***number***1*** *** *** * *** * *** *** *** ***
|
texte***bf_note***Note***0***20*** *** ***number***1*** *** *** * *** * *** *** *** ***
|
||||||
texte***bf_coef***Coefficient***0.5***10***1*** ***number***0*** *** *** * *** * *** *** *** ***
|
texte***bf_coef***Coefficient***0.5***10***1*** ***number***0*** *** *** * *** * *** *** *** ***
|
||||||
EOT,
|
EOT,
|
||||||
|
|
|
@ -39,7 +39,7 @@ class ApiController extends YesWikiController
|
||||||
* @Route("/api/meeo/controle",methods={"POST"},options={"acl":{"public"}})
|
* @Route("/api/meeo/controle",methods={"POST"},options={"acl":{"public"}})
|
||||||
*/
|
*/
|
||||||
public function control(Request $request) {
|
public function control(Request $request) {
|
||||||
$eleveController = $this->getService(NoteManager::class);
|
$noteManager = $this->getService(NoteManager::class);
|
||||||
$content = $request->getContent();
|
$content = $request->getContent();
|
||||||
|
|
||||||
parse_str($content, $parameters);
|
parse_str($content, $parameters);
|
||||||
|
@ -51,8 +51,7 @@ class ApiController extends YesWikiController
|
||||||
}, ARRAY_FILTER_USE_KEY);
|
}, ARRAY_FILTER_USE_KEY);
|
||||||
|
|
||||||
$controle = new Controle($parameters['intitule'], $parameters['matiere'], $parameters['coef'], $eleves);
|
$controle = new Controle($parameters['intitule'], $parameters['matiere'], $parameters['coef'], $eleves);
|
||||||
|
$controle->createNotes($noteManager);
|
||||||
$eleveController->addNotes($controle->getNotes());
|
|
||||||
return $this->wiki->redirect('?Notes', 200);
|
return $this->wiki->redirect('?Notes', 200);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
namespace YesWiki\MeeO\Controle;
|
namespace YesWiki\MeeO\Controle;
|
||||||
|
|
||||||
|
use YesWiki\Meeo\Service\NoteManager;
|
||||||
|
|
||||||
class Controle {
|
class Controle {
|
||||||
public $intitule;
|
public $intitule;
|
||||||
public $matiere;
|
public $matiere;
|
||||||
|
@ -28,18 +30,9 @@ class Controle {
|
||||||
return $outputArray;
|
return $outputArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getNotes() {
|
public function createNotes(NoteManager $noteManager) {
|
||||||
$notes = [];
|
|
||||||
foreach ($this->eleves as $eleve => $note) {
|
foreach ($this->eleves as $eleve => $note) {
|
||||||
$notes[] = [
|
$noteManager->createNote($this->intitule, $eleve, $this->matiere, $note, $this->coef);
|
||||||
'bf_titre' => "Note : ".$this->intitule." - ".$eleve." - ".$this->matiere,
|
|
||||||
'bf_intitule' => $this->intitule,
|
|
||||||
'listeListeMatierebf_matiere' => $this->matiere,
|
|
||||||
'listefiche6bf_eleve' => $eleve,
|
|
||||||
'bf_note' => $note,
|
|
||||||
'bf_coef' => $this->coef,
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
return $notes;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -16,6 +16,7 @@ class NoteManager {
|
||||||
protected $entryManager;
|
protected $entryManager;
|
||||||
protected $listManager;
|
protected $listManager;
|
||||||
protected $formId;
|
protected $formId;
|
||||||
|
protected $eleveFormId;
|
||||||
protected $authController;
|
protected $authController;
|
||||||
|
|
||||||
public function __construct( Wiki $wiki, ParameterBagInterface $params, EntryManager $entryManager, ListManager $listManager, AuthController $authController)
|
public function __construct( Wiki $wiki, ParameterBagInterface $params, EntryManager $entryManager, ListManager $listManager, AuthController $authController)
|
||||||
|
@ -28,12 +29,10 @@ class NoteManager {
|
||||||
|
|
||||||
$meeo_config = $this->params->get('meeo');
|
$meeo_config = $this->params->get('meeo');
|
||||||
$this->formId = $meeo_config['notesFormId'];
|
$this->formId = $meeo_config['notesFormId'];
|
||||||
|
$this->eleveFormId = $meeo_config['elevesFormId'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function viewBulletins() {
|
public function viewBulletins() {
|
||||||
// $eleveIdentifier = 'listefiche'.$meeo_config['elevesFormId'].'bf_eleve';
|
|
||||||
// $groupeEE = $meeo_config['groupeEE'];
|
|
||||||
|
|
||||||
$username = $this->authController->getLoggedUserName();
|
$username = $this->authController->getLoggedUserName();
|
||||||
|
|
||||||
$eleves = $this->wiki->services->get(EleveManager::class)->getAll();
|
$eleves = $this->wiki->services->get(EleveManager::class)->getAll();
|
||||||
|
@ -72,19 +71,25 @@ class NoteManager {
|
||||||
return $this->wiki->render('@meeo/edu_controle.twig', ['matieres' => $matieres['label'], 'classes' => $classes['label'], 'eleves' => $eleves]);
|
return $this->wiki->render('@meeo/edu_controle.twig', ['matieres' => $matieres['label'], 'classes' => $classes['label'], 'eleves' => $eleves]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addNotes($notes) {
|
public function createNote($intitule, $eleve, $matiere, $note, $coef) {
|
||||||
foreach ($notes as $note) {
|
$note = [
|
||||||
$note['antispam'] = true;
|
'bf_titre' => "Note : ".$intitule." - ".$eleve." - ".$matiere,
|
||||||
|
'bf_intitule' => $intitule,
|
||||||
|
'listeListeMatierebf_matiere' => $matiere,
|
||||||
|
'listefiche'.$this->eleveFormId.'bf_eleve' => $eleve,
|
||||||
|
'bf_note' => $note,
|
||||||
|
'bf_coef' => $coef,
|
||||||
|
'antispam' => true
|
||||||
|
];
|
||||||
$this->entryManager->create($this->formId, $note);
|
$this->entryManager->create($this->formId, $note);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public function getNotes($eleveId, $matiereId) {
|
public function getNotes($eleveId, $matiereId) {
|
||||||
// echo "<p>".$eleveId."</p>";
|
// echo "<p>".$eleveId."</p>";
|
||||||
// echo "<p>".$matiereId."</p>";
|
// echo "<p>".$matiereId."</p>";
|
||||||
$entries = $this->entryManager->search(['formsIds' => $this->formId,
|
$entries = $this->entryManager->search(['formsIds' => $this->formId,
|
||||||
'queries' =>[
|
'queries' =>[
|
||||||
'listefiche6bf_eleve' => $eleveId,
|
'listefiche'.$this->eleveFormId.'bf_eleve' => $eleveId,
|
||||||
'listeListeMatierebf_matiere' => $matiereId
|
'listeListeMatierebf_matiere' => $matiereId
|
||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
|
|
Loading…
Reference in a new issue