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

WIP

parent dbed44c8
Loading
Loading
Loading
Loading
+31 −20
Changes for module/Application/src/Application/Controller/IndexController.php: 31 added lines, 20 removed lines.
Original line number Diff line number Diff line
@@ -2,11 +2,10 @@

namespace Application\Controller;

use Application\Entity\Db\Agent;
use Application\Entity\Db\AgentAutorite;
use Application\Entity\Db\AgentSuperieur;
use Application\Provider\Privilege\AgentPrivileges;
use Application\Provider\Role\RoleProvider as AppRoleProvider;
use Application\Entity\Db\Agent;
use Application\Provider\Template\TexteTemplate;
use Application\Service\Agent\AgentServiceAwareTrait;
use Application\Service\AgentAutorite\AgentAutoriteServiceAwareTrait;
@@ -16,8 +15,10 @@ use EntretienProfessionnel\Entity\Db\Campagne;
use EntretienProfessionnel\Service\Campagne\CampagneServiceAwareTrait;
use EntretienProfessionnel\Service\EntretienProfessionnel\EntretienProfessionnelServiceAwareTrait;
use Formation\Service\DemandeExterne\DemandeExterneServiceAwareTrait;
use Formation\Service\FormationInstanceInscrit\FormationInstanceInscritServiceAwareTrait;
use Formation\Service\Inscription\InscriptionServiceAwareTrait;
use Laminas\Http\Response;
use Laminas\Mvc\Controller\AbstractActionController;
use Laminas\View\Model\ViewModel;
use Structure\Controller\StructureController;
use Structure\Entity\Db\StructureAgentForce;
use Structure\Provider\Parametre\StructureParametres;
@@ -30,8 +31,6 @@ use UnicaenUtilisateur\Entity\Db\Role;
use UnicaenUtilisateur\Entity\Db\User;
use UnicaenUtilisateur\Service\Role\RoleServiceAwareTrait;
use UnicaenUtilisateur\Service\User\UserServiceAwareTrait;
use Laminas\Mvc\Controller\AbstractActionController;
use Laminas\View\Model\ViewModel;

class IndexController extends AbstractActionController
{
@@ -48,7 +47,7 @@ class IndexController extends AbstractActionController

    use FichePosteServiceAwareTrait;
    use EntretienProfessionnelServiceAwareTrait;
    use FormationInstanceInscritServiceAwareTrait;
    use InscriptionServiceAwareTrait;
    use DemandeExterneServiceAwareTrait;

    public function indexAction(): ViewModel|Response
@@ -118,16 +117,22 @@ class IndexController extends AbstractActionController
        $user = $this->getUserService()->getConnectedUser();
        $agent = $this->getAgentService()->getAgentByUser($user);

        $agents = array_map(function (AgentSuperieur $a) { return $a->getAgent(); },$this->getAgentSuperieurService()->getAgentsSuperieursBySuperieur($agent));
        $agents = array_map(function (AgentSuperieur $a) {
            return $a->getAgent();
        }, $this->getAgentSuperieurService()->getAgentsSuperieursBySuperieur($agent));
        $agents = $this->getAgentService()->filtrerWithStatutTemoin($agents, $this->getParametreService()->getParametreByCode(StructureParametres::TYPE, StructureParametres::AGENT_TEMOIN_STATUT));
        $agents = $this->getAgentService()->filtrerWithAffectationTemoin($agents, $this->getParametreService()->getParametreByCode(StructureParametres::TYPE, StructureParametres::AGENT_TEMOIN_AFFECTATION));
        usort($agents, function (Agent $a, Agent $b) { return $a->getNomUsuel()." ".$a->getPrenom() > $b->getNomUsuel()." ".$b->getPrenom();});
        usort($agents, function (Agent $a, Agent $b) {
            return $a->getNomUsuel() . " " . $a->getPrenom() > $b->getNomUsuel() . " " . $b->getPrenom();
        });

        /** Campagne d'entretien professionnel ************************************************************************/
        $last = $this->getCampagneService()->getLastCampagne();
        $campagnes = $this->getCampagneService()->getCampagnesActives();
        if ($last !== null) $campagnes[] = $last;
        usort($campagnes, function (Campagne $a, Campagne $b) { return $a->getDateDebut() > $b->getDateDebut();});
        usort($campagnes, function (Campagne $a, Campagne $b) {
            return $a->getDateDebut() > $b->getDateDebut();
        });

        /** Récuperation des eps **************************************************************************************/
        $entretiens = [];
@@ -137,10 +142,10 @@ class IndexController extends AbstractActionController

        /** Récupération des fiches de postes *************************************************************************/
        $fichesDePoste = [];
        foreach ($agents as $agent) {
            if ($agent instanceof StructureAgentForce) $agent = $agent->getAgent();
            $fiches = $this->getFichePosteService()->getFichesPostesByAgent($agent);
            $fichesDePoste[$agent->getId()] = $fiches;
        foreach ($agents as $agent_) {
            if ($agent_ instanceof StructureAgentForce) $agent_ = $agent_->getAgent();
            $fiches = $this->getFichePosteService()->getFichesPostesByAgent($agent_);
            $fichesDePoste[$agent_->getId()] = $fiches;
        }
        $fichesDePostePdf = $this->getAgentService()->getFichesPostesPdfByAgents($agents);

@@ -161,17 +166,23 @@ class IndexController extends AbstractActionController
        $user = $this->getUserService()->getConnectedUser();
        $agent = $this->getAgentService()->getAgentByUser($user);

        $agents = array_map(function (AgentAutorite $a) { return $a->getAgent(); },$this->getAgentAutoriteService()->getAgentsAutoritesByAutorite($agent));
        $agents = array_map(function (AgentAutorite $a) {
            return $a->getAgent();
        }, $this->getAgentAutoriteService()->getAgentsAutoritesByAutorite($agent));
        $agents = $this->getAgentService()->filtrerWithStatutTemoin($agents, $this->getParametreService()->getParametreByCode(StructureParametres::TYPE, StructureParametres::AGENT_TEMOIN_STATUT));
        $agents = $this->getAgentService()->filtrerWithAffectationTemoin($agents, $this->getParametreService()->getParametreByCode(StructureParametres::TYPE, StructureParametres::AGENT_TEMOIN_AFFECTATION));

        usort($agents, function (Agent $a, Agent $b) { return $a->getNomUsuel()." ".$a->getPrenom() > $b->getNomUsuel()." ".$b->getPrenom();});
        usort($agents, function (Agent $a, Agent $b) {
            return $a->getNomUsuel() . " " . $a->getPrenom() > $b->getNomUsuel() . " " . $b->getPrenom();
        });

        /** Campagne d'entretien professionnel ************************************************************************/
        $last = $this->getCampagneService()->getLastCampagne();
        $campagnes = $this->getCampagneService()->getCampagnesActives();
        if ($last !== null) $campagnes[] = $last;
        usort($campagnes, function (Campagne $a, Campagne $b) { return $a->getDateDebut() > $b->getDateDebut();});
        usort($campagnes, function (Campagne $a, Campagne $b) {
            return $a->getDateDebut() > $b->getDateDebut();
        });

        /** Récuperation des eps **************************************************************************************/
        $entretiens = [];
@@ -181,10 +192,10 @@ class IndexController extends AbstractActionController

        /** Récupération des fiches de postes *************************************************************************/
        $fichesDePoste = [];
        foreach ($agents as $agent) {
            if ($agent instanceof StructureAgentForce) $agent = $agent->getAgent();
            $fiches = $this->getFichePosteService()->getFichesPostesByAgent($agent);
            $fichesDePoste[$agent->getId()] = $fiches;
        foreach ($agents as $agent_) {
            if ($agent_ instanceof StructureAgentForce) $agent_ = $agent_->getAgent();
            $fiches = $this->getFichePosteService()->getFichesPostesByAgent($agent_);
            $fichesDePoste[$agent_->getId()] = $fiches;
        }
        $fichesDePostePdf = $this->getAgentService()->getFichesPostesPdfByAgents($agents);

+2 −5
Changes for module/Application/src/Application/Controller/IndexControllerFactory.php: 2 added lines, 5 removed lines.
Original line number Diff line number Diff line
@@ -9,7 +9,6 @@ use Application\Service\FichePoste\FichePosteService;
use EntretienProfessionnel\Service\Campagne\CampagneService;
use EntretienProfessionnel\Service\EntretienProfessionnel\EntretienProfessionnelService;
use Formation\Service\DemandeExterne\DemandeExterneService;
use Formation\Service\FormationInstanceInscrit\FormationInstanceInscritService;
use Interop\Container\ContainerInterface;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
@@ -20,7 +19,8 @@ use UnicaenRenderer\Service\Rendu\RenduService;
use UnicaenUtilisateur\Service\Role\RoleService;
use UnicaenUtilisateur\Service\User\UserService;

class IndexControllerFactory {
class IndexControllerFactory
{

    /**
     * @param ContainerInterface $container
@@ -45,7 +45,6 @@ class IndexControllerFactory {
         *
         * @var FichePosteService $fichePosteService
         * @var EntretienProfessionnelService $entretienProfessionelService
         * @var FormationInstanceInscritService $formationInstanceinscritService
         * @var DemandeExterneService $demandeExterneService
         *
         */
@@ -62,7 +61,6 @@ class IndexControllerFactory {

        $fichePosteService = $container->get(FichePosteService::class);
        $entretienProfessionelService = $container->get(EntretienProfessionnelService::class);
        $formationInstanceinscritService = $container->get(FormationInstanceInscritService::class);
        $demandeExterneService = $container->get(DemandeExterneService::class);

        /** @var IndexController $controller */
@@ -81,7 +79,6 @@ class IndexControllerFactory {

        $controller->setFichePosteService($fichePosteService);
        $controller->setEntretienProfessionnelService($entretienProfessionelService);
        $controller->setFormationInstanceInscritService($formationInstanceinscritService);
        $controller->setDemandeExterneService($demandeExterneService);
        return $controller;
    }
−128

File deleted.

+2 −2
Changes for module/Formation/config/merged/enquete.config.php: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -277,7 +277,7 @@ return [
                                'type'  => Segment::class,
                                'may_terminate' => true,
                                'options' => [
                                    'route'    => '/repondre-questions/:inscrit',
                                    'route'    => '/repondre-questions/:inscription',
                                    'defaults' => [
                                        'controller' => EnqueteQuestionController::class,
                                        'action'     => 'repondre-questions',
@@ -288,7 +288,7 @@ return [
                                'type'  => Segment::class,
                                'may_terminate' => true,
                                'options' => [
                                    'route'    => '/valider-questions/:inscrit',
                                    'route'    => '/valider-questions/:inscription',
                                    'defaults' => [
                                        'controller' => EnqueteQuestionController::class,
                                        'action'     => 'valider-questions',
+10 −83
Changes for module/Formation/config/merged/formation-instance-inscrit.config.php: 10 added lines, 83 removed lines.
Original line number Diff line number Diff line
@@ -6,11 +6,7 @@ use Formation\Controller\FormationInstanceInscritController;
use Formation\Controller\FormationInstanceInscritControllerFactory;
use Formation\Controller\PlanDeFormationController;
use Formation\Controller\ProjetPersonnelController;
use Formation\Provider\Privilege\FormationinstanceinscritPrivileges;
use Formation\Provider\Privilege\FormationinstancePrivileges;
use Formation\Service\FormationInstanceInscrit\FormationInstanceInscritService;
use Formation\Service\FormationInstanceInscrit\FormationInstanceInscritServiceFactory;
use Laminas\Router\Http\Literal;
use Laminas\Router\Http\Segment;
use UnicaenPrivilege\Guard\PrivilegeController;

@@ -29,10 +25,6 @@ return [
                [
                    'controller' => FormationInstanceInscritController::class,
                    'action' => [
                        'inscription-formation',
                        'inscription',
                        'desinscription',

                        'formations',
                        'inscriptions',
                        'inscription-interne',
@@ -42,26 +34,6 @@ return [
                        'Agent',
                    ],
                ],
                [
                    'controller' => FormationInstanceInscritController::class,
                    'action' => [
                        'valider-responsable',
                        'refuser-responsable',
                    ],
                    'privileges' => [
                        FormationinstanceinscritPrivileges::INSCRIPTION_VALIDER_SUPERIEURE,
                    ],
                ],
                [
                    'controller' => FormationInstanceInscritController::class,
                    'action' => [
                        'valider-drh',
                        'refuser-drh',
                    ],
                    'privileges' => [
                        FormationinstanceinscritPrivileges::INSCRIPTION_VALIDER_GESTIONNAIRE,
                    ],
                ],
            ],
        ],
    ],
@@ -177,66 +149,21 @@ return [
                    ],
                ],
            ],
            'inscription-formation' => [
                'type' => Literal::class,
                'options' => [
                    'route' => '/inscription-formation',
                    'defaults' => [
                        'controller' => FormationInstanceInscritController::class,
                        'action' => 'inscription-formation',
                    ],
                ],
            ],
            'formation-instance' => [
                'child_routes' => [
                    'inscription' => [
                        'type' => Segment::class,
                        'options' => [
                            'route' => '/inscription/:formation-instance/:agent',
                            'defaults' => [
                                'controller' => FormationInstanceInscritController::class,
                                'action' => 'inscription',
                            ],
                        ],
                    ],
                    'desinscription' => [
                        'type' => Segment::class,
                        'options' => [
                            'route' => '/desinscription/:inscrit',
                            'defaults' => [
                                'controller' => FormationInstanceInscritController::class,
                                'action' => 'desinscription',
                            ],
                        ],
                    ],
                    'valider-responsable' => [
                        'type' => Segment::class,
                        'options' => [
                            'route' => '/valider-responsable/:inscrit',
                            'defaults' => [
                                'controller' => FormationInstanceInscritController::class,
                                'action' => 'valider-responsable',
                            ],
                        ],
                    ],
                    'refuser-responsable' => [
                        'type' => Segment::class,
                        'options' => [
                            'route' => '/refuser-responsable/:inscrit',
                            'defaults' => [
                                'controller' => FormationInstanceInscritController::class,
                                'action' => 'refuser-responsable',
                            ],
                        ],
                    ],
                ],
            ],
//            'inscription-formation' => [
//                'type' => Literal::class,
//                'options' => [
//                    'route' => '/inscription-formation',
//                    'defaults' => [
//                        'controller' => FormationInstanceInscritController::class,
//                        'action' => 'inscription-formation',
//                    ],
//                ],
//            ],
        ],
    ],

    'service_manager' => [
        'factories' => [
            FormationInstanceInscritService::class => FormationInstanceInscritServiceFactory::class,
        ],
    ],
    'controllers' => [
Loading