Loading data/privileges.php +2 −0 Changes for data/privileges.php: 2 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -444,6 +444,8 @@ return [ 'privileges' => [ 'grades-visualisation' => 'Visualisation grades', 'grades-edition' => 'Édition grades', 'corps-visualisation' => 'Visualisation corps', 'corps-edition' => 'Édition corps', ], ], Loading module/Application/config/administration.config.php +9 −0 Changes for module/Application/config/administration.config.php: 9 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -133,6 +133,14 @@ return [ 'order' => 800, 'border-color' => '#BBCF55', ], 'corps' => [ 'label' => 'Gestion des corps', 'icon' => 'fas fa-graduation-cap', 'route' => 'corps', 'resource' => PrivilegeController::getResourceId('Application\Controller\Corps', 'index'), 'order' => 800, 'border-color' => '#BBCF55', ], 'Employeurs' => [ 'border-color' => '#9F491F', 'icon' => 'fas fa-table-list', Loading Loading @@ -290,6 +298,7 @@ return [ Privileges::REFERENTIEL_COMMUN_VOIRIE_VISUALISATION, Privileges::REFERENTIEL_COMMUN_EMPLOYEUR_VISUALISATION, Privileges::NOMENCLATURE_RH_GRADES_VISUALISATION, Privileges::NOMENCLATURE_RH_CORPS_VISUALISATION, Privileges::TYPE_INTERVENTION_VISUALISATION, Privileges::TYPE_RESSOURCE_VISUALISATION, Privileges::PIECE_JUSTIFICATIVE_GESTION_VISUALISATION, Loading module/Application/config/corps.config.php 0 → 100755 +83 −0 Changes for module/Application/config/corps.config.php: 83 added lines, 0 removed lines. 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' => [ 'corps' => [ 'type' => 'Literal', 'options' => [ 'route' => '/corps', 'defaults' => [ 'controller' => 'Application\Controller\Corps', 'action' => 'index', ], ], 'may_terminate' => true, 'child_routes' => [ 'saisie' => [ 'type' => 'Segment', 'options' => [ 'route' => '/saisie[/:corps]', 'constraints' => [ 'corps' => '[0-9]*', ], 'defaults' => [ 'action' => 'saisie', ], ], 'may_terminate' => true, ], 'supprimer' => [ 'type' => 'Segment', 'options' => [ 'route' => '/supprimer/:corps', 'constraints' => [ 'corps' => '[0-9]*', ], 'defaults' => [ 'action' => 'supprimer', ], ], 'may_terminate' => true, ], ], ], ], ], 'bjyauthorize' => [ 'guards' => [ PrivilegeController::class => [ [ 'controller' => 'Application\Controller\Corps', 'action' => ['index'], 'privileges' => [Privileges::NOMENCLATURE_RH_CORPS_VISUALISATION], ], [ 'controller' => 'Application\Controller\Corps', 'action' => ['saisie', 'supprimer'], 'privileges' => [Privileges::NOMENCLATURE_RH_CORPS_EDITION], ], ], ], ], 'controllers' => [ 'factories' => [ 'Application\Controller\Corps' => Controller\Factory\CorpsControllerFactory::class, ], ], 'form_elements' => [ 'factories' => [ Form\Corps\CorpsSaisieForm::class => Form\Corps\CorpsSaisieFormFactory::class, ], ], ]; module/Application/src/Controller/CorpsController.php 0 → 100644 +74 −0 Changes for module/Application/src/Controller/CorpsController.php: 74 added lines, 0 removed lines. Original line number Diff line number Diff line <?php /* * @author JORIOT Florian <florian.joriot at unicaen.fr> */ namespace Application\Controller; use Application\Entity\Db\Corps; use Application\Form\Corps\Traits\CorpsSaisieFormAwareTrait; use Application\Service\Traits\CorpsServiceAwareTrait; use UnicaenApp\Service\EntityManagerAwareTrait; use UnicaenApp\View\Model\MessengerViewModel; /** * Description of CorpsController * * @author Florian JORIOT <florian.joriot at unicaen.fr> */ class CorpsController extends AbstractController { use EntityManagerAwareTrait; use CorpsSaisieFormAwareTrait; use CorpsServiceAwareTrait; public function indexAction() { $dql = "SELECT c FROM " . Corps::class . " c WHERE c.histoDestruction is null"; $query = $this->em()->createQuery($dql); $corpss = $query->getResult(); return compact('corpss'); } public function saisieAction() { $corps = $this->getEvent()->getParam('corps'); $form = $this->getFormCorpsSaisie(); if (empty($corps)) { $title = "Création d'un nouveau corps"; $corps = $this->getServiceCorps()->newEntity(); } else { $title = "Édition d'un corps"; } $form->bindRequestSave($corps, $this->getRequest(), function () use ($corps, $form) { $this->getServiceCorps()->save($corps); $this->flashMessenger()->addSuccessMessage( "Ajout réussi" ); }); return compact('form', 'title'); } public function supprimerAction() { $corps = $this->getEvent()->getParam('corps'); $this->getServiceCorps()->delete($corps, true); return new MessengerViewModel(); } } No newline at end of file module/Application/src/Controller/Factory/CorpsControllerFactory.php 0 → 100644 +27 −0 Changes for module/Application/src/Controller/Factory/CorpsControllerFactory.php: 27 added lines, 0 removed lines. Original line number Diff line number Diff line <?php /* * @author JORIOT Florian <florian.joriot at unicaen.fr> */ namespace Application\Controller\Factory; use Application\Controller\CorpsController; use Psr\Container\ContainerInterface; class CorpsControllerFactory { /** * Create controller * * @param ContainerInterface $container * * @return CorpsController */ public function __invoke(ContainerInterface $container, $requestedName, $options = null) { $renderer = $container->get('ViewRenderer'); $controller = new CorpsController($renderer); return $controller; } } No newline at end of file Loading
data/privileges.php +2 −0 Changes for data/privileges.php: 2 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -444,6 +444,8 @@ return [ 'privileges' => [ 'grades-visualisation' => 'Visualisation grades', 'grades-edition' => 'Édition grades', 'corps-visualisation' => 'Visualisation corps', 'corps-edition' => 'Édition corps', ], ], Loading
module/Application/config/administration.config.php +9 −0 Changes for module/Application/config/administration.config.php: 9 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -133,6 +133,14 @@ return [ 'order' => 800, 'border-color' => '#BBCF55', ], 'corps' => [ 'label' => 'Gestion des corps', 'icon' => 'fas fa-graduation-cap', 'route' => 'corps', 'resource' => PrivilegeController::getResourceId('Application\Controller\Corps', 'index'), 'order' => 800, 'border-color' => '#BBCF55', ], 'Employeurs' => [ 'border-color' => '#9F491F', 'icon' => 'fas fa-table-list', Loading Loading @@ -290,6 +298,7 @@ return [ Privileges::REFERENTIEL_COMMUN_VOIRIE_VISUALISATION, Privileges::REFERENTIEL_COMMUN_EMPLOYEUR_VISUALISATION, Privileges::NOMENCLATURE_RH_GRADES_VISUALISATION, Privileges::NOMENCLATURE_RH_CORPS_VISUALISATION, Privileges::TYPE_INTERVENTION_VISUALISATION, Privileges::TYPE_RESSOURCE_VISUALISATION, Privileges::PIECE_JUSTIFICATIVE_GESTION_VISUALISATION, Loading
module/Application/config/corps.config.php 0 → 100755 +83 −0 Changes for module/Application/config/corps.config.php: 83 added lines, 0 removed lines. 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' => [ 'corps' => [ 'type' => 'Literal', 'options' => [ 'route' => '/corps', 'defaults' => [ 'controller' => 'Application\Controller\Corps', 'action' => 'index', ], ], 'may_terminate' => true, 'child_routes' => [ 'saisie' => [ 'type' => 'Segment', 'options' => [ 'route' => '/saisie[/:corps]', 'constraints' => [ 'corps' => '[0-9]*', ], 'defaults' => [ 'action' => 'saisie', ], ], 'may_terminate' => true, ], 'supprimer' => [ 'type' => 'Segment', 'options' => [ 'route' => '/supprimer/:corps', 'constraints' => [ 'corps' => '[0-9]*', ], 'defaults' => [ 'action' => 'supprimer', ], ], 'may_terminate' => true, ], ], ], ], ], 'bjyauthorize' => [ 'guards' => [ PrivilegeController::class => [ [ 'controller' => 'Application\Controller\Corps', 'action' => ['index'], 'privileges' => [Privileges::NOMENCLATURE_RH_CORPS_VISUALISATION], ], [ 'controller' => 'Application\Controller\Corps', 'action' => ['saisie', 'supprimer'], 'privileges' => [Privileges::NOMENCLATURE_RH_CORPS_EDITION], ], ], ], ], 'controllers' => [ 'factories' => [ 'Application\Controller\Corps' => Controller\Factory\CorpsControllerFactory::class, ], ], 'form_elements' => [ 'factories' => [ Form\Corps\CorpsSaisieForm::class => Form\Corps\CorpsSaisieFormFactory::class, ], ], ];
module/Application/src/Controller/CorpsController.php 0 → 100644 +74 −0 Changes for module/Application/src/Controller/CorpsController.php: 74 added lines, 0 removed lines. Original line number Diff line number Diff line <?php /* * @author JORIOT Florian <florian.joriot at unicaen.fr> */ namespace Application\Controller; use Application\Entity\Db\Corps; use Application\Form\Corps\Traits\CorpsSaisieFormAwareTrait; use Application\Service\Traits\CorpsServiceAwareTrait; use UnicaenApp\Service\EntityManagerAwareTrait; use UnicaenApp\View\Model\MessengerViewModel; /** * Description of CorpsController * * @author Florian JORIOT <florian.joriot at unicaen.fr> */ class CorpsController extends AbstractController { use EntityManagerAwareTrait; use CorpsSaisieFormAwareTrait; use CorpsServiceAwareTrait; public function indexAction() { $dql = "SELECT c FROM " . Corps::class . " c WHERE c.histoDestruction is null"; $query = $this->em()->createQuery($dql); $corpss = $query->getResult(); return compact('corpss'); } public function saisieAction() { $corps = $this->getEvent()->getParam('corps'); $form = $this->getFormCorpsSaisie(); if (empty($corps)) { $title = "Création d'un nouveau corps"; $corps = $this->getServiceCorps()->newEntity(); } else { $title = "Édition d'un corps"; } $form->bindRequestSave($corps, $this->getRequest(), function () use ($corps, $form) { $this->getServiceCorps()->save($corps); $this->flashMessenger()->addSuccessMessage( "Ajout réussi" ); }); return compact('form', 'title'); } public function supprimerAction() { $corps = $this->getEvent()->getParam('corps'); $this->getServiceCorps()->delete($corps, true); return new MessengerViewModel(); } } No newline at end of file
module/Application/src/Controller/Factory/CorpsControllerFactory.php 0 → 100644 +27 −0 Changes for module/Application/src/Controller/Factory/CorpsControllerFactory.php: 27 added lines, 0 removed lines. Original line number Diff line number Diff line <?php /* * @author JORIOT Florian <florian.joriot at unicaen.fr> */ namespace Application\Controller\Factory; use Application\Controller\CorpsController; use Psr\Container\ContainerInterface; class CorpsControllerFactory { /** * Create controller * * @param ContainerInterface $container * * @return CorpsController */ public function __invoke(ContainerInterface $container, $requestedName, $options = null) { $renderer = $container->get('ViewRenderer'); $controller = new CorpsController($renderer); return $controller; } } No newline at end of file