Loading module/Application/config/merged/agent.config.php +24 −30 Original line number Diff line number Diff line Loading @@ -6,10 +6,6 @@ use Application\Assertion\AgentAssertion; use Application\Assertion\AgentAssertionFactory; use Application\Controller\AgentController; use Application\Controller\AgentControllerFactory; use Application\Form\AgentFormation\AgentFormationForm; use Application\Form\AgentFormation\AgentFormationFormFactory; use Application\Form\AgentFormation\AgentFormationHydrator; use Application\Form\AgentFormation\AgentFormationHydratorFactory; use Application\Form\SelectionAgent\SelectionAgentForm; use Application\Form\SelectionAgent\SelectionAgentFormFactory; use Application\Form\SelectionAgent\SelectionAgentHydrator; Loading Loading @@ -85,7 +81,7 @@ return [ 'afficher-statuts-grades', 'afficher-application', 'afficher-competence', 'afficher-agent-formation', 'afficher-formation', ], 'privileges' => [ AgentPrivileges::AGENT_ELEMENT_VOIR, Loading @@ -106,7 +102,7 @@ return [ 'action' => [ 'ajouter-application', 'ajouter-competence', 'ajouter-agent-formation', 'ajouter-formation', ], 'privileges' => [ AgentPrivileges::AGENT_ELEMENT_AJOUTER, Loading @@ -118,7 +114,7 @@ return [ 'action' => [ 'modifier-application', 'modifier-competence', 'modifier-agent-formation', 'modifier-formation', ], 'privileges' => [ AgentPrivileges::AGENT_ELEMENT_MODIFIER, Loading @@ -132,8 +128,8 @@ return [ 'restaurer-application', 'historiser-competence', 'restaurer-competence', 'historiser-agent-formation', 'restaurer-agent-formation', 'historiser-formation', 'restaurer-formation', ], 'privileges' => [ AgentPrivileges::AGENT_ELEMENT_MODIFIER, Loading @@ -143,7 +139,7 @@ return [ [ 'controller' => AgentController::class, 'action' => [ 'detruire-agent-formation', 'detruire-formation', 'detruire-competence', 'detruire-application', ], Loading Loading @@ -350,63 +346,63 @@ return [ /** Route des AgentFormation **********************************************************************/ 'ajouter-agent-formation' => [ 'ajouter-formation' => [ 'type' => Segment::class, 'options' => [ 'route' => '/ajouter-agent-formation/:agent[/:formation]', 'route' => '/ajouter-formation/:agent', 'defaults' => [ 'controller' => AgentController::class, 'action' => 'ajouter-agent-formation', 'action' => 'ajouter-formation', ], ], ], 'afficher-agent-formation' => [ 'afficher-formation' => [ 'type' => Segment::class, 'options' => [ 'route' => '/afficher-agent-formation/:agent-formation', 'route' => '/afficher-formation/:agent/:formation-element', 'defaults' => [ 'controller' => AgentController::class, 'action' => 'afficher-agent-formation', 'action' => 'afficher-formation', ], ], ], 'modifier-agent-formation' => [ 'modifier-formation' => [ 'type' => Segment::class, 'options' => [ 'route' => '/modifier-agent-formation/:agent-formation', 'route' => '/modifier-formation/:agent/:formation-element', 'defaults' => [ 'controller' => AgentController::class, 'action' => 'modifier-agent-formation', 'action' => 'modifier-formation', ], ], ], 'historiser-agent-formation' => [ 'historiser-formation' => [ 'type' => Segment::class, 'options' => [ 'route' => '/historiser-agent-formation/:agent-formation', 'route' => '/historiser-formation/:agent/:formation-element', 'defaults' => [ 'controller' => AgentController::class, 'action' => 'historiser-agent-formation', 'action' => 'historiser-formation', ], ], ], 'restaurer-agent-formation' => [ 'restaurer-formation' => [ 'type' => Segment::class, 'options' => [ 'route' => '/restaurer-agent-formation/:agent-formation', 'route' => '/restaurer-formation/:agent/:formation-element', 'defaults' => [ 'controller' => AgentController::class, 'action' => 'restaurer-agent-formation', 'action' => 'restaurer-formation', ], ], ], 'detruire-agent-formation' => [ 'detruire-formation' => [ 'type' => Segment::class, 'options' => [ 'route' => '/detruire-agent-formation/:agent-formation', 'route' => '/detruire-formation/:agent/:formation-element', 'defaults' => [ 'controller' => AgentController::class, 'action' => 'detruire-agent-formation', 'action' => 'detruire-formation', ], ], ], Loading Loading @@ -504,13 +500,11 @@ return [ ], 'form_elements' => [ 'factories' => [ AgentFormationForm::class => AgentFormationFormFactory::class, SelectionAgentForm::class => SelectionAgentFormFactory::class, ], ], 'hydrators' => [ 'factories' => [ AgentFormationHydrator::class => AgentFormationHydratorFactory::class, SelectionAgentHydrator::class => SelectionAgentHydratorFactory::class, ], ], Loading module/Application/src/Application/Controller/AgentController.php +55 −43 Original line number Diff line number Diff line Loading @@ -4,10 +4,8 @@ namespace Application\Controller; use Application\Constant\RoleConstant; use Application\Entity\Db\Agent; use Application\Entity\Db\AgentFormation; use Application\Entity\Db\ApplicationElement; use Application\Entity\Db\CompetenceElement; use Application\Form\AgentFormation\AgentFormationFormAwareTrait; use Application\Form\ApplicationElement\ApplicationElementForm; use Application\Form\ApplicationElement\ApplicationElementFormAwareTrait; use Application\Form\CompetenceElement\CompetenceElementForm; Loading @@ -27,7 +25,12 @@ use Fichier\Entity\Db\Fichier; use Fichier\Form\Upload\UploadFormAwareTrait; use Fichier\Service\Fichier\FichierServiceAwareTrait; use Fichier\Service\Nature\NatureServiceAwareTrait; use Formation\Entity\Db\FormationElement; use Formation\Form\FormationElement\FormationElementForm; use Formation\Form\FormationElement\FormationElementFormAwareTrait; use Formation\Service\Formation\FormationServiceAwareTrait; use Formation\Service\FormationElement\FormationElementServiceAwareTrait; use Formation\Service\HasFormationCollection\HasFormationCollectionServiceAwareTrait; use UnicaenApp\Exception\RuntimeException; use UnicaenUtilisateur\Service\User\UserServiceAwareTrait; use UnicaenValidation\Entity\Db\ValidationInstance; Loading @@ -41,10 +44,13 @@ use Zend\View\Model\ViewModel; class AgentController extends AbstractActionController { use AgentServiceAwareTrait; use ApplicationElementServiceAwareTrait; use HasApplicationCollectionServiceAwareTrait; use CompetenceElementServiceAwareTrait; use HasCompetenceCollectionServiceAwareTrait; use FormationElementServiceAwareTrait; use HasFormationCollectionServiceAwareTrait; use EntretienProfessionnelServiceAwareTrait; use ValidationInstanceServiceAwareTrait; Loading @@ -59,7 +65,7 @@ class AgentController extends AbstractActionController use ApplicationElementFormAwareTrait; use CompetenceElementFormAwareTrait; use AgentFormationFormAwareTrait; use FormationElementFormAwareTrait; use SelectionApplicationFormAwareTrait; use UploadFormAwareTrait; Loading Loading @@ -354,19 +360,17 @@ class AgentController extends AbstractActionController return $vm; } /** Gestion des formations ****************************************************************************************/ /** Gestion des formation ***************************************************************************************/ public function ajouterAgentFormationAction() public function ajouterFormationAction() { $agent = $this->getAgentService()->getRequestedAgent($this); $formation = $this->getFormationService()->getRequestedFormation($this); $formationElement = new FormationElement(); $agentFormation = new AgentFormation(); $agentFormation->setAgent($agent); $agentFormation->setFormation($formation); $form = $this->getAgentFormationForm(); $form->setAttribute('action', $this->url()->fromRoute('agent/ajouter-agent-formation', ['agent' => $agent->getId(), 'formation' => ($formation) ? $formation->getId() : null])); $form->bind($agentFormation); /** @var FormationElementForm $form */ $form = $this->getFormationElementForm(); $form->setAttribute('action', $this->url()->fromRoute('agent/ajouter-formation', ['agent' => $agent->getId()], [], true)); $form->bind($formationElement); /** @var Request $request */ $request = $this->getRequest(); Loading @@ -374,34 +378,39 @@ class AgentController extends AbstractActionController $data = $request->getPost(); $form->setData($data); if ($form->isValid()) { $this->getAgentService()->createAgentFormation($agentFormation); $this->getHasFormationCollectionService()->addFormation($agent, $formationElement); } } $vm = new ViewModel(); $vm->setTemplate('application/default/default-form'); $vm->setVariables([ 'title' => "Ajout d'une formation associée à un agent", 'title' => "Ajout d'une formation suivie par l'agent", 'form' => $form, ]); return $vm; } public function afficherAgentFormationAction() public function afficherFormationAction() { $agentFormation = $this->getAgentService()->getRequestedAgentFormation($this); $formationElement = $this->getFormationElementService()->getRequestedFormationElement($this); $agent = $this->getAgentService()->getRequestedAgent($this); return new ViewModel([ 'title' => "Affichage d'une formation", 'agentFormation' => $agentFormation, 'title' => "Affichage d'une formation suivie par un agent", 'formationElement' => $formationElement, 'agent' => $agent, ]); } public function modifierAgentFormationAction() public function modifierFormationAction() { $agentFormation = $this->getAgentService()->getRequestedAgentFormation($this); $form = $this->getAgentFormationForm(); $form->setAttribute('action', $this->url()->fromRoute('agent/modifier-agent-formation', ['agent-formation' => $agentFormation->getId()])); $form->bind($agentFormation); $agent = $this->getAgentService()->getRequestedAgent($this); $formationElement = $this->getFormationElementService()->getRequestedFormationElement($this); $form = $this->getFormationElementForm(); $form->setAttribute('action', $this->url()->fromRoute('agent/modifier-formation', ['agent' => $agent->getId(), 'formation-element' => $formationElement->getId()])); $form->bind($formationElement); /** @var Request $request */ $request = $this->getRequest(); Loading @@ -409,61 +418,64 @@ class AgentController extends AbstractActionController $data = $request->getPost(); $form->setData($data); if ($form->isValid()) { $this->getAgentService()->updateAgentFormation($agentFormation); $this->getFormationElementService()->update($formationElement); } } $vm = new ViewModel(); $vm->setTemplate('application/default/default-form'); $vm->setVariables([ 'title' => "Modification d'une formation associée à un agent", 'title' => "Modification d'une formation suivie par un agent", 'form' => $form, ]); return $vm; } public function historiserAgentFormationAction() public function historiserFormationAction() { $retour = $this->params()->fromQuery('retour'); $agentFormation = $this->getAgentService()->getRequestedAgentFormation($this); $this->getAgentService()->historiserAgentFormation($agentFormation); $agent = $this->getAgentService()->getRequestedAgent($this); $formationElement = $this->getFormationElementService()->getRequestedFormationElement($this); $this->getFormationElementService()->historise($formationElement); if ($retour !== null) return $this->redirect()->toUrl($retour); return $this->redirect()->toRoute('agent/afficher', ['agent' => $agentFormation->getAgent()->getId()], [], true); return $this->redirect()->toRoute('agent/afficher', ['agent' => $agent->getId()], [], true); } public function restaurerAgentFormationAction() public function restaurerFormationAction() { $retour = $this->params()->fromQuery('retour'); $agentFormation = $this->getAgentService()->getRequestedAgentFormation($this); $this->getAgentService()->restoreAgentFormation($agentFormation); $agent = $this->getAgentService()->getRequestedAgent($this); $formationElement = $this->getFormationElementService()->getRequestedFormationElement($this); $this->getFormationElementService()->restore($formationElement); if ($retour !== null) return $this->redirect()->toUrl($retour); return $this->redirect()->toRoute('agent/afficher', ['agent' => $agentFormation->getAgent()->getId()], [], true); return $this->redirect()->toRoute('agent/afficher', ['agent' => $agent->getId()], [], true); } public function detruireAgentFormationAction() public function detruireFormationAction() { $agentFormation = $this->getAgentService()->getRequestedAgentFormation($this); $agent = $this->getAgentService()->getRequestedAgent($this); $formationElement = $this->getFormationElementService()->getRequestedFormationElement($this); /** @var Request $request */ $request = $this->getRequest(); if ($request->isPost()) { $data = $request->getPost(); if ($data["reponse"] === "oui") $this->getAgentService()->deleteAgentFormation($agentFormation); //return $this->redirect()->toRoute('home'); //la cascade doit gérer l'affaire if ($data["reponse"] === "oui") $this->getFormationElementService()->delete($formationElement); exit(); } $vm = new ViewModel(); if ($agentFormation !== null) { if ($formationElement !== null) { $vm->setTemplate('application/default/confirmation'); $vm->setVariables([ 'title' => "Suppression de la formation de " . $agentFormation->getAgent()->getDenomination(), 'title' => "Suppression de la formation de " . $formationElement->getFormation()->getLibelle(), 'text' => "La suppression est définitive êtes-vous sûr·e de vouloir continuer ?", 'action' => $this->url()->fromRoute('agent/detruire-agent-formation', ["agent-formation" => $agentFormation->getId()], [], true), 'action' => $this->url()->fromRoute('agent/detruire-formation', ["agent" => $agent->getId(), "formation-element" => $formationElement->getId()], [], true), ]); } return $vm; Loading Loading @@ -491,7 +503,7 @@ class AgentController extends AbstractActionController $elementText = "la compétence [" . $entity->getCompetence()->getLibelle() . "]"; break; case 'AgentFormation' : $entity = $this->getAgentService()->getAgentFormation($entityId); $entity = $this->getFormationElementService()->getFormationElement($entityId); $validationType = $this->getValidationTypeService()->getValidationTypeByCode("AGENT_FORMATION"); $elementText = "la formation [" . $entity->getFormation()->getLibelle() . "]"; break; Loading Loading @@ -523,10 +535,10 @@ class AgentController extends AbstractActionController $this->getApplicationElementService()->update($entity); break; case 'AgentCompetence' : $this->getAgentService()->updateAgentCompetence($entity); $this->getCompetenceElementService()->update($entity); break; case 'AgentFormation' : $this->getAgentService()->updateAgentFormation($entity); $this->getFormationElementService()->update($entity); break; } } Loading module/Application/src/Application/Controller/AgentControllerFactory.php +16 −6 Original line number Diff line number Diff line Loading @@ -2,7 +2,6 @@ namespace Application\Controller; use Application\Form\AgentFormation\AgentFormationForm; use Application\Form\ApplicationElement\ApplicationElementForm; use Application\Form\CompetenceElement\CompetenceElementForm; use Application\Service\Agent\AgentService; Loading @@ -17,7 +16,10 @@ use Application\Service\Structure\StructureService; use Fichier\Form\Upload\UploadForm; use Fichier\Service\Fichier\FichierService; use Fichier\Service\Nature\NatureService; use Formation\Form\FormationElement\FormationElementForm; use Formation\Service\Formation\FormationService; use Formation\Service\FormationElement\FormationElementService; use Formation\Service\HasFormationCollection\HasFormationCollectionService; use Interop\Container\ContainerInterface; use UnicaenUtilisateur\Service\User\UserService; use UnicaenValidation\Service\ValidationInstance\ValidationInstanceService; Loading @@ -34,6 +36,8 @@ class AgentControllerFactory { * @var CategorieService $categorieService * @var CompetenceElementService $competenceElementService * @var HasCompetenceCollectionService $hasCompetenceCollectionService * @var FormationElementService $formationElementService * @var HasFormationCollectionService $hasFormationElementService * @var EntretienProfessionnelService $entretienService * @var ParcoursDeFormationService $parcoursService * @var ValidationInstanceService $validationInstanceService Loading @@ -50,6 +54,8 @@ class AgentControllerFactory { $hasApplicationCollectionService = $container->get(HasApplicationCollectionService::class); $competenceElementService = $container->get(CompetenceElementService::class); $hasCompetenceCollectionService = $container->get(HasCompetenceCollectionService::class); $formationElementService = $container->get(FormationElementService::class); $hasFormationElementService = $container->get(HasFormationCollectionService::class); $categorieService = $container->get(CategorieService::class); $entretienService = $container->get(EntretienProfessionnelService::class); $parcoursService = $container->get(ParcoursDeFormationService::class); Loading @@ -64,24 +70,28 @@ class AgentControllerFactory { /** * @var ApplicationElementForm $applicationElementForm * @var CompetenceElementForm $competenceElementForm * @var AgentFormationForm $agentFormationForm * @var FormationElementForm $formationElementForm * @var UploadForm $uploadForm */ $applicationElementForm = $container->get('FormElementManager')->get(ApplicationElementForm::class); $competenceElementForm = $container->get('FormElementManager')->get(CompetenceElementForm::class); $agentFormationForm = $container->get('FormElementManager')->get(AgentFormationForm::class); $formationElementForm = $container->get('FormElementManager')->get(FormationElementForm::class); $uploadForm = $container->get('FormElementManager')->get(UploadForm::class); /** @var AgentController $controller */ $controller = new AgentController(); $controller->setAgentService($agentService); $controller->setApplicationElementService($applicationElementService); $controller->setCategorieService($categorieService); $controller->setParcoursDeFormationService($parcoursService); $controller->setHasApplicationCollectionService($hasApplicationCollectionService); $controller->setCompetenceElementService($competenceElementService); $controller->setHasCompetenceCollectionService($hasCompetenceCollectionService); $controller->setFormationElementService($formationElementService); $controller->setHasFormationCollectionService($hasFormationElementService); $controller->setParcoursDeFormationService($parcoursService); $controller->setCategorieService($categorieService); $controller->setEntretienProfessionnelService($entretienService); $controller->setValidationInstanceService($validationInstanceService); $controller->setValidationTypeService($validationTypeService); Loading @@ -93,7 +103,7 @@ class AgentControllerFactory { $controller->setApplicationElementForm($applicationElementForm); $controller->setCompetenceElementForm($competenceElementForm); $controller->setAgentFormationForm($agentFormationForm); $controller->setFormationElementForm($formationElementForm); $controller->setUploadForm($uploadForm); return $controller; Loading module/Application/src/Application/Entity/Db/Agent.php +8 −48 File changed.Preview size limit exceeded, changes collapsed. Show changes module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Agent.dcm.xml +10 −1 Original line number Diff line number Diff line Loading @@ -43,8 +43,17 @@ </inverse-join-columns> </join-table> </many-to-many> <many-to-many field="formations" target-entity="Formation\Entity\Db\FormationElement"> <join-table name="agent_formation"> <join-columns> <join-column name="agent_id" referenced-column-name="c_individu" /> </join-columns> <inverse-join-columns> <join-column name="formation_element_id" referenced-column-name="id" /> </inverse-join-columns> </join-table> </many-to-many> <one-to-many target-entity="Application\Entity\Db\AgentFormation" mapped-by="agent" field="formations"/> <one-to-many target-entity="Application\Entity\Db\EntretienProfessionnel" mapped-by="agent" field="entretiens"/> <one-to-many target-entity="Application\Entity\Db\StructureAgentForce" mapped-by="agent" field="structuresForcees"/> Loading Loading
module/Application/config/merged/agent.config.php +24 −30 Original line number Diff line number Diff line Loading @@ -6,10 +6,6 @@ use Application\Assertion\AgentAssertion; use Application\Assertion\AgentAssertionFactory; use Application\Controller\AgentController; use Application\Controller\AgentControllerFactory; use Application\Form\AgentFormation\AgentFormationForm; use Application\Form\AgentFormation\AgentFormationFormFactory; use Application\Form\AgentFormation\AgentFormationHydrator; use Application\Form\AgentFormation\AgentFormationHydratorFactory; use Application\Form\SelectionAgent\SelectionAgentForm; use Application\Form\SelectionAgent\SelectionAgentFormFactory; use Application\Form\SelectionAgent\SelectionAgentHydrator; Loading Loading @@ -85,7 +81,7 @@ return [ 'afficher-statuts-grades', 'afficher-application', 'afficher-competence', 'afficher-agent-formation', 'afficher-formation', ], 'privileges' => [ AgentPrivileges::AGENT_ELEMENT_VOIR, Loading @@ -106,7 +102,7 @@ return [ 'action' => [ 'ajouter-application', 'ajouter-competence', 'ajouter-agent-formation', 'ajouter-formation', ], 'privileges' => [ AgentPrivileges::AGENT_ELEMENT_AJOUTER, Loading @@ -118,7 +114,7 @@ return [ 'action' => [ 'modifier-application', 'modifier-competence', 'modifier-agent-formation', 'modifier-formation', ], 'privileges' => [ AgentPrivileges::AGENT_ELEMENT_MODIFIER, Loading @@ -132,8 +128,8 @@ return [ 'restaurer-application', 'historiser-competence', 'restaurer-competence', 'historiser-agent-formation', 'restaurer-agent-formation', 'historiser-formation', 'restaurer-formation', ], 'privileges' => [ AgentPrivileges::AGENT_ELEMENT_MODIFIER, Loading @@ -143,7 +139,7 @@ return [ [ 'controller' => AgentController::class, 'action' => [ 'detruire-agent-formation', 'detruire-formation', 'detruire-competence', 'detruire-application', ], Loading Loading @@ -350,63 +346,63 @@ return [ /** Route des AgentFormation **********************************************************************/ 'ajouter-agent-formation' => [ 'ajouter-formation' => [ 'type' => Segment::class, 'options' => [ 'route' => '/ajouter-agent-formation/:agent[/:formation]', 'route' => '/ajouter-formation/:agent', 'defaults' => [ 'controller' => AgentController::class, 'action' => 'ajouter-agent-formation', 'action' => 'ajouter-formation', ], ], ], 'afficher-agent-formation' => [ 'afficher-formation' => [ 'type' => Segment::class, 'options' => [ 'route' => '/afficher-agent-formation/:agent-formation', 'route' => '/afficher-formation/:agent/:formation-element', 'defaults' => [ 'controller' => AgentController::class, 'action' => 'afficher-agent-formation', 'action' => 'afficher-formation', ], ], ], 'modifier-agent-formation' => [ 'modifier-formation' => [ 'type' => Segment::class, 'options' => [ 'route' => '/modifier-agent-formation/:agent-formation', 'route' => '/modifier-formation/:agent/:formation-element', 'defaults' => [ 'controller' => AgentController::class, 'action' => 'modifier-agent-formation', 'action' => 'modifier-formation', ], ], ], 'historiser-agent-formation' => [ 'historiser-formation' => [ 'type' => Segment::class, 'options' => [ 'route' => '/historiser-agent-formation/:agent-formation', 'route' => '/historiser-formation/:agent/:formation-element', 'defaults' => [ 'controller' => AgentController::class, 'action' => 'historiser-agent-formation', 'action' => 'historiser-formation', ], ], ], 'restaurer-agent-formation' => [ 'restaurer-formation' => [ 'type' => Segment::class, 'options' => [ 'route' => '/restaurer-agent-formation/:agent-formation', 'route' => '/restaurer-formation/:agent/:formation-element', 'defaults' => [ 'controller' => AgentController::class, 'action' => 'restaurer-agent-formation', 'action' => 'restaurer-formation', ], ], ], 'detruire-agent-formation' => [ 'detruire-formation' => [ 'type' => Segment::class, 'options' => [ 'route' => '/detruire-agent-formation/:agent-formation', 'route' => '/detruire-formation/:agent/:formation-element', 'defaults' => [ 'controller' => AgentController::class, 'action' => 'detruire-agent-formation', 'action' => 'detruire-formation', ], ], ], Loading Loading @@ -504,13 +500,11 @@ return [ ], 'form_elements' => [ 'factories' => [ AgentFormationForm::class => AgentFormationFormFactory::class, SelectionAgentForm::class => SelectionAgentFormFactory::class, ], ], 'hydrators' => [ 'factories' => [ AgentFormationHydrator::class => AgentFormationHydratorFactory::class, SelectionAgentHydrator::class => SelectionAgentHydratorFactory::class, ], ], Loading
module/Application/src/Application/Controller/AgentController.php +55 −43 Original line number Diff line number Diff line Loading @@ -4,10 +4,8 @@ namespace Application\Controller; use Application\Constant\RoleConstant; use Application\Entity\Db\Agent; use Application\Entity\Db\AgentFormation; use Application\Entity\Db\ApplicationElement; use Application\Entity\Db\CompetenceElement; use Application\Form\AgentFormation\AgentFormationFormAwareTrait; use Application\Form\ApplicationElement\ApplicationElementForm; use Application\Form\ApplicationElement\ApplicationElementFormAwareTrait; use Application\Form\CompetenceElement\CompetenceElementForm; Loading @@ -27,7 +25,12 @@ use Fichier\Entity\Db\Fichier; use Fichier\Form\Upload\UploadFormAwareTrait; use Fichier\Service\Fichier\FichierServiceAwareTrait; use Fichier\Service\Nature\NatureServiceAwareTrait; use Formation\Entity\Db\FormationElement; use Formation\Form\FormationElement\FormationElementForm; use Formation\Form\FormationElement\FormationElementFormAwareTrait; use Formation\Service\Formation\FormationServiceAwareTrait; use Formation\Service\FormationElement\FormationElementServiceAwareTrait; use Formation\Service\HasFormationCollection\HasFormationCollectionServiceAwareTrait; use UnicaenApp\Exception\RuntimeException; use UnicaenUtilisateur\Service\User\UserServiceAwareTrait; use UnicaenValidation\Entity\Db\ValidationInstance; Loading @@ -41,10 +44,13 @@ use Zend\View\Model\ViewModel; class AgentController extends AbstractActionController { use AgentServiceAwareTrait; use ApplicationElementServiceAwareTrait; use HasApplicationCollectionServiceAwareTrait; use CompetenceElementServiceAwareTrait; use HasCompetenceCollectionServiceAwareTrait; use FormationElementServiceAwareTrait; use HasFormationCollectionServiceAwareTrait; use EntretienProfessionnelServiceAwareTrait; use ValidationInstanceServiceAwareTrait; Loading @@ -59,7 +65,7 @@ class AgentController extends AbstractActionController use ApplicationElementFormAwareTrait; use CompetenceElementFormAwareTrait; use AgentFormationFormAwareTrait; use FormationElementFormAwareTrait; use SelectionApplicationFormAwareTrait; use UploadFormAwareTrait; Loading Loading @@ -354,19 +360,17 @@ class AgentController extends AbstractActionController return $vm; } /** Gestion des formations ****************************************************************************************/ /** Gestion des formation ***************************************************************************************/ public function ajouterAgentFormationAction() public function ajouterFormationAction() { $agent = $this->getAgentService()->getRequestedAgent($this); $formation = $this->getFormationService()->getRequestedFormation($this); $formationElement = new FormationElement(); $agentFormation = new AgentFormation(); $agentFormation->setAgent($agent); $agentFormation->setFormation($formation); $form = $this->getAgentFormationForm(); $form->setAttribute('action', $this->url()->fromRoute('agent/ajouter-agent-formation', ['agent' => $agent->getId(), 'formation' => ($formation) ? $formation->getId() : null])); $form->bind($agentFormation); /** @var FormationElementForm $form */ $form = $this->getFormationElementForm(); $form->setAttribute('action', $this->url()->fromRoute('agent/ajouter-formation', ['agent' => $agent->getId()], [], true)); $form->bind($formationElement); /** @var Request $request */ $request = $this->getRequest(); Loading @@ -374,34 +378,39 @@ class AgentController extends AbstractActionController $data = $request->getPost(); $form->setData($data); if ($form->isValid()) { $this->getAgentService()->createAgentFormation($agentFormation); $this->getHasFormationCollectionService()->addFormation($agent, $formationElement); } } $vm = new ViewModel(); $vm->setTemplate('application/default/default-form'); $vm->setVariables([ 'title' => "Ajout d'une formation associée à un agent", 'title' => "Ajout d'une formation suivie par l'agent", 'form' => $form, ]); return $vm; } public function afficherAgentFormationAction() public function afficherFormationAction() { $agentFormation = $this->getAgentService()->getRequestedAgentFormation($this); $formationElement = $this->getFormationElementService()->getRequestedFormationElement($this); $agent = $this->getAgentService()->getRequestedAgent($this); return new ViewModel([ 'title' => "Affichage d'une formation", 'agentFormation' => $agentFormation, 'title' => "Affichage d'une formation suivie par un agent", 'formationElement' => $formationElement, 'agent' => $agent, ]); } public function modifierAgentFormationAction() public function modifierFormationAction() { $agentFormation = $this->getAgentService()->getRequestedAgentFormation($this); $form = $this->getAgentFormationForm(); $form->setAttribute('action', $this->url()->fromRoute('agent/modifier-agent-formation', ['agent-formation' => $agentFormation->getId()])); $form->bind($agentFormation); $agent = $this->getAgentService()->getRequestedAgent($this); $formationElement = $this->getFormationElementService()->getRequestedFormationElement($this); $form = $this->getFormationElementForm(); $form->setAttribute('action', $this->url()->fromRoute('agent/modifier-formation', ['agent' => $agent->getId(), 'formation-element' => $formationElement->getId()])); $form->bind($formationElement); /** @var Request $request */ $request = $this->getRequest(); Loading @@ -409,61 +418,64 @@ class AgentController extends AbstractActionController $data = $request->getPost(); $form->setData($data); if ($form->isValid()) { $this->getAgentService()->updateAgentFormation($agentFormation); $this->getFormationElementService()->update($formationElement); } } $vm = new ViewModel(); $vm->setTemplate('application/default/default-form'); $vm->setVariables([ 'title' => "Modification d'une formation associée à un agent", 'title' => "Modification d'une formation suivie par un agent", 'form' => $form, ]); return $vm; } public function historiserAgentFormationAction() public function historiserFormationAction() { $retour = $this->params()->fromQuery('retour'); $agentFormation = $this->getAgentService()->getRequestedAgentFormation($this); $this->getAgentService()->historiserAgentFormation($agentFormation); $agent = $this->getAgentService()->getRequestedAgent($this); $formationElement = $this->getFormationElementService()->getRequestedFormationElement($this); $this->getFormationElementService()->historise($formationElement); if ($retour !== null) return $this->redirect()->toUrl($retour); return $this->redirect()->toRoute('agent/afficher', ['agent' => $agentFormation->getAgent()->getId()], [], true); return $this->redirect()->toRoute('agent/afficher', ['agent' => $agent->getId()], [], true); } public function restaurerAgentFormationAction() public function restaurerFormationAction() { $retour = $this->params()->fromQuery('retour'); $agentFormation = $this->getAgentService()->getRequestedAgentFormation($this); $this->getAgentService()->restoreAgentFormation($agentFormation); $agent = $this->getAgentService()->getRequestedAgent($this); $formationElement = $this->getFormationElementService()->getRequestedFormationElement($this); $this->getFormationElementService()->restore($formationElement); if ($retour !== null) return $this->redirect()->toUrl($retour); return $this->redirect()->toRoute('agent/afficher', ['agent' => $agentFormation->getAgent()->getId()], [], true); return $this->redirect()->toRoute('agent/afficher', ['agent' => $agent->getId()], [], true); } public function detruireAgentFormationAction() public function detruireFormationAction() { $agentFormation = $this->getAgentService()->getRequestedAgentFormation($this); $agent = $this->getAgentService()->getRequestedAgent($this); $formationElement = $this->getFormationElementService()->getRequestedFormationElement($this); /** @var Request $request */ $request = $this->getRequest(); if ($request->isPost()) { $data = $request->getPost(); if ($data["reponse"] === "oui") $this->getAgentService()->deleteAgentFormation($agentFormation); //return $this->redirect()->toRoute('home'); //la cascade doit gérer l'affaire if ($data["reponse"] === "oui") $this->getFormationElementService()->delete($formationElement); exit(); } $vm = new ViewModel(); if ($agentFormation !== null) { if ($formationElement !== null) { $vm->setTemplate('application/default/confirmation'); $vm->setVariables([ 'title' => "Suppression de la formation de " . $agentFormation->getAgent()->getDenomination(), 'title' => "Suppression de la formation de " . $formationElement->getFormation()->getLibelle(), 'text' => "La suppression est définitive êtes-vous sûr·e de vouloir continuer ?", 'action' => $this->url()->fromRoute('agent/detruire-agent-formation', ["agent-formation" => $agentFormation->getId()], [], true), 'action' => $this->url()->fromRoute('agent/detruire-formation', ["agent" => $agent->getId(), "formation-element" => $formationElement->getId()], [], true), ]); } return $vm; Loading Loading @@ -491,7 +503,7 @@ class AgentController extends AbstractActionController $elementText = "la compétence [" . $entity->getCompetence()->getLibelle() . "]"; break; case 'AgentFormation' : $entity = $this->getAgentService()->getAgentFormation($entityId); $entity = $this->getFormationElementService()->getFormationElement($entityId); $validationType = $this->getValidationTypeService()->getValidationTypeByCode("AGENT_FORMATION"); $elementText = "la formation [" . $entity->getFormation()->getLibelle() . "]"; break; Loading Loading @@ -523,10 +535,10 @@ class AgentController extends AbstractActionController $this->getApplicationElementService()->update($entity); break; case 'AgentCompetence' : $this->getAgentService()->updateAgentCompetence($entity); $this->getCompetenceElementService()->update($entity); break; case 'AgentFormation' : $this->getAgentService()->updateAgentFormation($entity); $this->getFormationElementService()->update($entity); break; } } Loading
module/Application/src/Application/Controller/AgentControllerFactory.php +16 −6 Original line number Diff line number Diff line Loading @@ -2,7 +2,6 @@ namespace Application\Controller; use Application\Form\AgentFormation\AgentFormationForm; use Application\Form\ApplicationElement\ApplicationElementForm; use Application\Form\CompetenceElement\CompetenceElementForm; use Application\Service\Agent\AgentService; Loading @@ -17,7 +16,10 @@ use Application\Service\Structure\StructureService; use Fichier\Form\Upload\UploadForm; use Fichier\Service\Fichier\FichierService; use Fichier\Service\Nature\NatureService; use Formation\Form\FormationElement\FormationElementForm; use Formation\Service\Formation\FormationService; use Formation\Service\FormationElement\FormationElementService; use Formation\Service\HasFormationCollection\HasFormationCollectionService; use Interop\Container\ContainerInterface; use UnicaenUtilisateur\Service\User\UserService; use UnicaenValidation\Service\ValidationInstance\ValidationInstanceService; Loading @@ -34,6 +36,8 @@ class AgentControllerFactory { * @var CategorieService $categorieService * @var CompetenceElementService $competenceElementService * @var HasCompetenceCollectionService $hasCompetenceCollectionService * @var FormationElementService $formationElementService * @var HasFormationCollectionService $hasFormationElementService * @var EntretienProfessionnelService $entretienService * @var ParcoursDeFormationService $parcoursService * @var ValidationInstanceService $validationInstanceService Loading @@ -50,6 +54,8 @@ class AgentControllerFactory { $hasApplicationCollectionService = $container->get(HasApplicationCollectionService::class); $competenceElementService = $container->get(CompetenceElementService::class); $hasCompetenceCollectionService = $container->get(HasCompetenceCollectionService::class); $formationElementService = $container->get(FormationElementService::class); $hasFormationElementService = $container->get(HasFormationCollectionService::class); $categorieService = $container->get(CategorieService::class); $entretienService = $container->get(EntretienProfessionnelService::class); $parcoursService = $container->get(ParcoursDeFormationService::class); Loading @@ -64,24 +70,28 @@ class AgentControllerFactory { /** * @var ApplicationElementForm $applicationElementForm * @var CompetenceElementForm $competenceElementForm * @var AgentFormationForm $agentFormationForm * @var FormationElementForm $formationElementForm * @var UploadForm $uploadForm */ $applicationElementForm = $container->get('FormElementManager')->get(ApplicationElementForm::class); $competenceElementForm = $container->get('FormElementManager')->get(CompetenceElementForm::class); $agentFormationForm = $container->get('FormElementManager')->get(AgentFormationForm::class); $formationElementForm = $container->get('FormElementManager')->get(FormationElementForm::class); $uploadForm = $container->get('FormElementManager')->get(UploadForm::class); /** @var AgentController $controller */ $controller = new AgentController(); $controller->setAgentService($agentService); $controller->setApplicationElementService($applicationElementService); $controller->setCategorieService($categorieService); $controller->setParcoursDeFormationService($parcoursService); $controller->setHasApplicationCollectionService($hasApplicationCollectionService); $controller->setCompetenceElementService($competenceElementService); $controller->setHasCompetenceCollectionService($hasCompetenceCollectionService); $controller->setFormationElementService($formationElementService); $controller->setHasFormationCollectionService($hasFormationElementService); $controller->setParcoursDeFormationService($parcoursService); $controller->setCategorieService($categorieService); $controller->setEntretienProfessionnelService($entretienService); $controller->setValidationInstanceService($validationInstanceService); $controller->setValidationTypeService($validationTypeService); Loading @@ -93,7 +103,7 @@ class AgentControllerFactory { $controller->setApplicationElementForm($applicationElementForm); $controller->setCompetenceElementForm($competenceElementForm); $controller->setAgentFormationForm($agentFormationForm); $controller->setFormationElementForm($formationElementForm); $controller->setUploadForm($uploadForm); return $controller; Loading
module/Application/src/Application/Entity/Db/Agent.php +8 −48 File changed.Preview size limit exceeded, changes collapsed. Show changes
module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Agent.dcm.xml +10 −1 Original line number Diff line number Diff line Loading @@ -43,8 +43,17 @@ </inverse-join-columns> </join-table> </many-to-many> <many-to-many field="formations" target-entity="Formation\Entity\Db\FormationElement"> <join-table name="agent_formation"> <join-columns> <join-column name="agent_id" referenced-column-name="c_individu" /> </join-columns> <inverse-join-columns> <join-column name="formation_element_id" referenced-column-name="id" /> </inverse-join-columns> </join-table> </many-to-many> <one-to-many target-entity="Application\Entity\Db\AgentFormation" mapped-by="agent" field="formations"/> <one-to-many target-entity="Application\Entity\Db\EntretienProfessionnel" mapped-by="agent" field="entretiens"/> <one-to-many target-entity="Application\Entity\Db\StructureAgentForce" mapped-by="agent" field="structuresForcees"/> Loading