Loading module/Application/src/Application/Controller/Structure/StructureController.php +4 −0 Original line number Diff line number Diff line Loading @@ -23,9 +23,13 @@ class StructureController extends AbstractActionController { public function indexAction() { $structures = $this->getStructureService()->getStructures(); $user = $this->getUserService()->getConnectedUser(); $role = $this->getUserService()->getConnectedRole(); return new ViewModel([ 'structures' => $structures, 'user' => $user, 'role' => $role, ]); } Loading module/Application/src/Application/Form/FicheMetier/LibelleForm.php +3 −1 Original line number Diff line number Diff line Loading @@ -19,7 +19,9 @@ class LibelleForm extends Form { 'options' => [ 'label' => "Libellé du métier :", 'empty_option' => "Sélectionner un metier ...", 'value_options' => $this->getRessourceRhService()->getMetiersTypesAsOptions(), 'value_options' => //$this->getOptions(), $this->getRessourceRhService()->getMetiersTypesAsMultiOptions(), ], 'attributes' => [ 'id' => 'metier', Loading module/Application/src/Application/Service/RessourceRh/RessourceRhService.php +37 −2 Original line number Diff line number Diff line Loading @@ -4,10 +4,8 @@ namespace Application\Service\RessourceRh; use Application\Entity\Db\Corps; use Application\Entity\Db\Correspondance; use Application\Entity\Db\Domaine; use Application\Entity\Db\Grade; use Application\Entity\Db\Metier; use Application\Entity\Db\FamilleProfessionnelle; use Application\Entity\Db\MissionSpecifique; use DateTime; use Doctrine\ORM\NonUniqueResultException; Loading Loading @@ -217,6 +215,43 @@ class RessourceRhService { return $options; } public function getMetiersTypesAsMultiOptions() { /** @var Metier[] $metiers */ $qb = $this->getEntityManager()->getRepository(Metier::class)->createQueryBuilder('metier') ->orderBy('metier.libelle', 'ASC'); $metiers = $qb->getQuery()->getResult(); $vide = []; $result = []; foreach ($metiers as $metier) { if ($metier->getFonction()) { $libelle = []; foreach ($metier->getFonction()->getLibelles() as $fonctionLibelle) $libelle[] = $fonctionLibelle->getLibelle(); $result[implode("/", $libelle)][] = $metier; } else { $vide[] = $metier; } } ksort($result); $multi = []; foreach ($result as $key => $metiers) { //['label'=>'A', 'options' => ["A" => "A", "a"=> "a"]], $options = []; foreach ($metiers as $metier) { $options[$metier->getId()] = $metier->getLibelle(); } $multi[] = ['label' => $key, 'options' => $options]; } $options = []; foreach ($vide as $metier) { $options[$metier->getId()] = $metier->getLibelle(); } $multi[] = ['label' => 'Sans fonction rattachée', 'options' => $options]; return $multi; } /** MISSION SPECIFIQUE ********************************************************************************************/ /** Loading module/Application/view/application/structure/index.phtml +3 −0 Original line number Diff line number Diff line <?php use Application\Provider\Privilege\StructurePrivileges; use Utilisateur\Entity\Db\Role; $this->headTitle("Index des structures"); /** * @var Application\Entity\Db\Structure[] $structures * @var \Utilisateur\Entity\Db\User $user * @var \Utilisateur\Entity\Db\Role $role */ $canGestionnaire = $this->isAllowed(StructurePrivileges::getResourceId(StructurePrivileges::GESTIONNAIRE)); Loading Loading
module/Application/src/Application/Controller/Structure/StructureController.php +4 −0 Original line number Diff line number Diff line Loading @@ -23,9 +23,13 @@ class StructureController extends AbstractActionController { public function indexAction() { $structures = $this->getStructureService()->getStructures(); $user = $this->getUserService()->getConnectedUser(); $role = $this->getUserService()->getConnectedRole(); return new ViewModel([ 'structures' => $structures, 'user' => $user, 'role' => $role, ]); } Loading
module/Application/src/Application/Form/FicheMetier/LibelleForm.php +3 −1 Original line number Diff line number Diff line Loading @@ -19,7 +19,9 @@ class LibelleForm extends Form { 'options' => [ 'label' => "Libellé du métier :", 'empty_option' => "Sélectionner un metier ...", 'value_options' => $this->getRessourceRhService()->getMetiersTypesAsOptions(), 'value_options' => //$this->getOptions(), $this->getRessourceRhService()->getMetiersTypesAsMultiOptions(), ], 'attributes' => [ 'id' => 'metier', Loading
module/Application/src/Application/Service/RessourceRh/RessourceRhService.php +37 −2 Original line number Diff line number Diff line Loading @@ -4,10 +4,8 @@ namespace Application\Service\RessourceRh; use Application\Entity\Db\Corps; use Application\Entity\Db\Correspondance; use Application\Entity\Db\Domaine; use Application\Entity\Db\Grade; use Application\Entity\Db\Metier; use Application\Entity\Db\FamilleProfessionnelle; use Application\Entity\Db\MissionSpecifique; use DateTime; use Doctrine\ORM\NonUniqueResultException; Loading Loading @@ -217,6 +215,43 @@ class RessourceRhService { return $options; } public function getMetiersTypesAsMultiOptions() { /** @var Metier[] $metiers */ $qb = $this->getEntityManager()->getRepository(Metier::class)->createQueryBuilder('metier') ->orderBy('metier.libelle', 'ASC'); $metiers = $qb->getQuery()->getResult(); $vide = []; $result = []; foreach ($metiers as $metier) { if ($metier->getFonction()) { $libelle = []; foreach ($metier->getFonction()->getLibelles() as $fonctionLibelle) $libelle[] = $fonctionLibelle->getLibelle(); $result[implode("/", $libelle)][] = $metier; } else { $vide[] = $metier; } } ksort($result); $multi = []; foreach ($result as $key => $metiers) { //['label'=>'A', 'options' => ["A" => "A", "a"=> "a"]], $options = []; foreach ($metiers as $metier) { $options[$metier->getId()] = $metier->getLibelle(); } $multi[] = ['label' => $key, 'options' => $options]; } $options = []; foreach ($vide as $metier) { $options[$metier->getId()] = $metier->getLibelle(); } $multi[] = ['label' => 'Sans fonction rattachée', 'options' => $options]; return $multi; } /** MISSION SPECIFIQUE ********************************************************************************************/ /** Loading
module/Application/view/application/structure/index.phtml +3 −0 Original line number Diff line number Diff line <?php use Application\Provider\Privilege\StructurePrivileges; use Utilisateur\Entity\Db\Role; $this->headTitle("Index des structures"); /** * @var Application\Entity\Db\Structure[] $structures * @var \Utilisateur\Entity\Db\User $user * @var \Utilisateur\Entity\Db\Role $role */ $canGestionnaire = $this->isAllowed(StructurePrivileges::getResourceId(StructurePrivileges::GESTIONNAIRE)); Loading