Loading data/privileges.php +2 −0 Original line number Diff line number Diff line Loading @@ -11,6 +11,8 @@ return [ 'element-synchronisation' => 'Enseignements - Synchronisation', 'etape-visualisation' => 'Formations - Visualisation', 'etape-edition' => 'Formations - Édition', 'type-formation-visualisation' => 'Type formations - Visualisation', 'type-formation-edition' => 'Type formations - Édition', 'centres-cout-edition' => 'Centres de coûts - Édition', 'modulateurs-edition' => 'Modulateurs - Édition', 'taux-mixite-edition' => 'Taux de mixité - Édition', Loading module/Application/config/administration.config.php +10 −1 Original line number Diff line number Diff line Loading @@ -160,6 +160,14 @@ return [ 'order' => 85, 'border - color' => '#111', ], 'gestion-type-formation' => [ 'label' => 'Gestion des types de formations', 'icon' => 'fas fa-table-list', 'route' => 'type-formation', 'resource' => PrivilegeController::getResourceId('Application\Controller\TypeFormation', 'index'), 'order' => 86, 'border - color' => '#111', ], 'gestion-intervenant' => [ 'label' => 'Gestion intervenants (Statuts, PJ, etc...)', 'icon' => 'fas fa-table-list', Loading Loading @@ -245,7 +253,8 @@ return [ 'administration-referentiel-commun', 'administration-nomenclature-rh', 'administration-periode', 'administration-etablissement',], 'administration-etablissement', 'administration-type-formation',], 'privileges' => [ Privileges::IMPORT_ECARTS, Privileges::IMPORT_MAJ, Loading module/Application/config/type-formation.config.php 0 → 100755 +123 −0 Original line number Diff line number Diff line <?php /* * @author JORIOT Florian <florian.joriot at unicaen.fr> */ namespace Application; use Application\Provider\Privilege\Privileges; use UnicaenAuth\Guard\PrivilegeController; return [ 'router' => [ 'routes' => [ 'type-formation' => [ 'type' => 'Literal', 'options' => [ 'route' => '/type-formation', 'defaults' => [ 'controller' => 'Application\Controller\TypeFormation', 'action' => 'index', ], ], 'may_terminate' => true, 'child_routes' => [ 'saisie' => [ 'type' => 'Segment', 'options' => [ 'route' => '/saisie[/:typeFormation]', 'constraints' => [ 'typeFormation' => '[0-9]*', ], 'defaults' => [ 'action' => 'saisie', ], ], 'may_terminate' => true, ], 'supprimer' => [ 'type' => 'Segment', 'options' => [ 'route' => '/supprimer/:typeFormation', 'constraints' => [ 'typeFormation' => '[0-9]*', ], 'defaults' => [ 'action' => 'supprimer', ], ], 'may_terminate' => true, ], 'saisie-groupe' => [ 'type' => 'Segment', 'options' => [ 'route' => '/saisie-groupe[/:groupeTypeFormation]', 'constraints' => [ 'groupeTypeFormation' => '[0-9]*', ], 'defaults' => [ 'action' => 'saisieGroupe', ], ], 'may_terminate' => true, ], 'supprimer-groupe' => [ 'type' => 'Segment', 'options' => [ 'route' => '/supprimer-groupe/:groupeTypeFormation', 'constraints' => [ 'groupeTypeFormation' => '[0-9]*', ], 'defaults' => [ 'action' => 'supprimerGroupe', ], ], 'may_terminate' => true, ], 'trier' => [ 'type' => 'Segment', 'options' => [ 'route' => '/trier/', 'constraints' => [ ], 'defaults' => [ 'action' => 'trier', ], ], 'may_terminate' => true, ], ], ], ], ], 'bjyauthorize' => [ 'guards' => [ PrivilegeController::class => [ [ 'controller' => 'Application\Controller\TypeFormation', 'action' => ['index'], 'privileges' => [Privileges::ODF_TYPE_FORMATION_VISUALISATION], ], [ 'controller' => 'Application\Controller\TypeFormation', 'action' => ['saisie', 'supprimer', 'saisieGroupe', 'supprimerGroupe', "trier"], 'privileges' => [Privileges::ODF_TYPE_FORMATION_EDITION], ], ], ], ], 'controllers' => [ 'factories' => [ 'Application\Controller\TypeFormation' => Controller\Factory\TypeFormationControllerFactory::class, 'Application\Controller\GroupeTypeFormation' => Controller\Factory\GroupeTypeFormationControllerFactory::class, ], ], 'form_elements' => [ 'factories' => [ Form\GroupeTypeFormation\GroupeTypeFormationSaisieForm::class => Form\GroupeTypeFormation\GroupeTypeFormationSaisieFormFactory::class, Form\TypeFormation\TypeFormationSaisieForm::class => Form\TypeFormation\TypeFormationSaisieFormFactory::class, ], ], ]; module/Application/src/Controller/Factory/TypeFormationControllerFactory.php 0 → 100644 +27 −0 Original line number Diff line number Diff line <?php /* * @author JORIOT Florian <florian.joriot at unicaen.fr> */ namespace Application\Controller\Factory; use Application\Controller\TypeFormationController; use Psr\Container\ContainerInterface; class TypeFormationControllerFactory { /** * Create controller * * @param ContainerInterface $container * * @return TypeFormationController */ public function __invoke(ContainerInterface $container, $requestedName, $options = null) { $renderer = $container->get('ViewRenderer'); $controller = new TypeFormationController($renderer); return $controller; } } No newline at end of file module/Application/src/Controller/TypeFormationController.php 0 → 100644 +136 −0 Original line number Diff line number Diff line <?php /* * @author JORIOT Florian <florian.joriot at unicaen.fr> */ namespace Application\Controller; use Application\Entity\Db\GroupeTypeFormation; use Application\Form\GroupeTypeFormation\Traits\GroupeTypeFormationSaisieFormAwareTrait; use Application\Form\TypeFormation\Traits\TypeFormationSaisieFormAwareTrait; use Application\Service\Traits\GroupeTypeFormationServiceAwareTrait; use Application\Service\Traits\TypeFormationServiceAwareTrait; use UnicaenApp\Service\EntityManagerAwareTrait; use UnicaenApp\View\Model\MessengerViewModel; /** * Description of TypeFormationController * * @author Florian JORIOT <florian.joriot at unicaen.fr> */ class TypeFormationController extends AbstractController { use EntityManagerAwareTrait; use TypeFormationSaisieFormAwareTrait; use TypeFormationServiceAwareTrait; use GroupeTypeFormationSaisieFormAwareTrait; use GroupeTypeFormationServiceAwareTrait; public function indexAction() { $dql = "SELECT gtf,tf FROM " . GroupeTypeFormation::class . " gtf LEFT JOIN gtf.typeFormation tf WITH tf.histoDestruction is null WHERE gtf.histoDestruction is null ORDER BY gtf.ordre"; $query = $this->em()->createQuery($dql); $groupeTypeFormations = $query->getResult(); return compact('groupeTypeFormations'); } public function saisieAction() { $typeFormations = $this->getEvent()->getParam('typeFormation'); $form = $this->getFormTypeFormationSaisie(); if (empty($typeFormations)) { $title = "Création d'une nouvelle formation"; $typeFormations = $this->getServiceTypeFormation()->newEntity(); } else { $title = "Edition d'une formation"; } $form->bindRequestSave($typeFormations, $this->getRequest(), function () use ($typeFormations, $form) { $this->getServiceTypeFormation()->save($typeFormations); $this->flashMessenger()->addSuccessMessage( "Ajout réussis" ); }); return compact('form', 'title'); } public function saisieGroupeAction() { $groupeTypeFormation = $this->getEvent()->getParam('groupeTypeFormation'); $form = $this->getFormGroupeTypeFormationSaisie(); if (empty($groupeTypeFormation)) { $title = "Création d'un nouveau groupe de types de formations"; $groupeTypeFormation = $this->getServiceGroupeTypeFormation()->newEntity(); } else { $title = "Edition d'un groupe de type de formations"; } $form->bindRequestSave($groupeTypeFormation, $this->getRequest(), function () use ($groupeTypeFormation, $form) { $this->getServiceTypeFormation()->save($groupeTypeFormation); $this->flashMessenger()->addSuccessMessage( "Ajout réussis" ); }); return compact('form', 'title'); } public function supprimerAction() { // $typeformation = $this->getEvent()->getParam('typeformation'); // $this->getServicetypeformation()->delete($typeformation, false); // // return new MessengerViewModel(); } public function supprimerGroupeAction() { // $typeformation = $this->getEvent()->getParam('typeformation'); // $this->getServicetypeformation()->delete($typeformation, false); // // return new MessengerViewModel(); } public function trierAction() { $champsIds = explode(',', $this->params()->fromPost('champsIds', '')); $ordre = 1; foreach ($champsIds as $champId) { $sp = $this->getServiceGroupeTypeFormation()->get($champId); if ($sp) { $sp->setOrdre($ordre); $ordre++; $this->getServiceGroupeTypeFormation()->save($sp); } } return new MessengerViewModel(); } } No newline at end of file Loading
data/privileges.php +2 −0 Original line number Diff line number Diff line Loading @@ -11,6 +11,8 @@ return [ 'element-synchronisation' => 'Enseignements - Synchronisation', 'etape-visualisation' => 'Formations - Visualisation', 'etape-edition' => 'Formations - Édition', 'type-formation-visualisation' => 'Type formations - Visualisation', 'type-formation-edition' => 'Type formations - Édition', 'centres-cout-edition' => 'Centres de coûts - Édition', 'modulateurs-edition' => 'Modulateurs - Édition', 'taux-mixite-edition' => 'Taux de mixité - Édition', Loading
module/Application/config/administration.config.php +10 −1 Original line number Diff line number Diff line Loading @@ -160,6 +160,14 @@ return [ 'order' => 85, 'border - color' => '#111', ], 'gestion-type-formation' => [ 'label' => 'Gestion des types de formations', 'icon' => 'fas fa-table-list', 'route' => 'type-formation', 'resource' => PrivilegeController::getResourceId('Application\Controller\TypeFormation', 'index'), 'order' => 86, 'border - color' => '#111', ], 'gestion-intervenant' => [ 'label' => 'Gestion intervenants (Statuts, PJ, etc...)', 'icon' => 'fas fa-table-list', Loading Loading @@ -245,7 +253,8 @@ return [ 'administration-referentiel-commun', 'administration-nomenclature-rh', 'administration-periode', 'administration-etablissement',], 'administration-etablissement', 'administration-type-formation',], 'privileges' => [ Privileges::IMPORT_ECARTS, Privileges::IMPORT_MAJ, Loading
module/Application/config/type-formation.config.php 0 → 100755 +123 −0 Original line number Diff line number Diff line <?php /* * @author JORIOT Florian <florian.joriot at unicaen.fr> */ namespace Application; use Application\Provider\Privilege\Privileges; use UnicaenAuth\Guard\PrivilegeController; return [ 'router' => [ 'routes' => [ 'type-formation' => [ 'type' => 'Literal', 'options' => [ 'route' => '/type-formation', 'defaults' => [ 'controller' => 'Application\Controller\TypeFormation', 'action' => 'index', ], ], 'may_terminate' => true, 'child_routes' => [ 'saisie' => [ 'type' => 'Segment', 'options' => [ 'route' => '/saisie[/:typeFormation]', 'constraints' => [ 'typeFormation' => '[0-9]*', ], 'defaults' => [ 'action' => 'saisie', ], ], 'may_terminate' => true, ], 'supprimer' => [ 'type' => 'Segment', 'options' => [ 'route' => '/supprimer/:typeFormation', 'constraints' => [ 'typeFormation' => '[0-9]*', ], 'defaults' => [ 'action' => 'supprimer', ], ], 'may_terminate' => true, ], 'saisie-groupe' => [ 'type' => 'Segment', 'options' => [ 'route' => '/saisie-groupe[/:groupeTypeFormation]', 'constraints' => [ 'groupeTypeFormation' => '[0-9]*', ], 'defaults' => [ 'action' => 'saisieGroupe', ], ], 'may_terminate' => true, ], 'supprimer-groupe' => [ 'type' => 'Segment', 'options' => [ 'route' => '/supprimer-groupe/:groupeTypeFormation', 'constraints' => [ 'groupeTypeFormation' => '[0-9]*', ], 'defaults' => [ 'action' => 'supprimerGroupe', ], ], 'may_terminate' => true, ], 'trier' => [ 'type' => 'Segment', 'options' => [ 'route' => '/trier/', 'constraints' => [ ], 'defaults' => [ 'action' => 'trier', ], ], 'may_terminate' => true, ], ], ], ], ], 'bjyauthorize' => [ 'guards' => [ PrivilegeController::class => [ [ 'controller' => 'Application\Controller\TypeFormation', 'action' => ['index'], 'privileges' => [Privileges::ODF_TYPE_FORMATION_VISUALISATION], ], [ 'controller' => 'Application\Controller\TypeFormation', 'action' => ['saisie', 'supprimer', 'saisieGroupe', 'supprimerGroupe', "trier"], 'privileges' => [Privileges::ODF_TYPE_FORMATION_EDITION], ], ], ], ], 'controllers' => [ 'factories' => [ 'Application\Controller\TypeFormation' => Controller\Factory\TypeFormationControllerFactory::class, 'Application\Controller\GroupeTypeFormation' => Controller\Factory\GroupeTypeFormationControllerFactory::class, ], ], 'form_elements' => [ 'factories' => [ Form\GroupeTypeFormation\GroupeTypeFormationSaisieForm::class => Form\GroupeTypeFormation\GroupeTypeFormationSaisieFormFactory::class, Form\TypeFormation\TypeFormationSaisieForm::class => Form\TypeFormation\TypeFormationSaisieFormFactory::class, ], ], ];
module/Application/src/Controller/Factory/TypeFormationControllerFactory.php 0 → 100644 +27 −0 Original line number Diff line number Diff line <?php /* * @author JORIOT Florian <florian.joriot at unicaen.fr> */ namespace Application\Controller\Factory; use Application\Controller\TypeFormationController; use Psr\Container\ContainerInterface; class TypeFormationControllerFactory { /** * Create controller * * @param ContainerInterface $container * * @return TypeFormationController */ public function __invoke(ContainerInterface $container, $requestedName, $options = null) { $renderer = $container->get('ViewRenderer'); $controller = new TypeFormationController($renderer); return $controller; } } No newline at end of file
module/Application/src/Controller/TypeFormationController.php 0 → 100644 +136 −0 Original line number Diff line number Diff line <?php /* * @author JORIOT Florian <florian.joriot at unicaen.fr> */ namespace Application\Controller; use Application\Entity\Db\GroupeTypeFormation; use Application\Form\GroupeTypeFormation\Traits\GroupeTypeFormationSaisieFormAwareTrait; use Application\Form\TypeFormation\Traits\TypeFormationSaisieFormAwareTrait; use Application\Service\Traits\GroupeTypeFormationServiceAwareTrait; use Application\Service\Traits\TypeFormationServiceAwareTrait; use UnicaenApp\Service\EntityManagerAwareTrait; use UnicaenApp\View\Model\MessengerViewModel; /** * Description of TypeFormationController * * @author Florian JORIOT <florian.joriot at unicaen.fr> */ class TypeFormationController extends AbstractController { use EntityManagerAwareTrait; use TypeFormationSaisieFormAwareTrait; use TypeFormationServiceAwareTrait; use GroupeTypeFormationSaisieFormAwareTrait; use GroupeTypeFormationServiceAwareTrait; public function indexAction() { $dql = "SELECT gtf,tf FROM " . GroupeTypeFormation::class . " gtf LEFT JOIN gtf.typeFormation tf WITH tf.histoDestruction is null WHERE gtf.histoDestruction is null ORDER BY gtf.ordre"; $query = $this->em()->createQuery($dql); $groupeTypeFormations = $query->getResult(); return compact('groupeTypeFormations'); } public function saisieAction() { $typeFormations = $this->getEvent()->getParam('typeFormation'); $form = $this->getFormTypeFormationSaisie(); if (empty($typeFormations)) { $title = "Création d'une nouvelle formation"; $typeFormations = $this->getServiceTypeFormation()->newEntity(); } else { $title = "Edition d'une formation"; } $form->bindRequestSave($typeFormations, $this->getRequest(), function () use ($typeFormations, $form) { $this->getServiceTypeFormation()->save($typeFormations); $this->flashMessenger()->addSuccessMessage( "Ajout réussis" ); }); return compact('form', 'title'); } public function saisieGroupeAction() { $groupeTypeFormation = $this->getEvent()->getParam('groupeTypeFormation'); $form = $this->getFormGroupeTypeFormationSaisie(); if (empty($groupeTypeFormation)) { $title = "Création d'un nouveau groupe de types de formations"; $groupeTypeFormation = $this->getServiceGroupeTypeFormation()->newEntity(); } else { $title = "Edition d'un groupe de type de formations"; } $form->bindRequestSave($groupeTypeFormation, $this->getRequest(), function () use ($groupeTypeFormation, $form) { $this->getServiceTypeFormation()->save($groupeTypeFormation); $this->flashMessenger()->addSuccessMessage( "Ajout réussis" ); }); return compact('form', 'title'); } public function supprimerAction() { // $typeformation = $this->getEvent()->getParam('typeformation'); // $this->getServicetypeformation()->delete($typeformation, false); // // return new MessengerViewModel(); } public function supprimerGroupeAction() { // $typeformation = $this->getEvent()->getParam('typeformation'); // $this->getServicetypeformation()->delete($typeformation, false); // // return new MessengerViewModel(); } public function trierAction() { $champsIds = explode(',', $this->params()->fromPost('champsIds', '')); $ordre = 1; foreach ($champsIds as $champId) { $sp = $this->getServiceGroupeTypeFormation()->get($champId); if ($sp) { $sp->setOrdre($ordre); $ordre++; $this->getServiceGroupeTypeFormation()->save($sp); } } return new MessengerViewModel(); } } No newline at end of file