Loading module/Application/config/merged/competence.config.php +5 −1 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ use Application\Service\CompetenceType\CompetenceTypeServiceFactory; use Application\Service\HasCompetenceCollection\HasCompetenceCollectionService; use Application\Service\HasCompetenceCollection\HasCompetenceCollectionServiceFactory; use Application\View\Helper\CompetenceBlocViewHelper; use Application\View\Helper\CompetenceBlocViewHelperFactory; use UnicaenPrivilege\Guard\PrivilegeController; use Zend\Router\Http\Literal; use Zend\Router\Http\Segment; Loading Loading @@ -418,7 +419,10 @@ return [ ], ], 'view_helpers' => [ 'invokables' => [ 'factories' => [ CompetenceBlocViewHelper::class => CompetenceBlocViewHelperFactory::class, ], 'aliases' => [ 'competenceBloc' => CompetenceBlocViewHelper::class, ], ], Loading module/Application/src/Application/Entity/Db/FicheMetier.php +30 −35 Original line number Diff line number Diff line Loading @@ -226,54 +226,49 @@ class FicheMetier implements HistoriqueAwareInterface, HasEtatInterface, return $texte; } public function getConnaissances() { /** * @param int $typeId * @return string */ public function getComptencesByType(int $typeId) : string { $competences = $this->getCompetenceListe(); $competences = array_map(function (CompetenceElement $c) { return $c->getCompetence();}, $competences); $competences = array_filter($competences, function (Competence $c) use ($typeId) { return $c->getType()->getId() === $typeId;}); usort($competences, function (Competence $a, Competence $b) { return $a->getLibelle() > $b->getLibelle();}); $texte = ""; $texte .= "<ul>"; /** @var CompetenceElement $competence */ $texte = "<ul>"; foreach ($competences as $competence) { if ($competence->getCompetence()->getType()->getId() === CompetenceType::CODE_CONNAISSANCE) { $texte .= "<li>"; $texte .= $competence->getCompetence()->getLibelle(); $texte .= $competence->getLibelle(); $texte .= "</li>"; } } $texte .= "</ul>"; return $texte; } public function getCompetencesOperationnelles() { $competences = $this->getCompetenceListe(); $texte = ""; $texte .= "<ul>"; /** @var CompetenceElement $competence */ foreach ($competences as $competence) { if ($competence->getCompetence()->getType()->getId() === CompetenceType::CODE_OPERATIONNELLE) { $texte .= "<li>"; $texte .= $competence->getCompetence()->getLibelle(); $texte .= "</li>"; } } $texte .= "</ul>"; return $texte; /** * @return string */ public function getConnaissances() : string { return $this->getComptencesByType(CompetenceType::CODE_CONNAISSANCE); } public function getCompetencesComportementales() { $competences = $this->getCompetenceListe(); $texte = ""; $texte .= "<ul>"; /** @var CompetenceElement $competence */ foreach ($competences as $competence) { if ($competence->getCompetence()->getType()->getId() === CompetenceType::CODE_COMPORTEMENTALE) { $texte .= "<li>"; $texte .= $competence->getCompetence()->getLibelle(); $texte .= "</li>"; } /** * @return string */ public function getCompetencesOperationnelles() : string { return $this->getComptencesByType(CompetenceType::CODE_OPERATIONNELLE); } $texte .= "</ul>"; return $texte; /** * @return string */ public function getCompetencesComportementales() : string { return $this->getComptencesByType(CompetenceType::CODE_COMPORTEMENTALE); } public function getApplicationsAffichage() { Loading module/Application/src/Application/Entity/Db/MacroContent/FichePosteMacroTrait.php +35 −21 Original line number Diff line number Diff line Loading @@ -3,6 +3,8 @@ namespace Application\Entity\Db\MacroContent; use Application\Entity\Db\Competence; use Application\Entity\Db\CompetenceElement; use Application\Entity\Db\CompetenceType; use Application\Entity\Db\FichePoste; use Application\Entity\Db\ParcoursDeFormation; use Formation\Entity\Db\Formation; Loading Loading @@ -139,41 +141,53 @@ trait FichePosteMacroTrait { } /** * @param int $typeId * @return string */ public function toStringCompetences() : string public function toStringCompetencesByTypes(int $typeId) : string { /** @var FichePoste $ficheposte */ $ficheposte = $this; $competences = $ficheposte->getDictionnaire('competences'); $competences = array_filter($competences, function ($a) { return $a["conserve"] === true;}); if (empty($competences)) return ""; $dictionnaire = $ficheposte->getDictionnaire('competences'); $dictionnaire = array_filter($dictionnaire, function ($a) { return $a["conserve"] === true;}); $dictionnaire = array_filter($dictionnaire, function ($a) use ($typeId) { return $a["entite"]->getType()->getId() === $typeId;}); usort($dictionnaire, function ($a, $b) { return $a["entite"]->getLibelle() > $b["entite"]->getLibelle();}); $result = []; foreach ($competences as $competence) { /** @var Competence $entite */ $entite = $competence["entite"]; if ($entite !== null) $result [$entite->getType()?$entite->getType()->getLibelle():"Sans type"][$entite->getId()] = $entite; } ksort($result); $texte = "<h3> Compétences </h3>"; $texte .= "<ul>"; foreach ($result as $groupe => $liste) { usort($liste, function (Competence $a, Competence $b) { return $a->getLibelle() > $b->getLibelle();}); $texte = "<ul>"; foreach ($dictionnaire as $element) { $texte .= "<li>"; $texte .= $groupe; $texte .= "<ul>"; foreach ($liste as $item) { $texte .= "<li>".$item->getLibelle()."</li>"; } $texte .= "</ul>"; $texte .= $element["entite"]->getLibelle(); $texte .= "</li>"; } $texte .= "</ul>"; return $texte; } /** * @return string */ public function toStringCompetencesConnaissances() : string { return $this->toStringCompetencesByTypes(CompetenceType::CODE_CONNAISSANCE); } /** * @return string */ public function toStringCompetencesOperationnelles() : string { return $this->toStringCompetencesByTypes(CompetenceType::CODE_OPERATIONNELLE); } /** * @return string */ public function toStringCompetencesComportementales() : string { return $this->toStringCompetencesByTypes(CompetenceType::CODE_COMPORTEMENTALE); } /** * @return string */ Loading module/Application/src/Application/View/Helper/CompetenceBlocViewHelper.php +27 −1 Original line number Diff line number Diff line Loading @@ -2,6 +2,8 @@ namespace Application\View\Helper; use Application\Entity\Db\CompetenceType; use Application\Service\CompetenceType\CompetenceTypeServiceAwareTrait; use Application\View\Renderer\PhpRenderer; use Zend\View\Helper\AbstractHelper; use Zend\View\Helper\Partial; Loading @@ -9,6 +11,10 @@ use Zend\View\Resolver\TemplatePathStack; class CompetenceBlocViewHelper extends AbstractHelper { /** @var CompetenceType[] */ private $competencesTypes; /** * @param array $competences * @param array $options Loading @@ -20,6 +26,26 @@ class CompetenceBlocViewHelper extends AbstractHelper $view = $this->getView(); $view->resolver()->attach(new TemplatePathStack(['script_paths' => [__DIR__ . "/partial"]])); return $view->partial('competence-bloc', ['competences' => $competences, 'options' => $options]); return $view->partial('competence-bloc', ['competences' => $competences, 'types' => $this->getCompetencesTypes(), 'options' => $options]); } /** * @return CompetenceType[]|null */ public function getCompetencesTypes(): ?array { return $this->competencesTypes; } /** * @param CompetenceType[] $competencesTypes * @return CompetenceBlocViewHelper */ public function setCompetencesTypes(?array $competencesTypes): CompetenceBlocViewHelper { $this->competencesTypes = $competencesTypes; return $this; } } No newline at end of file module/Application/src/Application/View/Helper/CompetenceBlocViewHelperFactory.php 0 → 100644 +26 −0 Original line number Diff line number Diff line <?php namespace Application\View\Helper; use Application\Service\CompetenceType\CompetenceTypeService; use Interop\Container\ContainerInterface; class CompetenceBlocViewHelperFactory { /** * @param ContainerInterface $container * @return CompetenceBlocViewHelper */ public function __invoke(ContainerInterface $container) { /** * @var CompetenceTypeService $competenceTypeService */ $competenceTypeService = $container->get(CompetenceTypeService::class); $types = $competenceTypeService->getCompetencesTypes('ordre'); $helper = new CompetenceBlocViewHelper(); $helper->setCompetencesTypes($types); return $helper; } } No newline at end of file Loading
module/Application/config/merged/competence.config.php +5 −1 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ use Application\Service\CompetenceType\CompetenceTypeServiceFactory; use Application\Service\HasCompetenceCollection\HasCompetenceCollectionService; use Application\Service\HasCompetenceCollection\HasCompetenceCollectionServiceFactory; use Application\View\Helper\CompetenceBlocViewHelper; use Application\View\Helper\CompetenceBlocViewHelperFactory; use UnicaenPrivilege\Guard\PrivilegeController; use Zend\Router\Http\Literal; use Zend\Router\Http\Segment; Loading Loading @@ -418,7 +419,10 @@ return [ ], ], 'view_helpers' => [ 'invokables' => [ 'factories' => [ CompetenceBlocViewHelper::class => CompetenceBlocViewHelperFactory::class, ], 'aliases' => [ 'competenceBloc' => CompetenceBlocViewHelper::class, ], ], Loading
module/Application/src/Application/Entity/Db/FicheMetier.php +30 −35 Original line number Diff line number Diff line Loading @@ -226,54 +226,49 @@ class FicheMetier implements HistoriqueAwareInterface, HasEtatInterface, return $texte; } public function getConnaissances() { /** * @param int $typeId * @return string */ public function getComptencesByType(int $typeId) : string { $competences = $this->getCompetenceListe(); $competences = array_map(function (CompetenceElement $c) { return $c->getCompetence();}, $competences); $competences = array_filter($competences, function (Competence $c) use ($typeId) { return $c->getType()->getId() === $typeId;}); usort($competences, function (Competence $a, Competence $b) { return $a->getLibelle() > $b->getLibelle();}); $texte = ""; $texte .= "<ul>"; /** @var CompetenceElement $competence */ $texte = "<ul>"; foreach ($competences as $competence) { if ($competence->getCompetence()->getType()->getId() === CompetenceType::CODE_CONNAISSANCE) { $texte .= "<li>"; $texte .= $competence->getCompetence()->getLibelle(); $texte .= $competence->getLibelle(); $texte .= "</li>"; } } $texte .= "</ul>"; return $texte; } public function getCompetencesOperationnelles() { $competences = $this->getCompetenceListe(); $texte = ""; $texte .= "<ul>"; /** @var CompetenceElement $competence */ foreach ($competences as $competence) { if ($competence->getCompetence()->getType()->getId() === CompetenceType::CODE_OPERATIONNELLE) { $texte .= "<li>"; $texte .= $competence->getCompetence()->getLibelle(); $texte .= "</li>"; } } $texte .= "</ul>"; return $texte; /** * @return string */ public function getConnaissances() : string { return $this->getComptencesByType(CompetenceType::CODE_CONNAISSANCE); } public function getCompetencesComportementales() { $competences = $this->getCompetenceListe(); $texte = ""; $texte .= "<ul>"; /** @var CompetenceElement $competence */ foreach ($competences as $competence) { if ($competence->getCompetence()->getType()->getId() === CompetenceType::CODE_COMPORTEMENTALE) { $texte .= "<li>"; $texte .= $competence->getCompetence()->getLibelle(); $texte .= "</li>"; } /** * @return string */ public function getCompetencesOperationnelles() : string { return $this->getComptencesByType(CompetenceType::CODE_OPERATIONNELLE); } $texte .= "</ul>"; return $texte; /** * @return string */ public function getCompetencesComportementales() : string { return $this->getComptencesByType(CompetenceType::CODE_COMPORTEMENTALE); } public function getApplicationsAffichage() { Loading
module/Application/src/Application/Entity/Db/MacroContent/FichePosteMacroTrait.php +35 −21 Original line number Diff line number Diff line Loading @@ -3,6 +3,8 @@ namespace Application\Entity\Db\MacroContent; use Application\Entity\Db\Competence; use Application\Entity\Db\CompetenceElement; use Application\Entity\Db\CompetenceType; use Application\Entity\Db\FichePoste; use Application\Entity\Db\ParcoursDeFormation; use Formation\Entity\Db\Formation; Loading Loading @@ -139,41 +141,53 @@ trait FichePosteMacroTrait { } /** * @param int $typeId * @return string */ public function toStringCompetences() : string public function toStringCompetencesByTypes(int $typeId) : string { /** @var FichePoste $ficheposte */ $ficheposte = $this; $competences = $ficheposte->getDictionnaire('competences'); $competences = array_filter($competences, function ($a) { return $a["conserve"] === true;}); if (empty($competences)) return ""; $dictionnaire = $ficheposte->getDictionnaire('competences'); $dictionnaire = array_filter($dictionnaire, function ($a) { return $a["conserve"] === true;}); $dictionnaire = array_filter($dictionnaire, function ($a) use ($typeId) { return $a["entite"]->getType()->getId() === $typeId;}); usort($dictionnaire, function ($a, $b) { return $a["entite"]->getLibelle() > $b["entite"]->getLibelle();}); $result = []; foreach ($competences as $competence) { /** @var Competence $entite */ $entite = $competence["entite"]; if ($entite !== null) $result [$entite->getType()?$entite->getType()->getLibelle():"Sans type"][$entite->getId()] = $entite; } ksort($result); $texte = "<h3> Compétences </h3>"; $texte .= "<ul>"; foreach ($result as $groupe => $liste) { usort($liste, function (Competence $a, Competence $b) { return $a->getLibelle() > $b->getLibelle();}); $texte = "<ul>"; foreach ($dictionnaire as $element) { $texte .= "<li>"; $texte .= $groupe; $texte .= "<ul>"; foreach ($liste as $item) { $texte .= "<li>".$item->getLibelle()."</li>"; } $texte .= "</ul>"; $texte .= $element["entite"]->getLibelle(); $texte .= "</li>"; } $texte .= "</ul>"; return $texte; } /** * @return string */ public function toStringCompetencesConnaissances() : string { return $this->toStringCompetencesByTypes(CompetenceType::CODE_CONNAISSANCE); } /** * @return string */ public function toStringCompetencesOperationnelles() : string { return $this->toStringCompetencesByTypes(CompetenceType::CODE_OPERATIONNELLE); } /** * @return string */ public function toStringCompetencesComportementales() : string { return $this->toStringCompetencesByTypes(CompetenceType::CODE_COMPORTEMENTALE); } /** * @return string */ Loading
module/Application/src/Application/View/Helper/CompetenceBlocViewHelper.php +27 −1 Original line number Diff line number Diff line Loading @@ -2,6 +2,8 @@ namespace Application\View\Helper; use Application\Entity\Db\CompetenceType; use Application\Service\CompetenceType\CompetenceTypeServiceAwareTrait; use Application\View\Renderer\PhpRenderer; use Zend\View\Helper\AbstractHelper; use Zend\View\Helper\Partial; Loading @@ -9,6 +11,10 @@ use Zend\View\Resolver\TemplatePathStack; class CompetenceBlocViewHelper extends AbstractHelper { /** @var CompetenceType[] */ private $competencesTypes; /** * @param array $competences * @param array $options Loading @@ -20,6 +26,26 @@ class CompetenceBlocViewHelper extends AbstractHelper $view = $this->getView(); $view->resolver()->attach(new TemplatePathStack(['script_paths' => [__DIR__ . "/partial"]])); return $view->partial('competence-bloc', ['competences' => $competences, 'options' => $options]); return $view->partial('competence-bloc', ['competences' => $competences, 'types' => $this->getCompetencesTypes(), 'options' => $options]); } /** * @return CompetenceType[]|null */ public function getCompetencesTypes(): ?array { return $this->competencesTypes; } /** * @param CompetenceType[] $competencesTypes * @return CompetenceBlocViewHelper */ public function setCompetencesTypes(?array $competencesTypes): CompetenceBlocViewHelper { $this->competencesTypes = $competencesTypes; return $this; } } No newline at end of file
module/Application/src/Application/View/Helper/CompetenceBlocViewHelperFactory.php 0 → 100644 +26 −0 Original line number Diff line number Diff line <?php namespace Application\View\Helper; use Application\Service\CompetenceType\CompetenceTypeService; use Interop\Container\ContainerInterface; class CompetenceBlocViewHelperFactory { /** * @param ContainerInterface $container * @return CompetenceBlocViewHelper */ public function __invoke(ContainerInterface $container) { /** * @var CompetenceTypeService $competenceTypeService */ $competenceTypeService = $container->get(CompetenceTypeService::class); $types = $competenceTypeService->getCompetencesTypes('ordre'); $helper = new CompetenceBlocViewHelper(); $helper->setCompetencesTypes($types); return $helper; } } No newline at end of file