Loading module/Application/config/merged/ressource-rh.config.php +48 −0 Original line number Diff line number Diff line Loading @@ -11,6 +11,10 @@ use Application\Form\RessourceRh\DomaineHydrator; use Application\Form\RessourceRh\FonctionForm; use Application\Form\RessourceRh\FonctionFormFactory; use Application\Form\RessourceRh\FonctionHydrator; use Application\Form\RessourceRh\GradeForm; use Application\Form\RessourceRh\GradeFormFactory; use Application\Form\RessourceRh\GradeHydrator; use Application\Form\RessourceRh\GradeHydratorFactory; use Application\Form\RessourceRh\MetierFamilleForm; use Application\Form\RessourceRh\MetierFamilleFormFactory; use Application\Form\RessourceRh\MetierFamilleHydrator; Loading Loading @@ -57,6 +61,7 @@ return [ 'creer-famille', 'ajouter-domaine', 'ajouter-fonction', 'ajouter-grade', ], 'privileges' => [ RessourceRhPrivileges::AJOUTER, Loading @@ -72,6 +77,7 @@ return [ 'modifier-famille', 'modifier-domaine', 'modifier-fonction', 'modifier-grade', ], 'privileges' => [ RessourceRhPrivileges::MODIFIER, Loading @@ -87,6 +93,7 @@ return [ 'effacer-famille', 'supprimer-domaine', 'supprimer-fonction', 'supprimer-grade', ], 'privileges' => [ RessourceRhPrivileges::EFFACER, Loading Loading @@ -386,6 +393,45 @@ return [ ], ], ], 'grade' => [ 'type' => Literal::class, 'options' => [ 'route' => '/grade', ], 'may_terminate' => false, 'child_routes' => [ 'ajouter' => [ 'type' => Literal::class, 'options' => [ 'route' => '/ajouter', 'defaults' => [ 'controller' => RessourceRhController::class, 'action' => 'ajouter-grade', ], ], ], 'modifier' => [ 'type' => Segment::class, 'options' => [ 'route' => '/modifier/:grade', 'defaults' => [ 'controller' => RessourceRhController::class, 'action' => 'modifier-grade', ], ], ], 'supprimer' => [ 'type' => Segment::class, 'options' => [ 'route' => '/supprimer/:grade', 'defaults' => [ 'controller' => RessourceRhController::class, 'action' => 'supprimer-grade', ], ], ], ], ], ], ], ], Loading @@ -412,6 +458,7 @@ return [ MetierFamilleForm::class => MetierFamilleFormFactory::class, DomaineForm::class => DomaineFormFactory::class, FonctionForm::class => FonctionFormFactory::class, GradeForm::class => GradeFormFactory::class, ], ], 'hydrators' => [ Loading @@ -425,6 +472,7 @@ return [ ], 'factories' => [ MetierHydrator::class => MetierHydratorFactory::class, GradeHydrator::class => GradeHydratorFactory::class, ], ] Loading module/Application/src/Application/Controller/RessourceRh/RessourceRhController.php +81 −3 Original line number Diff line number Diff line Loading @@ -7,10 +7,12 @@ use Application\Entity\Db\Corps; use Application\Entity\Db\Correspondance; use Application\Entity\Db\Domaine; use Application\Entity\Db\Fonction; use Application\Entity\Db\Grade; use Application\Entity\Db\Metier; use Application\Entity\Db\MetierFamille; use Application\Form\RessourceRh\DomaineForm; use Application\Form\RessourceRh\FonctionForm; use Application\Form\RessourceRh\GradeForm; use Application\Form\RessourceRh\MetierFamilleForm; use Application\Form\RessourceRh\MetierForm; use Application\Form\RessourceRh\AgentStatusForm; Loading @@ -33,6 +35,7 @@ class RessourceRhController extends AbstractActionController { $familles = $this->getRessourceRhService()->getMetiersFamilles('libelle'); $domaines = $this->getRessourceRhService()->getDomaines('libelle'); $fonctions = $this->getRessourceRhService()->getFonctions('libelle'); $grades = $this->getRessourceRhService()->getGrades(); return new ViewModel([ 'status' => $status, Loading @@ -42,6 +45,7 @@ class RessourceRhController extends AbstractActionController { 'corps' => $corps, 'domaines' => $domaines, 'fonctions' => $fonctions, 'grades' => $grades, ]); } Loading Loading @@ -507,7 +511,7 @@ class RessourceRhController extends AbstractActionController { public function modifierFonctionAction() { /** @var Domaine $domaine */ /** @var Fonction $fonction */ $fonctionId = $this->params()->fromRoute('fonction'); $fonction = $this->getRessourceRhService()->getFonction($fonctionId); Loading Loading @@ -537,15 +541,89 @@ class RessourceRhController extends AbstractActionController { public function supprimerFonctionAction() { /** @var Domaine $domaine */ /** @var Fonction $fonction */ $fonctionId = $this->params()->fromRoute('fonction'); $fonction = $this->getRessourceRhService()->getFonction($fonctionId); if ($domaine !== null) { if ($fonction !== null) { $this->getRessourceRhService()->deleteFonction($fonction); } $this->redirect()->toRoute('ressource-rh', [], [], true); } /** Grade ******************************************************************************************************/ public function ajouterGradeAction() { /** @var Grade $grade */ $grade = new Grade(); /** @var GradeForm $form */ $form = $this->getServiceLocator()->get('FormElementManager')->get(GradeForm::class); $form->setAttribute('action', $this->url()->fromRoute('ressource-rh/grade/ajouter', [], [], true)); $form->bind($grade); /** @var Request $request */ $request = $this->getRequest(); if ($request->isPost()) { $data = $request->getPost(); $form->setData($data); if ($form->isValid()) { $this->getRessourceRhService()->createGrade($grade); } } $vm = new ViewModel(); $vm->setTemplate('application/default/default-form'); $vm->setVariables([ 'title' => 'Ajouter un grade', 'form' => $form, ]); return $vm; } public function modifierGradeAction() { /** @var Grade $grade */ $gradeId = $this->params()->fromRoute('grade'); $grade = $this->getRessourceRhService()->getGrade($gradeId); /** @var GradeForm $form */ $form = $this->getServiceLocator()->get('FormElementManager')->get(GradeForm::class); $form->setAttribute('action', $this->url()->fromRoute('ressource-rh/grade/modifier', ['grade' => $grade->getId()], [], true)); $form->bind($grade); /** @var Request $request */ $request = $this->getRequest(); if ($request->isPost()) { $data = $request->getPost(); $form->setData($data); if ($form->isValid()) { $this->getRessourceRhService()->updateGrade($grade); } } $vm = new ViewModel(); $vm->setTemplate('application/default/default-form'); $vm->setVariables([ 'title' => 'Modifier un grade', 'form' => $form, ]); return $vm; } public function supprimerGradeAction() { /** @var Grade $grade */ $gradeId = $this->params()->fromRoute('grade'); $grade = $this->getRessourceRhService()->getGrade($gradeId); if ($grade !== null) { $this->getRessourceRhService()->deleteGrade($grade); } $this->redirect()->toRoute('ressource-rh', [], [], true); } } No newline at end of file module/Application/src/Application/Entity/Db/Grade.php 0 → 100644 +84 −0 Original line number Diff line number Diff line <?php namespace Application\Entity\Db; class Grade { /** @var integer */ private $id; /** @var Corps */ private $corps; /** @var string */ private $libelle; /** @var integer */ private $rang; /** * @return int */ public function getId() { return $this->id; } /** * @return Corps */ public function getCorps() { return $this->corps; } /** * @param Corps $corps * @return Grade */ public function setCorps($corps) { $this->corps = $corps; return $this; } /** * @return string */ public function getLibelle() { return $this->libelle; } /** * @param string $libelle * @return Grade */ public function setLibelle($libelle) { $this->libelle = $libelle; return $this; } public function __toString() { $texte = $this->getCorps()->getLibelle() . " ". $this->getLibelle(); return $texte; } /** * @return int */ public function getRang() { return $this->rang; } /** * @param int $rang * @return Grade */ public function setRang($rang) { $this->rang = $rang; return $this; } } No newline at end of file module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Grade.dcm.xml 0 → 100644 +16 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> <entity name="Application\Entity\Db\Grade" table="grade"> <id name="id" type="integer" column="id"> <generator strategy="IDENTITY"/> </id> <field name="libelle" type="string" length="256" column="libelle" nullable="false" /> <field name="rang" type="integer" column="rang" nullable="true" /> <many-to-one target-entity="Application\Entity\Db\Corps" field="corps"> <join-column name="corps" referenced-column-name="id" /> </many-to-one> </entity> </doctrine-mapping> module/Application/src/Application/Form/RessourceRh/GradeForm.php 0 → 100644 +78 −0 Original line number Diff line number Diff line <?php namespace Application\Form\RessourceRh; use Application\Entity\Db\Corps; use DoctrineModule\Form\Element\ObjectSelect; use UnicaenApp\Service\EntityManagerAwareTrait; use Zend\Form\Element\Button; use Zend\Form\Element\Text; use Zend\Form\Form; class GradeForm extends Form { use EntityManagerAwareTrait; public function init() { // Status $this->add([ 'type' => ObjectSelect::class, 'name' => 'corps', 'options' => [ 'label' => "Corps* :", 'empty_option' => "Sélectionner un corps ...", 'object_manager' => $this->getEntityManager(), 'target_class' => Corps::class, 'property' => 'libelle', 'find_method' => [ 'name' => 'findBy', 'params' => [ 'criteria' => [], 'orderBy' => ['libelle' => 'ASC'], ], ], 'disable_inarray_validator' => true, ], 'attributes' => [ 'id' => 'corps', ], ]); // libelle $this->add([ 'type' => Text::class, 'name' => 'libelle', 'options' => [ 'label' => "Libelle :", ], 'attributes' => [ 'id' => 'libelle', ], ]); // rang $this->add([ 'type' => Text::class, 'name' => 'rang', 'options' => [ 'label' => "Rang :", ], 'attributes' => [ 'id' => 'rang', ], ]); // button $this->add([ 'type' => Button::class, 'name' => 'creer', 'options' => [ 'label' => '<i class="fas fa-save"></i> Enregistrer le grade', 'label_options' => [ 'disable_html_escape' => true, ], ], 'attributes' => [ 'type' => 'submit', 'class' => 'btn btn-primary', ], ]); } } No newline at end of file Loading
module/Application/config/merged/ressource-rh.config.php +48 −0 Original line number Diff line number Diff line Loading @@ -11,6 +11,10 @@ use Application\Form\RessourceRh\DomaineHydrator; use Application\Form\RessourceRh\FonctionForm; use Application\Form\RessourceRh\FonctionFormFactory; use Application\Form\RessourceRh\FonctionHydrator; use Application\Form\RessourceRh\GradeForm; use Application\Form\RessourceRh\GradeFormFactory; use Application\Form\RessourceRh\GradeHydrator; use Application\Form\RessourceRh\GradeHydratorFactory; use Application\Form\RessourceRh\MetierFamilleForm; use Application\Form\RessourceRh\MetierFamilleFormFactory; use Application\Form\RessourceRh\MetierFamilleHydrator; Loading Loading @@ -57,6 +61,7 @@ return [ 'creer-famille', 'ajouter-domaine', 'ajouter-fonction', 'ajouter-grade', ], 'privileges' => [ RessourceRhPrivileges::AJOUTER, Loading @@ -72,6 +77,7 @@ return [ 'modifier-famille', 'modifier-domaine', 'modifier-fonction', 'modifier-grade', ], 'privileges' => [ RessourceRhPrivileges::MODIFIER, Loading @@ -87,6 +93,7 @@ return [ 'effacer-famille', 'supprimer-domaine', 'supprimer-fonction', 'supprimer-grade', ], 'privileges' => [ RessourceRhPrivileges::EFFACER, Loading Loading @@ -386,6 +393,45 @@ return [ ], ], ], 'grade' => [ 'type' => Literal::class, 'options' => [ 'route' => '/grade', ], 'may_terminate' => false, 'child_routes' => [ 'ajouter' => [ 'type' => Literal::class, 'options' => [ 'route' => '/ajouter', 'defaults' => [ 'controller' => RessourceRhController::class, 'action' => 'ajouter-grade', ], ], ], 'modifier' => [ 'type' => Segment::class, 'options' => [ 'route' => '/modifier/:grade', 'defaults' => [ 'controller' => RessourceRhController::class, 'action' => 'modifier-grade', ], ], ], 'supprimer' => [ 'type' => Segment::class, 'options' => [ 'route' => '/supprimer/:grade', 'defaults' => [ 'controller' => RessourceRhController::class, 'action' => 'supprimer-grade', ], ], ], ], ], ], ], ], Loading @@ -412,6 +458,7 @@ return [ MetierFamilleForm::class => MetierFamilleFormFactory::class, DomaineForm::class => DomaineFormFactory::class, FonctionForm::class => FonctionFormFactory::class, GradeForm::class => GradeFormFactory::class, ], ], 'hydrators' => [ Loading @@ -425,6 +472,7 @@ return [ ], 'factories' => [ MetierHydrator::class => MetierHydratorFactory::class, GradeHydrator::class => GradeHydratorFactory::class, ], ] Loading
module/Application/src/Application/Controller/RessourceRh/RessourceRhController.php +81 −3 Original line number Diff line number Diff line Loading @@ -7,10 +7,12 @@ use Application\Entity\Db\Corps; use Application\Entity\Db\Correspondance; use Application\Entity\Db\Domaine; use Application\Entity\Db\Fonction; use Application\Entity\Db\Grade; use Application\Entity\Db\Metier; use Application\Entity\Db\MetierFamille; use Application\Form\RessourceRh\DomaineForm; use Application\Form\RessourceRh\FonctionForm; use Application\Form\RessourceRh\GradeForm; use Application\Form\RessourceRh\MetierFamilleForm; use Application\Form\RessourceRh\MetierForm; use Application\Form\RessourceRh\AgentStatusForm; Loading @@ -33,6 +35,7 @@ class RessourceRhController extends AbstractActionController { $familles = $this->getRessourceRhService()->getMetiersFamilles('libelle'); $domaines = $this->getRessourceRhService()->getDomaines('libelle'); $fonctions = $this->getRessourceRhService()->getFonctions('libelle'); $grades = $this->getRessourceRhService()->getGrades(); return new ViewModel([ 'status' => $status, Loading @@ -42,6 +45,7 @@ class RessourceRhController extends AbstractActionController { 'corps' => $corps, 'domaines' => $domaines, 'fonctions' => $fonctions, 'grades' => $grades, ]); } Loading Loading @@ -507,7 +511,7 @@ class RessourceRhController extends AbstractActionController { public function modifierFonctionAction() { /** @var Domaine $domaine */ /** @var Fonction $fonction */ $fonctionId = $this->params()->fromRoute('fonction'); $fonction = $this->getRessourceRhService()->getFonction($fonctionId); Loading Loading @@ -537,15 +541,89 @@ class RessourceRhController extends AbstractActionController { public function supprimerFonctionAction() { /** @var Domaine $domaine */ /** @var Fonction $fonction */ $fonctionId = $this->params()->fromRoute('fonction'); $fonction = $this->getRessourceRhService()->getFonction($fonctionId); if ($domaine !== null) { if ($fonction !== null) { $this->getRessourceRhService()->deleteFonction($fonction); } $this->redirect()->toRoute('ressource-rh', [], [], true); } /** Grade ******************************************************************************************************/ public function ajouterGradeAction() { /** @var Grade $grade */ $grade = new Grade(); /** @var GradeForm $form */ $form = $this->getServiceLocator()->get('FormElementManager')->get(GradeForm::class); $form->setAttribute('action', $this->url()->fromRoute('ressource-rh/grade/ajouter', [], [], true)); $form->bind($grade); /** @var Request $request */ $request = $this->getRequest(); if ($request->isPost()) { $data = $request->getPost(); $form->setData($data); if ($form->isValid()) { $this->getRessourceRhService()->createGrade($grade); } } $vm = new ViewModel(); $vm->setTemplate('application/default/default-form'); $vm->setVariables([ 'title' => 'Ajouter un grade', 'form' => $form, ]); return $vm; } public function modifierGradeAction() { /** @var Grade $grade */ $gradeId = $this->params()->fromRoute('grade'); $grade = $this->getRessourceRhService()->getGrade($gradeId); /** @var GradeForm $form */ $form = $this->getServiceLocator()->get('FormElementManager')->get(GradeForm::class); $form->setAttribute('action', $this->url()->fromRoute('ressource-rh/grade/modifier', ['grade' => $grade->getId()], [], true)); $form->bind($grade); /** @var Request $request */ $request = $this->getRequest(); if ($request->isPost()) { $data = $request->getPost(); $form->setData($data); if ($form->isValid()) { $this->getRessourceRhService()->updateGrade($grade); } } $vm = new ViewModel(); $vm->setTemplate('application/default/default-form'); $vm->setVariables([ 'title' => 'Modifier un grade', 'form' => $form, ]); return $vm; } public function supprimerGradeAction() { /** @var Grade $grade */ $gradeId = $this->params()->fromRoute('grade'); $grade = $this->getRessourceRhService()->getGrade($gradeId); if ($grade !== null) { $this->getRessourceRhService()->deleteGrade($grade); } $this->redirect()->toRoute('ressource-rh', [], [], true); } } No newline at end of file
module/Application/src/Application/Entity/Db/Grade.php 0 → 100644 +84 −0 Original line number Diff line number Diff line <?php namespace Application\Entity\Db; class Grade { /** @var integer */ private $id; /** @var Corps */ private $corps; /** @var string */ private $libelle; /** @var integer */ private $rang; /** * @return int */ public function getId() { return $this->id; } /** * @return Corps */ public function getCorps() { return $this->corps; } /** * @param Corps $corps * @return Grade */ public function setCorps($corps) { $this->corps = $corps; return $this; } /** * @return string */ public function getLibelle() { return $this->libelle; } /** * @param string $libelle * @return Grade */ public function setLibelle($libelle) { $this->libelle = $libelle; return $this; } public function __toString() { $texte = $this->getCorps()->getLibelle() . " ". $this->getLibelle(); return $texte; } /** * @return int */ public function getRang() { return $this->rang; } /** * @param int $rang * @return Grade */ public function setRang($rang) { $this->rang = $rang; return $this; } } No newline at end of file
module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Grade.dcm.xml 0 → 100644 +16 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> <entity name="Application\Entity\Db\Grade" table="grade"> <id name="id" type="integer" column="id"> <generator strategy="IDENTITY"/> </id> <field name="libelle" type="string" length="256" column="libelle" nullable="false" /> <field name="rang" type="integer" column="rang" nullable="true" /> <many-to-one target-entity="Application\Entity\Db\Corps" field="corps"> <join-column name="corps" referenced-column-name="id" /> </many-to-one> </entity> </doctrine-mapping>
module/Application/src/Application/Form/RessourceRh/GradeForm.php 0 → 100644 +78 −0 Original line number Diff line number Diff line <?php namespace Application\Form\RessourceRh; use Application\Entity\Db\Corps; use DoctrineModule\Form\Element\ObjectSelect; use UnicaenApp\Service\EntityManagerAwareTrait; use Zend\Form\Element\Button; use Zend\Form\Element\Text; use Zend\Form\Form; class GradeForm extends Form { use EntityManagerAwareTrait; public function init() { // Status $this->add([ 'type' => ObjectSelect::class, 'name' => 'corps', 'options' => [ 'label' => "Corps* :", 'empty_option' => "Sélectionner un corps ...", 'object_manager' => $this->getEntityManager(), 'target_class' => Corps::class, 'property' => 'libelle', 'find_method' => [ 'name' => 'findBy', 'params' => [ 'criteria' => [], 'orderBy' => ['libelle' => 'ASC'], ], ], 'disable_inarray_validator' => true, ], 'attributes' => [ 'id' => 'corps', ], ]); // libelle $this->add([ 'type' => Text::class, 'name' => 'libelle', 'options' => [ 'label' => "Libelle :", ], 'attributes' => [ 'id' => 'libelle', ], ]); // rang $this->add([ 'type' => Text::class, 'name' => 'rang', 'options' => [ 'label' => "Rang :", ], 'attributes' => [ 'id' => 'rang', ], ]); // button $this->add([ 'type' => Button::class, 'name' => 'creer', 'options' => [ 'label' => '<i class="fas fa-save"></i> Enregistrer le grade', 'label_options' => [ 'disable_html_escape' => true, ], ], 'attributes' => [ 'type' => 'submit', 'class' => 'btn btn-primary', ], ]); } } No newline at end of file