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 YesWiki\Wiki;
|
||||
use YesWiki\Bazar\Service\FormManager;
|
||||
use YesWiki\Core\Service\PageManager;
|
||||
use YesWiki\Core\Service\TripleStore;
|
||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||
|
||||
class CreateFormsCommand extends Command
|
||||
|
@ -78,12 +80,28 @@ EOT,
|
|||
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)
|
||||
{
|
||||
$existingForm = $formManager->getOne($meeo_config['notes']['formId']);
|
||||
if ($existingForm)
|
||||
return false;
|
||||
|
||||
$this->matiereList();
|
||||
|
||||
$data = [
|
||||
"bn_id_nature" => $meeo_config['notes']['formId'],
|
||||
"bn_label_nature" => "Notes",
|
||||
|
@ -94,8 +112,9 @@ EOT,
|
|||
"bn_sem_use_template" => "1",
|
||||
"bn_template" => <<<EOT
|
||||
titre*** ***Titre Automatique***
|
||||
liste***ListeMatière***Matière*** *** *** ***bf_matiere*** ***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*** *** *** * *** * *** *** *** ***
|
||||
EOT,
|
||||
"bn_ce_i18n" => "fr-FR",
|
||||
|
@ -108,7 +127,6 @@ EOT,
|
|||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
|
||||
$formManager = $this->wiki->services->get(FormManager::class);
|
||||
$params = $this->wiki->services->get(ParameterBagInterface::class);
|
||||
if (!$params->has('meeo')) {
|
||||
|
@ -116,22 +134,21 @@ EOT,
|
|||
$lastFormId = array_key_last($result);
|
||||
$meeo_config = [
|
||||
'absences' => [
|
||||
'formId' => $lastFormId,
|
||||
'formId' => $lastFormId + 1,
|
||||
],
|
||||
'notes' => [
|
||||
'formId' => $lastFormId + 1,
|
||||
'formId' => $lastFormId + 2,
|
||||
]
|
||||
];
|
||||
} else {
|
||||
$meeo_config = $params->get('meeo');
|
||||
}
|
||||
|
||||
if (!$this->absencesForm($formManager, $meeo_config))
|
||||
return Command::FAILURE;
|
||||
$this->absencesForm($formManager, $meeo_config);
|
||||
|
||||
if (!$this->notesForm($formManager, $meeo_config))
|
||||
return Command::FAILURE;
|
||||
$this->notesForm($formManager, $meeo_config);
|
||||
|
||||
echo 'Succeed\n';
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue