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

PPP

parent 48bdf3a5
Loading
Loading
Loading
Loading
+88 −0
Original line number Diff line number Diff line
@@ -6,6 +6,10 @@ use Application\Assertion\AgentAssertion;
use Application\Assertion\AgentAssertionFactory;
use Application\Controller\AgentController;
use Application\Controller\AgentControllerFactory;
use Application\Form\AgentPPP\AgentPPPForm;
use Application\Form\AgentPPP\AgentPPPFormFactory;
use Application\Form\AgentPPP\AgentPPPHydrator;
use Application\Form\AgentPPP\AgentPPPHydratorFactory;
use Application\Form\SelectionAgent\SelectionAgentForm;
use Application\Form\SelectionAgent\SelectionAgentFormFactory;
use Application\Form\SelectionAgent\SelectionAgentHydrator;
@@ -13,6 +17,8 @@ use Application\Form\SelectionAgent\SelectionAgentHydratorFactory;
use Application\Provider\Privilege\AgentPrivileges;
use Application\Service\Agent\AgentService;
use Application\Service\Agent\AgentServiceFactory;
use Application\Service\AgentPPP\AgentPPPService;
use Application\Service\AgentPPP\AgentPPPServiceFactory;
use Application\View\Helper\AgentAffectationViewHelper;
use Application\View\Helper\AgentGradeViewHelper;
use Application\View\Helper\AgentStatutViewHelper;
@@ -108,6 +114,20 @@ return [
                    ],
                    'assertion'  => AgentAssertion::class,
                ],
                /** NEW STUFFS CCC */
                [
                    'controller' => AgentController::class,
                    'action' => [
                        'ajouter-ppp',
                        'modifier-ppp',
                        'historiser-ppp',
                        'restaurer-ppp',
                        'detruire-ppp',
                    ],
                    'privileges' => [
                        AgentPrivileges::AGENT_GESTION_CCC,
                    ],
                ],
            ],
        ],
    ],
@@ -260,6 +280,71 @@ return [
                            ],
                        ],
                    ],

                    /** PPP *******************************************************************************************/

                    'ppp' => [
                        'type'  => Literal::class,
                        'options' => [
                            'route'    => '/ppp',
                            'defaults' => [
                                'controller' => AgentController::class,
                            ],
                        ],
                        'may_terminate' => 'false',
                        'child_routes' => [
                            'ajouter' => [
                                'type'  => Segment::class,
                                'options' => [
                                    'route'    => '/ajouter/:agent',
                                    'defaults' => [
                                        'controller' => AgentController::class,
                                        'action' => 'ajouter-ppp'
                                    ],
                                ],
                            ],
                            'modifier' => [
                                'type'  => Segment::class,
                                'options' => [
                                    'route'    => '/modifier/:ppp',
                                    'defaults' => [
                                        'controller' => AgentController::class,
                                        'action' => 'modifier-ppp'
                                    ],
                                ],
                            ],
                            'historiser' => [
                                'type'  => Segment::class,
                                'options' => [
                                    'route'    => '/historiser/:ppp',
                                    'defaults' => [
                                        'controller' => AgentController::class,
                                        'action' => 'historiser-ppp'
                                    ],
                                ],
                            ],
                            'restaurer' => [
                                'type'  => Segment::class,
                                'options' => [
                                    'route'    => '/restaurer/:ppp',
                                    'defaults' => [
                                        'controller' => AgentController::class,
                                        'action' => 'restaurer-ppp'
                                    ],
                                ],
                            ],
                            'detruire' => [
                                'type'  => Segment::class,
                                'options' => [
                                    'route'    => '/detruire/:ppp',
                                    'defaults' => [
                                        'controller' => AgentController::class,
                                        'action' => 'detruire-ppp'
                                    ],
                                ],
                            ],
                        ],
                    ],
                ],
            ],
        ],
@@ -295,6 +380,7 @@ return [
        'factories' => [
            AgentAssertion::class => AgentAssertionFactory::class,
            AgentService::class => AgentServiceFactory::class,
            AgentPPPService::class => AgentPPPServiceFactory::class,
        ],
    ],
    'controllers'     => [
@@ -305,11 +391,13 @@ return [
    'form_elements' => [
        'factories' => [
            SelectionAgentForm::class => SelectionAgentFormFactory::class,
            AgentPPPForm::class => AgentPPPFormFactory::class,
        ],
    ],
    'hydrators' => [
        'factories' => [
            SelectionAgentHydrator::class => SelectionAgentHydratorFactory::class,
            AgentPPPHydrator::class => AgentPPPHydratorFactory::class,
        ],
    ],
    'view_helpers' => [
+42 −0
Original line number Diff line number Diff line
<?php

namespace Application;

use Application\Form\HasPeriode\HasPeriodeForm;
use Application\Form\HasPeriode\HasPeriodeFormFactory;
use Application\Form\HasPeriode\HasPeriodeHydrator;
use Application\Form\HasPeriode\HasPeriodeHydratorFactory;
use UnicaenPrivilege\Guard\PrivilegeController;

return [
    'bjyauthorize' => [
        'guards' => [
            PrivilegeController::class => [

            ],
        ],
    ],

    'router'          => [
        'routes' => [
        ],
    ],

    'service_manager' => [
        'factories' => [],
    ],
    'controllers'     => [
        'factories' => [],
    ],
    'form_elements' => [
        'factories' => [
            HasPeriodeForm::class => HasPeriodeFormFactory::class,
        ],
    ],
    'hydrators' => [
        'factories' => [
            HasPeriodeHydrator::class => HasPeriodeHydratorFactory::class,
        ],
    ]

];
 No newline at end of file
+111 −1
Original line number Diff line number Diff line
@@ -3,11 +3,14 @@
namespace Application\Controller;

use Application\Constant\RoleConstant;
use Application\Entity\Db\AgentPPP;
use Application\Entity\Db\ApplicationElement;
use Application\Form\AgentPPP\AgentPPPFormAwareTrait;
use Application\Form\ApplicationElement\ApplicationElementFormAwareTrait;
use Application\Form\CompetenceElement\CompetenceElementFormAwareTrait;
use Application\Form\SelectionApplication\SelectionApplicationFormAwareTrait;
use Application\Service\Agent\AgentServiceAwareTrait;
use Application\Service\AgentPPP\AgentPPPServiceAwareTrait;
use Application\Service\Application\ApplicationServiceAwareTrait;
use Application\Service\ApplicationElement\ApplicationElementServiceAwareTrait;
use Application\Service\Categorie\CategorieServiceAwareTrait;
@@ -70,6 +73,9 @@ class AgentController extends AbstractActionController

    use FichePosteServiceAwareTrait;

    use AgentPPPServiceAwareTrait;
    use AgentPPPFormAwareTrait;

    public function indexAction()
    {
        $fromQueries = $this->params()->fromQuery();
@@ -105,7 +111,7 @@ class AgentController extends AbstractActionController

        $connectedAgent = $this->getAgentService()->getAgentByUser($utilisateur);
        $connectedRole = $this->getUserService()->getConnectedRole();
        if ($connectedAgent !== $agent AND ($connectedRole->getRoleId() === RoleConstant::PERSONNEL OR $agent === null)) {
        if ($connectedAgent !== $agent and ($connectedRole->getRoleId() === RoleConstant::PERSONNEL or $agent === null)) {
            return $this->redirect()->toRoute('agent/afficher', ['agent' => $connectedAgent->getId()], [], true);
        }
        $entretiens = $this->getEntretienProfessionnelService()->getEntretiensProfessionnelsParAgent($agent);
@@ -127,6 +133,8 @@ class AgentController extends AbstractActionController
            'parcoursArray' => $parcoursArray,
            'fichespostes' => $fichespostes,
            'missions' => $missions,

            'ppps' => $this->getAgentPPPService()->getAgentPPPsByAgent($agent),
        ]);
    }

@@ -354,4 +362,106 @@ class AgentController extends AbstractActionController
        exit;
    }

    /** PARTIE ASSOCIEE AUX PPP, STAGE, TUTORAT, ACCOMPAGNEMENT *******************************************************/

    public function ajouterPppAction()
    {
        $agent = $this->getAgentService()->getRequestedAgent($this);

        $ppp = new AgentPPP();
        $ppp->setAgent($agent);

        $form = $this->getAgentPPPForm();
        $form->setAttribute('action', $this->url()->fromRoute('agent/ppp/ajouter', ['agent' => $agent->getId()], [], true));
        $form->bind($ppp);

        $request = $this->getRequest();
        if ($request->isPost()) {
            $data = $request->getPost();
            $form->setData($data);
            if ($form->isValid()) {
                $this->getAgentPPPService()->create($ppp);
            }
        }

        $vm = new ViewModel();
        $vm->setTemplate('application/default/default-form');
        $vm->setVariables([
            'title' => "Ajouter un projet professionnel personnel",
            'form' => $form,
        ]);
        return $vm;
    }

    public function modifierPppAction()
    {
        $ppp = $this->getAgentPPPService()->getRequestedAgentPPP($this);

        $form = $this->getAgentPPPForm();
        $form->setAttribute('action', $this->url()->fromRoute('agent/ppp/modifier', ['ppp' => $ppp->getId()], [], true));
        $form->bind($ppp);

        $request = $this->getRequest();
        if ($request->isPost()) {
            $data = $request->getPost();
            $form->setData($data);
            if ($form->isValid()) {
                $this->getAgentPPPService()->update($ppp);
            }
        }

        $vm = new ViewModel();
        $vm->setTemplate('application/default/default-form');
        $vm->setVariables([
            'title' => "Modifier un projet professionnel personnel",
            'form' => $form,
        ]);
        return $vm;
    }

    public function historiserPppAction()
    {
        $ppp = $this->getAgentPPPService()->getRequestedAgentPPP($this);
        $retour = $this->params()->fromQuery('retour');

        $this->getAgentPPPService()->historise($ppp);

        if ($retour) return $this->redirect()->toUrl($retour);
        return $this->redirect()->toRoute('agent/afficher', ['agent' => $ppp->getAgent()->getId()], ['fragment' => 'ppp'], true);
    }

    public function restaurerPppAction()
    {
        $ppp = $this->getAgentPPPService()->getRequestedAgentPPP($this);
        $retour = $this->params()->fromQuery('retour');

        $this->getAgentPPPService()->restore($ppp);

        if ($retour) return $this->redirect()->toUrl($retour);
        return $this->redirect()->toRoute('agent/afficher', ['agent' => $ppp->getAgent()->getId()], ['fragment' => 'ppp'], true);
    }

    public function detruirePppAction()
    {
        $ppp = $this->getAgentPPPService()->getRequestedAgentPPP($this);

        /** @var Request $request */
        $request = $this->getRequest();
        if ($request->isPost()) {
            $data = $request->getPost();
            if ($data["reponse"] === "oui") $this->getAgentPPPService()->delete($ppp);
            exit();
        }

        $vm = new ViewModel();
        if ($ppp !== null) {
            $vm->setTemplate('application/default/confirmation');
            $vm->setVariables([
                'title' => "Suppression du projet professionnel personnel #" . $ppp->getId(),
                'text' => "La suppression est définitive êtes-vous sûr&middot;e de vouloir continuer ?",
                'action' => $this->url()->fromRoute('agent/ppp/detruire', ["ppp" => $ppp->getId()], [], true),
            ]);
        }
        return $vm;
    }
}
 No newline at end of file
+10 −0
Original line number Diff line number Diff line
@@ -2,9 +2,11 @@

namespace Application\Controller;

use Application\Form\AgentPPP\AgentPPPForm;
use Application\Form\ApplicationElement\ApplicationElementForm;
use Application\Form\CompetenceElement\CompetenceElementForm;
use Application\Service\Agent\AgentService;
use Application\Service\AgentPPP\AgentPPPService;
use Application\Service\Application\ApplicationService;
use Application\Service\ApplicationElement\ApplicationElementService;
use Application\Service\Categorie\CategorieService;
@@ -53,6 +55,9 @@ class AgentControllerFactory {
         * @var UserService $userService
         *
         * @var FichePosteService $fichePosteService
         *
         * @var AgentPPPService $agentPPPService
         * @var AgentPPPForm $agentPPPForm
         */
        $agentService = $container->get(AgentService::class);
        $applicationElementService = $container->get(ApplicationElementService::class);
@@ -85,6 +90,9 @@ class AgentControllerFactory {
        $formationElementForm = $container->get('FormElementManager')->get(FormationElementForm::class);
        $uploadForm = $container->get('FormElementManager')->get(UploadForm::class);

        $agentPPPService = $container->get(AgentPPPService::class);
        $agentPPPForm = $container->get('FormElementManager')->get(AgentPPPForm::class);

        /** @var AgentController $controller */
        $controller = new AgentController();

@@ -115,6 +123,8 @@ class AgentControllerFactory {
        $controller->setFormationElementForm($formationElementForm);
        $controller->setUploadForm($uploadForm);

        $controller->setAgentPPPService($agentPPPService);
        $controller->setAgentPPPForm($agentPPPForm);
        return $controller;
    }
}
 No newline at end of file
+206 −0
Original line number Diff line number Diff line
<?php

namespace Application\Entity\Db;

use Application\Entity\Db\Interfaces\HasPeriodeInterface;
use Application\Entity\Db\Traits\HasPeriodeTrait;
use UnicaenEtat\Entity\Db\Etat;
use UnicaenUtilisateur\Entity\HistoriqueAwareInterface;
use UnicaenUtilisateur\Entity\HistoriqueAwareTrait;

class AgentPPP implements HasPeriodeInterface, HistoriqueAwareInterface {
    use HasPeriodeTrait;
    use HistoriqueAwareTrait;

    /** @var int */
    private $id;
    /** @var Agent */
    private $agent;
    /** @var string|null */
    private $type;
    /** @var string|null */
    private $libelle;
    /** @var Etat|null */
    private $etat;
    /** @var float|null */
    private $formationCPF;
    /** @var float|null */
    private $formationCout;
    /** @var float|null */
    private $formationPriseEnCharge;
    /** @var string|null */
    private $formationOrganisme;
    /** @var string|null */
    private $complement;

    /**
     * @return int
     */
    public function getId(): ?int
    {
        return $this->id;
    }


    /**
     * @return Agent
     */
    public function getAgent(): Agent
    {
        return $this->agent;
    }

    /**
     * @param Agent $agent
     * @return AgentPPP
     */
    public function setAgent(Agent $agent): AgentPPP
    {
        $this->agent = $agent;
        return $this;
    }

    /**
     * @return string|null
     */
    public function getType(): ?string
    {
        return $this->type;
    }

    /**
     * @param string|null $type
     * @return AgentPPP
     */
    public function setType(?string $type): AgentPPP
    {
        $this->type = $type;
        return $this;
    }

    /**
     * @return string|null
     */
    public function getLibelle(): ?string
    {
        return $this->libelle;
    }

    /**
     * @param string|null $libelle
     * @return AgentPPP
     */
    public function setLibelle(?string $libelle): AgentPPP
    {
        $this->libelle = $libelle;
        return $this;
    }

    /**
     * @return Etat|null
     */
    public function getEtat(): ?Etat
    {
        return $this->etat;
    }

    /**
     * @param Etat|null $etat
     * @return AgentPPP
     */
    public function setEtat(?Etat $etat): AgentPPP
    {
        $this->etat = $etat;
        return $this;
    }

    /**
     * @return float|null
     */
    public function getFormationCPF(): ?float
    {
        return $this->formationCPF;
    }

    /**
     * @param float|null $formationCPF
     * @return AgentPPP
     */
    public function setFormationCPF(?float $formationCPF): AgentPPP
    {
        $this->formationCPF = $formationCPF;
        return $this;
    }

    /**
     * @return float|null
     */
    public function getFormationCout(): ?float
    {
        return $this->formationCout;
    }

    /**
     * @param float|null $formationCout
     * @return AgentPPP
     */
    public function setFormationCout(?float $formationCout): AgentPPP
    {
        $this->formationCout = $formationCout;
        return $this;
    }

    /**
     * @return float|null
     */
    public function getFormationPriseEnCharge(): ?float
    {
        return $this->formationPriseEnCharge;
    }

    /**
     * @param float|null $formationPriseEnCharge
     * @return AgentPPP
     */
    public function setFormationPriseEnCharge(?float $formationPriseEnCharge): AgentPPP
    {
        $this->formationPriseEnCharge = $formationPriseEnCharge;
        return $this;
    }

    /**
     * @return string|null
     */
    public function getFormationOrganisme(): ?string
    {
        return $this->formationOrganisme;
    }

    /**
     * @param string|null $formationOrganisme
     * @return AgentPPP
     */
    public function setFormationOrganisme(?string $formationOrganisme): AgentPPP
    {
        $this->formationOrganisme = $formationOrganisme;
        return $this;
    }

    /**
     * @return string|null
     */
    public function getComplement(): ?string
    {
        return $this->complement;
    }

    /**
     * @param string|null $complement
     * @return AgentPPP
     */
    public function setComplement(?string $complement): AgentPPP
    {
        $this->complement = $complement;
        return $this;
    }
}
 No newline at end of file
Loading