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

Plan de formation ..

parent be5c3327
Loading
Loading
Loading
Loading
+2 −3
Changes for documentation/release/3.1.4.md: 2 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -32,11 +32,10 @@ create table formation_plan_formation
    id    serial constraint formation_plan_formation_pk primary key,
    annee varchar(128) not null
);

create table formation_action_plan
(
    action_id integer not null constraint formation_action_plan_formation_id_fk references formation,
    plan_id   integer not null constraint formation_action_plan_formation_plan_formation_id_fk references formation_plan_formation,
    action_id integer not null constraint formation_action_plan_formation_id_fk references formation on delete cascade,
    plan_id   integer not null constraint formation_action_plan_formation_plan_formation_id_fk references formation_plan_formation on delete cascade,
    constraint formation_action_plan_pk primary key (action_id, plan_id)
);
```
+3 −3
Changes for module/Formation/config/merged/formation-instance-inscrit.config.php: 3 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@ namespace Formation;

use Formation\Controller\FormationInstanceInscritController;
use Formation\Controller\FormationInstanceInscritControllerFactory;
use Formation\Controller\PlanFormationController;
use Formation\Controller\PlanDeFormationController;
use Formation\Controller\ProjetPersonnelController;
use Formation\Form\Inscription\InscriptionForm;
use Formation\Form\Inscription\InscriptionFormFactory;
@@ -86,8 +86,8 @@ return [
                    [
                        'order' => 100,
                        'label' => "Plan de formation",
                        'route' => 'plan-formation',
                        'resource' => PrivilegeController::getResourceId(PlanFormationController::class, 'afficher') ,
                        'route' => 'plan-de-formation/courant',
                        'resource' => PrivilegeController::getResourceId(PlanDeFormationController::class, 'courant') ,
                    ],
                    [
                        'order' => 200,
+51 −23
Changes for module/Formation/config/merged/plan-de-formation.config.php: 51 added lines, 23 removed lines.
Original line number Diff line number Diff line
@@ -2,11 +2,8 @@

namespace Formation;

use Formation\Controller\FormationController;
use Formation\Controller\FormationGroupeController;
use Formation\Controller\FormationInstanceController;
use Formation\Controller\PlanFormationController;
use Formation\Controller\PlanFormationControllerFactory;
use Formation\Controller\PlanDeFormationController;
use Formation\Controller\PlanDeFormationControllerFactory;
use Formation\Provider\Privilege\PlanformationPrivileges;
use Formation\Service\PlanDeFormation\PlanDeFormationService;
use Formation\Service\PlanDeFormation\PlanDeFormationServiceFactory;
@@ -18,9 +15,22 @@ return [
        'guards' => [
            PrivilegeController::class => [
                [
                    'controller' => PlanFormationController::class,
                    'controller' => PlanDeFormationController::class,
                    'action' => [
                        'courant',
                    ],
                    'privileges' => [
                        PlanformationPrivileges::PLANFORMATION_ACCES
                    ],
                ],
                [
                    'controller' => PlanDeFormationController::class,
                    'action' => [
                        'index',
                        'afficher',
                        'ajouter',
                        'modifier',
                        'supprimer'
                    ],
                    'privileges' => [
                        PlanformationPrivileges::PLANFORMATION_ACCES
@@ -37,24 +47,29 @@ return [
                    'gestion-formation' => [
                        'pages' => [
                            [
                                'label' => "Gestion de l'offre de formation",
                                'label' => "Gestion du plan de formation",
                                'route' => 'home',
                                'resources' => [
                                    PrivilegeController::getResourceId(PlanFormationController::class, 'afficher') ,
                                    PrivilegeController::getResourceId(FormationGroupeController::class, 'index') ,
                                    PrivilegeController::getResourceId(FormationController::class, 'index') ,
                                    PrivilegeController::getResourceId(FormationInstanceController::class, 'index') ,
                                    PrivilegeController::getResourceId(PlanDeFormationController::class, 'courant') ,
                                    PrivilegeController::getResourceId(PlanDeFormationController::class, 'index') ,
                                ],
                                'order'    => 300,
                                'order'    => 100,
                                'dropdown-header' => true,
                            ],
                            'planformation_' => [
                                'label'    => 'Plan de formation à venir',
                                'route'    => 'plan-formation',
                                'resource' => PrivilegeController::getResourceId(PlanFormationController::class, 'afficher') ,
                                'order'    => 302,
                            'planformation_courrant' => [
                                'label'    => 'Plan de formation courant',
                                'route'    => 'plan-de-formation/courant',
                                'resource' => PrivilegeController::getResourceId(PlanDeFormationController::class, 'courant') ,
                                'order'    => 110,
                                'icon' => 'fas fa-angle-right',
                            ],
                            'plansformation' => [
                                'label'    => 'Plans de formation',
                                'route'    => 'plan-de-formation',
                                'resource' => PrivilegeController::getResourceId(PlanDeFormationController::class, 'index') ,
                                'order'    => 120,
                                'icon' => 'fas fa-angle-right',
                            ]
                        ],
                    ],
                ],
@@ -64,17 +79,30 @@ return [

    'router'          => [
        'routes' => [
            'plan-formation' => [
            'plan-de-formation' => [
                'type'  => Segment::class,
                'options' => [
                    'route'    => '/plan-formation[/:annee]',
                    /** @see PlanDeFormationController::indexAction() */
                    'route'    => '/plan-de-formation',
                    'defaults' => [
                        'controller' => PlanFormationController::class,
                        'action'     => 'afficher',
                        'controller' => PlanDeFormationController::class,
                        'action'     => 'index',
                    ],
                ],
                'may_terminate' => true,
                'child_routes' => [],
                'child_routes' => [
                    'courant' => [
                        'type'  => Segment::class,
                        'options' => [
                            /** @see PlanDeFormationController::courantAction() */
                            'route'    => '/courant',
                            'defaults' => [
                                'controller' => PlanDeFormationController::class,
                                'action'     => 'courant',
                            ],
                        ],
                    ],
                ],
            ],
        ],
    ],
@@ -86,7 +114,7 @@ return [
    ],
    'controllers'     => [
        'factories' => [
            PlanFormationController::class => PlanFormationControllerFactory::class,
            PlanDeFormationController::class => PlanDeFormationControllerFactory::class,
        ],
    ],
    'form_elements' => [
+2 −3
Changes for module/Formation/config/merged/structure.config.php: 2 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ return [
                        'afficher',
                    ],
                    'privileges' => [ //TODO privileges
                        FormationPrivileges::FORMATION_AFFICHER,
                        FormationPrivileges::FORMATION_MODIFIER,
                    ],
                ],
            ],
@@ -36,9 +36,8 @@ return [
                        'pages' => [
                            [
                                'label' => 'Gestion des ressources',
                                'route' => 'home',
                                'route' => 'formation/structure',
                                'resources' => [
                                    PrivilegeController::getResourceId(FormationController::class, 'index'),
                                    PrivilegeController::getResourceId(StructureController::class, 'index'),
                                ],
                                'order'    => 10000,
+66 −0
Changes for module/Formation/src/Formation/Controller/PlanDeFormationController.php: 66 added lines, 0 removed lines.
Original line number Diff line number Diff line
<?php

namespace Formation\Controller;

use Application\Service\Agent\AgentServiceAwareTrait;
use Formation\Entity\Db\Formation;
use Formation\Entity\Db\FormationGroupe;
use Formation\Service\Abonnement\AbonnementServiceAwareTrait;
use Formation\Service\Formation\FormationServiceAwareTrait;
use Formation\Service\FormationGroupe\FormationGroupeServiceAwareTrait;
use Formation\Service\FormationInstance\FormationInstanceServiceAwareTrait;
use Formation\Service\PlanDeFormation\PlanDeFormationServiceAwareTrait;
use Laminas\Mvc\Controller\AbstractActionController;
use Laminas\View\Model\ViewModel;

class PlanDeFormationController extends AbstractActionController {
    use AbonnementServiceAwareTrait;
    use AgentServiceAwareTrait;
    use FormationGroupeServiceAwareTrait;
    use FormationServiceAwareTrait;
    use PlanDeFormationServiceAwareTrait;

    use FormationInstanceServiceAwareTrait;

    public function indexAction() : ViewModel
    {
        $plans = $this->getPlanDeFormationService()->getPlansDeFormation();
        return new ViewModel([
            'plans' => $plans,
        ]);
    }

    public function courantAction() : ViewModel
    {
        $planDeFormation = $this->getPlanDeFormationService()->getPlanDeFormationByAnnee();


        $formations = $planDeFormation->getFormations();

        $groupes = [];
        $formationsArrayByGroupe = [];
        foreach ($formations as $formation) {
            $groupes[$formation->getGroupe()->getId()] = $formation->getGroupe();
            $formationsArrayByGroupe[$formation->getGroupe()->getId()][] = $formation;
        }

        $sessionsArrayByFormation = [];
        foreach ($formations as $formation) {
            //todo recupérer par lot
            $sessionsArrayByFormation[$formation->getId()] = $this->getFormationInstanceService()->getFormationsInstancesOuvertesByFormation($formation);
        }

        $abonnements = [];
        $agent = $this->getAgentService()->getAgentByConnectedUser();
        if ($agent !== null) $abonnements = $this->getAbonnementService()->getAbonnementsByAgent($agent);

        return new ViewModel([
            'planDeFormation' => $planDeFormation,
            'formations' => $formations,
            'groupes' => $groupes,
            'formationsArrayByGroupe' => $formationsArrayByGroupe,
            'sessionsArrayByFormation' => $sessionsArrayByFormation,
            'abonnements' => $abonnements,
        ]);
    }
}
 No newline at end of file
Loading