Add ListeMatiere
This commit is contained in:
parent
62b3501427
commit
b1260c72e2
1 changed files with 25 additions and 8 deletions
|
@ -9,6 +9,8 @@ use Symfony\Component\Console\Input\InputOption;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
use YesWiki\Wiki;
|
use YesWiki\Wiki;
|
||||||
use YesWiki\Bazar\Service\FormManager;
|
use YesWiki\Bazar\Service\FormManager;
|
||||||
|
use YesWiki\Core\Service\PageManager;
|
||||||
|
use YesWiki\Core\Service\TripleStore;
|
||||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||||
|
|
||||||
class CreateFormsCommand extends Command
|
class CreateFormsCommand extends Command
|
||||||
|
@ -78,12 +80,28 @@ EOT,
|
||||||
return $formManager->create($data);
|
return $formManager->create($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function matiereList()
|
||||||
|
{
|
||||||
|
$pageManager = $this->wiki->services->get(PageManager::class);
|
||||||
|
$tripleStore = $this->wiki->services->get(TripleStore::class);
|
||||||
|
|
||||||
|
if (!$pageManager->getOne('ListeMatiere')) {
|
||||||
|
$pageManager->save('ListeMatière', '{"label":{"francais":"Français","math":"Math"},"titre_liste":"Matieres"}');
|
||||||
|
// in case, there is already some triples for 'ListOuinonLms', delete them
|
||||||
|
$tripleStore->delete('ListeMatière', 'http://outils-reseaux.org/_vocabulary/type', null);
|
||||||
|
// create the triple to specify this page is a list
|
||||||
|
$tripleStore->create('ListeMatière', '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']);
|
$existingForm = $formManager->getOne($meeo_config['notes']['formId']);
|
||||||
if ($existingForm)
|
if ($existingForm)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
$this->matiereList();
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
"bn_id_nature" => $meeo_config['notes']['formId'],
|
"bn_id_nature" => $meeo_config['notes']['formId'],
|
||||||
"bn_label_nature" => "Notes",
|
"bn_label_nature" => "Notes",
|
||||||
|
@ -94,8 +112,9 @@ EOT,
|
||||||
"bn_sem_use_template" => "1",
|
"bn_sem_use_template" => "1",
|
||||||
"bn_template" => <<<EOT
|
"bn_template" => <<<EOT
|
||||||
titre*** ***Titre Automatique***
|
titre*** ***Titre Automatique***
|
||||||
|
liste***ListeMatière***Matière*** *** *** ***bf_matiere*** ***1*** *** *** * *** * *** *** *** ***
|
||||||
listefiche***5***Elève*** *** *** ***bf_eleve*** ***1*** *** *** * *** * *** *** *** ***
|
listefiche***5***Elève*** *** *** ***bf_eleve*** ***1*** *** *** * *** * *** *** *** ***
|
||||||
texte***bf_note***Note***0***20*** *** ***number***0*** *** *** * *** * *** *** *** ***
|
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,
|
||||||
"bn_ce_i18n" => "fr-FR",
|
"bn_ce_i18n" => "fr-FR",
|
||||||
|
@ -108,7 +127,6 @@ EOT,
|
||||||
|
|
||||||
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')) {
|
if (!$params->has('meeo')) {
|
||||||
|
@ -116,22 +134,21 @@ EOT,
|
||||||
$lastFormId = array_key_last($result);
|
$lastFormId = array_key_last($result);
|
||||||
$meeo_config = [
|
$meeo_config = [
|
||||||
'absences' => [
|
'absences' => [
|
||||||
'formId' => $lastFormId,
|
'formId' => $lastFormId + 1,
|
||||||
],
|
],
|
||||||
'notes' => [
|
'notes' => [
|
||||||
'formId' => $lastFormId + 1,
|
'formId' => $lastFormId + 2,
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
} else {
|
} else {
|
||||||
$meeo_config = $params->get('meeo');
|
$meeo_config = $params->get('meeo');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->absencesForm($formManager, $meeo_config))
|
$this->absencesForm($formManager, $meeo_config);
|
||||||
return Command::FAILURE;
|
|
||||||
|
|
||||||
if (!$this->notesForm($formManager, $meeo_config))
|
$this->notesForm($formManager, $meeo_config);
|
||||||
return Command::FAILURE;
|
|
||||||
|
|
||||||
|
echo 'Succeed\n';
|
||||||
return Command::SUCCESS;
|
return Command::SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue