Loading module/Application/config/others/ecole-doctorale.config.php +34 Changes for module/Application/config/others/ecole-doctorale.config.php: 34 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ use Application\Provider\Privilege\EcoleDoctoralePrivileges; use Application\Service\EcoleDoctorale\EcoleDoctoraleService; use Application\View\Helper\EcoleDoctoraleHelper; use UnicaenAuth\Guard\PrivilegeController; use Zend\Mvc\Router\Http\Segment; return [ 'bjyauthorize' => [ Loading @@ -16,6 +17,7 @@ return [ 'controller' => 'Application\Controller\EcoleDoctorale', 'action' => [ 'index', 'information' ], 'privileges' => EcoleDoctoralePrivileges::ECOLE_DOCT_CONSULTATION, ], Loading Loading @@ -50,6 +52,16 @@ return [ ], 'may_terminate' => true, 'child_routes' => [ 'information' => [ 'type' => Segment::class, 'options' => [ 'route' => '/information/:ecoleDoctorale', 'defaults' => [ 'action' => 'information', ], ], ], 'ajouter' => [ 'type' => 'Segment', 'options' => [ Loading Loading @@ -148,6 +160,28 @@ return [ 'resource' => PrivilegeController::getResourceId('Application\Controller\EcoleDoctorale', 'index'), 'order' => 10, 'pages' => [ 'modification' => [ 'label' => 'Modification', 'route' => 'ecole-doctorale/modifier', 'resource' => PrivilegeController::getResourceId('Application\Controller\EcoleDoctorale', 'index'), 'withtarget' => true, 'paramsInject' => [ 'ecoleDoctorale', ], ], 'information' => [ 'label' => 'Détails', 'route' => 'ecole-doctorale/information', 'resource' => PrivilegeController::getResourceId('Application\Controller\EcoleDoctorale', 'index'), 'withtarget' => true, 'paramsInject' => [ 'ecoleDoctorale', ], ], ], ], ], ], Loading module/Application/config/others/etablissement.config.php +36 −3 Changes for module/Application/config/others/etablissement.config.php: 36 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -4,9 +4,11 @@ use Application\Controller\Factory\EtablissementControllerFactory; use Application\Form\Factory\EtablissementFormFactory; use Application\Form\Factory\EtablissementHydratorFactory; use Application\Provider\Privilege\EcoleDoctoralePrivileges; use Application\Provider\Privilege\EtablissementPrivileges; use Application\Service\Etablissement\EtablissementService; use Application\View\Helper\EtablissementHelper; use UnicaenAuth\Guard\PrivilegeController; use Zend\Mvc\Router\Http\Segment; return [ 'bjyauthorize' => [ Loading @@ -16,8 +18,9 @@ return [ 'controller' => 'Application\Controller\Etablissement', 'action' => [ 'index', 'information', ], 'privileges' => EcoleDoctoralePrivileges::ECOLE_DOCT_CONSULTATION, 'privileges' => EtablissementPrivileges::ETABLISSEMENT_CONSULTATION, ], [ 'controller' => 'Application\Controller\Etablissement', Loading @@ -30,7 +33,7 @@ return [ 'retirer-individu', 'supprimer-logo', ], 'privileges' => EcoleDoctoralePrivileges::ECOLE_DOCT_MODIFICATION, 'privileges' => EtablissementPrivileges::ETABLISSEMENT_MODIFICATION, ], ], ], Loading @@ -50,6 +53,15 @@ return [ ], 'may_terminate' => true, 'child_routes' => [ 'information' => [ 'type' => Segment::class, 'options' => [ 'route' => '/information/:etablissement', 'defaults' => [ 'action' => 'information', ], ], ], 'ajouter' => [ 'type' => 'Segment', 'options' => [ Loading Loading @@ -146,8 +158,29 @@ return [ 'label' => 'Établissements', 'route' => 'etablissement', 'resource' => PrivilegeController::getResourceId('Application\Controller\Etablissement', 'index'), 'order' => 5, 'pages' => [ 'modification' => [ 'label' => 'Modification', 'route' => 'etablissement/modifier', 'resource' => PrivilegeController::getResourceId('Application\Controller\Etablissement', 'index'), 'withtarget' => true, 'paramsInject' => [ 'etablissement', ], ], 'information' => [ 'label' => 'Détails', 'route' => 'etablissement/information', 'resource' => PrivilegeController::getResourceId('Application\Controller\Etablissement', 'index'), 'withtarget' => true, 'paramsInject' => [ 'etablissement', ], ], ], ], ], ], Loading module/Application/config/others/unite-recherche.config.php +33 Changes for module/Application/config/others/unite-recherche.config.php: 33 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -8,6 +8,7 @@ use Application\Service\DomaineScientifiqueService; use Application\Service\UniteRecherche\UniteRechercheService; use UnicaenAuth\Guard\PrivilegeController; use Application\View\Helper\UniteRechercheHelper; use Zend\Mvc\Router\Http\Segment; return [ 'bjyauthorize' => [ Loading @@ -17,6 +18,7 @@ return [ 'controller' => 'Application\Controller\UniteRecherche', 'action' => [ 'index', 'information', ], 'privileges' => UniteRecherchePrivileges::UNITE_RECH_CONSULTATION, ], Loading Loading @@ -56,6 +58,15 @@ return [ ], 'may_terminate' => true, 'child_routes' => [ 'information' => [ 'type' => Segment::class, 'options' => [ 'route' => '/information/:uniteRecherche', 'defaults' => [ 'action' => 'information', ], ], ], 'ajouter' => [ 'type' => 'Segment', 'options' => [ Loading Loading @@ -219,6 +230,28 @@ return [ 'resource' => PrivilegeController::getResourceId('Application\Controller\UniteRecherche', 'index'), 'order' => 20, 'pages' => [ 'modification' => [ 'label' => 'Modification', 'route' => 'unite-recherche/modifier', 'resource' => PrivilegeController::getResourceId('Application\Controller\UniteRecherche', 'index'), 'withtarget' => true, 'paramsInject' => [ 'uniteRecherche', ], ], 'information' => [ 'label' => 'Détails', 'route' => 'unite-recherche/information', 'resource' => PrivilegeController::getResourceId('Application\Controller\UniteRecherche', 'index'), 'withtarget' => true, 'paramsInject' => [ 'uniteRecherche', ], ], ], ], ], ], Loading module/Application/src/Application/Controller/EcoleDoctoraleController.php +45 −24 Changes for module/Application/src/Application/Controller/EcoleDoctoraleController.php: 45 added lines, 24 removed lines. Original line number Diff line number Diff line Loading @@ -3,6 +3,8 @@ namespace Application\Controller; use Application\Entity\Db\EcoleDoctorale; use Application\Entity\Db\Individu; use Application\Entity\Db\IndividuRole; use Application\Entity\Db\Role; use Application\Entity\Db\Structure; use Application\Entity\Db\StructureConcreteInterface; Loading @@ -11,6 +13,7 @@ use Application\Service\EcoleDoctorale\EcoleDoctoraleServiceAwareTrait; use Application\Service\Etablissement\EtablissementServiceAwareTrait; use Application\Service\Individu\IndividuServiceAwareTrait; use Application\Service\Role\RoleServiceAwareTrait; use UnicaenApp\Exception\RuntimeException; use Zend\View\Model\ViewModel; class EcoleDoctoraleController extends AbstractController Loading @@ -30,31 +33,12 @@ class EcoleDoctoraleController extends AbstractController */ public function indexAction() { $selected = $this->params()->fromQuery('selected'); $roles = null; $effectifs = null; if ($selected) { /** * @var StructureConcreteInterface $structure * @var Role[] $roles */ $structure = $this->getEcoleDoctoraleService()->getRepository()->findByStructureId($selected); $roles = $structure->getStructure()->getStructureDependantRoles(); $effectifs = []; foreach ($roles as $role) { $individus = $this->individuService->getRepository()->findByRole($role); $effectifs[$role->getLibelle()] = $individus; } } $structuresAll = $this->getEcoleDoctoraleService()->getRepository()->findAll(); /** retrait des structures substituées */ //TODO faire cela dans le service ??? $structuresSub = array_filter($structuresAll, function (StructureConcreteInterface $structure) { return count($structure->getStructure()->getStructuresSubstituees())!=0; }); $toRemove = []; /** @var EcoleDoctorale $structure */ foreach($structuresSub as $structure) { foreach ($structure->getStructure()->getStructuresSubstituees() as $sub) { $toRemove[] = $sub; Loading @@ -70,10 +54,47 @@ class EcoleDoctoraleController extends AbstractController } return new ViewModel([ 'structuresPrincipales' => $structures, 'selected' => $selected, 'roles' => $roles, 'effectifs' => $effectifs, 'ecoles' => $structures, ]); } public function informationAction() { $id = $this->params()->fromRoute('ecoleDoctorale'); $ecole = $this->getEcoleDoctoraleService()->getRepository()->findByStructureId($id); if ($ecole === null) { throw new RuntimeException("Aucune école doctorale ne possède l'identifiant renseigné."); } $roleListings = []; $individuListings = []; $roles = $this->getRoleService()->getRolesByStructure($ecole->getStructure()); $individus = $this->getRoleService()->getIndividuByStructure($ecole->getStructure()); $individuRoles = $this->getRoleService()->getIndividuRoleByStructure($ecole->getStructure()); /** @var Role $role */ foreach ($roles as $role) { $roleListings [$role->getLibelle()] = 0; } /** @var Individu $individu */ foreach ($individus as $individu) { $denomination = $individu->getNomComplet(false, false, false, true, false); $individuListings[$denomination] = []; } /** @var IndividuRole $individuRole */ foreach ($individuRoles as $individuRole) { $denomination = $individuRole->getIndividu()->getNomComplet(false, false, false, true, false); $role = $individuRole->getRole()->getLibelle(); $individuListings[$denomination][] = $role; $roleListings[$role]++; } return new ViewModel([ 'ecole' => $ecole, 'roleListing' => $roleListings, 'individuListing' => $individuListings, ]); } Loading module/Application/src/Application/Controller/EtablissementController.php +51 −25 Changes for module/Application/src/Application/Controller/EtablissementController.php: 51 added lines, 25 removed lines. Original line number Diff line number Diff line Loading @@ -3,6 +3,8 @@ namespace Application\Controller; use Application\Entity\Db\Etablissement; use Application\Entity\Db\Individu; use Application\Entity\Db\IndividuRole; use Application\Entity\Db\Role; use Application\Entity\Db\SourceInterface; use Application\Entity\Db\Structure; Loading @@ -11,6 +13,7 @@ use Application\Form\EtablissementForm; use Application\Service\Etablissement\EtablissementServiceAwareTrait; use Application\Service\Individu\IndividuServiceAwareTrait; use Application\Service\Role\RoleServiceAwareTrait; use UnicaenApp\Exception\RuntimeException; use Zend\View\Model\ViewModel; /** Loading Loading @@ -48,35 +51,16 @@ class EtablissementController extends AbstractController */ public function indexAction() { $selected = $this->params()->fromQuery('selected'); $etablissements = $this->getEtablissementService()->getRepository()->findAll(); usort($etablissements, function(Etablissement $a,Etablissement $b) {return $a->getLibelle() > $b->getLibelle();}); $roles = null; $effectifs = null; if ($selected) { /** * @var Etablissement $etablissement * @var Role[] $roles */ $etablissement = $this->getEtablissementService()->getRepository()->findByStructureId($selected); $roles = $etablissement->getStructure()->getStructureDependantRoles(); $effectifs = []; foreach ($roles as $role) { $individus = $this->individuService->getRepository()->findByRole($role); $effectifs[$role->getLibelle()] = $individus; } } $etablissementsSYGAL = $this->getEtablissementService()->getRepository()->findAllBySource(SourceInterface::CODE_SYGAL); $etablissementsPrincipaux = array_filter($etablissementsSYGAL, function (Etablissement $etablissement) { return count($etablissement->getStructure()->getStructuresSubstituees())==0; }); $etablissementsSecondaires = array_diff($etablissements, $etablissementsPrincipaux); /** retrait des structures substituées */ //TODO faire cela dans le service ??? $structuresSub = array_filter($etablissementsSYGAL, function (StructureConcreteInterface $structure) { return count($structure->getStructure()->getStructuresSubstituees())!=0; }); $toRemove = []; /** @var Etablissement $structure */ foreach($structuresSub as $structure) { foreach ($structure->getStructure()->getStructuresSubstituees() as $sub) { $toRemove[] = $sub; Loading @@ -92,12 +76,54 @@ class EtablissementController extends AbstractController } return new ViewModel([ 'structuresPrincipales' => $etablissementsPrincipaux, 'structuresSecondaires' => $structures, 'selected' => $selected, 'roles' => $roles, 'effectifs' => $effectifs, 'etablissementsSygal' => $etablissementsPrincipaux, 'etablissementsExternes' => $structures, ]); } public function informationAction() { $id = $this->params()->fromRoute('etablissement'); $etablissement = $this->getEtablissementService()->getRepository()->findByStructureId($id); if ($etablissement === null) { throw new RuntimeException("Aucun établissement ne possède l'identifiant renseigné."); } $roleListings = []; $individuListings = []; $roles = $this->getRoleService()->getRolesByStructure($etablissement->getStructure()); $individus = $this->getRoleService()->getIndividuByStructure($etablissement->getStructure()); $individuRoles = $this->getRoleService()->getIndividuRoleByStructure($etablissement->getStructure()); /** @var Role $role */ foreach ($roles as $role) { if (! $role->isTheseDependant()) { $roleListings [$role->getLibelle()] = 0; } } /** @var Individu $individu */ foreach ($individus as $individu) { $denomination = $individu->getNomComplet(false, false, false, true, false); $individuListings[$denomination] = []; } /** @var IndividuRole $individuRole */ foreach ($individuRoles as $individuRole) { if (! $individuRole->getRole()->isTheseDependant()) { $denomination = $individuRole->getIndividu()->getNomComplet(false, false, false, true, false); $role = $individuRole->getRole()->getLibelle(); $individuListings[$denomination][] = $role; $roleListings[$role]++; } } return new ViewModel([ 'etablissement' => $etablissement, 'roleListing' => $roleListings, 'individuListing' => $individuListings, ]); } /** Loading Loading
module/Application/config/others/ecole-doctorale.config.php +34 Changes for module/Application/config/others/ecole-doctorale.config.php: 34 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ use Application\Provider\Privilege\EcoleDoctoralePrivileges; use Application\Service\EcoleDoctorale\EcoleDoctoraleService; use Application\View\Helper\EcoleDoctoraleHelper; use UnicaenAuth\Guard\PrivilegeController; use Zend\Mvc\Router\Http\Segment; return [ 'bjyauthorize' => [ Loading @@ -16,6 +17,7 @@ return [ 'controller' => 'Application\Controller\EcoleDoctorale', 'action' => [ 'index', 'information' ], 'privileges' => EcoleDoctoralePrivileges::ECOLE_DOCT_CONSULTATION, ], Loading Loading @@ -50,6 +52,16 @@ return [ ], 'may_terminate' => true, 'child_routes' => [ 'information' => [ 'type' => Segment::class, 'options' => [ 'route' => '/information/:ecoleDoctorale', 'defaults' => [ 'action' => 'information', ], ], ], 'ajouter' => [ 'type' => 'Segment', 'options' => [ Loading Loading @@ -148,6 +160,28 @@ return [ 'resource' => PrivilegeController::getResourceId('Application\Controller\EcoleDoctorale', 'index'), 'order' => 10, 'pages' => [ 'modification' => [ 'label' => 'Modification', 'route' => 'ecole-doctorale/modifier', 'resource' => PrivilegeController::getResourceId('Application\Controller\EcoleDoctorale', 'index'), 'withtarget' => true, 'paramsInject' => [ 'ecoleDoctorale', ], ], 'information' => [ 'label' => 'Détails', 'route' => 'ecole-doctorale/information', 'resource' => PrivilegeController::getResourceId('Application\Controller\EcoleDoctorale', 'index'), 'withtarget' => true, 'paramsInject' => [ 'ecoleDoctorale', ], ], ], ], ], ], Loading
module/Application/config/others/etablissement.config.php +36 −3 Changes for module/Application/config/others/etablissement.config.php: 36 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -4,9 +4,11 @@ use Application\Controller\Factory\EtablissementControllerFactory; use Application\Form\Factory\EtablissementFormFactory; use Application\Form\Factory\EtablissementHydratorFactory; use Application\Provider\Privilege\EcoleDoctoralePrivileges; use Application\Provider\Privilege\EtablissementPrivileges; use Application\Service\Etablissement\EtablissementService; use Application\View\Helper\EtablissementHelper; use UnicaenAuth\Guard\PrivilegeController; use Zend\Mvc\Router\Http\Segment; return [ 'bjyauthorize' => [ Loading @@ -16,8 +18,9 @@ return [ 'controller' => 'Application\Controller\Etablissement', 'action' => [ 'index', 'information', ], 'privileges' => EcoleDoctoralePrivileges::ECOLE_DOCT_CONSULTATION, 'privileges' => EtablissementPrivileges::ETABLISSEMENT_CONSULTATION, ], [ 'controller' => 'Application\Controller\Etablissement', Loading @@ -30,7 +33,7 @@ return [ 'retirer-individu', 'supprimer-logo', ], 'privileges' => EcoleDoctoralePrivileges::ECOLE_DOCT_MODIFICATION, 'privileges' => EtablissementPrivileges::ETABLISSEMENT_MODIFICATION, ], ], ], Loading @@ -50,6 +53,15 @@ return [ ], 'may_terminate' => true, 'child_routes' => [ 'information' => [ 'type' => Segment::class, 'options' => [ 'route' => '/information/:etablissement', 'defaults' => [ 'action' => 'information', ], ], ], 'ajouter' => [ 'type' => 'Segment', 'options' => [ Loading Loading @@ -146,8 +158,29 @@ return [ 'label' => 'Établissements', 'route' => 'etablissement', 'resource' => PrivilegeController::getResourceId('Application\Controller\Etablissement', 'index'), 'order' => 5, 'pages' => [ 'modification' => [ 'label' => 'Modification', 'route' => 'etablissement/modifier', 'resource' => PrivilegeController::getResourceId('Application\Controller\Etablissement', 'index'), 'withtarget' => true, 'paramsInject' => [ 'etablissement', ], ], 'information' => [ 'label' => 'Détails', 'route' => 'etablissement/information', 'resource' => PrivilegeController::getResourceId('Application\Controller\Etablissement', 'index'), 'withtarget' => true, 'paramsInject' => [ 'etablissement', ], ], ], ], ], ], Loading
module/Application/config/others/unite-recherche.config.php +33 Changes for module/Application/config/others/unite-recherche.config.php: 33 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -8,6 +8,7 @@ use Application\Service\DomaineScientifiqueService; use Application\Service\UniteRecherche\UniteRechercheService; use UnicaenAuth\Guard\PrivilegeController; use Application\View\Helper\UniteRechercheHelper; use Zend\Mvc\Router\Http\Segment; return [ 'bjyauthorize' => [ Loading @@ -17,6 +18,7 @@ return [ 'controller' => 'Application\Controller\UniteRecherche', 'action' => [ 'index', 'information', ], 'privileges' => UniteRecherchePrivileges::UNITE_RECH_CONSULTATION, ], Loading Loading @@ -56,6 +58,15 @@ return [ ], 'may_terminate' => true, 'child_routes' => [ 'information' => [ 'type' => Segment::class, 'options' => [ 'route' => '/information/:uniteRecherche', 'defaults' => [ 'action' => 'information', ], ], ], 'ajouter' => [ 'type' => 'Segment', 'options' => [ Loading Loading @@ -219,6 +230,28 @@ return [ 'resource' => PrivilegeController::getResourceId('Application\Controller\UniteRecherche', 'index'), 'order' => 20, 'pages' => [ 'modification' => [ 'label' => 'Modification', 'route' => 'unite-recherche/modifier', 'resource' => PrivilegeController::getResourceId('Application\Controller\UniteRecherche', 'index'), 'withtarget' => true, 'paramsInject' => [ 'uniteRecherche', ], ], 'information' => [ 'label' => 'Détails', 'route' => 'unite-recherche/information', 'resource' => PrivilegeController::getResourceId('Application\Controller\UniteRecherche', 'index'), 'withtarget' => true, 'paramsInject' => [ 'uniteRecherche', ], ], ], ], ], ], Loading
module/Application/src/Application/Controller/EcoleDoctoraleController.php +45 −24 Changes for module/Application/src/Application/Controller/EcoleDoctoraleController.php: 45 added lines, 24 removed lines. Original line number Diff line number Diff line Loading @@ -3,6 +3,8 @@ namespace Application\Controller; use Application\Entity\Db\EcoleDoctorale; use Application\Entity\Db\Individu; use Application\Entity\Db\IndividuRole; use Application\Entity\Db\Role; use Application\Entity\Db\Structure; use Application\Entity\Db\StructureConcreteInterface; Loading @@ -11,6 +13,7 @@ use Application\Service\EcoleDoctorale\EcoleDoctoraleServiceAwareTrait; use Application\Service\Etablissement\EtablissementServiceAwareTrait; use Application\Service\Individu\IndividuServiceAwareTrait; use Application\Service\Role\RoleServiceAwareTrait; use UnicaenApp\Exception\RuntimeException; use Zend\View\Model\ViewModel; class EcoleDoctoraleController extends AbstractController Loading @@ -30,31 +33,12 @@ class EcoleDoctoraleController extends AbstractController */ public function indexAction() { $selected = $this->params()->fromQuery('selected'); $roles = null; $effectifs = null; if ($selected) { /** * @var StructureConcreteInterface $structure * @var Role[] $roles */ $structure = $this->getEcoleDoctoraleService()->getRepository()->findByStructureId($selected); $roles = $structure->getStructure()->getStructureDependantRoles(); $effectifs = []; foreach ($roles as $role) { $individus = $this->individuService->getRepository()->findByRole($role); $effectifs[$role->getLibelle()] = $individus; } } $structuresAll = $this->getEcoleDoctoraleService()->getRepository()->findAll(); /** retrait des structures substituées */ //TODO faire cela dans le service ??? $structuresSub = array_filter($structuresAll, function (StructureConcreteInterface $structure) { return count($structure->getStructure()->getStructuresSubstituees())!=0; }); $toRemove = []; /** @var EcoleDoctorale $structure */ foreach($structuresSub as $structure) { foreach ($structure->getStructure()->getStructuresSubstituees() as $sub) { $toRemove[] = $sub; Loading @@ -70,10 +54,47 @@ class EcoleDoctoraleController extends AbstractController } return new ViewModel([ 'structuresPrincipales' => $structures, 'selected' => $selected, 'roles' => $roles, 'effectifs' => $effectifs, 'ecoles' => $structures, ]); } public function informationAction() { $id = $this->params()->fromRoute('ecoleDoctorale'); $ecole = $this->getEcoleDoctoraleService()->getRepository()->findByStructureId($id); if ($ecole === null) { throw new RuntimeException("Aucune école doctorale ne possède l'identifiant renseigné."); } $roleListings = []; $individuListings = []; $roles = $this->getRoleService()->getRolesByStructure($ecole->getStructure()); $individus = $this->getRoleService()->getIndividuByStructure($ecole->getStructure()); $individuRoles = $this->getRoleService()->getIndividuRoleByStructure($ecole->getStructure()); /** @var Role $role */ foreach ($roles as $role) { $roleListings [$role->getLibelle()] = 0; } /** @var Individu $individu */ foreach ($individus as $individu) { $denomination = $individu->getNomComplet(false, false, false, true, false); $individuListings[$denomination] = []; } /** @var IndividuRole $individuRole */ foreach ($individuRoles as $individuRole) { $denomination = $individuRole->getIndividu()->getNomComplet(false, false, false, true, false); $role = $individuRole->getRole()->getLibelle(); $individuListings[$denomination][] = $role; $roleListings[$role]++; } return new ViewModel([ 'ecole' => $ecole, 'roleListing' => $roleListings, 'individuListing' => $individuListings, ]); } Loading
module/Application/src/Application/Controller/EtablissementController.php +51 −25 Changes for module/Application/src/Application/Controller/EtablissementController.php: 51 added lines, 25 removed lines. Original line number Diff line number Diff line Loading @@ -3,6 +3,8 @@ namespace Application\Controller; use Application\Entity\Db\Etablissement; use Application\Entity\Db\Individu; use Application\Entity\Db\IndividuRole; use Application\Entity\Db\Role; use Application\Entity\Db\SourceInterface; use Application\Entity\Db\Structure; Loading @@ -11,6 +13,7 @@ use Application\Form\EtablissementForm; use Application\Service\Etablissement\EtablissementServiceAwareTrait; use Application\Service\Individu\IndividuServiceAwareTrait; use Application\Service\Role\RoleServiceAwareTrait; use UnicaenApp\Exception\RuntimeException; use Zend\View\Model\ViewModel; /** Loading Loading @@ -48,35 +51,16 @@ class EtablissementController extends AbstractController */ public function indexAction() { $selected = $this->params()->fromQuery('selected'); $etablissements = $this->getEtablissementService()->getRepository()->findAll(); usort($etablissements, function(Etablissement $a,Etablissement $b) {return $a->getLibelle() > $b->getLibelle();}); $roles = null; $effectifs = null; if ($selected) { /** * @var Etablissement $etablissement * @var Role[] $roles */ $etablissement = $this->getEtablissementService()->getRepository()->findByStructureId($selected); $roles = $etablissement->getStructure()->getStructureDependantRoles(); $effectifs = []; foreach ($roles as $role) { $individus = $this->individuService->getRepository()->findByRole($role); $effectifs[$role->getLibelle()] = $individus; } } $etablissementsSYGAL = $this->getEtablissementService()->getRepository()->findAllBySource(SourceInterface::CODE_SYGAL); $etablissementsPrincipaux = array_filter($etablissementsSYGAL, function (Etablissement $etablissement) { return count($etablissement->getStructure()->getStructuresSubstituees())==0; }); $etablissementsSecondaires = array_diff($etablissements, $etablissementsPrincipaux); /** retrait des structures substituées */ //TODO faire cela dans le service ??? $structuresSub = array_filter($etablissementsSYGAL, function (StructureConcreteInterface $structure) { return count($structure->getStructure()->getStructuresSubstituees())!=0; }); $toRemove = []; /** @var Etablissement $structure */ foreach($structuresSub as $structure) { foreach ($structure->getStructure()->getStructuresSubstituees() as $sub) { $toRemove[] = $sub; Loading @@ -92,12 +76,54 @@ class EtablissementController extends AbstractController } return new ViewModel([ 'structuresPrincipales' => $etablissementsPrincipaux, 'structuresSecondaires' => $structures, 'selected' => $selected, 'roles' => $roles, 'effectifs' => $effectifs, 'etablissementsSygal' => $etablissementsPrincipaux, 'etablissementsExternes' => $structures, ]); } public function informationAction() { $id = $this->params()->fromRoute('etablissement'); $etablissement = $this->getEtablissementService()->getRepository()->findByStructureId($id); if ($etablissement === null) { throw new RuntimeException("Aucun établissement ne possède l'identifiant renseigné."); } $roleListings = []; $individuListings = []; $roles = $this->getRoleService()->getRolesByStructure($etablissement->getStructure()); $individus = $this->getRoleService()->getIndividuByStructure($etablissement->getStructure()); $individuRoles = $this->getRoleService()->getIndividuRoleByStructure($etablissement->getStructure()); /** @var Role $role */ foreach ($roles as $role) { if (! $role->isTheseDependant()) { $roleListings [$role->getLibelle()] = 0; } } /** @var Individu $individu */ foreach ($individus as $individu) { $denomination = $individu->getNomComplet(false, false, false, true, false); $individuListings[$denomination] = []; } /** @var IndividuRole $individuRole */ foreach ($individuRoles as $individuRole) { if (! $individuRole->getRole()->isTheseDependant()) { $denomination = $individuRole->getIndividu()->getNomComplet(false, false, false, true, false); $role = $individuRole->getRole()->getLibelle(); $individuListings[$denomination][] = $role; $roleListings[$role]++; } } return new ViewModel([ 'etablissement' => $etablissement, 'roleListing' => $roleListings, 'individuListing' => $individuListings, ]); } /** Loading