Commit 04a9f57f authored by Thomas Hamel's avatar Thomas Hamel
Browse files

Formation externe peut-être reliée à des compétences RNCP

parent b1931c9a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -178,7 +178,7 @@ use UnicaenIdref\View\Helper\IdrefLinkViewHelper;
 * @method ActualiteViewHelper actualite()
 * @method StructureViewHelper structure(Structure|Etablissement|EcoleDoctorale|UniteRecherche $structure, bool $afficherLibelle = true, bool $sansOmbre = false, $options = [])
 * @method FichierViewHelper fichier(Fichier $object, string $urlTelechargementFichier, string $urlSuppressionFichier, bool $canGererFichier, string $libelleOptionnel = "", bool $voirHistoInfo = true, bool $canVoirSuppression = true, bool $isTargetBlank = false, array $options = [])
 * @method SousCompetenceViewHelper sousCompetences(SousCompetence $object, array $options = [])
 * @method SousCompetenceViewHelper sousCompetences(SousCompetence[] $object, array $options = [])
 * @method EtatViewHelper etatHelper(mixed $etat = null, int|null $resultat = null, string|null $resultatString = "", $options = [])
 * @method MissionEnseignementViewHelper missionEnseignement(MissionEnseignement $missionEnseignement, These $these, $options = [])
 * @method IdrefLinkViewHelper idrefLink(string $ppn)
+3 −0
Original line number Diff line number Diff line
@@ -8,6 +8,8 @@ use Formation\Controller\FormationExterneController;
use Formation\Controller\FormationExterneControllerFactory;
use Formation\Form\Formation\FormationExterne\FormationExterneForm;
use Formation\Form\Formation\FormationExterne\FormationExterneFormFactory;
use Formation\Form\Formation\FormationExterne\FormationExterneHydrator;
use Formation\Form\Formation\FormationExterne\FormationExterneHydratorFactory;
use Formation\Provider\Privilege\FormationPrivileges;
use Formation\Service\Formation\FormationExterne\FormationExterneService;
use Formation\Service\Formation\FormationExterne\FormationExterneServiceFactory;
@@ -283,6 +285,7 @@ return [
    ],
    'hydrators' => [
        'factories' => [
            FormationExterneHydrator::class => FormationExterneHydratorFactory::class,
        ],
    ]
];
 No newline at end of file
+27 −1
Original line number Diff line number Diff line
@@ -18,6 +18,9 @@ use Formation\Service\Formation\FormationExterne\FormationExterneServiceAwareTra
use Formation\Service\Validation\ValidationFormationExterne\ValidationFormationExterneServiceAwareTrait;
use Individu\Entity\Db\Individu;
use Laminas\View\Model\ViewModel;
use RNCP\Entity\Db\SousCompetence;
use RNCP\Entity\Db\SousCompetenceRelation;
use RNCP\Service\SousCompetence\SousCompetenceServiceAwareTrait;
use UnicaenApp\Service\EntityManagerAwareTrait;
use UnicaenParametre\Service\Parametre\ParametreServiceAwareTrait;
use Validation\Entity\Db\ValidationFormationExterne;
@@ -31,6 +34,7 @@ class IndexController extends AbstractController
    use FormationExterneServiceAwareTrait;
    use ValidationFormationExterneServiceAwareTrait;
    use JustificatifServiceAwareTrait;
    use SousCompetenceServiceAwareTrait;

    public function indexAction() : ViewModel
    {
@@ -175,6 +179,15 @@ class IndexController extends AbstractController
        ]);
    }

    /**
     *
     * @return array<int, array{
     *     formationExterne: FormationExterne,
     *     anneeUniv: int,
     *     validation: ValidationFormationExterne|null,
     *     sousCompetences: SousCompetence[]
     * }>
     */
    private function getFormationsExternesAvecAnneeUniv(array $formationsExternes, AnneeUniv $anneeUnivCourante): array
    {
        $formationsExternesAvecAnneeUniv = [];
@@ -189,7 +202,20 @@ class IndexController extends AbstractController
            $validation =
                $this->validationFormationExterneService->getRepository()->findValidationByFormationExterneAndCode($formationExterne, TypeValidation::CODE_VALIDATION_FORMATION_EXTERNE);
            if (!$validation) $validation = $this->validationFormationExterneService->getRepository()->findValidationByFormationExterneAndCode($formationExterne, TypeValidation::CODE_REFUS_FORMATION_EXTERNE);
            $formationsExternesAvecAnneeUniv[] = array("formationExterne" => $formationExterne, "anneeUniv" => $premiereAnnee ?? $anneeUnivCourante->getPremiereAnnee(), "validation" => $validation);

            $sousCompetences = $this->getSousCompetenceService()
                ->getRepository()
                ->findByEntite(
                    SousCompetenceRelation::FORMATION_EXTERNE,
                    $formationExterne->getId()
                );

            $formationsExternesAvecAnneeUniv[] = array(
                "formationExterne" => $formationExterne,
                "anneeUniv" => $premiereAnnee ?? $anneeUnivCourante->getPremiereAnnee(),
                "validation" => $validation,
                'sousCompetences' => $sousCompetences
            );
        }

        return $formationsExternesAvecAnneeUniv;
+4 −0
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@ use Formation\Service\Validation\ValidationFormationExterne\ValidationFormationE
use Interop\Container\ContainerInterface;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use RNCP\Service\SousCompetence\SousCompetenceService;
use UnicaenParametre\Service\Parametre\ParametreService;

class IndexControllerFactory {
@@ -31,6 +32,7 @@ class IndexControllerFactory {
         * @var FormationExterneService $formationExterneService
         * @var ValidationFormationExterneService $validationFormationExterneService
         * @var JustificatifService $justificatifService
         * @var SousCompetenceService $sousCompetenceService
        */
        $entityManager = $container->get('doctrine.entitymanager.orm_default');
        $doctorantService = $container->get(DoctorantService::class);
@@ -39,6 +41,7 @@ class IndexControllerFactory {
        $formationExterneService = $container->get(FormationExterneService::class);
        $validationFormationExterneService = $container->get(ValidationFormationExterneService::class);
        $justificatifService = $container->get(JustificatifService::class);
        $sousCompetenceService = $container->get(SousCompetenceService::class);

        $controller = new IndexController();
        $controller->setEntityManager($entityManager);
@@ -48,6 +51,7 @@ class IndexControllerFactory {
        $controller->setJustificatifService($justificatifService);
        $controller->setFormationExterneService($formationExterneService);
        $controller->setValidationFormationExterneService($validationFormationExterneService);
        $controller->setSousCompetenceService($sousCompetenceService);

        return $controller;
    }
+4 −4
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ class Formation implements HistoriqueAwareInterface,
    public const TYPE_CODE_TRAVERSAL = 'T';
    public const TYPE_CODE_SPECIFIQUE = 'S';

    private int $id;
    private ?int $id = null;
    private ?string $libelle = null;
    private ?string $description  = null;
    private ?string $lien  = null;
@@ -45,9 +45,9 @@ class Formation implements HistoriqueAwareInterface,
    private ?string $programme = null;

    /**
     * @return int
     * @return ?int
     */
    public function getId(): int
    public function getId(): ?int
    {
        return $this->id;
    }
@@ -225,7 +225,7 @@ class Formation implements HistoriqueAwareInterface,
    public function addSousCompetence(SousCompetence $sousCompetence): self
    {
        $sousCompetence->addRelation(
            'formation',
            SousCompetenceRelation::FORMATION,
            $this->getId()
        );

Loading