Commit bb75fe77 authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

Amélioration de l'affichage des compétences dans les profils de recrutement

parent 9e4baa21
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -89,11 +89,13 @@ class FicheProfilController extends AbstractActionController {
    public function exporterAction()
    {
        $ficheprofil = $this->getFicheProfilService()->getRequestedFicheProfil($this);
        $ficheposte = $ficheprofil->getFichePoste();
        $ficheposte->addDictionnaire('competences', $this->getFichePosteService()->getCompetencesDictionnaires($ficheposte));

        $this->getExporterService()->setVars([
            'type' => 'PROFIL_DE_RECRUTMENT',
            'ficheprofil' => $ficheprofil,
            'ficheposte' => $ficheprofil->getFichePoste(),
            'ficheposte' => $ficheposte,
            'structure' => $ficheprofil->getStructure(),
        ]);
        $this->getExporterService()->export('export.pdf');
+0 −57
Original line number Diff line number Diff line
@@ -349,63 +349,6 @@ class FichePoste implements ResourceInterface, HistoriqueAwareInterface, HasAgen

    /** Fonction pour les affichages dans les documents ***************************************************************/

    public function getConnaissancesAffichage()
    {
        $dictionnaire = [];
        foreach ($this->getFichesMetiers() as $fiche) {
            /** @var Competence $competence */
            foreach ($fiche->getFicheType()->getCompetenceListe() as $competenceElement) {
                $competence = $competenceElement->getCompetence();
                if ($competence->getType()->getId() === CompetenceType::CODE_CONNAISSANCE) $dictionnaire[$competence->getId()] = $competence->getLibelle();
            }
        }

        $texte = "<ul>";
        foreach ($dictionnaire as $id => $libelle) {
            $texte .= "<li>".$libelle."</li>";
        }
        $texte .= "</ul>";
        return $texte;
    }

    public function getCompetencesOperationnellesAffichage()
    {
        $dictionnaire = [];
        foreach ($this->getFichesMetiers() as $fiche) {
            /** @var Competence $competence */
            foreach ($fiche->getFicheType()->getCompetenceListe() as $competenceElement) {
                $competence = $competenceElement->getCompetence();
                if ($competence->getType()->getId() === CompetenceType::CODE_OPERATIONNELLE) $dictionnaire[$competence->getId()] = $competence->getLibelle();
            }
        }

        $texte = "<ul>";
        foreach ($dictionnaire as $id => $libelle) {
            $texte .= "<li>".$libelle."</li>";
        }
        $texte .= "</ul>";
        return $texte;
    }

    public function getCompetencesComportementalesAffichage()
    {
        $dictionnaire = [];
        foreach ($this->getFichesMetiers() as $fiche) {
            /** @var Competence $competence */
            foreach ($fiche->getFicheType()->getCompetenceListe() as $competenceElement) {
                $competence = $competenceElement->getCompetence();
                if ($competence->getType()->getId() === CompetenceType::CODE_COMPORTEMENTALE) $dictionnaire[$competence->getId()] = $competence->getLibelle();
            }
        }

        $texte = "<ul>";
        foreach ($dictionnaire as $id => $libelle) {
            $texte .= "<li>".$libelle."</li>";
        }
        $texte .= "</ul>";
        return $texte;
    }

    public function addDictionnaire(string $clef, $valeur)
    {
        $this->dictionnaires[$clef] = $valeur;
+27 −2
Original line number Diff line number Diff line
@@ -142,15 +142,16 @@ trait FichePosteMacroTrait {

    /**
     * @param int $typeId
     * @param bool $all
     * @return string
     */
    public function toStringCompetencesByTypes(int $typeId) : string
    public function toStringCompetencesByTypes(int $typeId, bool $all=false) : string
    {
        /** @var FichePoste $ficheposte */
        $ficheposte = $this;

        $dictionnaire = $ficheposte->getDictionnaire('competences');
        $dictionnaire = array_filter($dictionnaire, function ($a) { return $a["conserve"] === true;});
        if (!$all) $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();});

@@ -172,6 +173,14 @@ trait FichePosteMacroTrait {
        return $this->toStringCompetencesByTypes(CompetenceType::CODE_CONNAISSANCE);
    }

    /**
     * @return string
     */
    public function toStringAllCompetencesConnaissances() : string
    {
        return $this->toStringCompetencesByTypes(CompetenceType::CODE_CONNAISSANCE, true);
    }

    /**
     * @return string
     */
@@ -180,6 +189,14 @@ trait FichePosteMacroTrait {
        return $this->toStringCompetencesByTypes(CompetenceType::CODE_OPERATIONNELLE);
    }

    /**
     * @return string
     */
    public function toStringAllCompetencesOperationnelles() : string
    {
        return $this->toStringCompetencesByTypes(CompetenceType::CODE_OPERATIONNELLE, true);
    }

    /**
     * @return string
     */
@@ -188,6 +205,14 @@ trait FichePosteMacroTrait {
        return $this->toStringCompetencesByTypes(CompetenceType::CODE_COMPORTEMENTALE);
    }

    /**
     * @return string
     */
    public function toStringAllCompetencesComportementales() : string
    {
        return $this->toStringCompetencesByTypes(CompetenceType::CODE_COMPORTEMENTALE, true);
    }

    /**
     * @return string
     */