Loading module/Application/src/Application/Service/Structure/StructureService.php +24 −0 Original line number Diff line number Diff line Loading @@ -680,6 +680,30 @@ class StructureService extends BaseService return $result; } /** * @param string $type * @param int $structureId * @return StructureConcreteInterface */ public function getStructuresConcreteByTypeAndStructureConcreteId($type, $structureId) { $qb = $this->getEntityManager()->getRepository($this->getEntityByType($type))->createQueryBuilder('structureConcrete') ->addSelect('structure') ->join('structureConcrete.structure', 'structure') ->andWhere('structureConcrete.id = :structureId') ->setParameter('structureId', $structureId) ; try { $result = $qb->getQuery()->getOneOrNullResult(); } catch (NonUniqueResultException $e) { throw new RuntimeException("Plusieurs ".$type." partagent le même identifiant de structure [".$structureId."]"); } if (!$result) throw new RuntimeException("Aucun(e) ".$type." de trouvé(e)."); return $result; } /** * Identifie les structures substituables en utilisant le sourceCode. * Loading module/Indicateur/src/Indicateur/Controller/Factory/IndicateurControllerFactory.php +4 −0 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ namespace Indicateur\Controller\Factory; use Application\Service\AnomalieService; use Application\Service\Etablissement\EtablissementService; use Application\Service\Individu\IndividuService; use Application\Service\Structure\StructureService; use Application\Service\These\TheseService; use Indicateur\Controller\IndicateurController; use Indicateur\Service\IndicateurService; Loading @@ -23,6 +24,7 @@ class IndicateurControllerFactory * @var TheseService $theseService * @var AnomalieService $anomalieService * @var EtablissementService $etablissementService * @var StructureService $structureService * @var IndicateurService $indicateurService */ $individuService = $controllerManager->getServiceLocator()->get('IndividuService'); Loading @@ -30,6 +32,7 @@ class IndicateurControllerFactory $anomalieService = $controllerManager->getServiceLocator()->get(AnomalieService::class); $etablissementService = $controllerManager->getServiceLocator()->get('EtablissementService'); $indicateurService = $controllerManager->getServiceLocator()->get(IndicateurService::class); $structureService = $controllerManager->getServiceLocator()->get(StructureService::class); $controller = new IndicateurController(); $controller->setIndividuService($individuService); Loading @@ -37,6 +40,7 @@ class IndicateurControllerFactory $controller->setAnomalieService($anomalieService); $controller->setEtablissementService($etablissementService); $controller->setIndicateurService($indicateurService); $controller->setStructureService($structureService); return $controller; } Loading module/Indicateur/src/Indicateur/Controller/IndicateurController.php +39 −1 Original line number Diff line number Diff line Loading @@ -3,10 +3,15 @@ namespace Indicateur\Controller; use Application\Entity\Db\Acteur; use Application\Entity\Db\EcoleDoctorale; use Application\Entity\Db\Etablissement; use Application\Entity\Db\These; use Application\Entity\Db\TypeStructure; use Application\Entity\Db\UniteRecherche; use Application\Service\AnomalieServiceAwareTrait; use Application\Service\Etablissement\EtablissementServiceAwareTrait; use Application\Service\Individu\IndividuServiceAwareTrait; use Application\Service\Structure\StructureServiceAwareTrait; use Application\Service\These\TheseServiceAwareTrait; use DateTime; use Indicateur\Form\IndicateurForm; Loading @@ -24,6 +29,7 @@ class IndicateurController extends AbstractActionController { use EtablissementServiceAwareTrait; use AnomalieServiceAwareTrait; use IndicateurServiceAwareTrait; use StructureServiceAwareTrait; /** * @return array|ViewModel Loading Loading @@ -146,6 +152,7 @@ class IndicateurController extends AbstractActionController { return new ViewModel([ 'indicateur' => $indicateur, 'data' => $data, 'structureService' => $this->getStructureService(), ]); } Loading @@ -163,6 +170,9 @@ class IndicateurController extends AbstractActionController { 'Titre' => 'TITRE', 'Première inscription' => 'DATE_PREM_INSC', 'Date de soutenance' => 'DATE_SOUTENANCE', 'Établissement d\'inscription' => 'ETABLISSEMENT_ID', 'École doctorale' => 'ECOLE_DOCT_ID', 'Unité de recherche' => 'UNITE_RECH_ID', ]; } if ($indicateur->getDisplayAs() == Indicateur::INDIVIDU) { Loading Loading @@ -191,7 +201,35 @@ class IndicateurController extends AbstractActionController { foreach ($data as $entry) { $record = []; foreach($headers as $key => $fct) { $record[] = $entry[$fct]; $value = ''; switch($key) { case 'Établissement d\'inscription' : if ($entry[$fct]) { /** @var Etablissement $etablissement */ $etablissement = $this->getStructureService()->getStructuresConcreteByTypeAndStructureConcreteId(TypeStructure::CODE_ETABLISSEMENT, $entry[$fct]); $value = $etablissement->getLibelle(); } else $value .= ""; break; case 'École doctorale' : if ($entry[$fct]) { /** @var EcoleDoctorale $ecole */ $ecole = $this->getStructureService()->getStructuresConcreteByTypeAndStructureConcreteId(TypeStructure::CODE_ECOLE_DOCTORALE, $entry[$fct]); $value = $ecole->getLibelle(); } else $value .= ""; break; case 'Unité de recherche' : if ($entry[$fct]) { /** @var UniteRecherche $unite */ $unite = $this->getStructureService()->getStructuresConcreteByTypeAndStructureConcreteId(TypeStructure::CODE_UNITE_RECHERCHE, $entry[$fct]); $value = $unite->getLibelle(); } else $value .= ""; break; default: $value = $entry[$fct]; break; } $record[] = $value; } $records[] = $record; } Loading module/Indicateur/src/Indicateur/View/Helper/CompletIndicateurTheseHelper.php +44 −3 Original line number Diff line number Diff line Loading @@ -2,6 +2,11 @@ namespace Indicateur\View\Helper; use Application\Entity\Db\EcoleDoctorale; use Application\Entity\Db\Etablissement; use Application\Entity\Db\TypeStructure; use Application\Entity\Db\UniteRecherche; use Application\Service\Structure\StructureService; use Indicateur\Model\Indicateur; use Zend\Form\View\Helper\AbstractHelper; Loading @@ -10,9 +15,10 @@ class CompletIndicateurTheseHelper extends AbstractHelper /** * @param Indicateur $indicateur * @param array $data * @param StructureService $structureService * @return string */ public function render($indicateur, $data) { public function render($indicateur, $data, $structureService) { $rubriques = [ 'id' => 'ID', Loading @@ -20,6 +26,9 @@ class CompletIndicateurTheseHelper extends AbstractHelper 'Titre' => 'TITRE', 'Première inscription' => 'DATE_PREM_INSC', 'Date de soutenance' => 'DATE_SOUTENANCE', 'Établissement d\'inscription' => 'ETABLISSEMENT_ID', 'École doctorale' => 'ECOLE_DOCT_ID', 'Unité de recherche' => 'UNITE_RECH_ID', ]; $html = ''; Loading @@ -36,9 +45,41 @@ class CompletIndicateurTheseHelper extends AbstractHelper $html .= '<tr>'; foreach ($rubriques as $clef => $valeur) { $html .= '<td>'; if ($clef === 'Titre') $html .= '<a href="'.$this->getView()->url('these/identite', ['these' => $entry['ID']], [], true).'">'; switch($clef) { case 'Titre': $html .= '<a href="' . $this->getView()->url('these/identite', ['these' => $entry['ID']], [], true) . '">'; $html .= $entry[$valeur]; if ($clef === 'Titre') $html .= '</a>'; $html .= '</a>'; break; case 'Établissement d\'inscription': if ($entry[$valeur]) { /** @var Etablissement $etablissement */ $etablissement = $structureService->getStructuresConcreteByTypeAndStructureConcreteId(TypeStructure::CODE_ETABLISSEMENT, $entry[$valeur]); $html .= '<abbr title="' . $etablissement->getLibelle() . '">' . $etablissement->getSigle() . '</abbr>'; } else $html .= "---"; break; case 'École doctorale': if ($entry[$valeur]) { /** @var EcoleDoctorale $ecole */ $ecole = $structureService->getStructuresConcreteByTypeAndStructureConcreteId(TypeStructure::CODE_ECOLE_DOCTORALE, $entry[$valeur]); $html .= '<abbr title="' . $ecole->getLibelle() . '">' . $ecole->getSigle() . '</abbr>'; } else { $html .= "---"; } break; case 'Unité de recherche': if ($entry[$valeur]) { /** @var UniteRecherche $unite */ $unite = $structureService->getStructuresConcreteByTypeAndStructureConcreteId(TypeStructure::CODE_UNITE_RECHERCHE, $entry[$valeur]); $html .= '<abbr title="' . $unite->getLibelle() . '">' . $unite->getSigle() . '</abbr>'; } else { $html .= "---"; } break; default: $html .= $entry[$valeur]; break; } $html .= '</td>'; } $html .= '</tr>'; Loading module/Indicateur/view/indicateur/indicateur/view.phtml +4 −1 Original line number Diff line number Diff line Loading @@ -6,6 +6,9 @@ use Indicateur\Provider\Privilege\IndicateurPrivileges; /** * @var Indicateur $indicateur * @var array $data * @var \Application\Service\Structure\StructureService $structureService * * @see \Indicateur\Controller\IndicateurController::viewAction() */ ?> Loading Loading @@ -33,7 +36,7 @@ use Indicateur\Provider\Privilege\IndicateurPrivileges; </p> <?php if ($indicateur->getDisplayAs() === Indicateur::THESE): ?> <?php echo $this->completIndicateurThese()->render($indicateur, $data); ?> <?php echo $this->completIndicateurThese()->render($indicateur, $data, $structureService); ?> <?php endif; ?> <?php if ($indicateur->getDisplayAs() === Indicateur::INDIVIDU): ?> Loading Loading
module/Application/src/Application/Service/Structure/StructureService.php +24 −0 Original line number Diff line number Diff line Loading @@ -680,6 +680,30 @@ class StructureService extends BaseService return $result; } /** * @param string $type * @param int $structureId * @return StructureConcreteInterface */ public function getStructuresConcreteByTypeAndStructureConcreteId($type, $structureId) { $qb = $this->getEntityManager()->getRepository($this->getEntityByType($type))->createQueryBuilder('structureConcrete') ->addSelect('structure') ->join('structureConcrete.structure', 'structure') ->andWhere('structureConcrete.id = :structureId') ->setParameter('structureId', $structureId) ; try { $result = $qb->getQuery()->getOneOrNullResult(); } catch (NonUniqueResultException $e) { throw new RuntimeException("Plusieurs ".$type." partagent le même identifiant de structure [".$structureId."]"); } if (!$result) throw new RuntimeException("Aucun(e) ".$type." de trouvé(e)."); return $result; } /** * Identifie les structures substituables en utilisant le sourceCode. * Loading
module/Indicateur/src/Indicateur/Controller/Factory/IndicateurControllerFactory.php +4 −0 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ namespace Indicateur\Controller\Factory; use Application\Service\AnomalieService; use Application\Service\Etablissement\EtablissementService; use Application\Service\Individu\IndividuService; use Application\Service\Structure\StructureService; use Application\Service\These\TheseService; use Indicateur\Controller\IndicateurController; use Indicateur\Service\IndicateurService; Loading @@ -23,6 +24,7 @@ class IndicateurControllerFactory * @var TheseService $theseService * @var AnomalieService $anomalieService * @var EtablissementService $etablissementService * @var StructureService $structureService * @var IndicateurService $indicateurService */ $individuService = $controllerManager->getServiceLocator()->get('IndividuService'); Loading @@ -30,6 +32,7 @@ class IndicateurControllerFactory $anomalieService = $controllerManager->getServiceLocator()->get(AnomalieService::class); $etablissementService = $controllerManager->getServiceLocator()->get('EtablissementService'); $indicateurService = $controllerManager->getServiceLocator()->get(IndicateurService::class); $structureService = $controllerManager->getServiceLocator()->get(StructureService::class); $controller = new IndicateurController(); $controller->setIndividuService($individuService); Loading @@ -37,6 +40,7 @@ class IndicateurControllerFactory $controller->setAnomalieService($anomalieService); $controller->setEtablissementService($etablissementService); $controller->setIndicateurService($indicateurService); $controller->setStructureService($structureService); return $controller; } Loading
module/Indicateur/src/Indicateur/Controller/IndicateurController.php +39 −1 Original line number Diff line number Diff line Loading @@ -3,10 +3,15 @@ namespace Indicateur\Controller; use Application\Entity\Db\Acteur; use Application\Entity\Db\EcoleDoctorale; use Application\Entity\Db\Etablissement; use Application\Entity\Db\These; use Application\Entity\Db\TypeStructure; use Application\Entity\Db\UniteRecherche; use Application\Service\AnomalieServiceAwareTrait; use Application\Service\Etablissement\EtablissementServiceAwareTrait; use Application\Service\Individu\IndividuServiceAwareTrait; use Application\Service\Structure\StructureServiceAwareTrait; use Application\Service\These\TheseServiceAwareTrait; use DateTime; use Indicateur\Form\IndicateurForm; Loading @@ -24,6 +29,7 @@ class IndicateurController extends AbstractActionController { use EtablissementServiceAwareTrait; use AnomalieServiceAwareTrait; use IndicateurServiceAwareTrait; use StructureServiceAwareTrait; /** * @return array|ViewModel Loading Loading @@ -146,6 +152,7 @@ class IndicateurController extends AbstractActionController { return new ViewModel([ 'indicateur' => $indicateur, 'data' => $data, 'structureService' => $this->getStructureService(), ]); } Loading @@ -163,6 +170,9 @@ class IndicateurController extends AbstractActionController { 'Titre' => 'TITRE', 'Première inscription' => 'DATE_PREM_INSC', 'Date de soutenance' => 'DATE_SOUTENANCE', 'Établissement d\'inscription' => 'ETABLISSEMENT_ID', 'École doctorale' => 'ECOLE_DOCT_ID', 'Unité de recherche' => 'UNITE_RECH_ID', ]; } if ($indicateur->getDisplayAs() == Indicateur::INDIVIDU) { Loading Loading @@ -191,7 +201,35 @@ class IndicateurController extends AbstractActionController { foreach ($data as $entry) { $record = []; foreach($headers as $key => $fct) { $record[] = $entry[$fct]; $value = ''; switch($key) { case 'Établissement d\'inscription' : if ($entry[$fct]) { /** @var Etablissement $etablissement */ $etablissement = $this->getStructureService()->getStructuresConcreteByTypeAndStructureConcreteId(TypeStructure::CODE_ETABLISSEMENT, $entry[$fct]); $value = $etablissement->getLibelle(); } else $value .= ""; break; case 'École doctorale' : if ($entry[$fct]) { /** @var EcoleDoctorale $ecole */ $ecole = $this->getStructureService()->getStructuresConcreteByTypeAndStructureConcreteId(TypeStructure::CODE_ECOLE_DOCTORALE, $entry[$fct]); $value = $ecole->getLibelle(); } else $value .= ""; break; case 'Unité de recherche' : if ($entry[$fct]) { /** @var UniteRecherche $unite */ $unite = $this->getStructureService()->getStructuresConcreteByTypeAndStructureConcreteId(TypeStructure::CODE_UNITE_RECHERCHE, $entry[$fct]); $value = $unite->getLibelle(); } else $value .= ""; break; default: $value = $entry[$fct]; break; } $record[] = $value; } $records[] = $record; } Loading
module/Indicateur/src/Indicateur/View/Helper/CompletIndicateurTheseHelper.php +44 −3 Original line number Diff line number Diff line Loading @@ -2,6 +2,11 @@ namespace Indicateur\View\Helper; use Application\Entity\Db\EcoleDoctorale; use Application\Entity\Db\Etablissement; use Application\Entity\Db\TypeStructure; use Application\Entity\Db\UniteRecherche; use Application\Service\Structure\StructureService; use Indicateur\Model\Indicateur; use Zend\Form\View\Helper\AbstractHelper; Loading @@ -10,9 +15,10 @@ class CompletIndicateurTheseHelper extends AbstractHelper /** * @param Indicateur $indicateur * @param array $data * @param StructureService $structureService * @return string */ public function render($indicateur, $data) { public function render($indicateur, $data, $structureService) { $rubriques = [ 'id' => 'ID', Loading @@ -20,6 +26,9 @@ class CompletIndicateurTheseHelper extends AbstractHelper 'Titre' => 'TITRE', 'Première inscription' => 'DATE_PREM_INSC', 'Date de soutenance' => 'DATE_SOUTENANCE', 'Établissement d\'inscription' => 'ETABLISSEMENT_ID', 'École doctorale' => 'ECOLE_DOCT_ID', 'Unité de recherche' => 'UNITE_RECH_ID', ]; $html = ''; Loading @@ -36,9 +45,41 @@ class CompletIndicateurTheseHelper extends AbstractHelper $html .= '<tr>'; foreach ($rubriques as $clef => $valeur) { $html .= '<td>'; if ($clef === 'Titre') $html .= '<a href="'.$this->getView()->url('these/identite', ['these' => $entry['ID']], [], true).'">'; switch($clef) { case 'Titre': $html .= '<a href="' . $this->getView()->url('these/identite', ['these' => $entry['ID']], [], true) . '">'; $html .= $entry[$valeur]; if ($clef === 'Titre') $html .= '</a>'; $html .= '</a>'; break; case 'Établissement d\'inscription': if ($entry[$valeur]) { /** @var Etablissement $etablissement */ $etablissement = $structureService->getStructuresConcreteByTypeAndStructureConcreteId(TypeStructure::CODE_ETABLISSEMENT, $entry[$valeur]); $html .= '<abbr title="' . $etablissement->getLibelle() . '">' . $etablissement->getSigle() . '</abbr>'; } else $html .= "---"; break; case 'École doctorale': if ($entry[$valeur]) { /** @var EcoleDoctorale $ecole */ $ecole = $structureService->getStructuresConcreteByTypeAndStructureConcreteId(TypeStructure::CODE_ECOLE_DOCTORALE, $entry[$valeur]); $html .= '<abbr title="' . $ecole->getLibelle() . '">' . $ecole->getSigle() . '</abbr>'; } else { $html .= "---"; } break; case 'Unité de recherche': if ($entry[$valeur]) { /** @var UniteRecherche $unite */ $unite = $structureService->getStructuresConcreteByTypeAndStructureConcreteId(TypeStructure::CODE_UNITE_RECHERCHE, $entry[$valeur]); $html .= '<abbr title="' . $unite->getLibelle() . '">' . $unite->getSigle() . '</abbr>'; } else { $html .= "---"; } break; default: $html .= $entry[$valeur]; break; } $html .= '</td>'; } $html .= '</tr>'; Loading
module/Indicateur/view/indicateur/indicateur/view.phtml +4 −1 Original line number Diff line number Diff line Loading @@ -6,6 +6,9 @@ use Indicateur\Provider\Privilege\IndicateurPrivileges; /** * @var Indicateur $indicateur * @var array $data * @var \Application\Service\Structure\StructureService $structureService * * @see \Indicateur\Controller\IndicateurController::viewAction() */ ?> Loading Loading @@ -33,7 +36,7 @@ use Indicateur\Provider\Privilege\IndicateurPrivileges; </p> <?php if ($indicateur->getDisplayAs() === Indicateur::THESE): ?> <?php echo $this->completIndicateurThese()->render($indicateur, $data); ?> <?php echo $this->completIndicateurThese()->render($indicateur, $data, $structureService); ?> <?php endif; ?> <?php if ($indicateur->getDisplayAs() === Indicateur::INDIVIDU): ?> Loading