Compare commits
11 commits
450836cac5
...
43d586f57b
Author | SHA1 | Date | |
---|---|---|---|
|
43d586f57b | ||
|
cd44b21a8a | ||
|
082e3232de | ||
|
ebf108e354 | ||
|
1ebeee196e | ||
|
1ace33f690 | ||
|
621da28094 | ||
|
2b5cc846c2 | ||
|
bcb1888700 | ||
|
06d8eb8b81 | ||
|
18b0707ffd |
19 changed files with 458 additions and 79 deletions
|
@ -14,7 +14,7 @@ class AbsencesAction extends YesWikiAction
|
||||||
public function run()
|
public function run()
|
||||||
{
|
{
|
||||||
$meeo_config = $this->params->get('meeo');
|
$meeo_config = $this->params->get('meeo');
|
||||||
$formId = $meeo_config['absences']['formId'];
|
$formId = $meeo_config['absencesFormId'];
|
||||||
$eleveIdentifier = 'listefiche'.$meeo_config['elevesFormId'].'bf_eleve';
|
$eleveIdentifier = 'listefiche'.$meeo_config['elevesFormId'].'bf_eleve';
|
||||||
$groupeEE = $meeo_config['groupeEE'];
|
$groupeEE = $meeo_config['groupeEE'];
|
||||||
|
|
||||||
|
|
20
actions/ControleAction.php
Normal file
20
actions/ControleAction.php
Normal 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();
|
||||||
|
}
|
||||||
|
}
|
20
actions/ElevesAction.php
Normal file
20
actions/ElevesAction.php
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use YesWiki\Core\YesWikiAction;
|
||||||
|
use YesWiki\Bazar\Service\EntryManager;
|
||||||
|
use YesWiki\Bazar\Service\ListManager;
|
||||||
|
use YesWiki\Meeo\Service\EleveManager;
|
||||||
|
|
||||||
|
class ElevesAction extends YesWikiAction
|
||||||
|
{
|
||||||
|
public function formatArguments($arg)
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
$eleveManager = $this->getService(EleveManager::class);
|
||||||
|
return $eleveManager->view();
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,8 +3,7 @@
|
||||||
namespace YesWiki\Meeo;
|
namespace YesWiki\Meeo;
|
||||||
|
|
||||||
use YesWiki\Core\YesWikiAction;
|
use YesWiki\Core\YesWikiAction;
|
||||||
use YesWiki\Bazar\Service\EntryManager;
|
use YesWiki\Meeo\Service\NoteManager;
|
||||||
use YesWiki\Core\Service\UserManager;
|
|
||||||
|
|
||||||
class NotesAction extends YesWikiAction
|
class NotesAction extends YesWikiAction
|
||||||
{
|
{
|
||||||
|
@ -15,36 +14,7 @@ class NotesAction extends YesWikiAction
|
||||||
|
|
||||||
public function run()
|
public function run()
|
||||||
{
|
{
|
||||||
$meeo_config = $this->params->get('meeo');
|
$noteManager = $this->getService(NoteManager::class);
|
||||||
$formId = $meeo_config['notes']['formId'];
|
$noteManager->viewBulletins();
|
||||||
$eleveIdentifier = 'listefiche'.$meeo_config['elevesFormId'].'bf_eleve';
|
|
||||||
$groupeEE = $meeo_config['groupeEE'];
|
|
||||||
|
|
||||||
$entryManager = $this->getService(EntryManager::class);
|
|
||||||
$userManager = $this->getService(UserManager::class);
|
|
||||||
|
|
||||||
if ( $userManager->isInGroup($groupeEE, admincheck: false) ) {
|
|
||||||
$eleves = $entryManager->search(['formsIds' => $meeo_config['elevesFormId']]);
|
|
||||||
$entries = $entryManager->search(['formsIds' => $formId]);
|
|
||||||
|
|
||||||
include 'tools/meeo/libs/Bulletin.lib.php';
|
|
||||||
|
|
||||||
$bulletins = [];
|
|
||||||
foreach ( $eleves as $eleve) {
|
|
||||||
$bulletins[] = new Bulletin($this->wiki, $eleve, "Passerelle");
|
|
||||||
}
|
|
||||||
// echo var_dump($eleves);
|
|
||||||
// echo var_dump($entries);
|
|
||||||
// echo var_dump($matieres);
|
|
||||||
return $this->render('@meeo/edu_notes.twig', [
|
|
||||||
"bulletins" => $bulletins,
|
|
||||||
]);
|
|
||||||
} else {
|
|
||||||
$entries = $entryManager->search(['formsIds' => $formId]);
|
|
||||||
|
|
||||||
return $this->render('@meeo/eleve_notes.twig', [
|
|
||||||
"bulletin" => $bulletin,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,15 @@
|
||||||
label: MeeO # Nom affiché dans la barre d'action de l'éditeur
|
label: MeeO # Nom affiché dans la barre d'action de l'éditeur
|
||||||
actions:
|
actions:
|
||||||
absences:
|
absences:
|
||||||
label: _T(MEEO_ABSENCES_LABEL)
|
label: Absences
|
||||||
description: Absences des élèves
|
description: Absences des élèves
|
||||||
notes:
|
notes:
|
||||||
label: _T(MEEO_NOTES_LABEL)
|
label: Notes
|
||||||
description: Notes des élèves
|
description: Notes des élèves
|
||||||
|
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
|
# La liste des actions de ce groupe
|
|
@ -52,10 +52,19 @@ class CreateFormsCommand extends Command
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function createOrUpdate($formManager, $formId, $data) {
|
||||||
|
$existingForm = $formManager->getOne($formId);
|
||||||
|
if ($existingForm)
|
||||||
|
return $formManager->update($data);
|
||||||
|
|
||||||
|
return $formManager->create($data);
|
||||||
|
}
|
||||||
|
|
||||||
private function absencesForm(FormManager $formManager, $meeo_config)
|
private function absencesForm(FormManager $formManager, $meeo_config)
|
||||||
{
|
{
|
||||||
|
$formId = $meeo_config['absencesFormId'];
|
||||||
$data = [
|
$data = [
|
||||||
"bn_id_nature" => $meeo_config['absences']['formId'],
|
"bn_id_nature" => $formId,
|
||||||
"bn_label_nature" => "Absences",
|
"bn_label_nature" => "Absences",
|
||||||
"bn_description" => "Absences des élèves",
|
"bn_description" => "Absences des élèves",
|
||||||
"bn_condition" => "",
|
"bn_condition" => "",
|
||||||
|
@ -64,7 +73,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***5***Elève*** *** *** *** *** ***1*** *** *** * *** * *** *** *** ***
|
listefiche***6***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*** *** *** * *** * *** *** *** ***
|
||||||
|
@ -74,11 +83,7 @@ EOT,
|
||||||
"bn_only_one_entry_message" => null
|
"bn_only_one_entry_message" => null
|
||||||
];
|
];
|
||||||
|
|
||||||
$existingForm = $formManager->getOne($meeo_config['absences']['formId']);
|
$this->createOrUpdate($formManager, $formId, $data);
|
||||||
if ($existingForm)
|
|
||||||
return $formManager->update($data);
|
|
||||||
|
|
||||||
return $formManager->create($data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function matiereList()
|
private function matiereList()
|
||||||
|
@ -87,24 +92,22 @@ EOT,
|
||||||
$tripleStore = $this->wiki->services->get(TripleStore::class);
|
$tripleStore = $this->wiki->services->get(TripleStore::class);
|
||||||
|
|
||||||
if (!$pageManager->getOne('ListeMatiere')) {
|
if (!$pageManager->getOne('ListeMatiere')) {
|
||||||
$pageManager->save('ListeMatière', '{"label":{"francais":"Français","math":"Math"},"titre_liste":"Matieres"}');
|
$pageManager->save('ListeMatiere', '{"label":{"francais":"Français","math":"Math"},"titre_liste":"Matieres"}');
|
||||||
// in case, there is already some triples for 'ListOuinonLms', delete them
|
// in case, there is already some triples for 'ListOuinonLms', delete them
|
||||||
$tripleStore->delete('ListeMatière', 'http://outils-reseaux.org/_vocabulary/type', null);
|
$tripleStore->delete('ListeMatiere', 'http://outils-reseaux.org/_vocabulary/type', null);
|
||||||
// create the triple to specify this page is a list
|
// create the triple to specify this page is a list
|
||||||
$tripleStore->create('ListeMatière', 'http://outils-reseaux.org/_vocabulary/type', 'liste', '', '');
|
$tripleStore->create('ListeMatiere', 'http://outils-reseaux.org/_vocabulary/type', 'liste', '', '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function notesForm(FormManager $formManager, $meeo_config)
|
private function notesForm(FormManager $formManager, $meeo_config)
|
||||||
{
|
{
|
||||||
$existingForm = $formManager->getOne($meeo_config['notes']['formId']);
|
$formId = $meeo_config['notesFormId'];
|
||||||
if ($existingForm)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
$this->matiereList();
|
$this->matiereList();
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
"bn_id_nature" => $meeo_config['notes']['formId'],
|
"bn_id_nature" => $formId,
|
||||||
"bn_label_nature" => "Notes",
|
"bn_label_nature" => "Notes",
|
||||||
"bn_description" => "Notes des élèves",
|
"bn_description" => "Notes des élèves",
|
||||||
"bn_condition" => "",
|
"bn_condition" => "",
|
||||||
|
@ -115,7 +118,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***ListeMatière***Matière*** *** *** ***bf_matiere*** ***1*** *** *** * *** * *** *** *** ***
|
liste***ListeMatière***Matière*** *** *** ***bf_matiere*** ***1*** *** *** * *** * *** *** *** ***
|
||||||
listefiche***5***Elève*** *** *** ***bf_eleve*** ***1*** *** *** * *** * *** *** *** ***
|
listefiche***6***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,
|
||||||
|
@ -124,32 +127,63 @@ EOT,
|
||||||
"bn_only_one_entry_message" => null
|
"bn_only_one_entry_message" => null
|
||||||
];
|
];
|
||||||
|
|
||||||
return $formManager->create($data);
|
$this->createOrUpdate($formManager, $formId, $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function classeList()
|
||||||
|
{
|
||||||
|
$pageManager = $this->wiki->services->get(PageManager::class);
|
||||||
|
$tripleStore = $this->wiki->services->get(TripleStore::class);
|
||||||
|
|
||||||
|
if (!$pageManager->getOne('ListeClasses')) {
|
||||||
|
$pageManager->save('ListeClasses', '{"label":{},"titre_liste":"Classe"}');
|
||||||
|
// in case, there is already some triples for 'ListOuinonLms', delete them
|
||||||
|
$tripleStore->delete('ListeClasses', 'http://outils-reseaux.org/_vocabulary/type', null);
|
||||||
|
// create the triple to specify this page is a list
|
||||||
|
$tripleStore->create('ListeClasses', 'http://outils-reseaux.org/_vocabulary/type', 'liste', '', '');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function elevesForms(FormManager $formManager, $meeo_config) {
|
||||||
|
|
||||||
|
$formId = $meeo_config['elevesFormId'];
|
||||||
|
|
||||||
|
$this->classeList();
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
"bn_id_nature" => $formId,
|
||||||
|
"bn_label_nature" => "Eleves",
|
||||||
|
"bn_description" => "Liste des élèves",
|
||||||
|
"bn_condition" => "",
|
||||||
|
"bn_sem_context" => "",
|
||||||
|
"bn_sem_type" => "",
|
||||||
|
"bn_sem_use_template" => "1",
|
||||||
|
"bn_template" => <<<EOT
|
||||||
|
texte***bf_titre***Nom d'utilisateur*** *** *** *** ***text***1*** *** *** * *** * *** *** *** ***
|
||||||
|
texte***bf_nom***Nom complet*** *** *** *** ***text***1*** *** *** * *** * *** *** *** ***
|
||||||
|
champs_mail***bf_mail***Email*** *** % *** ***form*** ***1***0*** *** * *** % *** *** *** ***
|
||||||
|
liste***ListeClasses***Classe*** *** ***aucune***bf_classe*** ***1*** *** *** * *** * *** *** *** ***
|
||||||
|
EOT,
|
||||||
|
"bn_ce_i18n" => "fr-FR",
|
||||||
|
"bn_only_one_entry" => "N",
|
||||||
|
"bn_only_one_entry_message" => null
|
||||||
|
];
|
||||||
|
|
||||||
|
$this->createOrUpdate($formManager, $formId, $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function execute(InputInterface $input, OutputInterface $output)
|
protected function execute(InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
$formManager = $this->wiki->services->get(FormManager::class);
|
$formManager = $this->wiki->services->get(FormManager::class);
|
||||||
$params = $this->wiki->services->get(ParameterBagInterface::class);
|
$params = $this->wiki->services->get(ParameterBagInterface::class);
|
||||||
if (!$params->has('meeo')) {
|
$meeo_config = $params->get('meeo');
|
||||||
$result = $formManager->getAll();
|
|
||||||
$lastFormId = array_key_last($result);
|
|
||||||
$meeo_config = [
|
|
||||||
'absences' => [
|
|
||||||
'formId' => $lastFormId + 1,
|
|
||||||
],
|
|
||||||
'notes' => [
|
|
||||||
'formId' => $lastFormId + 2,
|
|
||||||
]
|
|
||||||
];
|
|
||||||
} else {
|
|
||||||
$meeo_config = $params->get('meeo');
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->absencesForm($formManager, $meeo_config);
|
$this->absencesForm($formManager, $meeo_config);
|
||||||
|
|
||||||
$this->notesForm($formManager, $meeo_config);
|
$this->notesForm($formManager, $meeo_config);
|
||||||
|
|
||||||
|
$this->elevesForms($formManager, $meeo_config);
|
||||||
|
|
||||||
echo 'Succeed\n';
|
echo 'Succeed\n';
|
||||||
return Command::SUCCESS;
|
return Command::SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
72
commands/UpdateElevesFromYunohostCommand.php
Normal file
72
commands/UpdateElevesFromYunohostCommand.php
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace YesWiki\Meeo\Commands;
|
||||||
|
|
||||||
|
use Symfony\Component\Console\Command\Command;
|
||||||
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||||
|
use YesWiki\Wiki;
|
||||||
|
use YesWiki\Bazar\Service\EntryManager;
|
||||||
|
|
||||||
|
class UpdateElevesFromYunohostCommand extends Command {
|
||||||
|
protected $wiki;
|
||||||
|
|
||||||
|
public function __construct(Wiki &$wiki) {
|
||||||
|
parent::__construct();
|
||||||
|
$this->wiki = $wiki;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function configure() {
|
||||||
|
$this
|
||||||
|
// the name of the command : ./yeswicli helloworld:hello"
|
||||||
|
->setName('meeo:update')
|
||||||
|
// the short description shown while running "./yeswicli list"
|
||||||
|
->setDescription('Update la liste des élèves depuis les utilisateurs Yunohost')
|
||||||
|
|
||||||
|
// the full command description shown when running the command with
|
||||||
|
// the "--help" option
|
||||||
|
// ->setHelp("This command display the message \"Hello !\" with options for uppercase of add a username.\n" .
|
||||||
|
// "The argument \"username\" can be used to add a username. Example : \n" .
|
||||||
|
// "Command line'./yeswicli helloworld:hello \"John Smith\"' gives \"Hello John Smith !\"")
|
||||||
|
|
||||||
|
// add argument for username
|
||||||
|
// second parameter could be InputArgument::OPTIONAL <=> null, InputArgument::REQUIRED, InputArgument::IS_ARRAY
|
||||||
|
// third parameter is the description
|
||||||
|
// forth parameter is default value
|
||||||
|
// ->addArgument('username', InputArgument::OPTIONAL, 'Username')
|
||||||
|
|
||||||
|
// add option to display output as UPPERCASE
|
||||||
|
// second parameter null|string is shortcut
|
||||||
|
// third parameter null|int could be InputOption::VALUE_NONE <=> null, InputOption::VALUE_REQUIRED
|
||||||
|
// , InputOption::VALUE_OPTIONAL, InputOption::VALUE_IS_ARRAY, InputOption::VALUE_NEGATABLE
|
||||||
|
// forth parameter is the description
|
||||||
|
// ->addOption('uppercase', 'u', InputOption::VALUE_NONE, 'Display output in UPPERCASE')
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function execute(InputInterface $input, OutputInterface $output) {
|
||||||
|
$entryManager = $this->wiki->services->get(EntryManager::class);
|
||||||
|
$params = $this->wiki->services->get(ParameterBagInterface::class);
|
||||||
|
$meeo_config = $params->get('meeo');
|
||||||
|
$yunohostFormId = $meeo_config['yunohostFormId'];
|
||||||
|
$elevesFormId = $meeo_config['elevesFormId'];
|
||||||
|
|
||||||
|
$yunohostEntries = $entryManager->search(['formsIds' => $yunohostFormId]);
|
||||||
|
foreach ($yunohostEntries as $yunohostEntry) {
|
||||||
|
$eleveEntry = $entryManager->search(['formsIds' => $elevesFormId, 'queries' => [
|
||||||
|
'bf_titre' => $yunohostEntry['bf_titre']
|
||||||
|
]]);
|
||||||
|
if ($eleveEntry == null) {
|
||||||
|
$entryManager->create($elevesFormId, [
|
||||||
|
'bf_titre' => $yunohostEntry['bf_titre'],
|
||||||
|
'bf_nom' => $yunohostEntry['bf_nom'],
|
||||||
|
'bf_mail' => $yunohostEntry['bf_mail'],
|
||||||
|
'antispam' => 1
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Command::SUCCESS;
|
||||||
|
}
|
||||||
|
}
|
10
config.yaml
10
config.yaml
|
@ -1,11 +1,17 @@
|
||||||
parameters:
|
parameters:
|
||||||
|
meeo:
|
||||||
|
elevesFormId: 6
|
||||||
|
absencesFormId: 7
|
||||||
|
notesFormId: 8
|
||||||
|
yunohostFormId: 5
|
||||||
|
groupeEE: 'EquipeEducative'
|
||||||
services:
|
services:
|
||||||
_defaults:
|
_defaults:
|
||||||
autowire: true
|
autowire: true
|
||||||
public: true
|
public: true
|
||||||
|
|
||||||
# YesWiki\MeeO\Service\:
|
YesWiki\Meeo\Service\:
|
||||||
# resource: 'services/*'
|
resource: 'services/*'
|
||||||
|
|
||||||
# Allows to use controllers as services
|
# Allows to use controllers as services
|
||||||
# YesWiki\MeeO\Controller\:
|
# YesWiki\MeeO\Controller\:
|
||||||
|
|
35
controllers/ApiController.php
Normal file
35
controllers/ApiController.php
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
<?php
|
||||||
|
namespace YesWiki\Meeo\Controller;
|
||||||
|
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
|
use YesWiki\Core\ApiResponse;
|
||||||
|
use YesWiki\Core\YesWikiController;
|
||||||
|
use YesWiki\Meeo\Service\EleveManager;
|
||||||
|
|
||||||
|
class ApiController extends YesWikiController
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @Route("/api/meeo/eleves",methods={"POST"},options={"acl":{"public"}})
|
||||||
|
*/
|
||||||
|
public function eleveUpdate(Request $request) {
|
||||||
|
$eleveController = $this->getService(EleveManager::class);
|
||||||
|
$content = $request->getContent();
|
||||||
|
|
||||||
|
parse_str($content, $parameters);
|
||||||
|
|
||||||
|
$datas = [];
|
||||||
|
foreach ($parameters as $cle => $valeur) {
|
||||||
|
$clef_action = explode('_', $cle);
|
||||||
|
if ($clef_action[1] == 'classe' && $valeur != 'aucune') {
|
||||||
|
$datas[] = $eleveController->updateClasse($clef_action[0], $valeur);
|
||||||
|
}
|
||||||
|
if ($clef_action[1] == 'del') {
|
||||||
|
$eleveController->del($clef_action[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->wiki->redirect('?Eleves', 200);
|
||||||
|
}
|
||||||
|
}
|
9
javascripts/edu_controle_filter.js
Normal file
9
javascripts/edu_controle_filter.js
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
$(document).ready(function(){
|
||||||
|
$("#classe").on("change", function() {
|
||||||
|
var value = $(this).val().toLowerCase();
|
||||||
|
$("#eleves div.form-group").filter(function() {
|
||||||
|
var text = $(this).attr('classe').toLowerCase();
|
||||||
|
$(this).toggle(text.indexOf(value) > -1);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
|
@ -1,6 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
return [
|
|
||||||
'MEEO_ABSENCES_LABEL' => 'Absences',
|
|
||||||
'MEEO_NOTES_LABEL' => 'Notes',
|
|
||||||
];
|
|
|
@ -1,8 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace YesWiki\Meeo;
|
namespace YesWiki\Meeo\Bulletin;
|
||||||
|
|
||||||
include 'tools/meeo/libs/Matiere.lib.php';
|
include 'tools/meeo/libs/bulletin/Matiere.lib.php';
|
||||||
|
|
||||||
use YesWiki\Bazar\Service\ListManager;
|
use YesWiki\Bazar\Service\ListManager;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace YesWiki\Meeo;
|
namespace YesWiki\Meeo\Bulletin;
|
||||||
|
|
||||||
include 'tools/meeo/libs/Note.lib.php';
|
include 'tools/meeo/libs/bulletin/Note.lib.php';
|
||||||
|
|
||||||
use YesWiki\Bazar\Service\EntryManager;
|
use YesWiki\Bazar\Service\EntryManager;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace YesWiki\Meeo;
|
namespace YesWiki\Meeo\Bulletin;
|
||||||
|
|
||||||
class Note {
|
class Note {
|
||||||
private $intitule;
|
private $intitule;
|
18
libs/controle/Controle.lib.php
Normal file
18
libs/controle/Controle.lib.php
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
46
services/EleveManager.php
Normal file
46
services/EleveManager.php
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace YesWiki\Meeo\Service;
|
||||||
|
|
||||||
|
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||||
|
use YesWiki\Bazar\Service\EntryManager;
|
||||||
|
use YesWiki\Bazar\Service\ListManager;
|
||||||
|
use YesWiki\Wiki;
|
||||||
|
|
||||||
|
class EleveManager {
|
||||||
|
|
||||||
|
private $formId;
|
||||||
|
private $entryManager;
|
||||||
|
private $listManager;
|
||||||
|
private $wiki;
|
||||||
|
|
||||||
|
public function __construct( Wiki $wiki, ParameterBagInterface $params, EntryManager $entryManager, ListManager $listManager)
|
||||||
|
{
|
||||||
|
$meeo_config = $params->get('meeo');
|
||||||
|
$this->wiki = $wiki;
|
||||||
|
$this->formId = $meeo_config['elevesFormId'];
|
||||||
|
$this->entryManager = $entryManager;
|
||||||
|
$this->listManager = $listManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function del($id) {
|
||||||
|
$this->entryManager->delete($id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateClasse($id, $classe) {
|
||||||
|
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->getAll();
|
||||||
|
// echo '<p>'.var_dump($eleves).'</p>';
|
||||||
|
|
||||||
|
$classes = $this->listManager->getOne('ListeClasses');
|
||||||
|
|
||||||
|
return $this->wiki->render('@meeo/edu_eleves.twig', ['eleves' => $eleves, 'classes' => $classes['label']]);
|
||||||
|
}
|
||||||
|
}
|
70
services/NoteManager.php
Normal file
70
services/NoteManager.php
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace YesWiki\Meeo\Service;
|
||||||
|
|
||||||
|
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||||
|
use YesWiki\Bazar\Service\EntryManager;
|
||||||
|
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;
|
||||||
|
protected $params;
|
||||||
|
protected $entryManager;
|
||||||
|
protected $listManager;
|
||||||
|
protected $userManager;
|
||||||
|
|
||||||
|
public function __construct( Wiki $wiki, ParameterBagInterface $params, EntryManager $entryManager, ListManager $listManager, UserManager $userManager)
|
||||||
|
{
|
||||||
|
$this->wiki = $wiki;
|
||||||
|
$this->params = $params;
|
||||||
|
$this->entryManager = $entryManager;
|
||||||
|
$this->listManager = $listManager;
|
||||||
|
$this->userManager = $userManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function viewBulletins() {
|
||||||
|
$meeo_config = $this->params->get('meeo');
|
||||||
|
$formId = $meeo_config['notesFormId'];
|
||||||
|
$eleveIdentifier = 'listefiche'.$meeo_config['elevesFormId'].'bf_eleve';
|
||||||
|
$groupeEE = $meeo_config['groupeEE'];
|
||||||
|
|
||||||
|
if ( $this->userManager->isInGroup($groupeEE, admincheck: false) ) {
|
||||||
|
$eleves = $this->entryManager->search(['formsIds' => $meeo_config['elevesFormId']]);
|
||||||
|
$entries = $this->entryManager->search(['formsIds' => $formId]);
|
||||||
|
|
||||||
|
include 'tools/meeo/libs/bulletin/Bulletin.lib.php';
|
||||||
|
|
||||||
|
$bulletins = [];
|
||||||
|
foreach ( $eleves as $eleve) {
|
||||||
|
//TODO enlever "Passerelle"
|
||||||
|
$bulletins[] = new Bulletin($this->wiki, $eleve, "Passerelle");
|
||||||
|
}
|
||||||
|
// echo var_dump($eleves);
|
||||||
|
// echo var_dump($entries);
|
||||||
|
// echo var_dump($matieres);
|
||||||
|
return $this->wiki->render('@meeo/edu_notes.twig', [
|
||||||
|
"bulletins" => $bulletins,
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
$entries = $entryManager->search(['formsIds' => $formId]);
|
||||||
|
|
||||||
|
return $this->wiki->render('@meeo/eleve_notes.twig', [
|
||||||
|
"bulletin" => $bulletin,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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]);
|
||||||
|
}
|
||||||
|
}
|
50
templates/edu_controle.twig
Normal file
50
templates/edu_controle.twig
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
{{ include_javascript('tools/meeo/javascripts/edu_controle_filter.js') }}
|
||||||
|
|
||||||
|
<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" required>
|
||||||
|
</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" required>
|
||||||
|
{% 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" required>
|
||||||
|
{% 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>
|
||||||
|
<div id="eleves">
|
||||||
|
{% for eleve in eleves %}
|
||||||
|
<div class="form-group" classe="{{ eleve['listeListeClassesbf_classe'] }}" hidden>
|
||||||
|
<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" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<button type="submit" class="btn btn-default">Envoyer</button>
|
||||||
|
</form>
|
29
templates/edu_eleves.twig
Normal file
29
templates/edu_eleves.twig
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-8"><h2>Nom</h5></div>
|
||||||
|
<div class="col-sm-3"><h2>Classe</h2></div>
|
||||||
|
<div class="col-sm-1 text-center"><h2><span class="glyphicon glyphicon-trash"></span></h2></div>
|
||||||
|
</div>
|
||||||
|
<form action="?api/meeo/eleves" method="post" enctype="application/json">
|
||||||
|
{% for eleve in eleves|sort %}
|
||||||
|
<div class="row form-group" id="{{eleve['id_fiche']}}" name="{{eleve['id_fiche']}}">
|
||||||
|
<div class="col-sm-8">{{ eleve['bf_nom'] }}</div>
|
||||||
|
<div class="col-sm-3">
|
||||||
|
<select id="{{eleve['id_fiche']}}_classe" name="{{eleve['id_fiche']}}_classe" class="form-control">
|
||||||
|
{% for identifier, classe in classes %}
|
||||||
|
<option value="{{identifier}}" {% if eleve['listeListeClassesbf_classe'] == identifier %}selected{% endif %} >{{classe}}</option>
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-1 text-center">
|
||||||
|
<input id="{{eleve['id_fiche']}}_del" name="{{eleve['id_fiche']}}_del" class="form-check-input" type="checkbox" value=""/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-12 text-center">
|
||||||
|
<button class="btn btn-default">Valider</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
Loading…
Reference in a new issue