diff --git a/config/autoload/unicaen-db-import.global.php b/config/autoload/unicaen-db-import.global.php index 99376ad302aa9f3f3c6000220a80fc6ef09418aa..8320b985f7bedc41634f74731ef4a1c523cb7e7d 100644 --- a/config/autoload/unicaen-db-import.global.php +++ b/config/autoload/unicaen-db-import.global.php @@ -126,6 +126,24 @@ return [ 'columns' => ['id_orig', 'agent_id', 'structure_id', 'corps_id', 'grade_id', 'bap_id', 'd_debut', 'd_fin'], ], ], + [ + 'name' => 'Import_AGENT_QUOTITE', + 'source' => [ + 'name' => 'Quotité travaillé par les agents', + 'select' => 'SELECT ID, INDIVIDU_ID AS AGENT_ID, D_DEBUT AS DEBUT, D_FIN AS FIN, QUOTITE FROM INDIVIDU_QUOTITE JOIN V_PREECOG_AGENT on V_PREECOG_AGENT.C_INDIVIDU = INDIVIDU_QUOTITE.INDIVIDU_ID', + 'connection' => 'octopus', + 'source_code_column' => 'ID', + //'columns' => ['AGENT_ID', 'STRUCTURE_ID', 'CORPS_ID', 'GRADE_ID', 'BAP_ID', 'DATE_DEBUT', 'DATE_FIN'], + ], + 'intermediate_table' => 'src_agent_quotite', + 'destination' => [ + 'name' => 'Grade des agents gérés par la DRH', + 'table' => 'agent_quotite', + 'connection' => 'default', + 'source_code_column' => 'id', + 'columns' => ['agent_id', 'debut', 'fin', 'quotite'], + ], + ], [ 'name' => 'Import_STATUT', 'source' => [ diff --git a/module/Application/config/merged/agent.config.php b/module/Application/config/merged/agent.config.php index fb748de2842f4b0e26b13f8cbabc2bb6cfedcb98..8f21efe79b78dbf88bb6ae59b7079a76b5facaef 100644 --- a/module/Application/config/merged/agent.config.php +++ b/module/Application/config/merged/agent.config.php @@ -6,10 +6,6 @@ use Application\Assertion\AgentAssertion; use Application\Assertion\AgentAssertionFactory; use Application\Controller\AgentController; use Application\Controller\AgentControllerFactory; -use Application\Form\Agent\AgentForm; -use Application\Form\Agent\AgentFormFactory; -use Application\Form\Agent\AgentHydrator; -use Application\Form\Agent\AgentHydratorFactory; use Application\Form\AgentApplication\AgentApplicationForm; use Application\Form\AgentApplication\AgentApplicationFormFactory; use Application\Form\AgentApplication\AgentApplicationHydrator; @@ -107,9 +103,6 @@ return [ [ 'controller' => AgentController::class, 'action' => [ - 'modifier', - 'ajouter-agent-mission-specifique', - 'modifier-agent-mission-specifique', 'upload-fichier', ], 'privileges' => [ @@ -140,17 +133,6 @@ return [ ], 'assertion' => AgentAssertion::class, ], - [ - 'controller' => AgentController::class, - 'action' => [ - 'historiser-agent-mission-specifique', - 'restaurer-agent-mission-specifique', - 'detruire-agent-mission-specifique', - ], - 'privileges' => [ - AgentPrivileges::AGENT_EFFACER, - ], - ], [ 'controller' => AgentController::class, 'action' => [ @@ -248,59 +230,6 @@ return [ ], ], - /** Route des AgentMissionSpecifique ********************************************************************/ - - 'ajouter-agent-mission-specifique' => [ - 'type' => Segment::class, - 'options' => [ - 'route' => '/ajouter-agent-mission-specifique/:agent', - 'defaults' => [ - 'controller' => AgentController::class, - 'action' => 'ajouter-agent-mission-specifique', - ], - ], - ], - 'modifier-agent-mission-specifique' => [ - 'type' => Segment::class, - 'options' => [ - 'route' => '/modifier-agent-mission-specifique/:agent-mission-specifique', - 'defaults' => [ - 'controller' => AgentController::class, - 'action' => 'modifier-agent-mission-specifique', - ], - ], - ], - 'historiser-agent-mission-specifique' => [ - 'type' => Segment::class, - 'options' => [ - 'route' => '/historiser-agent-mission-specifique/:agent-mission-specifique', - 'defaults' => [ - 'controller' => AgentController::class, - 'action' => 'historiser-agent-mission-specifique', - ], - ], - ], - 'restaurer-agent-mission-specifique' => [ - 'type' => Segment::class, - 'options' => [ - 'route' => '/restaurer-agent-mission-specifique/:agent-mission-specifique', - 'defaults' => [ - 'controller' => AgentController::class, - 'action' => 'restaurer-agent-mission-specifique', - ], - ], - ], - 'detruire-agent-mission-specifique' => [ - 'type' => Segment::class, - 'options' => [ - 'route' => '/detruire-agent-mission-specifique/:agent-mission-specifique', - 'defaults' => [ - 'controller' => AgentController::class, - 'action' => 'detruire-agent-mission-specifique', - ], - ], - ], - /** Route des AgentApplication ********************************************************************/ 'ajouter-agent-application' => [ @@ -516,16 +445,6 @@ return [ /** AUTRE ****************************************************************************************/ - 'modifier' => [ - 'type' => Segment::class, - 'options' => [ - 'route' => '/modifier/:agent', - 'defaults' => [ - 'controller' => AgentController::class, - 'action' => 'modifier', - ], - ], - ], 'upload-fichier' => [ 'type' => Segment::class, 'options' => [ @@ -593,7 +512,6 @@ return [ ], 'form_elements' => [ 'factories' => [ - AgentForm::class => AgentFormFactory::class, AgentApplicationForm::class => AgentApplicationFormFactory::class, AgentCompetenceForm::class => AgentCompetenceFormFactory::class, AgentFormationForm::class => AgentFormationFormFactory::class, @@ -602,7 +520,6 @@ return [ ], 'hydrators' => [ 'factories' => [ - AgentHydrator::class => AgentHydratorFactory::class, AgentApplicationHydrator::class => AgentApplicationHydratorFactory::class, AgentCompetenceHydrator::class => AgentCompetenceHydratorFactory::class, AgentFormationHydrator::class => AgentFormationHydratorFactory::class, diff --git a/module/Application/config/merged/competence.config.php b/module/Application/config/merged/competence.config.php index 9973ddeaf85a7f1f009bd9a385ae37863d07e158..53139720fe2ee8aead8bb43642e80fd568e586f3 100644 --- a/module/Application/config/merged/competence.config.php +++ b/module/Application/config/merged/competence.config.php @@ -22,8 +22,7 @@ use Application\Service\CompetenceTheme\CompetenceThemeService; use Application\Service\CompetenceTheme\CompetenceThemeServiceFactory; use Application\Service\CompetenceType\CompetenceTypeService; use Application\Service\CompetenceType\CompetenceTypeServiceFactory; -use Application\View\Helper\CompetencesViewHelper; -use Application\View\Helper\CompetenceViewHelper; +use Application\View\Helper\CompetenceBlocViewHelper; use UnicaenPrivilege\Guard\PrivilegeController; use Zend\Router\Http\Literal; use Zend\Router\Http\Segment; @@ -384,8 +383,7 @@ return [ ], 'view_helpers' => [ 'invokables' => [ - 'competence' => CompetenceViewHelper::class, - 'competences' => CompetencesViewHelper::class, + 'competenceBloc' => CompetenceBlocViewHelper::class, ], ], diff --git a/module/Application/config/merged/corps.config.php b/module/Application/config/merged/corps.config.php index 9372e80b3cf253a7af9602317b76c0d87b0d7539..40aa7ec18e57fdaa5a8d9e64886fd79607f1674f 100644 --- a/module/Application/config/merged/corps.config.php +++ b/module/Application/config/merged/corps.config.php @@ -44,6 +44,7 @@ return [ 'controller' => CorpsController::class, 'action' => [ 'afficher-agents-avec-corps', + 'afficher-agents-avec-correspondance', 'afficher-agents-avec-grade', ], 'privileges' => [ @@ -120,6 +121,17 @@ return [ ], 'may_terminate' => true, ], + 'afficher-agents-avec-correspondance' => [ + 'type' => Segment::class, + 'options' => [ + 'route' => '/afficher-agents-avec-correspondance/:correspondance', + 'defaults' => [ + 'controller' => CorpsController::class, + 'action' => 'afficher-agents-avec-correspondance', + ], + ], + 'may_terminate' => true, + ], 'afficher-agents-avec-grade' => [ 'type' => Segment::class, 'options' => [ diff --git a/module/Application/config/merged/fiche-metier.config.php b/module/Application/config/merged/fiche-metier.config.php index abf9e691f979f2530c6bcac65c3c344a29e52f72..25dcb3086a3380ae496736d747815ebfde0bd327 100644 --- a/module/Application/config/merged/fiche-metier.config.php +++ b/module/Application/config/merged/fiche-metier.config.php @@ -60,6 +60,7 @@ return [ 'controller' => FicheMetierController::class, 'action' => [ 'ajouter', +// 'ajouter-terminer', 'ajouter-avec-metier', ], 'privileges' => [ @@ -209,6 +210,17 @@ return [ ], 'may_terminate' => true, ], +// 'ajouter-terminer' => [ +// 'type' => Segment::class, +// 'options' => [ +// 'route' => '/ajouter-terminer/:fiche', +// 'defaults' => [ +// 'controller' => FicheMetierController::class, +// 'action' => 'ajouter-terminer', +// ], +// ], +// 'may_terminate' => true, +// ], 'ajouter-avec-metier' => [ 'type' => Segment::class, 'options' => [ diff --git a/module/Application/src/Application/Controller/AgentController.php b/module/Application/src/Application/Controller/AgentController.php index f01d675df6c9594e7bc711fae3e1c141c786f7f0..eaecb39bd9d360b97da701b61874279d93c4dc87 100644 --- a/module/Application/src/Application/Controller/AgentController.php +++ b/module/Application/src/Application/Controller/AgentController.php @@ -9,15 +9,11 @@ use Application\Entity\Db\AgentApplication; use Application\Entity\Db\AgentCompetence; use Application\Entity\Db\AgentFormation; use Application\Entity\Db\AgentGrade; -use Application\Entity\Db\AgentMissionSpecifique; use Application\Entity\Db\AgentStatut; -use Application\Form\Agent\AgentFormAwareTrait; use Application\Form\AgentApplication\AgentApplicationForm; use Application\Form\AgentApplication\AgentApplicationFormAwareTrait; use Application\Form\AgentCompetence\AgentCompetenceFormAwareTrait; use Application\Form\AgentFormation\AgentFormationFormAwareTrait; -use Application\Form\AgentMissionSpecifique\AgentMissionSpecifiqueForm; -use Application\Form\AgentMissionSpecifique\AgentMissionSpecifiqueFormAwareTrait; use Application\Service\Agent\AgentServiceAwareTrait; use Application\Service\Application\ApplicationServiceAwareTrait; use Application\Service\EntretienProfessionnel\EntretienProfessionnelServiceAwareTrait; @@ -51,48 +47,57 @@ class AgentController extends AbstractActionController use StructureServiceAwareTrait; use UserServiceAwareTrait; - use AgentFormAwareTrait; use AgentApplicationFormAwareTrait; use AgentCompetenceFormAwareTrait; use AgentFormationFormAwareTrait; - use AgentMissionSpecifiqueFormAwareTrait; use UploadFormAwareTrait; + public function indexAction() + { + $fromQueries = $this->params()->fromQuery(); + $filtres = []; + $clefs = ['titulaire', 'cdi', 'cdd', 'administratif', 'chercheur', 'enseignant', 'vacataire']; + foreach ($clefs as $clef) { + if (empty($fromQueries) or $fromQueries[$clef] === 'on') $filtres[$clef] = true; + } - public function indexAction() { - $agents = $this->getAgentService()->getAgents(); - return new ViewModel([ + $agents = $this->getAgentService()->getAgents($filtres); + return new ViewModel([ 'agents' => $agents, + 'filtres' => $filtres, ]); } - public function afficherAction() { - + public function afficherAction() + { $agent = $this->getAgentService()->getRequestedAgent($this); $entretiens = $this->getEntretienProfessionnelService()->getEntretiensProfessionnelsParAgent($agent); - $user = $this->getUserService()->getConnectedUser(); - $role = $this->getUserService()->getConnectedRole(); $responsables = $this->getAgentService()->getClosestResponsablesByAgent($agent); return new ViewModel([ 'title' => 'Afficher l\'agent', 'agent' => $agent, - 'role' => $role, - 'user' => $user, 'entretiens' => $entretiens, 'responsables' => $responsables, ]); } - public function afficherStatutsGradesAction() { + public function afficherStatutsGradesAction() + { $agent = $this->getAgentService()->getRequestedAgent($this); $affectations = $agent->getAffectations(); - usort($affectations, function(AgentAffectation $a, AgentAffectation $b) { return $a->getDateDebut() < $b->getDateDebut();}); + usort($affectations, function (AgentAffectation $a, AgentAffectation $b) { + return $a->getDateDebut() < $b->getDateDebut(); + }); $grades = $agent->getGrades(); - usort($grades, function(AgentGrade $a, AgentGrade $b) { return $a->getDateDebut() < $b->getDateDebut();}); + usort($grades, function (AgentGrade $a, AgentGrade $b) { + return $a->getDateDebut() < $b->getDateDebut(); + }); $statuts = $agent->getStatuts(); - usort($statuts, function(AgentStatut $a, AgentStatut $b) { return $a->getDebut() < $b->getDebut();}); + usort($statuts, function (AgentStatut $a, AgentStatut $b) { + return $a->getDebut() < $b->getDebut(); + }); return new ViewModel([ 'title' => 'Listing de tous les statuts et grades de ' . $agent->getDenomination(), @@ -103,138 +108,6 @@ class AgentController extends AbstractActionController ]); } - public function modifierAction() - { - $agent = $this->getAgentService()->getRequestedAgent($this); - $form = $this->getAgentForm(); - $form->setAttribute('action', $this->url()->fromRoute('agent/modifier', ['agent' => $agent->getId()], [], true)); - $form->bind($agent); - - /** @var Request $request */ - $request = $this->getRequest(); - if ($request->isPost()) { - $data = $request->getPost(); - $form->setData($data); - if ($form->isValid()) { - $this->getAgentService()->update($agent); - } - } - - $vm = new ViewModel(); - $vm->setTemplate('application/default/default-form'); - $vm->setVariables([ - 'title' => 'Modifier l\'agent', - 'form' => $form, - ]); - return $vm; - } - - /** Gestion des missions spécifiques ******************************************************************************/ - - public function ajouterAgentMissionSpecifiqueAction() - { - $agent = $this->getAgentService()->getRequestedAgent($this); - $agentMissionSpecifique = new AgentMissionSpecifique(); - $agentMissionSpecifique->setAgent($agent); - - /** @var AgentMissionSpecifiqueForm $form */ - $form = $this->getAgentMissionSpecifiqueForm(); - $form->setAttribute('action', $this->url()->fromRoute('agent/ajouter-agent-mission-specifique', [ 'agent' => $agent->getId() ], [], true)); - $form->bind($agentMissionSpecifique); - - /** @var Request $request */ - $request = $this->getRequest(); - if ($request->isPost()) { - $data = $request->getPost(); - $form->setData($data); - if ($form->isValid()) { - $agentMissionSpecifique->setAgent($agent); - $this->getAgentService()->createAgentMissionSpecifique($agentMissionSpecifique); - } - } - - $vm = new ViewModel(); - $vm->setTemplate('application/default/default-form'); - $vm->setVariables([ - 'title' => "Ajout d'une mission spécifique de l'agent", - 'form' => $form, - ]); - return $vm; - } - - public function modifierAgentMissionSpecifiqueAction() - { - $agentMissionSpecifique = $this->getAgentService()->getRequestedAgentMissionSpecifique($this); - $agent = $agentMissionSpecifique->getAgent(); - $form = $this->getAgentMissionSpecifiqueForm(); - $form->setAttribute('action', $this->url()->fromRoute('agent/modifier-agent-mission-specifique', ['agent-mission-specifique' => $agentMissionSpecifique->getId()])); - $form->bind($agentMissionSpecifique); - - /** @var Request $request */ - $request = $this->getRequest(); - if ($request->isPost()) { - $data = $request->getPost(); - $form->setData($data); - if ($form->isValid()) { - $agentMissionSpecifique->setAgent($agent); - $this->getAgentService()->updateAgentMissionSpecifique($agentMissionSpecifique); - } - } - - $vm = new ViewModel(); - $vm->setTemplate('application/default/default-form'); - $vm->setVariables([ - 'title' => "Modification d'une mission spécifique de l'agent", - 'form' => $form, - ]); - return $vm; - } - - public function historiserAgentMissionSpecifiqueAction() - { - $agentMissionSpecifique = $this->getAgentService()->getRequestedAgentMissionSpecifique($this); - $this->getAgentService()->historiserAgentMissionSpecifique($agentMissionSpecifique); - - $retour = $this->params()->fromQuery('retour'); - if ($retour) return $this->redirect()->toUrl($retour); - return $this->redirect()->toRoute('agent/afficher', ['agent' => $agentMissionSpecifique->getAgent()->getId()], [], true); - } - - public function restaurerAgentMissionSpecifiqueAction() - { - $agentMissionSpecifique = $this->getAgentService()->getRequestedAgentMissionSpecifique($this); - $this->getAgentService()->restoreAgentMissionSpecifique($agentMissionSpecifique); - - $retour = $this->params()->fromQuery('retour'); - if ($retour) return $this->redirect()->toUrl($retour); - return $this->redirect()->toRoute('agent/afficher', ['agent' => $agentMissionSpecifique->getAgent()->getId()], [], true); - } - - public function detruireAgentMissionSpecifiqueAction() - { - $agentMissionSpecifique = $this->getAgentService()->getRequestedAgentMissionSpecifique($this); - - /** @var Request $request */ - $request = $this->getRequest(); - if ($request->isPost()) { - $data = $request->getPost(); - if ($data["reponse"] === "oui") $this->getAgentService()->deleteAgentMissionSpecifique($agentMissionSpecifique); - //return $this->redirect()->toRoute('home'); - exit(); - } - - $vm = new ViewModel(); - if ($agentMissionSpecifique !== null) { - $vm->setTemplate('application/default/confirmation'); - $vm->setVariables([ - 'title' => "Suppression de la mission spécifique de " . $agentMissionSpecifique->getAgent()->getDenomination(), - 'text' => "La suppression est définitive êtes-vous sûr·e de vouloir continuer ?", - 'action' => $this->url()->fromRoute('agent/detruire-agent-mission-specifique', ["agent-mission-specifique" => $agentMissionSpecifique->getId()], [], true), - ]); - } - return $vm; - } - /** Gestion des applications***************************************************************************************/ public function ajouterAgentApplicationAction() @@ -244,7 +117,7 @@ class AgentController extends AbstractActionController /** @var AgentApplicationForm $form */ $form = $this->getAgentApplicationForm(); - $form->setAttribute('action', $this->url()->fromRoute('agent/ajouter-agent-application', [ 'agent' => $agent->getId() ], [], true)); + $form->setAttribute('action', $this->url()->fromRoute('agent/ajouter-agent-application', ['agent' => $agent->getId()], [], true)); $form->bind($agentApplication); /** @var Request $request */ @@ -374,8 +247,8 @@ class AgentController extends AbstractActionController $vm = new ViewModel(); $vm->setTemplate('application/default/default-form'); $vm->setVariables([ - 'title' => "Ajout d'une compétence associée à un agent", - 'form' => $form, + 'title' => "Ajout d'une compétence associée à un agent", + 'form' => $form, ]); return $vm; } @@ -473,7 +346,7 @@ class AgentController extends AbstractActionController $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->setAttribute('action', $this->url()->fromRoute('agent/ajouter-agent-formation', ['agent' => $agent->getId(), 'formation' => ($formation) ? $formation->getId() : null])); $form->bind($agentFormation); /** @var Request $request */ @@ -591,17 +464,17 @@ class AgentController extends AbstractActionController case 'AgentApplication' : $entity = $this->getAgentService()->getAgentApplication($entityId); $validationType = $this->getValidationTypeService()->getValidationTypeByCode("AGENT_APPLICATION"); - $elementText = "l'application [".$entity->getApplication()->getLibelle()."]"; + $elementText = "l'application [" . $entity->getApplication()->getLibelle() . "]"; break; case 'AgentCompetence' : $entity = $this->getAgentService()->getAgentCompetence($entityId); $validationType = $this->getValidationTypeService()->getValidationTypeByCode("AGENT_COMPETENCE"); - $elementText = "la compétence [".$entity->getCompetence()->getLibelle()."]"; + $elementText = "la compétence [" . $entity->getCompetence()->getLibelle() . "]"; break; case 'AgentFormation' : $entity = $this->getAgentService()->getAgentFormation($entityId); $validationType = $this->getValidationTypeService()->getValidationTypeByCode("AGENT_FORMATION"); - $elementText = "la formation [".$entity->getFormation()->getLibelle()."]"; + $elementText = "la formation [" . $entity->getFormation()->getLibelle() . "]"; break; } @@ -624,7 +497,7 @@ class AgentController extends AbstractActionController $this->getValidationInstanceService()->create($validation); } - if ($validation !== null AND $entity !== null) { + if ($validation !== null and $entity !== null) { $entity->setValidation($validation); switch ($type) { case 'AgentApplication' : @@ -645,8 +518,8 @@ class AgentController extends AbstractActionController if ($entity !== null) { $vm->setTemplate('unicaen-validation/validation-instance/validation-modal'); $vm->setVariables([ - 'title' => "Validation de ".$elementText, - 'text' => "Validation de ".$elementText, + 'title' => "Validation de " . $elementText, + 'text' => "Validation de " . $elementText, 'action' => $this->url()->fromRoute('agent/valider-element', ["type" => $type, "id" => $entityId], [], true), ]); } @@ -666,14 +539,14 @@ class AgentController extends AbstractActionController $entity->setValidation(null); try { $this->getValidationInstanceService()->getEntityManager()->flush($entity); - } catch(ORMException $e) { + } catch (ORMException $e) { throw new RuntimeException("Un problème est survenue lors de l'enregistrement en base."); } if ($retour !== null) return $this->redirect()->toUrl($retour); return $this->redirect()->toRoute('agent/afficher', ['agent' => $entity->getAgent()->getId()], [], true); } - + /** Fichier associé à l'agent *************************************************************************************/ public function uploadFichierAction() @@ -682,11 +555,9 @@ class AgentController extends AbstractActionController $fichier = new Fichier(); $form = $this->getUploadForm(); - $form->setAttribute('action', $this->url()->fromRoute('agent/upload-fichier',['agent' => $agent->getId()] , [], true)); + $form->setAttribute('action', $this->url()->fromRoute('agent/upload-fichier', ['agent' => $agent->getId()], [], true)); $form->bind($fichier); - /** !TODO! lorsque l'on est dans une modal on perd le tableau files ... */ - /** @var Request $request */ $request = $this->getRequest(); if ($request->isPost()) { @@ -703,7 +574,7 @@ class AgentController extends AbstractActionController return $this->redirect()->toRoute('agent/afficher', ['agent' => $agent->getId()]); } - $vm = new ViewModel(); + $vm = new ViewModel(); $vm->setTemplate('application/default/default-form'); $vm->setVariables([ 'title' => 'Téléverserment d\'un fichier', @@ -743,20 +614,20 @@ class AgentController extends AbstractActionController * @param Agent[] $agents * @return array */ - private function formatAgentJSON($agents) + private function formatAgentJSON(array $agents) { $result = []; /** @var Agent[] $agents */ foreach ($agents as $agent) { - $structure = ($agent->getAffectationPrincipale())?($agent->getAffectationPrincipale()->getStructure()):null; - $extra = ($structure)?$structure->getLibelleCourt():"Affectation inconnue"; + $structure = ($agent->getAffectationPrincipale()) ? ($agent->getAffectationPrincipale()->getStructure()) : null; + $extra = ($structure) ? $structure->getLibelleCourt() : "Affectation inconnue"; $result[] = array( - 'id' => $agent->getId(), + 'id' => $agent->getId(), 'label' => $agent->getDenomination(), - 'extra' => "<span class='badge' style='background-color: slategray;'>".$extra."</span>", + 'extra' => "<span class='badge' style='background-color: slategray;'>" . $extra . "</span>", ); } - usort($result, function($a, $b) { + usort($result, function ($a, $b) { return strcmp($a['label'], $b['label']); }); return $result; diff --git a/module/Application/src/Application/Controller/AgentControllerFactory.php b/module/Application/src/Application/Controller/AgentControllerFactory.php index 84edcb3a8e88035b1a0a898ce07051c782f005dd..d0e72186ad50797c4882f4b1fefc5ed6185b8708 100644 --- a/module/Application/src/Application/Controller/AgentControllerFactory.php +++ b/module/Application/src/Application/Controller/AgentControllerFactory.php @@ -6,7 +6,6 @@ use Application\Form\Agent\AgentForm; use Application\Form\AgentApplication\AgentApplicationForm; use Application\Form\AgentCompetence\AgentCompetenceForm; use Application\Form\AgentFormation\AgentFormationForm; -use Application\Form\AgentMissionSpecifique\AgentMissionSpecifiqueForm; use Application\Service\Agent\AgentService; use Application\Service\EntretienProfessionnel\EntretienProfessionnelService; use Application\Service\Formation\FormationService; @@ -45,18 +44,14 @@ class AgentControllerFactory { $structureService = $container->get(StructureService::class); /** - * @var AgentForm $agentForm * @var AgentApplicationForm $agentApplicationForm * @var AgentCompetenceForm $agentCompetenceForm * @var AgentFormationForm $agentFormationForm - * @var AgentMissionSpecifiqueForm $agentMissionSpecifiqueForm * @var UploadForm $uploadForm */ - $agentForm = $container->get('FormElementManager')->get(AgentForm::class); $agentApplicationForm = $container->get('FormElementManager')->get(AgentApplicationForm::class); $agentCompetenceForm = $container->get('FormElementManager')->get(AgentCompetenceForm::class); $agentFormationForm = $container->get('FormElementManager')->get(AgentFormationForm::class); - $agentMissionSpecifiqueForm = $container->get('FormElementManager')->get(AgentMissionSpecifiqueForm::class); $uploadForm = $container->get('FormElementManager')->get(UploadForm::class); /** @var AgentController $controller */ @@ -72,11 +67,9 @@ class AgentControllerFactory { $controller->setUserService($userService); $controller->setStructureService($structureService); - $controller->setAgentForm($agentForm); $controller->setAgentApplicationForm($agentApplicationForm); $controller->setAgentCompetenceForm($agentCompetenceForm); $controller->setAgentFormationForm($agentFormationForm); - $controller->setAgentMissionSpecifiqueForm($agentMissionSpecifiqueForm); $controller->setUploadForm($uploadForm); return $controller; diff --git a/module/Application/src/Application/Controller/CompetenceController.php b/module/Application/src/Application/Controller/CompetenceController.php index 9bf2bf9be300592a446d20ce6185e371f90f49c6..dd1799ce4d787544268759d24e5db26af0689cf8 100644 --- a/module/Application/src/Application/Controller/CompetenceController.php +++ b/module/Application/src/Application/Controller/CompetenceController.php @@ -15,7 +15,8 @@ use Zend\Http\Request; use Zend\Mvc\Controller\AbstractActionController; use Zend\View\Model\ViewModel; -class CompetenceController extends AbstractActionController { +class CompetenceController extends AbstractActionController +{ use CompetenceServiceAwareTrait; use CompetenceThemeServiceAwareTrait; use CompetenceTypeServiceAwareTrait; @@ -52,7 +53,7 @@ class CompetenceController extends AbstractActionController { /** @var Request $request */ $request = $this->getRequest(); - if ($request->isPost()){ + if ($request->isPost()) { $data = $request->getPost(); $form->setData($data); if ($form->isValid()) { @@ -60,7 +61,7 @@ class CompetenceController extends AbstractActionController { } } - $vm = new ViewModel(); + $vm = new ViewModel(); $vm->setTemplate('application/default/default-form'); $vm->setVariables([ 'title' => "Ajout d'une compétence", @@ -78,7 +79,7 @@ class CompetenceController extends AbstractActionController { /** @var Request $request */ $request = $this->getRequest(); - if ($request->isPost()){ + if ($request->isPost()) { $data = $request->getPost(); $form->setData($data); if ($form->isValid()) { @@ -86,7 +87,7 @@ class CompetenceController extends AbstractActionController { } } - $vm = new ViewModel(); + $vm = new ViewModel(); $vm->setTemplate('application/default/default-form'); $vm->setVariables([ 'title' => "Modification d'une compétence", @@ -162,7 +163,7 @@ class CompetenceController extends AbstractActionController { /** @var Request $request */ $request = $this->getRequest(); - if ($request->isPost()){ + if ($request->isPost()) { $data = $request->getPost(); $form->setData($data); if ($form->isValid()) { @@ -170,7 +171,7 @@ class CompetenceController extends AbstractActionController { } } - $vm = new ViewModel(); + $vm = new ViewModel(); $vm->setTemplate('application/default/default-form'); $vm->setVariables([ 'title' => "Ajout d'un thème de compétences", @@ -188,7 +189,7 @@ class CompetenceController extends AbstractActionController { /** @var Request $request */ $request = $this->getRequest(); - if ($request->isPost()){ + if ($request->isPost()) { $data = $request->getPost(); $form->setData($data); if ($form->isValid()) { @@ -196,7 +197,7 @@ class CompetenceController extends AbstractActionController { } } - $vm = new ViewModel(); + $vm = new ViewModel(); $vm->setTemplate('application/default/default-form'); $vm->setVariables([ 'title' => "Modification d'un thème de compétences", @@ -254,7 +255,7 @@ class CompetenceController extends AbstractActionController { /** @var Request $request */ $request = $this->getRequest(); - if ($request->isPost()){ + if ($request->isPost()) { $data = $request->getPost(); $form->setData($data); if ($form->isValid()) { @@ -262,7 +263,7 @@ class CompetenceController extends AbstractActionController { } } - $vm = new ViewModel(); + $vm = new ViewModel(); $vm->setTemplate('application/default/default-form'); $vm->setVariables([ 'title' => "Ajout d'un type de compétences", @@ -280,7 +281,7 @@ class CompetenceController extends AbstractActionController { /** @var Request $request */ $request = $this->getRequest(); - if ($request->isPost()){ + if ($request->isPost()) { $data = $request->getPost(); $form->setData($data); if ($form->isValid()) { @@ -288,7 +289,7 @@ class CompetenceController extends AbstractActionController { } } - $vm = new ViewModel(); + $vm = new ViewModel(); $vm->setTemplate('application/default/default-form'); $vm->setVariables([ 'title' => "Modification d'un type de compétences", @@ -343,5 +344,4 @@ class CompetenceController extends AbstractActionController { } return $vm; } -} - +} \ No newline at end of file diff --git a/module/Application/src/Application/Controller/CompetenceControllerFactory.php b/module/Application/src/Application/Controller/CompetenceControllerFactory.php index 3e9bf740519ad42c3cf59b48c6af269436af9744..55b71890767c3ee25ebd72b5b9fb62e89f07fb60 100644 --- a/module/Application/src/Application/Controller/CompetenceControllerFactory.php +++ b/module/Application/src/Application/Controller/CompetenceControllerFactory.php @@ -10,7 +10,8 @@ use Application\Service\CompetenceTheme\CompetenceThemeService; use Application\Service\CompetenceType\CompetenceTypeService; use Interop\Container\ContainerInterface; -class CompetenceControllerFactory { +class CompetenceControllerFactory +{ public function __invoke(ContainerInterface $container) { @@ -19,17 +20,17 @@ class CompetenceControllerFactory { * @var CompetenceThemeService $competenceThemeService * @var CompetenceTypeService $competenceTypeService */ - $competenceService = $container->get(CompetenceService::class); - $competenceThemeService = $container->get(CompetenceThemeService::class); - $competenceTypeService = $container->get(CompetenceTypeService::class); + $competenceService = $container->get(CompetenceService::class); + $competenceThemeService = $container->get(CompetenceThemeService::class); + $competenceTypeService = $container->get(CompetenceTypeService::class); /** * @var CompetenceForm $competenceForm * @var CompetenceTypeForm $competenceTypeForm * @var ModifierLibelleForm $modifierLibelleForm */ - $competenceForm = $container->get('FormElementManager')->get(CompetenceForm::class); - $competenceTypeForm = $container->get('FormElementManager')->get(CompetenceTypeForm::class); + $competenceForm = $container->get('FormElementManager')->get(CompetenceForm::class); + $competenceTypeForm = $container->get('FormElementManager')->get(CompetenceTypeForm::class); $modifierLibelleForm = $container->get('FormElementManager')->get(ModifierLibelleForm::class); /** @var CompetenceController $controller */ diff --git a/module/Application/src/Application/Controller/CorpsController.php b/module/Application/src/Application/Controller/CorpsController.php index d77428e5cf365f43debc103707504f31266886df..8ffce3dc4aee927652f3ac00e6f6c782a16b374c 100644 --- a/module/Application/src/Application/Controller/CorpsController.php +++ b/module/Application/src/Application/Controller/CorpsController.php @@ -64,23 +64,27 @@ class CorpsController extends AbstractActionController { public function afficherAgentsAvecCorpsAction() { $corps = $this->getCorpsService()->getRequestedCorps($this); - $agents = $this->getAgentService()->getAgentsWithCorps($corps); return new ViewModel([ 'title' => 'Agents ayant le corps ['. $corps->getLibelleCourt().']', 'corps' => $corps, - 'agents' => $agents, ]); } public function afficherAgentsAvecGradeAction() { $grade = $this->getGradeService()->getRequestedGrade($this); - $agents = $this->getAgentService()->getAgentsWithGrade($grade); return new ViewModel([ 'title' => 'Agents ayant le grade ['. $grade->getLibelleCourt().']', 'grade' => $grade, - 'agents' => $agents, ]); } + public function afficherAgentsAvecCorrespondanceAction() { + $correspondance = $this->getCorrespondanceService()->getRequestedCorrespondance($this); + + return new ViewModel([ + 'title' => 'Agents ayant la correspondance ['. $correspondance->getLibelleCourt().']', + 'correspondance' => $correspondance, + ]); + } } \ No newline at end of file diff --git a/module/Application/src/Application/Controller/EntretienProfessionnelController.php b/module/Application/src/Application/Controller/EntretienProfessionnelController.php index 190704588de82211b947087e1617751e2b6dcda1..86e1473551805a4fdbdbe94cad650b1dd1aa4d5e 100644 --- a/module/Application/src/Application/Controller/EntretienProfessionnelController.php +++ b/module/Application/src/Application/Controller/EntretienProfessionnelController.php @@ -84,7 +84,10 @@ class EntretienProfessionnelController extends AbstractActionController // ne pas dupliquer les entretiens (si il existe alors on l'affiche) $entretien = null; if ($campagne !== null and $agent !== null) $entretien = $this->getEntretienProfessionnelService()->getEntretienProfessionnelByAgentAndCampagne($agent, $campagne); - if ($entretien !== null) return $this->redirect()->toRoute('entretien-professionnel/afficher', ["campagne" => $campagne->getId()], [], true); + if ($entretien !== null) { + /** @see EntretienProfessionnelController::afficherAction() */ + return $this->redirect()->toRoute('entretien-professionnel/afficher', ["entretien" => $entretien->getId()], [], true); + } $entretien = new EntretienProfessionnel(); if ($campagne !== null) $entretien->setCampagne($campagne); @@ -170,8 +173,9 @@ class EntretienProfessionnelController extends AbstractActionController public function afficherAction() { $entretien = $this->getEntretienProfessionnelService()->getRequestedEntretienProfessionnel($this, 'entretien'); - $validationAgent = $this->getValidationInstanceService()->getValidationInstanceByCodeAndEntite('ACCEPTER_ENTRETIEN_AGENT', $entretien); - $validationResponsable = $this->getValidationInstanceService()->getValidationInstanceByCodeAndEntite('ACCEPTER_ENTRETIEN_RESPONSABLE', $entretien); + $validationAgent = $this->getValidationInstanceService()->getValidationInstanceByCodeAndEntite('ENTRETIEN_AGENT', $entretien); + $validationResponsable = $this->getValidationInstanceService()->getValidationInstanceByCodeAndEntite('ENTRETIEN_RESPONSABLE', $entretien); + $validationDrh = $this->getValidationInstanceService()->getValidationInstanceByCodeAndEntite('ENTRETIEN_DRH', $entretien); $agent = $entretien->getAgent(); $fichespostes = ($agent) ? $agent->getFiches() : []; @@ -188,6 +192,7 @@ class EntretienProfessionnelController extends AbstractActionController 'entretien' => $entretien, 'validationAgent' => $validationAgent, 'validationResponsable' => $validationResponsable, + 'validationDrh' => $validationDrh, 'agent' => $agent, 'fichespostes' => $fichespostes, diff --git a/module/Application/src/Application/Controller/FicheMetierController.php b/module/Application/src/Application/Controller/FicheMetierController.php index 78fcad5651d85c2c8e1ddbcb71eabd287c7f6a08..f5f7db5e1bc5f88b3606554a2728e516eb8f1d6b 100644 --- a/module/Application/src/Application/Controller/FicheMetierController.php +++ b/module/Application/src/Application/Controller/FicheMetierController.php @@ -5,9 +5,9 @@ namespace Application\Controller; use Application\Entity\Db\Activite; use Application\Entity\Db\FicheMetier; use Application\Entity\Db\FicheMetierEtat; +use Application\Entity\Db\ParcoursDeFormation; use Application\Form\Activite\ActiviteForm; use Application\Form\Activite\ActiviteFormAwareTrait; -use Application\Form\EntityFormManagmentTrait; use Application\Form\FicheMetier\ActiviteExistanteForm; use Application\Form\FicheMetier\ActiviteExistanteFormAwareTrait; use Application\Form\FicheMetier\LibelleForm; @@ -28,6 +28,7 @@ use Application\Service\FicheMetier\FicheMetierServiceAwareTrait; use Application\Service\FicheMetierEtat\FicheMetierEtatServiceAwareTrait; use Application\Service\Metier\MetierServiceAwareTrait; use Application\Service\ParcoursDeFormation\ParcoursDeFormationServiceAwareTrait; +use Application\Service\RendererAwareTrait; use Mpdf\MpdfException; use UnicaenApp\Exception\RuntimeException; use UnicaenUtilisateur\Entity\DateTimeAwareTrait; @@ -39,6 +40,7 @@ use Zend\View\Model\ViewModel; class FicheMetierController extends AbstractActionController { use DateTimeAwareTrait; + use RendererAwareTrait; /** Traits associé aux services */ use ActiviteServiceAwareTrait; @@ -60,15 +62,6 @@ class FicheMetierController extends AbstractActionController use ConfigurationServiceAwareTrait; - use EntityFormManagmentTrait; - - private $renderer; - - public function setRenderer($renderer) - { - $this->renderer = $renderer; - } - public function indexAction() { $domaineId = $this->params()->fromQuery('domaine'); @@ -99,26 +92,71 @@ class FicheMetierController extends AbstractActionController $fiche = $this->getFicheMetierService()->getRequestedFicheMetier($this, 'id', true); $parcours = $this->getParcoursDeFormationService()->generateParcoursArrayFromFicheMetier($fiche); $applications = $this->getFicheMetierService()->getApplicationsDictionnaires($fiche); + $competences = $this->getFicheMetierService()->getCompetencesDictionnaires($fiche); return new ViewModel([ 'title' => "Visualisation d'une fiche métier", 'fiche' => $fiche, - 'parcours' => $parcours, + 'competences' => $competences, 'applications' => $applications, + 'parcours' => $parcours, + ]); + } + + public function ajouterAction() + { + /** @var FicheMetier $fiche */ + $fiche = new FicheMetier(); + $fiche->setEtat($this->getFicheMetierEtatService()->getEtatByCode(FicheMetierEtat::CODE_REDACTION)); + + /** @var LibelleForm $form */ + $form = $this->getLibelleForm(); + $form->setAttribute('action', $this->url()->fromRoute('fiche-metier-type/ajouter', [], [], true)); + $form->bind($fiche); + + /** @var Request $request */ + $request = $this->getRequest(); + if ($request->isPost()) { + $data = $request->getPost(); + $form->setData($data); + if ($form->isValid()) { + $this->getFicheMetierService()->create($fiche); + + $this->getConfigurationService()->addDefaultToFicheMetier($fiche); + $this->getFicheMetierService()->update($fiche); +// return $this->redirect()->toRoute('fiche-metier-type/ajouter-terminer', ['fiche' => $fiche], [], true); + } + } + + $vm = new ViewModel(); + $vm->setTemplate('application/default/default-form'); + $vm->setVariables([ + 'title' => 'Ajout d\'une fiche metier', + 'form' => $form, ]); + return $vm; } +// public function ajouterTerminerAction() { +// $fiche =$this->getFicheMetierService()->getRequestedFicheMetier($this); +// +// return new ViewModel(['fiche' => $fiche]); +// } + + public function editerAction() { $fiche = $this->getFicheMetierService()->getRequestedFicheMetier($this, 'id', false); if ($fiche === null) $fiche = $this->getFicheMetierService()->getLastFicheMetier(); $parcours = $this->getParcoursDeFormationService()->generateParcoursArrayFromFicheMetier($fiche); $applications = $this->getFicheMetierService()->getApplicationsDictionnaires($fiche); + $competences = $this->getFicheMetierService()->getCompetencesDictionnaires($fiche); return new ViewModel([ 'fiche' => $fiche, - 'parcours' => $parcours, + 'competences' => $competences, 'applications' => $applications, + 'parcours' => $parcours, ]); } @@ -126,11 +164,13 @@ class FicheMetierController extends AbstractActionController { $fiche = $this->getFicheMetierService()->getRequestedFicheMetier($this, 'id', true); $applications = $this->getFicheMetierService()->getApplicationsDictionnaires($fiche); + $parcours = $this->getParcoursDeFormationService()->getParcoursDeFormationsByType(ParcoursDeFormation::TYPE_CATEGORIE); $exporter = new FicheMetierPdfExporter($this->renderer, 'A4'); $exporter->setVars([ 'fiche' => $fiche, 'applications' => $applications, + 'parcours' => $parcours, ]); $metier = $fiche->getMetier(); @@ -197,39 +237,6 @@ class FicheMetierController extends AbstractActionController return $vm; } - public function ajouterAction() - { - /** @var FicheMetier $fiche */ - $fiche = new FicheMetier(); - $fiche->setEtat($this->getFicheMetierEtatService()->getEtatByCode(FicheMetierEtat::CODE_REDACTION)); - - /** @var LibelleForm $form */ - $form = $this->getLibelleForm(); - $form->setAttribute('action', $this->url()->fromRoute('fiche-metier-type/ajouter', [], [], true)); - $form->bind($fiche); - - /** @var Request $request */ - $request = $this->getRequest(); - if ($request->isPost()) { - $data = $request->getPost(); - $form->setData($data); - if ($form->isValid()) { - $this->getFicheMetierService()->create($fiche); - - $this->getConfigurationService()->addDefaultToFicheMetier($fiche); - $this->getFicheMetierService()->update($fiche); - } - } - - $vm = new ViewModel(); - $vm->setTemplate('application/default/default-form'); - $vm->setVariables([ - 'title' => 'Ajout d\'une fiche metier', - 'form' => $form, - ]); - return $vm; - } - public function ajouterAvecMetierAction() { $metier = $this->getMetierService()->getRequestedMetier($this); @@ -254,7 +261,7 @@ class FicheMetierController extends AbstractActionController /** @var Request $request */ $request = $this->getRequest(); if ($request->isPost()) { - $this->updateFromForm($request, $form, $this->getFicheMetierService()); + $this->getFicheMetierService()->updateFromForm($request, $form, $this->getFicheMetierService()); } $vm = new ViewModel(); @@ -461,7 +468,7 @@ class FicheMetierController extends AbstractActionController /** @var Request $request */ $request = $this->getRequest(); if ($request->isPost()) { - $this->updateFromForm($request, $form, $this->getFicheMetierService()); + $this->getFicheMetierService()->updateFromForm($request, $form, $this->getFicheMetierService()); } $vm = new ViewModel(); diff --git a/module/Application/src/Application/Controller/FichePosteController.php b/module/Application/src/Application/Controller/FichePosteController.php index a7e7d536a96ef2b98ddd94134df8b3fa7612f71c..2f81f777222c8929d5e49489624e33e99574c87c 100644 --- a/module/Application/src/Application/Controller/FichePosteController.php +++ b/module/Application/src/Application/Controller/FichePosteController.php @@ -30,7 +30,6 @@ use Application\Service\FichePoste\FichePosteServiceAwareTrait; use Application\Service\ParcoursDeFormation\ParcoursDeFormationServiceAwareTrait; use Application\Service\SpecificitePoste\SpecificitePosteServiceAwareTrait; use Application\Service\Structure\StructureServiceAwareTrait; -use DateTime; use UnicaenUtilisateur\Entity\DateTimeAwareTrait; use Zend\Http\Request; use Zend\Mvc\Controller\AbstractActionController; @@ -169,7 +168,6 @@ class FichePosteController extends AbstractActionController { ]); } - public function afficherAction() { $fiche = $this->getFichePosteService()->getRequestedFichePoste($this, 'fiche-poste'); @@ -185,12 +183,10 @@ class FichePosteController extends AbstractActionController { } $titre .= '</strong>'; - /** @var DateTime $date */ - $date = $this->getDateTime(); - $applications = $this->getFichePosteService()->getApplicationsDictionnaires($fiche, $date); - $competences = $this->getFichePosteService()->getCompetencesDictionnaires($fiche, $date); - $formations = $this->getFichePosteService()->getFormationsDictionnaires($fiche, $date); - $activites = $this->getFichePosteService()->getActivitesDictionnaires($fiche, $date); + $applications = $this->getFichePosteService()->getApplicationsDictionnaires($fiche); + $competences = $this->getFichePosteService()->getCompetencesDictionnaires($fiche); + $formations = $this->getFichePosteService()->getFormationsDictionnaires($fiche); + $activites = $this->getFichePosteService()->getActivitesDictionnaires($fiche); //parcours de formation $parcours = $this->getParcoursDeFormationService()->generateParcoursArrayFromFichePoste($fiche); @@ -211,17 +207,14 @@ class FichePosteController extends AbstractActionController { $structureId = $this->params()->fromQuery('structure'); $structure = $this->getStructureService()->getStructure($structureId); - - /** @var DateTime $date */ - $date = $this->getDateTime(); /** @var FichePoste $fiche */ $fiche = $this->getFichePosteService()->getRequestedFichePoste($this, 'fiche-poste', false); if ($fiche === null) $fiche = $this->getFichePosteService()->getLastFichePoste(); - $applications = $this->getFichePosteService()->getApplicationsDictionnaires($fiche, $date); - $competences = $this->getFichePosteService()->getCompetencesDictionnaires($fiche, $date); - $formations = $this->getFichePosteService()->getFormationsDictionnaires($fiche, $date); - $activites = $this->getFichePosteService()->getActivitesDictionnaires($fiche, $date); + $applications = $this->getFichePosteService()->getApplicationsDictionnaires($fiche); + $competences = $this->getFichePosteService()->getCompetencesDictionnaires($fiche); + $formations = $this->getFichePosteService()->getFormationsDictionnaires($fiche); + $activites = $this->getFichePosteService()->getActivitesDictionnaires($fiche); //parcours de formation $parcours = $this->getParcoursDeFormationService()->generateParcoursArrayFromFichePoste($fiche); @@ -552,7 +545,7 @@ class FichePosteController extends AbstractActionController { * @param array $data * @return ViewModel|void */ - private function checkValidite($fiche, $data) + private function checkValidite(FichePoste $fiche, array $data) { $cut = false; if ($data['est_principale'] === "1" && ((int) $data['quotite']) < 50) { @@ -575,9 +568,9 @@ class FichePosteController extends AbstractActionController { public function exportAction() { $fiche = $this->getFichePosteService()->getRequestedFichePoste($this, 'fiche-poste'); - $applications = $this->getFichePosteService()->getApplicationsDictionnaires($fiche, $this->getDateTime()); - $competences = $this->getFichePosteService()->getCompetencesDictionnaires($fiche, $this->getDateTime()); - $formations = $this->getFichePosteService()->getFormationsDictionnaires($fiche, $this->getDateTime()); + $applications = $this->getFichePosteService()->getApplicationsDictionnaires($fiche); + $competences = $this->getFichePosteService()->getCompetencesDictionnaires($fiche); + $formations = $this->getFichePosteService()->getFormationsDictionnaires($fiche); $exporter = new FichePostePdfExporter($this->renderer, 'A4'); $exporter->setVars([ @@ -596,7 +589,7 @@ class FichePosteController extends AbstractActionController { $ficheposte = $this->getFichePosteService()->getRequestedFichePoste($this, 'fiche-poste'); /** @var array $applications*/ - $applications = $this->getFichePosteService()->getApplicationsDictionnaires($ficheposte, $this->getDateTime()); + $applications = $this->getFichePosteService()->getApplicationsDictionnaires($ficheposte); /** @var Request $request */ $request = $this->getRequest(); @@ -629,7 +622,7 @@ class FichePosteController extends AbstractActionController { $ficheposte = $this->getFichePosteService()->getRequestedFichePoste($this, 'fiche-poste'); /** @var array $competences*/ - $competences = $this->getFichePosteService()->getCompetencesDictionnaires($ficheposte, $this->getDateTime()); + $competences = $this->getFichePosteService()->getCompetencesDictionnaires($ficheposte); /** @var Request $request */ $request = $this->getRequest(); diff --git a/module/Application/src/Application/Controller/IndexController.php b/module/Application/src/Application/Controller/IndexController.php index a69df47820a43a03929345ef56d2d701b47f8d89..19806d4055420e9ac2434cdb5174140bd1eb7952 100755 --- a/module/Application/src/Application/Controller/IndexController.php +++ b/module/Application/src/Application/Controller/IndexController.php @@ -54,7 +54,8 @@ class IndexController extends AbstractActionController case RoleConstant::PERSONNEL : $agent = $this->getAgentService()->getAgentByUser($connectedUser); return $this->redirect()->toRoute('agent/afficher', ['agent' => $agent->getId()], [], true); - break; + case RoleConstant::VALIDATEUR : + return $this->redirect()->toRoute('index-validateur', [], [], true); case RoleConstant::GESTIONNAIRE : $structures = $this->getStructureService()->getStructuresByGestionnaire($connectedUser); if (!empty($structures)) return $this->redirect()->toRoute('structure/afficher', ['structure' => $structures[0]->getId()], [], true); @@ -63,9 +64,6 @@ class IndexController extends AbstractActionController $structures = $this->getStructureService()->getStructuresByResponsable($connectedUser); if (!empty($structures)) return $this->redirect()->toRoute('structure/afficher', ['structure' => $structures[0]->getId()], [], true); break; - case RoleConstant::VALIDATEUR : - return $this->redirect()->toRoute('index-validateur', [], [], true); - break; } } diff --git a/module/Application/src/Application/Controller/MissionSpecifiqueAffectationController.php b/module/Application/src/Application/Controller/MissionSpecifiqueAffectationController.php index 16c8cdc66e2bad1184748b062deb04c24a1d3e4c..37221b9b1824784b1fcfc8e270d2f36d8d209b5e 100644 --- a/module/Application/src/Application/Controller/MissionSpecifiqueAffectationController.php +++ b/module/Application/src/Application/Controller/MissionSpecifiqueAffectationController.php @@ -3,6 +3,7 @@ namespace Application\Controller; use Application\Entity\Db\AgentMissionSpecifique; +use Application\Form\AgentMissionSpecifique\AgentMissionSpecifiqueForm; use Application\Form\AgentMissionSpecifique\AgentMissionSpecifiqueFormAwareTrait; use Application\Service\Agent\AgentServiceAwareTrait; use Application\Service\MissionSpecifique\MissionSpecifiqueAffectationServiceAwareTrait; @@ -23,15 +24,14 @@ class MissionSpecifiqueAffectationController extends AbstractActionController { public function indexAction() { - $agentId = $this->params()->fromQuery('agent'); + $fromQueries = $this->params()->fromQuery(); + $agentId = $fromQueries['agent']; + $structureId = $fromQueries['structure']; + $missionId = $fromQueries['mission']; $agent = $this->getAgentService()->getAgent($agentId); - $structureId = $this->params()->fromQuery('structure'); $structure = $this->getStructureService()->getStructure($structureId); - $missionId = $this->params()->fromQuery('mission'); $mission = $this->getMissionSpecifiqueService()->getMissionSpecifique($missionId); - $affectations = $this->getMissionSpecifiqueAffectationService()->getAffectations($agent, $mission, $structure); - $missions = $this->getMissionSpecifiqueService()->getMisssionsSpecifiquesAsOptions(); return new ViewModel([ @@ -44,28 +44,44 @@ class MissionSpecifiqueAffectationController extends AbstractActionController { ]); } - /** AFFECTATION ***************************************************************************************************/ + public function afficherAction() { + $affectation = $this->getMissionSpecifiqueAffectationService()->getRequestedAffectation($this); - public function ajouterAction() { + $vm = new ViewModel(); + $vm->setVariables([ + 'title' => "Affichage de l'affectation", + 'affectation' => $affectation, + ]); + return $vm; + } + public function ajouterAction() + { $structureId = $this->params()->fromQuery('structure'); $structure = $this->getStructureService()->getStructure($structureId); + $agentId = $this->params()->fromQuery('agent'); + $agent = $this->getAgentService()->getAgent($agentId); $affectation = new AgentMissionSpecifique(); + /** @var AgentMissionSpecifiqueForm $form */ $form = $this->getAgentMissionSpecifiqueForm(); - if ($structure) var_dump($structure->getId()); else var_dump(null); + /** @var SearchAndSelect $agentSS */ + $agentSS = $form->get('agent'); + if ($structure === null) { $form->setAttribute('action', $this->url()->fromRoute('mission-specifique/affectation/ajouter', [], [], true)); } else { $form->setAttribute('action', $this->url()->fromRoute('mission-specifique/affectation/ajouter', [], ["query" =>["structure" => $structure->getId()]], true)); - /** @var SearchAndSelect $agentSS */ - $agentSS = $form->get('agent'); - /** @see AgentController::rechercherWithStructureMereAction() */ - $agentSS->setAutocompleteSource($this->url()->fromRoute('agent/rechercher-with-structure-mere', ['structure' => $structure->getId()], [], true)); /** @var SearchAndSelect $structureSS */ $structureSS = $form->get('structure'); /** @see StructureController::rechercherWithStructureMereAction() */ $structureSS->setAutocompleteSource($this->url()->fromRoute('structure/rechercher-with-structure-mere', ['structure' => $structure->getId()], [], true)); + /** @see AgentController::rechercherWithStructureMereAction() */ + $agentSS->setAutocompleteSource($this->url()->fromRoute('agent/rechercher-with-structure-mere', ['structure' => $structure->getId()], [], true)); + } + if ($agent !== null) { + $affectation->setAgent($agent); + $agentSS->setAttribute('readonly', true); } $form->bind($affectation); @@ -88,30 +104,21 @@ class MissionSpecifiqueAffectationController extends AbstractActionController { return $vm; } - public function afficherAction() { - $affectation = $this->getMissionSpecifiqueAffectationService()->getRequestedAffectation($this); - - $vm = new ViewModel(); - $vm->setVariables([ - 'title' => "Affichage de l'affectation", - 'affectation' => $affectation, - ]); - return $vm; - } - public function modifierAction() { $structureId = $this->params()->fromQuery('structure'); $structure = $this->getStructureService()->getStructure($structureId); + $agentId = $this->params()->fromQuery('agent'); + $agent = $this->getAgentService()->getAgent($agentId); $affectation = $this->getMissionSpecifiqueAffectationService()->getRequestedAffectation($this); $form = $this->getAgentMissionSpecifiqueForm(); + /** @var SearchAndSelect $agentSS */ + $agentSS = $form->get('agent'); if ($structure === null) { $form->setAttribute('action', $this->url()->fromRoute('mission-specifique/affectation/modifier', [], [], true)); } else { $form->setAttribute('action', $this->url()->fromRoute('mission-specifique/affectation/modifier', [], ["query" =>["structure" => $structure->getId()]], true)); - /** @var SearchAndSelect $agentSS */ - $agentSS = $form->get('agent'); /** @see AgentController::rechercherWithStructureMereAction() */ $agentSS->setAutocompleteSource($this->url()->fromRoute('agent/rechercher-with-structure-mere', ['structure' => $structure->getId()], [], true)); /** @var SearchAndSelect $structureSS */ @@ -119,6 +126,10 @@ class MissionSpecifiqueAffectationController extends AbstractActionController { /** @see StructureController::rechercherWithStructureMereAction() */ $structureSS->setAutocompleteSource($this->url()->fromRoute('structure/rechercher-with-structure-mere', ['structure' => $structure->getId()], [], true)); } + if ($agent !== null) { + $affectation->setAgent($agent); + $agentSS->setAttribute('readonly', true); + } $form->bind($affectation); /** @var Request $request */ @@ -161,10 +172,6 @@ class MissionSpecifiqueAffectationController extends AbstractActionController { public function detruireAction() { $affectation = $this->getMissionSpecifiqueAffectationService()->getRequestedAffectation($this); - $structureId = $this->params()->fromQuery('structure'); - $structure = $this->getStructureService()->getStructure($structureId); - $params = []; - if ($structure !== null) $params["structure"] = $structure->getId(); /** @var Request $request */ $request = $this->getRequest(); @@ -180,7 +187,7 @@ class MissionSpecifiqueAffectationController extends AbstractActionController { $vm->setVariables([ 'title' => "Suppression de l'affectation de " . $affectation->getAgent()->getDenomination(), 'text' => "La suppression est définitive êtes-vous sûr·e de vouloir continuer ?", - 'action' => $this->url()->fromRoute('mission-specifique/affectation/detruire', ["affectation" => $affectation->getId()], ["query" => $params], true), + 'action' => $this->url()->fromRoute('mission-specifique/affectation/detruire', ["affectation" => $affectation->getId()], [], true), ]); } return $vm; diff --git a/module/Application/src/Application/Controller/MissionSpecifiqueAffectationControllerFactory.php b/module/Application/src/Application/Controller/MissionSpecifiqueAffectationControllerFactory.php index 15a32f86fd1ee472838788ad0ac90a2193154e88..411740568328348602da1d9c92e33fb51f955cae 100644 --- a/module/Application/src/Application/Controller/MissionSpecifiqueAffectationControllerFactory.php +++ b/module/Application/src/Application/Controller/MissionSpecifiqueAffectationControllerFactory.php @@ -4,7 +4,6 @@ namespace Application\Controller; use Application\Form\AgentMissionSpecifique\AgentMissionSpecifiqueForm; use Application\Service\Agent\AgentService; -use Application\Service\Agent\AgentServiceAwareTrait; use Application\Service\MissionSpecifique\MissionSpecifiqueAffectationService; use Application\Service\MissionSpecifique\MissionSpecifiqueService; use Application\Service\Structure\StructureService; @@ -19,7 +18,7 @@ class MissionSpecifiqueAffectationControllerFactory { public function __invoke(ContainerInterface $container) { /** - * @var AgentServiceAwareTrait $agentService + * @var AgentService $agentService * @var MissionSpecifiqueService $missionSpecifiqueService * @var StructureService $structureService * @var MissionSpecifiqueAffectationService $missionSpecifiqueAffectationService diff --git a/module/Application/src/Application/Controller/StructureController.php b/module/Application/src/Application/Controller/StructureController.php index a099feb5a5df9a0499776b286eb765a973217e48..d5a59c45b5377ffc76f9ecf3511085f9a88d8565 100644 --- a/module/Application/src/Application/Controller/StructureController.php +++ b/module/Application/src/Application/Controller/StructureController.php @@ -260,7 +260,6 @@ class StructureController extends AbstractActionController { $this->getUserService()->removeRole($responsable, $role); } - return $this->redirect()->toRoute('structure/afficher', ['structure' => $structure->getId()], [], true); } @@ -276,6 +275,7 @@ class StructureController extends AbstractActionController { } /** Fonctions de recherche ****************************************************************************************/ + public function rechercherAction() { if (($term = $this->params()->fromQuery('term'))) { @@ -329,7 +329,7 @@ class StructureController extends AbstractActionController { * @param Structure[] $structures * @return array */ - private function formatStructureJSON($structures) + private function formatStructureJSON(array $structures) { $result = []; foreach ($structures as $structure) { @@ -349,7 +349,7 @@ class StructureController extends AbstractActionController { * @param User[] $users * @return array */ - private function formatUtilisateurJSON($users) + private function formatUtilisateurJSON(array $users) { $result = []; foreach ($users as $user) { diff --git a/module/Application/src/Application/Entity/Db/Agent.php b/module/Application/src/Application/Entity/Db/Agent.php index 08650c3ca28fb5db1e7614bdf993e5f28fd2093c..8104e89e17926a185b4a97b0a8956ea2eefe1c9b 100644 --- a/module/Application/src/Application/Entity/Db/Agent.php +++ b/module/Application/src/Application/Entity/Db/Agent.php @@ -3,6 +3,7 @@ namespace Application\Entity\Db; use Application\Service\Agent\AgentServiceAwareTrait; +use DateTime; use Doctrine\Common\Collections\ArrayCollection; use Fichier\Entity\Db\Fichier; use Formation\Entity\Db\Formation; @@ -32,9 +33,11 @@ class Agent implements ResourceInterface private $utilisateur; /** @var int */ private $harpId; - /** @var int */ - private $quotite; + /** @var DateTime */ + private $delete; + /** @var ArrayCollection (AgentQuotite) */ + private $quotites; /** @var ArrayCollection (AgentAffectation) */ private $affectations; /** @var ArrayCollection (AgentGrade) */ @@ -137,7 +140,7 @@ class Agent implements ResourceInterface $affectations = []; /** @var AgentAffectation $affectation */ foreach ($this->affectations as $affectation) { - if ($affectation->isActive()) $affectations[] = $affectation; + if ($affectation->isActive($date)) $affectations[] = $affectation; } return $affectations; } @@ -212,24 +215,6 @@ class Agent implements ResourceInterface return $this; } - /** - * @return int - */ - public function getQuotite() - { - return $this->quotite; - } - - /** - * @param int $quotite - * @return Agent - */ - public function setQuotite($quotite) - { - $this->quotite = $quotite; - return $this; - } - /** * @return FichePoste[] */ @@ -238,16 +223,6 @@ class Agent implements ResourceInterface return $this->fiches->toArray(); } - /** - * @param FichePoste $fiche - * @return Agent - */ - public function setFiche($fiche) - { - $this->fiche = $fiche; - return $this; - } - /** * @return Fichier[] */ @@ -260,7 +235,7 @@ class Agent implements ResourceInterface * @param Fichier $fichier * @return Agent */ - public function addFichier($fichier) + public function addFichier(Fichier $fichier) { $this->fichiers->add($fichier); return $this; @@ -270,7 +245,7 @@ class Agent implements ResourceInterface * @param Fichier $fichier * @return Agent */ - public function removeFichier($fichier) + public function removeFichier(Fichier $fichier) { $this->fichiers->removeElement($fichier); return $this; @@ -280,7 +255,7 @@ class Agent implements ResourceInterface * @param string $nature * @return Fichier[] */ - public function fetchFiles($nature) + public function fetchFiles(string $nature) { $fichiers = $this->getFichiers(); $fichiers = array_filter($fichiers, function (Fichier $f) use ($nature) { @@ -454,6 +429,29 @@ class Agent implements ResourceInterface if ($level !== null and $level <= $niveau) $niveau = $level; } return ($niveau !== 999)?$niveau:null; + } + /** QUOTITES *****************************************************************************************/ + + /** + * @return AgentQuotite[] + */ + public function getQuotites() { + $quotites = $this->quotites->toArray(); + array_filter($quotites, function (AgentQuotite $q) { return $q->getImportationHistorisation(); }); + usort($quotites, function(AgentQuotite $a, AgentQuotite $b) { return $a->getDebut() > $b->getDebut();}); + return $quotites; + } + + /** + * @param DateTime|null $date + * @return AgentQuotite|null + */ + public function getQuotiteCourante(?DateTime $date = null) { + /** @var AgentQuotite $quotite */ + foreach ($this->quotites as $quotite) { + if ($quotite->isEnCours($date)) return $quotite; + } + return null; } } \ No newline at end of file diff --git a/module/Application/src/Application/Entity/Db/AgentQuotite.php b/module/Application/src/Application/Entity/Db/AgentQuotite.php new file mode 100644 index 0000000000000000000000000000000000000000..c62113214ea98066480d0834a2ac080e48479bc1 --- /dev/null +++ b/module/Application/src/Application/Entity/Db/AgentQuotite.php @@ -0,0 +1,111 @@ +<?php + +namespace Application\Entity\Db; + +use DateTime; +use UnicaenUtilisateur\Entity\DateTimeAwareTrait; + +class AgentQuotite +{ + use ImportableAwareTrait; + use DateTimeAwareTrait; + + /** @var int */ + private $id; + /** @var Agent */ + private $agent; + /** @var DateTime */ + private $debut; + /** @var DateTime */ + private $fin; + /** @var integer */ + private $quotite; + + /** + * @return int + */ + public function getId(): int + { + return $this->id; + } + + /** + * @return Agent + */ + public function getAgent(): Agent + { + return $this->agent; + } + + /** + * @param Agent $agent + * @return AgentQuotite + */ + public function setAgent(Agent $agent): AgentQuotite + { + $this->agent = $agent; + return $this; + } + + /** + * @return DateTime|null + */ + public function getDebut(): ?DateTime + { + return $this->debut; + } + + /** + * @param DateTime|null $debut + * @return AgentQuotite + */ + public function setDebut(?DateTime $debut): AgentQuotite + { + $this->debut = $debut; + return $this; + } + + /** + * @return DateTime|null + */ + public function getFin(): ?DateTime + { + return $this->fin; + } + + /** + * @param DateTime|null $fin + * @return AgentQuotite + */ + public function setFin(?DateTime $fin): AgentQuotite + { + $this->fin = $fin; + return $this; + } + + /** + * @return int|null + */ + public function getQuotite(): ?int + { + return $this->quotite; + } + + /** + * @param int $quotite + * @return AgentQuotite + */ + public function setQuotite(int $quotite): AgentQuotite + { + $this->quotite = $quotite; + return $this; + } + + public function isEnCours(?DateTime $date = null) + { + $date = $date ? : $this->getDateTime(); + if ($date < $this->getDebut()) return false; + if ($this->getFin() !== null and $date > $this->getFin()) return false; + return true; + } +} \ No newline at end of file diff --git a/module/Application/src/Application/Entity/Db/Corps.php b/module/Application/src/Application/Entity/Db/Corps.php index 7b6f554c68b9e7d1baf5cdec45c9d3f5f6f87dcf..d4676feb01b40e9f3f91de19f5aec1cea458a629 100644 --- a/module/Application/src/Application/Entity/Db/Corps.php +++ b/module/Application/src/Application/Entity/Db/Corps.php @@ -3,6 +3,7 @@ namespace Application\Entity\Db; use DateTime; +use Doctrine\Common\Collections\ArrayCollection; class Corps { @@ -23,6 +24,9 @@ class Corps /** @var integer */ private $niveau; + /** @var ArrayCollection (AgentGrade) */ + private $agentGrades; + /** * @return int */ @@ -149,10 +153,31 @@ class Corps return $this; } + /** + * @return AgentGrade[] + */ + public function getAgentGrades() + { + return $this->agentGrades->toArray(); + } + public function __toString() { return $this->getLibelleCourt(); } + /** + * @return string + */ + public function generateTooltip() + { + $text = ""; + $text .= "Libelle court : <strong>". $this->getLibelleCourt() . "</strong>"; + $text .= "<br/>"; + $text .= "Libelle long : <strong>". $this->getLibelleLong() . "</strong>"; + $text .= "<br/>"; + $text .= "Code : <strong>". $this->getCode() . "</strong>"; + return $text; + } } \ No newline at end of file diff --git a/module/Application/src/Application/Entity/Db/Correspondance.php b/module/Application/src/Application/Entity/Db/Correspondance.php index cb15d24df64ec320bf185a65fcfacdc419f9113e..91c37a87c708fac8522a0cd1cd41eddcf9c1cc14 100644 --- a/module/Application/src/Application/Entity/Db/Correspondance.php +++ b/module/Application/src/Application/Entity/Db/Correspondance.php @@ -3,6 +3,7 @@ namespace Application\Entity\Db; use DateTime; +use Doctrine\Common\Collections\ArrayCollection; class Correspondance { use ImportableAwareTrait; @@ -17,6 +18,8 @@ class Correspondance { private $libelleLong; /** @var DateTime */ private $histo; + /** @var ArrayCollection (AgentGrade) */ + private $agentGrades; /** * @return int @@ -117,6 +120,14 @@ class Correspondance { return $this; } + /** + * @return AgentGrade[] + */ + public function getAgentGrades() + { + return $this->agentGrades->toArray(); + } + /** * @return string */ @@ -125,5 +136,16 @@ class Correspondance { return $this->getLibelleCourt(); } + /** + * @return string + */ + public function generateTooltip() + { + $text = ""; + $text .= "Libelle court : <strong>". $this->getLibelleCourt() . "</strong>"; + $text .= "<br/>"; + $text .= "Libelle long : <strong>". $this->getLibelleLong() . "</strong>"; + return $text; + } } \ No newline at end of file diff --git a/module/Application/src/Application/Entity/Db/EntretienProfessionnel.php b/module/Application/src/Application/Entity/Db/EntretienProfessionnel.php index 4a3c74fa2ffebd2c494d27f9a43fe2d078ba71d9..c3e6e1a5a5610064c16e60cba69ea281a89b36ca 100644 --- a/module/Application/src/Application/Entity/Db/EntretienProfessionnel.php +++ b/module/Application/src/Application/Entity/Db/EntretienProfessionnel.php @@ -237,7 +237,7 @@ class EntretienProfessionnel implements HistoriqueAwareInterface, ResourceInterf * @param EntretienProfessionnelObservation[] $observations * @return EntretienProfessionnel */ - public function setObservations($observations) + public function setObservations(array $observations) { $this->observations->clear(); foreach ($observations as $observation) $this->addObservation($observation); @@ -274,7 +274,7 @@ class EntretienProfessionnel implements HistoriqueAwareInterface, ResourceInterf * @param ValidationInstance $validationAgent * @return EntretienProfessionnel */ - public function setValidationAgent($validationAgent) + public function setValidationAgent(ValidationInstance $validationAgent) { $this->validationAgent = $validationAgent; return $this; @@ -299,7 +299,7 @@ class EntretienProfessionnel implements HistoriqueAwareInterface, ResourceInterf * @param ValidationInstance $validationResponsable * @return EntretienProfessionnel */ - public function setValidationResponsable($validationResponsable) + public function setValidationResponsable(ValidationInstance $validationResponsable) { $this->validationResponsable = $validationResponsable; return $this; @@ -323,7 +323,7 @@ class EntretienProfessionnel implements HistoriqueAwareInterface, ResourceInterf /** * @param ValidationInstance $validationDRH */ - public function setValidationDRH($validationDRH) + public function setValidationDRH(ValidationInstance $validationDRH) { $this->validationDRH = $validationDRH; } @@ -344,10 +344,10 @@ class EntretienProfessionnel implements HistoriqueAwareInterface, ResourceInterf } /** - * @param string $token + * @param string|null $token * @return EntretienProfessionnel */ - public function setToken($token) + public function setToken(?string $token) { $this->token = $token; return $this; @@ -365,7 +365,7 @@ class EntretienProfessionnel implements HistoriqueAwareInterface, ResourceInterf * @param DateTime|null $acceptation * @return EntretienProfessionnel */ - public function setAcceptation($acceptation) + public function setAcceptation(?DateTime $acceptation) { $this->acceptation = $acceptation; return $this; diff --git a/module/Application/src/Application/Entity/Db/FicheMetier.php b/module/Application/src/Application/Entity/Db/FicheMetier.php index 3ce5ead0518970a417a4457accb1b4ba7df74563..a6984db519b764f5069b5141f782a05a396bc3a2 100644 --- a/module/Application/src/Application/Entity/Db/FicheMetier.php +++ b/module/Application/src/Application/Entity/Db/FicheMetier.php @@ -27,8 +27,6 @@ class FicheMetier implements HistoriqueAwareInterface { /** @var ArrayCollection */ private $formations; - - public function __construct() { $this->activites = new ArrayCollection(); @@ -37,7 +35,6 @@ class FicheMetier implements HistoriqueAwareInterface { $this->formations = new ArrayCollection(); } - /** * @return int */ @@ -55,10 +52,10 @@ class FicheMetier implements HistoriqueAwareInterface { } /** - * @param Metier $metier + * @param Metier|null $metier * @return FicheMetier */ - public function setMetier($metier) + public function setMetier(?Metier $metier) { $this->metier = $metier; return $this; @@ -89,9 +86,9 @@ class FicheMetier implements HistoriqueAwareInterface { } /** - * @param FicheMetierEtat $etat + * @param FicheMetierEtat|null $etat */ - public function setEtat($etat) + public function setEtat(?FicheMetierEtat $etat) { $this->etat = $etat; } @@ -102,7 +99,6 @@ class FicheMetier implements HistoriqueAwareInterface { public function getMissionsPrincipales() { $texte = '<ul>'; - //return $this->missionsPrincipales; $activites = $this->getActivites(); usort($activites, function (FicheMetierTypeActivite $a, FicheMetierTypeActivite $b) {return $a->getPosition() > $b->getPosition();}); foreach ($activites as $activite) { @@ -115,18 +111,21 @@ class FicheMetier implements HistoriqueAwareInterface { /** ACTIVITE ******************************************************************************************************/ /** + * Pour simplifier le tri selon la position est fait à ce niveau * @return FicheMetierTypeActivite[] */ public function getActivites() { - return $this->activites->toArray(); + $activites = $this->activites->toArray(); + usort($activites, function (FicheMetierTypeActivite $a, FicheMetierTypeActivite $b) { return $a->getPosition() > $b->getPosition();}); + return $activites; } /** * @param FicheMetierTypeActivite $activite * @return FicheMetier */ - public function addActivite($activite) + public function addActivite(FicheMetierTypeActivite $activite) { $this->activites->add($activite); return $this; @@ -136,7 +135,7 @@ class FicheMetier implements HistoriqueAwareInterface { * @param FicheMetierTypeActivite $activite * @return FicheMetier */ - public function removeActivite($activite) + public function removeActivite(FicheMetierTypeActivite $activite) { $this->activites->removeElement($activite); return $this; @@ -156,7 +155,7 @@ class FicheMetier implements HistoriqueAwareInterface { * @param Application $application * @return bool */ - public function hadApplication($application) + public function hadApplication(Application $application) { return $this->applications->contains($application); } @@ -165,7 +164,7 @@ class FicheMetier implements HistoriqueAwareInterface { * @param Application $application * @return FicheMetier */ - public function addApplication($application) + public function addApplication(Application $application) { $this->applications->add($application); return $this; @@ -175,7 +174,7 @@ class FicheMetier implements HistoriqueAwareInterface { * @param Application $application * @return FicheMetier */ - public function removeApplication($application) + public function removeApplication(Application $application) { $this->applications->removeElement($application); return $this; @@ -189,6 +188,7 @@ class FicheMetier implements HistoriqueAwareInterface { $this->applications->clear(); return $this; } + /** COMPETENCE ****************************************************************************************************/ /** @@ -203,7 +203,7 @@ class FicheMetier implements HistoriqueAwareInterface { * @param Competence $competence * @return FicheMetier */ - public function addCompetence($competence) + public function addCompetence(Competence $competence) { $this->competences->add($competence); return $this; @@ -213,7 +213,7 @@ class FicheMetier implements HistoriqueAwareInterface { * @param Competence $competence * @return FicheMetier */ - public function removeCompetence($competence) + public function removeCompetence(Competence $competence) { $this->competences->removeElement($competence); return $this; @@ -223,7 +223,7 @@ class FicheMetier implements HistoriqueAwareInterface { * @param Competence $competence * @return boolean */ - public function hasCompetence($competence) + public function hasCompetence(Competence $competence) { return $this->competences->contains($competence); } @@ -251,7 +251,7 @@ class FicheMetier implements HistoriqueAwareInterface { * @param Formation $formation * @return FicheMetier */ - public function addFormation($formation) + public function addFormation(Formation $formation) { $this->formations->add($formation); return $this; @@ -261,7 +261,7 @@ class FicheMetier implements HistoriqueAwareInterface { * @param Formation $formation * @return FicheMetier */ - public function removeFormation($formation) + public function removeFormation(Formation $formation) { $this->formations->removeElement($formation); return $this; @@ -271,7 +271,7 @@ class FicheMetier implements HistoriqueAwareInterface { * @param Formation $formation * @return boolean */ - public function hasFormation($formation) + public function hasFormation(Formation $formation) { return $this->formations->contains($formation); } @@ -281,5 +281,15 @@ class FicheMetier implements HistoriqueAwareInterface { $this->formations->clear(); } + /** FONCTION POUR MACRO *******************************************************************************************/ + + /** + * @return string + */ + public function getIntitule() { + $metier = $this->getMetier(); + if ($metier === null) return "Aucun métier est associé."; + return $metier->getLibelle(); + } } \ No newline at end of file diff --git a/module/Application/src/Application/Entity/Db/Grade.php b/module/Application/src/Application/Entity/Db/Grade.php index 0222775b20c1ec332fadd5ae95ec3789afc074f4..f0977d22e3481ec38e245a9b6d1db429975558e9 100644 --- a/module/Application/src/Application/Entity/Db/Grade.php +++ b/module/Application/src/Application/Entity/Db/Grade.php @@ -2,9 +2,8 @@ namespace Application\Entity\Db; -use Application\Entity\SynchroAwareInterface; -use Application\Entity\SynchroAwareTrait; use DateTime; +use Doctrine\Common\Collections\ArrayCollection; class Grade { use ImportableAwareTrait; @@ -19,6 +18,8 @@ class Grade { private $code; /** @var DateTime */ private $histo; + /** @var ArrayCollection (AgentGrade) */ + private $agentGrades; /** * @return string @@ -100,8 +101,30 @@ class Grade { return $this; } + /** + * @return AgentGrade[] + */ + public function getAgentGrades() + { + return $this->agentGrades->toArray(); + } + public function __toString() { return $this->getLibelleCourt(); } + + /** + * @return string + */ + public function generateTooltip() + { + $text = ""; + $text .= "Libelle court : <strong>". $this->getLibelleCourt() . "</strong>"; + $text .= "<br/>"; + $text .= "Libelle long : <strong>". $this->getLibelleLong() . "</strong>"; + $text .= "<br/>"; + $text .= "Code : <strong>". $this->getCode() . "</strong>"; + return $text; + } } \ No newline at end of file diff --git a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Agent.dcm.xml b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Agent.dcm.xml index 8b6e4eeace232d999b5dc288a2b63159dda9e9c7..cfa6c122aabdf34fd0ac1eadf296465a0f3658de 100644 --- a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Agent.dcm.xml +++ b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Agent.dcm.xml @@ -9,18 +9,16 @@ <field name="nomUsuel" column="nom_usage" type="string" length="64" /> <field name="harpId" column="harp_id" type="integer" /> + <one-to-many target-entity="Application\Entity\Db\AgentQuotite" mapped-by="agent" field="quotites"/> <one-to-many target-entity="Application\Entity\Db\AgentAffectation" mapped-by="agent" field="affectations"/> <one-to-many target-entity="Application\Entity\Db\AgentGrade" mapped-by="agent" field="grades"/> <one-to-many target-entity="Application\Entity\Db\AgentStatut" mapped-by="agent" field="statuts"/> - <field name="quotite" column="quotite" type="integer" /> - <one-to-one target-entity="UnicaenUtilisateur\Entity\Db\User" field="utilisateur"> <join-column name="utilisateur_id" referenced-column-name="id" /> </one-to-one> <one-to-many target-entity="Application\Entity\Db\FichePoste" mapped-by="agent" field="fiches" /> - <one-to-many target-entity="Application\Entity\Db\AgentMissionSpecifique" mapped-by="agent" field="missionsSpecifiques"/> <one-to-many target-entity="Application\Entity\Db\AgentApplication" mapped-by="agent" field="applications"/> <one-to-many target-entity="Application\Entity\Db\AgentCompetence" mapped-by="agent" field="competences"/> @@ -38,5 +36,6 @@ </join-table> </many-to-many> + <field name="delete" column="deleted_on" type="datetime" /> </entity> </doctrine-mapping> diff --git a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.AgentQuotite.dcm.xml b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.AgentQuotite.dcm.xml new file mode 100644 index 0000000000000000000000000000000000000000..97b3eb01ad1334ea6e940dd32f17ca6d74a08ab3 --- /dev/null +++ b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.AgentQuotite.dcm.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> + <entity name="Application\Entity\Db\AgentQuotite" table="agent_quotite"> + + <id name="id" type="string" column="id" /> + + <many-to-one target-entity="Application\Entity\Db\Agent" field="agent"> + <join-column name="agent_id" referenced-column-name="c_individu"/> + </many-to-one> + + <field name="debut" type="datetime" column="debut" nullable="false"/> + <field name="fin" type="datetime" column="fin" nullable="false"/> + <field name="quotite" type="integer" column="quotite" nullable="false"/> + + <!-- DB - IMPORT ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> + <field name="importationCreation" type="datetime" column="created_on" nullable="false"/> + <field name="importationModification" type="datetime" column="updated_on" nullable="false"/> + <field name="importationHistorisation" type="datetime" column="deleted_on" nullable="false"/> + + </entity> +</doctrine-mapping> diff --git a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Corps.dcm.xml b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Corps.dcm.xml index c25aecf9bfa5973e5c3cbc69744491adc08457ea..555721681b7e3545dde7b3939a06cac1195ca4a3 100644 --- a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Corps.dcm.xml +++ b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Corps.dcm.xml @@ -12,5 +12,6 @@ <field name="niveau" column="niveau" type="integer" /> <field name="histo" column="histo" type="datetime" /> + <one-to-many field="agentGrades" target-entity="Application\Entity\Db\AgentGrade" mapped-by="corps"/> </entity> </doctrine-mapping> diff --git a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Correspondance.dcm.xml b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Correspondance.dcm.xml index f334d4a0a0dcb4f1af6f225cc1dcb3cef9295ef4..5face049519b000540410be219c7e7e571a54e4a 100644 --- a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Correspondance.dcm.xml +++ b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Correspondance.dcm.xml @@ -10,5 +10,7 @@ <field name="libelleLong" column="lib_long" type="string" length="200" /> <field name="histo" type="datetime" column="histo"/> + <one-to-many field="agentGrades" target-entity="Application\Entity\Db\AgentGrade" mapped-by="bap"/> + </entity> </doctrine-mapping> diff --git a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.FicheMetierTypeActivite.dcm.xml b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.FicheMetierTypeActivite.dcm.xml index 3c7c623070890fc1a8296d4f2aeac341b7b8ef32..12aa3e2a868e043c44a5f64edc9c0a7fcc64e033 100644 --- a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.FicheMetierTypeActivite.dcm.xml +++ b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.FicheMetierTypeActivite.dcm.xml @@ -8,13 +8,13 @@ <field name="position" column="position" type="integer" nullable="false" /> - <many-to-one target-entity="Application\Entity\Db\FicheMetier" field="fiche"> + <one-to-one target-entity="Application\Entity\Db\FicheMetier" field="fiche"> <join-column name="fiche" referenced-column-name="id" /> - </many-to-one> + </one-to-one> - <many-to-one target-entity="Application\Entity\Db\Activite" field="activite"> + <one-to-one target-entity="Application\Entity\Db\Activite" field="activite"> <join-column name="activite" referenced-column-name="id" /> - </many-to-one> + </one-to-one> </entity> </doctrine-mapping> diff --git a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Grade.dcm.xml b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Grade.dcm.xml index 3877b7bc7232d3b6f47eb1d71558e591db31fe8f..0c166873ca66a8c27af505df970e96af72167b23 100644 --- a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Grade.dcm.xml +++ b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Grade.dcm.xml @@ -10,5 +10,6 @@ <field name="code" column="code" type="string" length="10" /> <field name="histo" column="histo" type="datetime" /> + <one-to-many field="agentGrades" target-entity="Application\Entity\Db\AgentGrade" mapped-by="grade"/> </entity> </doctrine-mapping> diff --git a/module/Application/src/Application/Form/Agent/AgentForm.php b/module/Application/src/Application/Form/Agent/AgentForm.php deleted file mode 100644 index b60fc45b2817e1954ed5276818e006666b920222..0000000000000000000000000000000000000000 --- a/module/Application/src/Application/Form/Agent/AgentForm.php +++ /dev/null @@ -1,56 +0,0 @@ -<?php - -namespace Application\Form\Agent; - -use Zend\Form\Element\Button; -use Zend\Form\Element\Select; -use Zend\Form\Form; - -class AgentForm extends Form { - - public function init() - { - //Quotité - $this->add([ - 'type' => Select::class, - 'name' => 'quotite', - 'options' => [ - 'label' => 'Quotité travaillée* :', - 'empty_option' => "Sélectionner une quotité ...", - 'value_options' => [ - 20 => ' 20 %', - 30 => ' 30 %', - 40 => ' 40 %', - 50 => ' 50 %', - 60 => ' 60 %', - 70 => ' 70 %', - 80 => ' 80 %', - 90 => ' 90 %', - 100 => '100 %', - ], - ], - 'attributes' => [ - 'id' => 'quotite', - 'class' => 'bootstrap-selectpicker show-tick', - 'data-live-search' => 'true', - ], - ]); - - //Bouton - $this->add([ - 'type' => Button::class, - 'name' => 'creer', - 'options' => [ - 'label' => '<i class="fas fa-save"></i> Enregistrer', - 'label_options' => [ - 'disable_html_escape' => true, - ], - ], - 'attributes' => [ - 'type' => 'submit', - 'class' => 'btn btn-primary', - ], - ]); - - } -} \ No newline at end of file diff --git a/module/Application/src/Application/Form/Agent/AgentFormAwareTrait.php b/module/Application/src/Application/Form/Agent/AgentFormAwareTrait.php deleted file mode 100644 index b058114ae0d7527530ad9c28e646eecf3933e187..0000000000000000000000000000000000000000 --- a/module/Application/src/Application/Form/Agent/AgentFormAwareTrait.php +++ /dev/null @@ -1,29 +0,0 @@ -<?php - -namespace Application\Form\Agent; - -trait AgentFormAwareTrait { - - /** @var AgentForm */ - private $agentForm; - - /** - * @return AgentForm - */ - public function getAgentForm() - { - return $this->agentForm; - } - - /** - * @param AgentForm $agentForm - * @return AgentForm - */ - public function setAgentForm($agentForm) - { - $this->agentForm = $agentForm; - return $this->agentForm; - } - - -} \ No newline at end of file diff --git a/module/Application/src/Application/Form/Agent/AgentFormFactory.php b/module/Application/src/Application/Form/Agent/AgentFormFactory.php deleted file mode 100644 index 56d507a24a043c0c580a6699d8bfd45034faf9af..0000000000000000000000000000000000000000 --- a/module/Application/src/Application/Form/Agent/AgentFormFactory.php +++ /dev/null @@ -1,21 +0,0 @@ -<?php - -namespace Application\Form\Agent; - -use Interop\Container\ContainerInterface; - - -class AgentFormFactory { - - public function __invoke(ContainerInterface $container) - { - /** @var AgentHydrator $hydrator */ - $hydrator = $container->get('HydratorManager')->get(AgentHydrator::class); - - /** @var AgentForm $form */ - $form = new AgentForm(); - $form->setHydrator($hydrator); - $form->init(); - return $form; - } -} \ No newline at end of file diff --git a/module/Application/src/Application/Form/Agent/AgentHydrator.php b/module/Application/src/Application/Form/Agent/AgentHydrator.php deleted file mode 100644 index 69259ebe5ed36a07a21f9614cde33706799e4163..0000000000000000000000000000000000000000 --- a/module/Application/src/Application/Form/Agent/AgentHydrator.php +++ /dev/null @@ -1,33 +0,0 @@ -<?php - -namespace Application\Form\Agent; - -use Application\Entity\Db\Agent; -use Zend\Hydrator\HydratorInterface; - -class AgentHydrator implements HydratorInterface { - - /** - * @param Agent $object - * @return array - */ - public function extract($object) - { - $data = [ - 'quotite' => $object->getQuotite(), - ]; - return $data; - } - - /** - * @param array $data - * @param Agent $object - * @return Agent - */ - public function hydrate(array $data, $object) - { - $object->setQuotite($data['quotite']); - return $object; - } - -} \ No newline at end of file diff --git a/module/Application/src/Application/Form/Agent/AgentHydratorFactory.php b/module/Application/src/Application/Form/Agent/AgentHydratorFactory.php deleted file mode 100644 index 6a1ec3f12437fe0f41d058a42bfe0b5cc0985ba1..0000000000000000000000000000000000000000 --- a/module/Application/src/Application/Form/Agent/AgentHydratorFactory.php +++ /dev/null @@ -1,17 +0,0 @@ -<?php - -namespace Application\Form\Agent; - -use Interop\Container\ContainerInterface; - -class AgentHydratorFactory { - - public function __invoke(ContainerInterface $container) { - - /** @var AgentHydrator $hydrator */ - $hydrator = new AgentHydrator; - return $hydrator; - } - - -} \ No newline at end of file diff --git a/module/Application/src/Application/Form/EntretienProfessionnel/EntretienProfessionnelHydrator.php b/module/Application/src/Application/Form/EntretienProfessionnel/EntretienProfessionnelHydrator.php index 8c26a5d61a4263afadc182573fbc39d6f35a9d74..f8e02e60981b3c0e13a779dac4dbb9fd8708e633 100644 --- a/module/Application/src/Application/Form/EntretienProfessionnel/EntretienProfessionnelHydrator.php +++ b/module/Application/src/Application/Form/EntretienProfessionnel/EntretienProfessionnelHydrator.php @@ -45,7 +45,7 @@ class EntretienProfessionnelHydrator implements HydratorInterface { $date = ($date_day !== null AND $date_time !== null)?DateTime::createFromFormat("d/m/Y H:i", $date_day." ".$date_time):null; $campagne = $this->getEntretienProfessionnelCampagneService()->getEntretienProfessionnelCampagne($data['campagne']); - $lieu = (isset($data['lieu']) AND trim($data['lieu']) !== "")?trim($data['lieu']):null; + $lieu = (isset($data['lieu_entretien']) AND trim($data['lieu_entretien']) !== "")?trim($data['lieu_entretien']):null; $object->setResponsable($reponsable); $object->setAgent($agent); diff --git a/module/Application/src/Application/Service/Agent/AgentService.php b/module/Application/src/Application/Service/Agent/AgentService.php index a9820859b0fe15368c220a94633397a65f5396ed..7508fae618b4bbc55175702bc04def7e034fc3c4 100644 --- a/module/Application/src/Application/Service/Agent/AgentService.php +++ b/module/Application/src/Application/Service/Agent/AgentService.php @@ -6,10 +6,7 @@ use Application\Entity\Db\Agent; use Application\Entity\Db\AgentApplication; use Application\Entity\Db\AgentCompetence; use Application\Entity\Db\AgentFormation; -use Application\Entity\Db\AgentGrade; use Application\Entity\Db\AgentMissionSpecifique; -use Application\Entity\Db\Corps; -use Application\Entity\Db\Grade; use Application\Entity\Db\Structure; use Application\Service\GestionEntiteHistorisationTrait; use Application\Service\Structure\StructureServiceAwareTrait; @@ -43,6 +40,8 @@ class AgentService { public function createQueryBuilder() { $qb = $this->getEntityManager()->getRepository(Agent::class)->createQueryBuilder('agent') + //quotite de l'agent + ->addSelect('quotite')->leftJoin('agent.quotites', 'quotite') //status de l'agent ->addSelect('statut')->leftJoin('agent.statuts', 'statut') ->addSelect('statut_structure')->leftJoin('statut.structure', 'statut_structure') @@ -90,19 +89,37 @@ class AgentService { ->addSelect('utilisateur')->leftJoin('agent.utilisateur', 'utilisateur') + ->andWhere('agent.delete IS NULL') ; return $qb; } /** + * @param array $temoins * @param string|null $order * @return Agent[] */ - public function getAgents(?string $order = null) + public function getAgents(array $temoins = [], ?string $order = null) { $qb = $this->getEntityManager()->getRepository(Agent::class)->createQueryBuilder('agent') + ->andWhere('agent.delete IS NULL') + + ->addSelect('statut')->leftJoin('agent.statuts', 'statut') + ->andWhere('statut.debut <= :NOW') + ->andWhere('statut.fin >= :NOW OR statut.fin IS NULL') + ->setParameter('NOW', $this->getDateTime()) ; + $tmp = []; + foreach ($temoins as $temoin => $value) { + if ($value) $tmp[] = 'statut.'. $temoin .' = :TRUE'; + } + if (!empty($tmp)) { + $qb = $qb->andWhere(implode(" OR ",$tmp)) + ->setParameter('TRUE', 'O') + ; + } + if ($order !== null) { $qb = $qb->orderBy('agent.' . $order); } else { @@ -235,6 +252,7 @@ class AgentService { ->setParameter('true', 'O') ->setParameter('false', 'N') ->orderBy('agent.nomUsuel, agent.prenom') + ->andWhere('agent.delete IS NULL'); ; if ($structure !== null && $sousstructure === true) { $qb1 = $qb1->andWhere('grade.structure = :structure OR structure.parent = :structure') @@ -284,6 +302,7 @@ class AgentService { ->addSelect('ficheposte')->leftJoin('agent.fiches', 'ficheposte') ->addSelect('poste')->leftJoin('ficheposte.poste', 'poste') + ->andWhere('agent.delete IS NULL'); ; if ($structures !== null) { @@ -691,29 +710,4 @@ class AgentService { $this->deleteFromTrait($agentMissionSpecifique); return $agentMissionSpecifique; } - - public function getAgentsWithGrade(Grade $grade) { - $qb = $this->getEntityManager()->getRepository(AgentGrade::class)->createQueryBuilder('agentgrade') - ->addSelect('agent')->join('agentgrade.agent', 'agent') - ->addSelect('grade')->join('agentgrade.grade', 'grade') - ->andWhere('grade.id = :id') - ->setParameter('id', $grade->getId()) - ->orderBy('agent.nomUsuel, agent.prenom', 'ASC') - ; - $result = $qb->getQuery()->getResult(); - return $result; - } - - public function getAgentsWithCorps(Corps $corps) { - $qb = $this->getEntityManager()->getRepository(AgentGrade::class)->createQueryBuilder('agentgrade') - ->addSelect('agent')->join('agentgrade.agent', 'agent') - ->addSelect('corps')->join('agentgrade.corps', 'corps') - ->andWhere('corps.id = :id') - ->setParameter('id', $corps->getId()) - ->orderBy('agent.nomUsuel, agent.prenom', 'ASC') - ; - $result = $qb->getQuery()->getResult(); - return $result; - } - } \ No newline at end of file diff --git a/module/Application/src/Application/Service/Application/ApplicationGroupeService.php b/module/Application/src/Application/Service/Application/ApplicationGroupeService.php index 66777dd11b5fcd0254fe97709c4d65f2ff4b811e..cf4b1baf6043206cd63c955498fac226dddf79eb 100644 --- a/module/Application/src/Application/Service/Application/ApplicationGroupeService.php +++ b/module/Application/src/Application/Service/Application/ApplicationGroupeService.php @@ -11,9 +11,6 @@ use UnicaenApp\Exception\RuntimeException; use Zend\Mvc\Controller\AbstractActionController; class ApplicationGroupeService { -// use EntityManagerAwareTrait; -// use UserServiceAwareTrait; -// use DateTimeAwareTrait; use GestionEntiteHistorisationTrait; use RendererAwareTrait; diff --git a/module/Application/src/Application/Service/Application/ApplicationGroupeServiceAwareTrait.php b/module/Application/src/Application/Service/Application/ApplicationGroupeServiceAwareTrait.php index d1ea95217516e1ea8c4d330a58ba270ca8a07c95..f087d642e4d877f32b51ddedac108a7872c717d7 100644 --- a/module/Application/src/Application/Service/Application/ApplicationGroupeServiceAwareTrait.php +++ b/module/Application/src/Application/Service/Application/ApplicationGroupeServiceAwareTrait.php @@ -2,8 +2,6 @@ namespace Application\Service\Application; -use Application\Service\Application\ApplicationGroupeService; - trait ApplicationGroupeServiceAwareTrait { /** @var ApplicationGroupeService */ @@ -12,7 +10,7 @@ trait ApplicationGroupeServiceAwareTrait { /** * @return ApplicationGroupeService */ - public function getApplicationGroupeService() + public function getApplicationGroupeService() : ApplicationGroupeService { return $this->applicationGroupeService; } @@ -21,7 +19,7 @@ trait ApplicationGroupeServiceAwareTrait { * @param ApplicationGroupeService $applicationGroupeService * @return ApplicationGroupeService */ - public function setApplicationGroupeService($applicationGroupeService) + public function setApplicationGroupeService(ApplicationGroupeService $applicationGroupeService) : ApplicationGroupeService { $this->applicationGroupeService = $applicationGroupeService; return $this->applicationGroupeService; diff --git a/module/Application/src/Application/Service/Application/ApplicationService.php b/module/Application/src/Application/Service/Application/ApplicationService.php index d74641bb1f98fe965923dd7c14314fcf30209faf..684ad6785554be497c10aabbe709096b9175412b 100644 --- a/module/Application/src/Application/Service/Application/ApplicationService.php +++ b/module/Application/src/Application/Service/Application/ApplicationService.php @@ -20,7 +20,7 @@ class ApplicationService { * @param Application $application * @return Application */ - public function create($application) + public function create(Application $application) { $application->setActif(true); try { @@ -36,7 +36,7 @@ class ApplicationService { * @param Application $application * @return Application */ - public function update($application) + public function update(Application $application) { try { $this->getEntityManager()->flush($application); @@ -49,7 +49,7 @@ class ApplicationService { /** * @param Application $application */ - public function delete($application) + public function delete(Application $application) { try { $this->getEntityManager()->remove($application); @@ -77,7 +77,7 @@ class ApplicationService { * @param string $ordre * @return Application[] */ - public function getApplications($champ = 'libelle', $ordre='ASC') + public function getApplications(string $champ = 'libelle', string $ordre='ASC') { $qb = $this->createQueryBuilder() ->orderBy('application.' . $champ, $ordre) @@ -92,7 +92,7 @@ class ApplicationService { * @param string $ordre * @return Application[] */ - public function getApplicationsAsOptions($champ = 'libelle', $ordre='ASC') + public function getApplicationsAsOptions(string $champ = 'libelle', string $ordre='ASC') { $result = $this->getApplications($champ, $ordre); $array = []; @@ -104,10 +104,10 @@ class ApplicationService { } /** - * @param ApplicationGroupe $groupe + * @param ApplicationGroupe|null $groupe * @return Application[] */ - public function getApplicationsGyGroupe($groupe) + public function getApplicationsGyGroupe(?ApplicationGroupe $groupe) { $qb = $this->createQueryBuilder() ->orderBy('application.libelle') @@ -129,9 +129,9 @@ class ApplicationService { * @param int $id * @return Application */ - public function getApplication($id) + public function getApplication(int $id) { - $qb = $this->getEntityManager()->getRepository(Application::class)->createQueryBuilder('application') + $qb = $this->createQueryBuilder() ->andWhere('application.id = :id') ->setParameter('id', $id) ; @@ -149,7 +149,7 @@ class ApplicationService { * @param string paramName * @return Application */ - public function getRequestedApplication($controller, $paramName) + public function getRequestedApplication(AbstractActionController $controller, $paramName) { $id = $controller->params()->fromRoute($paramName); return $this->getApplication($id); diff --git a/module/Application/src/Application/Service/Application/ApplicationServiceAwareTrait.php b/module/Application/src/Application/Service/Application/ApplicationServiceAwareTrait.php index 8b012c6cda102eb7bbf1c649ea8c0645f233550b..c4c9156a6ddc082bd9537d8b33b14e4e26e10acd 100644 --- a/module/Application/src/Application/Service/Application/ApplicationServiceAwareTrait.php +++ b/module/Application/src/Application/Service/Application/ApplicationServiceAwareTrait.php @@ -10,7 +10,7 @@ Trait ApplicationServiceAwareTrait { /** * @return ApplicationService */ - public function getApplicationService() + public function getApplicationService() : ApplicationService { return $this->applicationService; } @@ -19,7 +19,7 @@ Trait ApplicationServiceAwareTrait { * @param ApplicationService $applicationService * @return ApplicationService */ - public function setApplicationService($applicationService) + public function setApplicationService(ApplicationService $applicationService) : ApplicationService { $this->applicationService = $applicationService; return $this->applicationService; diff --git a/module/Application/src/Application/Service/ApplicationsRetirees/ApplicationsRetireesService.php b/module/Application/src/Application/Service/ApplicationsRetirees/ApplicationsRetireesService.php index b107f5ad4a0c5a310068b3f18cd7312422727999..674260a60ec09fa22e9b5fd8dc93026d63144cb6 100644 --- a/module/Application/src/Application/Service/ApplicationsRetirees/ApplicationsRetireesService.php +++ b/module/Application/src/Application/Service/ApplicationsRetirees/ApplicationsRetireesService.php @@ -5,10 +5,8 @@ namespace Application\Service\ApplicationsRetirees; use Application\Entity\Db\Application; use Application\Entity\Db\FichePoste; use Application\Entity\Db\FicheposteApplicationRetiree; -use DateTime; use Doctrine\ORM\NonUniqueResultException; use Doctrine\ORM\ORMException; -use Exception; use UnicaenApp\Exception\RuntimeException; use UnicaenApp\Service\EntityManagerAwareTrait; use UnicaenUtilisateur\Entity\DateTimeAwareTrait; @@ -72,12 +70,6 @@ class ApplicationsRetireesService { */ public function delete(FicheposteApplicationRetiree $applicationConservee) { -// $date = $this->getDateTime(); -// $user = $this->getUserService()->getConnectedUser(); -// -// $applicationConservee->setHistoDestruction($date); -// $applicationConservee->setHistoDestructeur($user); - try { $this->getEntityManager()->remove($applicationConservee); $this->getEntityManager()->flush($applicationConservee); diff --git a/module/Application/src/Application/Service/ApplicationsRetirees/ApplicationsRetireesServiceAwareTrait.php b/module/Application/src/Application/Service/ApplicationsRetirees/ApplicationsRetireesServiceAwareTrait.php index 65ffe467d5ab0637ac56e91e58afb50137fcbf3d..9ffcfe535d8d6f7d79d34ff5dcfa915719b289fe 100644 --- a/module/Application/src/Application/Service/ApplicationsRetirees/ApplicationsRetireesServiceAwareTrait.php +++ b/module/Application/src/Application/Service/ApplicationsRetirees/ApplicationsRetireesServiceAwareTrait.php @@ -10,7 +10,7 @@ trait ApplicationsRetireesServiceAwareTrait { /** * @return ApplicationsRetireesService */ - public function getApplicationsRetireesService() + public function getApplicationsRetireesService() : ApplicationsRetireesService { return $this->applicationsRetireesService; } @@ -19,7 +19,7 @@ trait ApplicationsRetireesServiceAwareTrait { * @param ApplicationsRetireesService $applicationsRetireesService * @return ApplicationsRetireesService */ - public function setApplicationsRetireesService($applicationsRetireesService) + public function setApplicationsRetireesService(ApplicationsRetireesService $applicationsRetireesService) : ApplicationsRetireesService { $this->applicationsRetireesService = $applicationsRetireesService; return $this->applicationsRetireesService; diff --git a/module/Application/src/Application/Service/Categorie/CategorieService.php b/module/Application/src/Application/Service/Categorie/CategorieService.php index b16decde39900707d7e3396624f2ac7e37c9a615..f961c4c60e94df0fc42b0206e369465df0a94777 100644 --- a/module/Application/src/Application/Service/Categorie/CategorieService.php +++ b/module/Application/src/Application/Service/Categorie/CategorieService.php @@ -11,8 +11,6 @@ use Zend\Mvc\Controller\AbstractActionController; class CategorieService { -// use UserServiceAwareTrait; -// use EntityManagerAwareTrait; use GestionEntiteHistorisationTrait; /** GESTION DES ENTITES *******************************************************************************************/ @@ -129,7 +127,7 @@ class CategorieService * @param string $param * @return Categorie */ - public function getRequestedCategorie($controller, $param='categorie') + public function getRequestedCategorie(AbstractActionController $controller, $param='categorie') { $id = $controller->params()->fromRoute($param); $result = $this->getCategorie($id); @@ -140,7 +138,7 @@ class CategorieService * @param string $code * @return Categorie */ - public function getCategorieByCode($code) + public function getCategorieByCode(string $code) { $qb = $this->createQueryBuider() ->andWhere('categorie.code = :code') diff --git a/module/Application/src/Application/Service/Categorie/CategorieServiceAwareTrait.php b/module/Application/src/Application/Service/Categorie/CategorieServiceAwareTrait.php index f902f5ca058c71dce2b615c404f0febdae81b011..c4fe9182106c618e17cf4f7270cb719dadaac2b7 100644 --- a/module/Application/src/Application/Service/Categorie/CategorieServiceAwareTrait.php +++ b/module/Application/src/Application/Service/Categorie/CategorieServiceAwareTrait.php @@ -10,7 +10,7 @@ trait CategorieServiceAwareTrait { /** * @return CategorieService */ - public function getCategorieService() + public function getCategorieService() : CategorieService { return $this->categorieService; } @@ -19,7 +19,7 @@ trait CategorieServiceAwareTrait { * @param CategorieService $categorieService * @return CategorieService */ - public function setCategorieService($categorieService) + public function setCategorieService(CategorieService $categorieService) : CategorieService { $this->categorieService = $categorieService; return $this->categorieService; diff --git a/module/Application/src/Application/Service/Competence/CompetenceService.php b/module/Application/src/Application/Service/Competence/CompetenceService.php index 1a3707d2a94f1fb140116bd33ac435df54c9cb65..35d9529f721ded2a58a65b869f363b3133405d12 100644 --- a/module/Application/src/Application/Service/Competence/CompetenceService.php +++ b/module/Application/src/Application/Service/Competence/CompetenceService.php @@ -71,14 +71,11 @@ class CompetenceService { /** * @return QueryBuilder */ - public function createQueryBuilderForCompetence() + public function createQueryBuilder() { $qb = $this->getEntityManager()->getRepository(Competence::class)->createQueryBuilder('competence') ->addSelect('type')->leftJoin('competence.type', 'type') ->addSelect('theme')->leftJoin('competence.theme', 'theme') - ->addSelect('createur')->join('competence.histoCreateur', 'createur') - ->addSelect('modificateur')->join('competence.histoModificateur', 'modificateur') - ->addSelect('destructeur')->leftJoin('competence.histoDestructeur', 'destructeur') ; return $qb; } @@ -90,7 +87,7 @@ class CompetenceService { */ public function getCompetences($champ = 'libelle', $order = 'ASC') { - $qb = $this->createQueryBuilderForCompetence() + $qb = $this->createQueryBuilder() ->orderBy('competence.'.$champ, $order) ; $result = $qb->getQuery()->getResult(); @@ -118,7 +115,7 @@ class CompetenceService { */ public function getCompetence(int $id) { - $qb = $this->createQueryBuilderForCompetence() + $qb = $this->createQueryBuilder() ->andWhere('competence.id = :id') ->setParameter('id', $id) ; diff --git a/module/Application/src/Application/Service/Corps/CorpsService.php b/module/Application/src/Application/Service/Corps/CorpsService.php index 0e5f95a08a9c20976629101a16b2b2a8d879df1f..e37ca61581af649497faa9bf50a3792aa0323dd9 100644 --- a/module/Application/src/Application/Service/Corps/CorpsService.php +++ b/module/Application/src/Application/Service/Corps/CorpsService.php @@ -35,48 +35,53 @@ class CorpsService { * @return QueryBuilder */ public function createQueryBuilder() { - $qb = $this->getEntityManager()->getRepository(Corps::class)->createQueryBuilder('corps'); + $qb = $this->getEntityManager()->getRepository(Corps::class)->createQueryBuilder('corps') + ; return $qb; } /** * @param string $champ * @param string $ordre + * @param boolean $avecAgent * @return Corps[] */ - public function getCorps($champ = 'libelleLong', $ordre = 'ASC') { + public function getCorps($champ = 'libelleLong', $ordre = 'ASC', $avecAgent = true) { $qb = $this->createQueryBuilder() ->andWhere('corps.histo IS NULL') ->orderBy('corps.' . $champ, $ordre) ; - $result = $qb->getQuery()->getResult(); - return $result; - } - /** - * @param string $champ - * @param string $ordre - * @return Corps[] - */ - public function getCorpsHistorises($champ = 'libelleLong', $ordre = 'ASC') { - $qb = $this->createQueryBuilder() - ->andWhere('corps.histo IS NOT NULL') - ->orderBy('corps.' . $champ, $ordre) - ; + if ($avecAgent) { + $qb = $qb->addSelect('agentGrade')->join('corps.agentGrades', 'agentGrade') + ->addSelect('agent')->join('agentGrade.agent','agent') + ->andWhere('agent.delete IS NULL') + ; + } + $result = $qb->getQuery()->getResult(); return $result; } /** * @param integer $id + * @param bool $avecAgent * @return Corps */ - public function getCorp($id) + public function getCorp(int $id, bool $avecAgent=true) { $qb = $this->createQueryBuilder() ->andWhere('corps.id = :id') ->setParameter('id', $id) ; + + if ($avecAgent) { + $qb = $qb->addSelect('agentGrade')->join('corps.agentGrades', 'agentGrade') + ->addSelect('agent')->join('agentGrade.agent','agent') + ->andWhere('agent.delete IS NULL') + ; + } + try { $result = $qb->getQuery()->getOneOrNullResult(); } catch (NonUniqueResultException $e) { @@ -90,12 +95,11 @@ class CorpsService { * @param string $param * @return Corps */ - public function getRequestedCorps($controller, $param = 'corps') + public function getRequestedCorps(AbstractActionController $controller, $param = 'corps') { $id = $controller->params()->fromRoute($param); $result = $this->getCorp($id); return $result; } - } diff --git a/module/Application/src/Application/Service/Corps/CorpsServiceAwareTrait.php b/module/Application/src/Application/Service/Corps/CorpsServiceAwareTrait.php index bc77f48f70c853dd63008667e2e58c89e78f3015..546ee452f4bc5865bbd9b1306a19dc102faff8fe 100644 --- a/module/Application/src/Application/Service/Corps/CorpsServiceAwareTrait.php +++ b/module/Application/src/Application/Service/Corps/CorpsServiceAwareTrait.php @@ -10,7 +10,7 @@ trait CorpsServiceAwareTrait { /** * @return CorpsService */ - public function getCorpsService() + public function getCorpsService() : CorpsService { return $this->corpsService; } @@ -19,7 +19,7 @@ trait CorpsServiceAwareTrait { * @param CorpsService $corpsService * @return CorpsService */ - public function setCorpsService($corpsService) + public function setCorpsService(CorpsService $corpsService) : CorpsService { $this->corpsService = $corpsService; return $this->corpsService; diff --git a/module/Application/src/Application/Service/Correspondance/CorrespondanceService.php b/module/Application/src/Application/Service/Correspondance/CorrespondanceService.php index ae1199dd1037ed96ee56753af7fcc9370398e975..2cb8df0845260cf157b4a6b05cccd9503e75ace4 100644 --- a/module/Application/src/Application/Service/Correspondance/CorrespondanceService.php +++ b/module/Application/src/Application/Service/Correspondance/CorrespondanceService.php @@ -7,6 +7,7 @@ use Doctrine\ORM\NonUniqueResultException; use Doctrine\ORM\QueryBuilder; use UnicaenApp\Exception\RuntimeException; use UnicaenApp\Service\EntityManagerAwareTrait; +use Zend\Mvc\Controller\AbstractActionController; class CorrespondanceService { use EntityManagerAwareTrait; @@ -24,20 +25,35 @@ class CorrespondanceService { /** * @param string $champ * @param string $ordre + * @param bool $avecAgent * @return Correspondance[] */ - public function getCorrespondances($champ = 'categorie', $ordre = 'ASC') { + public function getCorrespondances(string $champ = 'categorie', string $ordre = 'ASC', bool $avecAgent=true) { $qb = $this->createQueryBuilder() ->andWhere('correspondance.histo IS NULL') ->orderBy('correspondance.' . $champ, $ordre) ; + + if ($avecAgent) { + $qb = $qb->addSelect('agentGrade')->join('correspondance.agentGrades', 'agentGrade') + ->addSelect('agent')->join('agentGrade.agent','agent') + ->andWhere('agent.delete IS NULL') + ; + } + $result = $qb->getQuery()->getResult(); return $result; } - public function getCorrespondancesAsOptions() + /** + * @param string $champ + * @param string $ordre + * @param bool $avecAgent + * @return array + */ + public function getCorrespondancesAsOptions(string $champ = 'categorie', string $ordre = 'ASC', bool $avecAgent=false) { - $correspondances = $this->getCorrespondances(); + $correspondances = $this->getCorrespondances($champ, $ordre, $avecAgent); $options = []; foreach($correspondances as $correspondance) { $options[$correspondance->getId()] = $correspondance->getCategorie() . " - " . $correspondance->getLibelleLong(); @@ -45,13 +61,25 @@ class CorrespondanceService { return $options; } - public function getCorrespondance($id) + /** + * @param int $id + * @param bool $avecAgent + * @return Correspondance + */ + public function getCorrespondance(int $id, bool $avecAgent = true) { $qb = $this->createQueryBuilder() - ->andWhere('correspondance.id = :id') + ->andWhere('correspondance.source_id = :id') ->setParameter('id', $id) ; + if ($avecAgent) { + $qb = $qb->addSelect('agentGrade')->join('correspondance.agentGrades', 'agentGrade') + ->addSelect('agent')->join('agentGrade.agent','agent') + ->andWhere('agent.delete IS NULL') + ; + } + try { $result = $qb->getQuery()->getOneOrNullResult(); } catch (NonUniqueResultException $e) { @@ -59,4 +87,15 @@ class CorrespondanceService { } return $result; } + + /** + * @param AbstractActionController $controller + * @param string $param + * @return Correspondance + */ + public function getRequestedCorrespondance(AbstractActionController $controller, string $param = 'correspondance') + { + $id = $controller->params()->fromRoute($param); + return $this->getCorrespondance($id); + } } diff --git a/module/Application/src/Application/Service/Correspondance/CorrespondanceServiceAwareTrait.php b/module/Application/src/Application/Service/Correspondance/CorrespondanceServiceAwareTrait.php index f7e7216a8e34b663a2beb0f9d54027a8ad4dd84f..c101e0ef97f3b45ffe6f27aefc4e3de5060829cb 100644 --- a/module/Application/src/Application/Service/Correspondance/CorrespondanceServiceAwareTrait.php +++ b/module/Application/src/Application/Service/Correspondance/CorrespondanceServiceAwareTrait.php @@ -10,7 +10,7 @@ trait CorrespondanceServiceAwareTrait { /** * @return CorrespondanceService */ - public function getCorrespondanceService() + public function getCorrespondanceService() : CorrespondanceService { return $this->correspondanceService; } @@ -19,7 +19,7 @@ trait CorrespondanceServiceAwareTrait { * @param CorrespondanceService $correspondanceService * @return CorrespondanceService */ - public function setCorrespondanceService($correspondanceService) + public function setCorrespondanceService(CorrespondanceService $correspondanceService) : CorrespondanceService { $this->correspondanceService = $correspondanceService; return $this->correspondanceService; diff --git a/module/Application/src/Application/Service/Export/FicheMetier/fiche-metier-pdf.phtml b/module/Application/src/Application/Service/Export/FicheMetier/fiche-metier-pdf.phtml index 6bb504814e7db9fbdb707d19dcf39bb22d7c1379..77aa885ee60e0595458e59673cc583c556c7e3ab 100644 --- a/module/Application/src/Application/Service/Export/FicheMetier/fiche-metier-pdf.phtml +++ b/module/Application/src/Application/Service/Export/FicheMetier/fiche-metier-pdf.phtml @@ -2,13 +2,15 @@ /** * @var FicheMetier $fiche + * @var ParcoursDeFormation[] $parcours */ use Application\Entity\Db\Competence; use Application\Entity\Db\CompetenceType; use Application\Entity\Db\FicheMetier; use Application\Entity\Db\FicheMetierTypeActivite; -use Formation\Entity\Db\Formation; +use Application\Entity\Db\ParcoursDeFormation; +use Formation\Entity\Db\FormationGroupe; $metier = $fiche->getMetier(); ?> @@ -54,9 +56,10 @@ $metier = $fiche->getMetier(); margin-top: 0.5rem; margin-bottom: 0.5rem; } + div.activite { - border-left : 2px solid #123456; - border-bottom : 1px solid #123456; + border-left: 2px solid #123456; + border-bottom: 1px solid #123456; padding-left: 1rem; margin-bottom: 1rem; font-size: 9pt; @@ -73,6 +76,7 @@ $metier = $fiche->getMetier(); table.activite th { text-align: left; } + table.activite td { font-size: 9pt; /*margin-left: 5rem;*/ @@ -82,8 +86,10 @@ $metier = $fiche->getMetier(); </style> <?php - $activites = $fiche->getActivites(); - usort($activites, function (FicheMetierTypeActivite $a, FicheMetierTypeActivite $b) { return $a->getPosition() < $b->getPosition();}); +$activites = $fiche->getActivites(); +usort($activites, function (FicheMetierTypeActivite $a, FicheMetierTypeActivite $b) { + return $a->getPosition() < $b->getPosition(); +}); ?> <!-- TITRE ------------------------------------------------------------------------------------------------------------> @@ -93,26 +99,29 @@ $metier = $fiche->getMetier(); <h1><?php echo $metier->getLibelle(); ?></h1> </div> <div style="float:right;width:36%;"> - <?php $references = $metier->getReferences() ;?> - <table class="info-cartouche"> - <tr> - <th> Catégorie :</th> - <td> <?php echo ($metier->getCategorie())?$metier->getCategorie()->getCode():"???"; ?> </td> - </tr> - <tr> - <th> Références : </th> - <?php if ($references and !empty($references)) : ?> - <?php $first = true; ?> - <?php foreach ($references as $reference) : ?> - <?php if (!$first) echo "<tr><th></th>"; ?> - <td> - <?php echo $reference->getTitre(); ?> - </td></tr> - <?php $first = false; ?> - <?php endforeach; ?> - <?php endif; ?> - - </table> + <?php $references = $metier->getReferences(); ?> + <table class="info-cartouche"> + <tr> + <th> Catégorie :</th> + <td> <?php echo ($metier->getCategorie()) ? $metier->getCategorie()->getCode() : "???"; ?> </td> + </tr> + <tr> + <th> Références :</th> + <?php if ($references and !empty($references)) : ?> + <?php $first = true; ?> + <?php foreach ($references + + as $reference) : ?> + <?php if (!$first) echo "<tr><th></th>"; ?> + <td> + <?php echo $reference->getTitre(); ?> + </td> + </tr> + <?php $first = false; ?> + <?php endforeach; ?> + <?php endif; ?> + + </table> </div> </div> @@ -125,7 +134,7 @@ $metier = $fiche->getMetier(); <?php //echo $fiche->getMissionsPrincipales(); ?> -<?php foreach($activites as $activite) : ?> +<?php foreach ($activites as $activite) : ?> <?php if ($activite->getActivite()->estNonHistorise()) : ?> <table class="activite"> @@ -134,14 +143,14 @@ $metier = $fiche->getMetier(); </tr> <tr> <td> - <?php foreach ($activite->getActivite()->getDescriptions() as $description) : ?> - – <?php echo $description->getLibelle(); ?> <br/> - <?php endforeach; ?> + <?php foreach ($activite->getActivite()->getDescriptions() as $description) : ?> + – <?php echo $description->getLibelle(); ?> <br/> + <?php endforeach; ?> </td> </tr> </table> - <?php endif ;?> + <?php endif; ?> <?php endforeach; ?> <!-- PARCOURS DE FORMATION --------------------------------------------------------------------------------------------> @@ -152,14 +161,18 @@ $metier = $fiche->getMetier(); <?php $competences = $fiche->getCompetences(); -usort($competences, function (Competence $a, Competence $b) { return $a->getLibelle() > $b->getLibelle();}); +usort($competences, function (Competence $a, Competence $b) { + return $a->getLibelle() > $b->getLibelle(); +}); $types = []; -foreach($competences as $competence) { +foreach ($competences as $competence) { $type = $competence->getType(); $types[$type->getId()] = $type; } -usort($types, function(CompetenceType $a, CompetenceType $b) { return $a->getOrdre() > $b->getOrdre();}); +usort($types, function (CompetenceType $a, CompetenceType $b) { + return $a->getOrdre() > $b->getOrdre(); +}); $dictionnaire = []; foreach ($types as $type) $dictionnaire[$type->getLibelle()] = []; @@ -168,7 +181,7 @@ foreach ($competences as $competence) { } ?> -<?php if (! empty($competences)) : ?> +<?php if (!empty($competences)) : ?> <div class="secondary-block"> Compétences </div> @@ -197,21 +210,21 @@ $nogroupe = "zzz"; $dictionnaire = []; foreach ($applications as $application) { $groupe = $application->getGroupe(); - $libelle = ($groupe !== null)?$groupe->getLibelle():$nogroupe; + $libelle = ($groupe !== null) ? $groupe->getLibelle() : $nogroupe; $dictionnaire[$libelle][] = $application; } ksort($dictionnaire); ?> -<?php if (! empty($applications)) : ?> +<?php if (!empty($applications)) : ?> <div class="secondary-block"> Applications </div> - <?php foreach($dictionnaire as $key => $liste) : ?> + <?php foreach ($dictionnaire as $key => $liste) : ?> <table class="activite"> <tr> - <th> <?php echo ($key !== $nogroupe)?$key:"Sans groupe ..."; ?> </th> + <th> <?php echo ($key !== $nogroupe) ? $key : "Sans groupe ..."; ?> </th> </tr> <tr> <td> @@ -225,19 +238,61 @@ ksort($dictionnaire); <?php endif; ?> <?php -$formations = $fiche->getFormations(); -usort($formations, function (Formation $a, Formation $b) { return $a->getLibelle() > $b->getLibelle();}); +$categorie = $fiche->getMetier()->getCategorie(); +$parcour = null; +/** @var ParcoursDeFormation $p */ +foreach ($parcours as $p) { + if ($p->getReference() === $categorie->getId()) { + $parcour = $p; + break; + } +} + ?> -<?php if (! empty($formations)) : ?> +<?php if (empty($parcours)) : ?> <div class="secondary-block"> - Formations + Aucun parcours de formation pour la catégorie : <?php echo $categorie->getLibelle(); ?> </div> - <div class="activite"> - <ul> - <?php foreach ($formations as $formation) : ?> - <li> <?php echo $formation->getLibelle(); ?> </li> - <?php endforeach; ?> - </ul> +<?php else : ?> + <div class="secondary-block"> + Parcours de formation : <?php echo $parcour->getLibelle(); ?> </div> + + <?php + $groupes = []; + $sans = []; + $formations = []; + foreach($parcour->getFormations() as $formation) { + if ($formation->getGroupe()) { + $groupes[$formation->getGroupe()->getId()] = $formation->getGroupe(); + $formations[$formation->getGroupe()->getId()][] = $formation; + } { + $sans[] = $formation; + } + } + usort($groupes, function (FormationGroupe $a, FormationGroupe $b) {return $a->getOrdre() > $b->getOrdre();}); + ?> + + <ul> + <?php foreach ($groupes as $groupe) : ?> + <li> <?php echo $groupe->getLibelle(); ?> + <ul> + <?php foreach ($formations[$groupe->getId()] as $formation) : ?> + <li> <?php echo $formation->getLibelle(); ?> </li> + <?php endforeach; ?> + </ul> + </li> + <?php endforeach; ?> + <?php if (! empty($sans)) : ?> + <l1> Sans groupe ... </l1> + <ul> + <?php foreach ($sans as $formation) : ?> + <li> <?php echo $formation->getLibelle(); ?> </li> + <?php endforeach; ?> + </ul> + <?php endif; ?> + </ul> + <?php endif; ?> + diff --git a/module/Application/src/Application/Service/Export/FichePoste/fiche-poste.phtml b/module/Application/src/Application/Service/Export/FichePoste/fiche-poste.phtml index c3c658d9ed7dc4c0adb07889e62bed44634b2e57..b0b137764b8d8b7c1f3bbd2a197f8fbc920bfb2c 100644 --- a/module/Application/src/Application/Service/Export/FichePoste/fiche-poste.phtml +++ b/module/Application/src/Application/Service/Export/FichePoste/fiche-poste.phtml @@ -157,7 +157,11 @@ $metierLibelle = ($metier)?$metier->getLibelle():null; <tr> <th> Quotité travaillée </th> <td> - <span class="manquant"> Information remontant de SIHAM ou renseignable dans l'application </span> + <?php if($quotite = $agent->getQuotiteCourante()) : ?> + <?php echo $quotite->getQuotite(); ?>% + <?php else: ?> + 100% + <?php endif; ?> </td> </tr> </table> diff --git a/module/Application/src/Application/Service/FicheMetier/FicheMetierService.php b/module/Application/src/Application/Service/FicheMetier/FicheMetierService.php index 5f7093d9c30d5cf9871c5eec4c9663b15d5da3aa..bd7b4ac5d5a9f445943d6b858828aae297bf6f4f 100644 --- a/module/Application/src/Application/Service/FicheMetier/FicheMetierService.php +++ b/module/Application/src/Application/Service/FicheMetier/FicheMetierService.php @@ -8,6 +8,7 @@ use Application\Entity\Db\Domaine; use Application\Entity\Db\FamilleProfessionnelle; use Application\Entity\Db\FicheMetier; use Application\Entity\Db\FicheMetierEtat; +use Application\Form\EntityFormManagmentTrait; use Formation\Entity\Db\Formation; use Application\Service\Application\ApplicationServiceAwareTrait; use Application\Service\Competence\CompetenceServiceAwareTrait; @@ -26,13 +27,15 @@ class FicheMetierService { use FormationServiceAwareTrait; use GestionEntiteHistorisationTrait; + use EntityFormManagmentTrait; + /** GESTION DES ENTITES *******************************************************************************************/ /** * @param FicheMetier $fiche * @return FicheMetier */ - public function create($fiche) + public function create(FicheMetier $fiche) { $this->createFromTrait($fiche); return $fiche; @@ -42,7 +45,7 @@ class FicheMetierService { * @param FicheMetier $fiche * @return FicheMetier */ - public function update($fiche) + public function update(FicheMetier $fiche) { $this->updateFromTrait($fiche); return $fiche; @@ -52,7 +55,7 @@ class FicheMetierService { * @param FicheMetier $fiche * @return FicheMetier */ - public function historise($fiche) + public function historise(FicheMetier $fiche) { $this->historiserFromTrait($fiche); return $fiche; @@ -62,7 +65,7 @@ class FicheMetierService { * @param FicheMetier $fiche * @return FicheMetier */ - public function restore($fiche) + public function restore(FicheMetier $fiche) { $this->restoreFromTrait($fiche); return $fiche; @@ -72,7 +75,7 @@ class FicheMetierService { * @param FicheMetier $fiche * @return FicheMetier */ - public function delete($fiche) + public function delete(FicheMetier $fiche) { $this->deleteFromTrait($fiche); return $fiche; @@ -88,6 +91,7 @@ class FicheMetierService { $qb = $this->getEntityManager()->getRepository(FicheMetier::class)->createQueryBuilder('ficheMetier') ->addSelect('metier')->join('ficheMetier.metier', 'metier') ->addSelect('domaine')->join('metier.domaines', 'domaine') + ->addSelect('famille')->join('domaine.famille', 'famille') ->addSelect('etat')->join('ficheMetier.etat', 'etat') ->addSelect('reference')->leftJoin('metier.references', 'reference') ->addSelect('referentiel')->leftJoin('reference.referentiel', 'referentiel') @@ -116,7 +120,7 @@ class FicheMetierService { * @param int $niveau * @return FicheMetier[] */ - public function getFichesMetiersWithNiveau($niveau) + public function getFichesMetiersWithNiveau(int $niveau) { $qb = $this->createQueryBuilder() ->andWhere('metier.niveau IS NULL or metier.niveau >= :niveau') @@ -131,7 +135,7 @@ class FicheMetierService { * @param string $order an attribute use to sort * @return FicheMetier[] */ - public function getFichesMetiersValides($order = 'id') + public function getFichesMetiersValides(string $order = 'id') { $qb = $this->createQueryBuilder() ->andWhere('etat.code = :code') @@ -147,9 +151,22 @@ class FicheMetierService { * @param int $id * @return FicheMetier */ - public function getFicheMetier($id) + public function getFicheMetier(int $id) { - $qb = $this->getEntityManager()->getRepository(FicheMetier::class)->createQueryBuilder('ficheMetier') + $qb = $this->createQueryBuilder() + ->addSelect('fmactivite')->leftJoin('ficheMetier.activites', 'fmactivite') + ->addSelect('activite')->leftJoin('fmactivite.activite', 'activite') + ->addSelect('aapplication')->leftJoin('activite.applications', 'aapplication') + ->addSelect('acompetence')->leftJoin('activite.competences', 'acompetence') + ->addSelect('aformation')->leftJoin('activite.formations', 'aformation') + + ->addSelect('application')->leftJoin('ficheMetier.applications', 'application') + ->addSelect('agroupe')->leftJoin('application.groupe', 'agroupe') + + ->addSelect('competence')->leftJoin('ficheMetier.competences', 'competence') + ->addSelect('ctype')->leftJoin('competence.type', 'ctype') + + ->addSelect('categorie')->leftJoin('metier.categorie', 'categorie') ->andWhere('ficheMetier.id = :id') ->setParameter('id', $id) ; @@ -168,7 +185,7 @@ class FicheMetierService { * @param bool $notNull * @return FicheMetier */ - public function getRequestedFicheMetier($controller, $name = 'fiche', $notNull = false) + public function getRequestedFicheMetier(AbstractController $controller, string $name = 'fiche', bool $notNull = false) { $ficheId = $controller->params()->fromRoute($name); $fiche = $this->getFicheMetier($ficheId); @@ -190,12 +207,9 @@ class FicheMetierService { * @param FamilleProfessionnelle $famille * @return FicheMetier[] */ - public function getFicheByFamille($famille) + public function getFicheByFamille(FamilleProfessionnelle $famille) { - $qb = $this->getEntityManager()->getRepository(FicheMetier::class)->createQueryBuilder('fiche') - ->addSelect('metier')->join('fiche.metier', 'metier') - ->addSelect('domaine')->join('metier.domaines', 'domaine') - ->addSelect('famille')->join('domaine.famille', 'famille') + $qb = $this->createQueryBuilder() ->andWhere('famille = :famille') ->setParameter('famille', $famille) ->orderBy('metier.libelle') @@ -209,12 +223,9 @@ class FicheMetierService { * @param Domaine $domaine * @return FicheMetier[] */ - public function getFicheByDomaine($domaine) + public function getFicheByDomaine(Domaine $domaine) { - $qb = $this->getEntityManager()->getRepository(FicheMetier::class)->createQueryBuilder('fiche') - ->addSelect('metier')->join('fiche.metier', 'metier') - ->addSelect('domaine')->join('metier.domaines', 'domaine') - ->addSelect('famille')->join('domaine.famille', 'famille') + $qb = $this->createQueryBuilder() ->andWhere('domaine = :domaine') ->setParameter('domaine', $domaine) ->orderBy('metier.libelle') @@ -228,7 +239,7 @@ class FicheMetierService { * @param int $niveau * @return array */ - public function getFichesMetiersAsOptions($niveau =0) + public function getFichesMetiersAsOptions(int $niveau =0) { $fiches = $this->getFichesMetiersWithNiveau($niveau); $array = []; @@ -273,7 +284,7 @@ class FicheMetierService { * @param array $data * @return FicheMetier */ - public function updateApplications(FicheMetier $fiche, $data) + public function updateApplications(FicheMetier $fiche, array $data) { $applicationIds = []; @@ -308,7 +319,7 @@ class FicheMetierService { * @param array $data * @return FicheMetier */ - public function updateFormations(FicheMetier $fiche, $data) + public function updateFormations(FicheMetier $fiche, array $data) { $formationIds = []; @@ -343,7 +354,7 @@ class FicheMetierService { * @param array $data * @return FicheMetier */ - public function updateCompetences(FicheMetier $fiche, $data) + public function updateCompetences(FicheMetier $fiche, array $data) { $competenceIds = []; @@ -375,10 +386,10 @@ class FicheMetierService { /** * @param FicheMetier $fiche - * @param DateTime $date + * @param DateTime|null $date * @return array */ - public function getApplicationsDictionnaires(FicheMetier $fiche, DateTime $date = null) + public function getApplicationsDictionnaires(FicheMetier $fiche, ?DateTime $date = null) { $dictionnaire = []; @@ -399,4 +410,30 @@ class FicheMetierService { return $dictionnaire; } + /** + * @param FicheMetier $fiche + * @param DateTime|null $date + * @return array + */ + public function getCompetencesDictionnaires(FicheMetier $fiche, ?DateTime $date = null) + { + $dictionnaire = []; + + foreach ($fiche->getCompetences() as $competence) { + $dictionnaire[$competence->getId()]["entite"] = $competence; + $dictionnaire[$competence->getId()]["raison"][] = $fiche; + $dictionnaire[$competence->getId()]["conserve"] = true; + } + + foreach ($fiche->getActivites() as $activite) { + foreach ($activite->getActivite()->getCompetences() as $competence) { + $dictionnaire[$competence->getId()]["entite"] = $competence; + $dictionnaire[$competence->getId()]["raison"][] = $activite; + $dictionnaire[$competence->getId()]["conserve"] = true; + } + } + + return $dictionnaire; + } + } \ No newline at end of file diff --git a/module/Application/src/Application/Service/FichePoste/FichePosteService.php b/module/Application/src/Application/Service/FichePoste/FichePosteService.php index e0decef3611627b026d77b25059a29e133b50b3f..3e933e4050e4ad39a9928ab6a62000f4932af3d1 100644 --- a/module/Application/src/Application/Service/FichePoste/FichePosteService.php +++ b/module/Application/src/Application/Service/FichePoste/FichePosteService.php @@ -22,8 +22,6 @@ use UnicaenUtilisateur\Entity\Db\User; use Zend\Mvc\Controller\AbstractActionController; class FichePosteService { -// use EntityManagerAwareTrait; -// use UserServiceAwareTrait; use GestionEntiteHistorisationTrait; use StructureServiceAwareTrait; @@ -33,7 +31,7 @@ class FichePosteService { * @param FichePoste $fiche * @return FichePoste */ - public function create($fiche) + public function create(FichePoste $fiche) { $this->createFromTrait($fiche); return $fiche; @@ -43,7 +41,7 @@ class FichePosteService { * @param FichePoste $fiche * @return FichePoste */ - public function update($fiche) + public function update(FichePoste $fiche) { $this->updateFromTrait($fiche); return $fiche; @@ -53,7 +51,7 @@ class FichePosteService { * @param FichePoste $fiche * @return FichePoste */ - public function historise($fiche) + public function historise(FichePoste $fiche) { $this->historiserFromTrait($fiche); return $fiche; @@ -63,7 +61,7 @@ class FichePosteService { * @param FichePoste $fiche * @return FichePoste */ - public function restore($fiche) + public function restore(FichePoste $fiche) { $this->restoreFromTrait($fiche); return $fiche; @@ -73,7 +71,7 @@ class FichePosteService { * @param FichePoste $fiche * @return FichePoste */ - public function delete($fiche) + public function delete(FichePoste $fiche) { $this->deleteFromTrait($fiche); return $fiche; @@ -123,12 +121,10 @@ class FichePosteService { */ public function getFichesPostes() { -// $qb = $this->getEntityManager()->getRepository(FichePoste::class)->createQueryBuilder('fiche') -// ->addSelect('poste')->leftJoin('fiche.poste', 'poste') -// ->addSelect('agent')->leftJoin('fiche.agent', 'agent') -// ->addSelect('specificite')->leftJoin('fiche.specificite', 'specificite') -// ->addSelect('externe')->leftJoin('fiche.fichesMetiers', 'externe') - $qb = $this->createQueryBuilder() + $qb = $this->getEntityManager()->getRepository(FichePoste::class)->createQueryBuilder('fiche') + ->addSelect('agent')->leftJoin('fiche.agent', 'agent') + ->addSelect('externe')->leftJoin('fiche.fichesMetiers', 'externe') +// $qb = $this->createQueryBuilder() ->andWhere('fiche.histoDestruction IS NULL') ->orderBy('fiche.id', 'ASC'); @@ -140,46 +136,8 @@ class FichePosteService { * @param integer $id * @return FichePoste */ - public function getFichePoste($id) + public function getFichePoste(int $id) { -// $qb = $this->getEntityManager()->getRepository(FichePoste::class)->createQueryBuilder('fiche') -// ->addSelect('agent')->leftJoin('fiche.agent', 'agent') -// ->addSelect('statut')->leftJoin('agent.statuts', 'statut') -// ->addSelect('agentgrade')->leftJoin('agent.grades', 'agentgrade') -// ->addSelect('grade')->leftJoin('agentgrade.grade', 'grade') -// ->addSelect('corps')->leftJoin('agentgrade.corps', 'corps') -// ->addSelect('correspondance')->leftJoin('agentgrade.bap', 'correspondance') -// -// ->addSelect('agentmission')->leftJoin('agent.missionsSpecifiques', 'agentmission') -// ->addSelect('mission')->leftJoin('agentmission.mission', 'mission') -// ->addSelect('m_structure')->leftJoin('agentmission.structure', 'm_structure') -// -// ->addSelect('poste')->leftJoin('fiche.poste', 'poste') -// ->addSelect('poste_domaine') ->leftJoin('poste.domaine', 'poste_domaine') -// ->addSelect('poste_structure') ->leftJoin('poste.structure', 'poste_structure') -// ->addSelect('poste_structure_t') ->leftJoin('poste_structure.type', 'poste_structure_t') -// ->addSelect('poste_correspondance') ->leftJoin('poste.correspondance', 'poste_correspondance') -// ->addSelect('poste_responsable') ->leftJoin('poste.rattachementHierarchique', 'poste_responsable') -// -// -// ->addSelect('externe')->leftJoin('fiche.fichesMetiers', 'externe') -// ->addSelect('fichemetier')->leftJoin('externe.ficheType', 'fichemetier') -// ->addSelect('metier')->leftJoin('fichemetier.metier', 'metier') -// ->addSelect('domaine')->leftJoin('metier.domaines', 'domaine') -//// ->addSelect('fmApplication')->join('fichemetier.applications', 'fmApplication') -//// ->addSelect('fmCompetence')->join('fichemetier.competences', 'fmCompetence') -//// ->addSelect('fmFormation')->join('fichemetier.formations', 'fmFormation') -// //activite -// ->addSelect('ftActivite')->leftJoin('fichemetier.activites', 'ftActivite') -// ->addSelect('activite')->leftJoin('ftActivite.activite', 'activite') -// ->addSelect('aLibelle')->leftJoin('activite.libelles', 'aLibelle') -// ->addSelect('aApplication')->leftJoin('activite.applications', 'aApplication') -// ->addSelect('aCompetence')->leftJoin('activite.competences', 'aCompetence') -// ->addSelect('aFormation')->leftJoin('activite.formations', 'aFormation') -// ->addSelect('aDescription')->leftJoin('activite.descriptions', 'aDescription') -// -// ->addSelect('expertise')->leftJoin('fiche.expertises', 'expertise') -// ->addSelect('specificite')->leftJoin('fiche.specificite', 'specificite') $qb = $this->createQueryBuilder() ->andWhere('fiche.id = :id') ->setParameter('id', $id) @@ -199,7 +157,7 @@ class FichePosteService { * @param bool $notNull * @return FichePoste */ - public function getRequestedFichePoste($controller, $paramName = 'fiche-poste', $notNull = false) + public function getRequestedFichePoste(AbstractActionController $controller, string $paramName = 'fiche-poste', bool $notNull = false) { $id = $controller->params()->fromRoute($paramName); $fiche = $this->getFichePoste($id); @@ -214,7 +172,7 @@ class FichePosteService { * @param FicheTypeExterne $ficheTypeExterne * @return FicheTypeExterne */ - public function createFicheTypeExterne($ficheTypeExterne) + public function createFicheTypeExterne(FicheTypeExterne $ficheTypeExterne) { try { $this->getEntityManager()->persist($ficheTypeExterne); @@ -244,7 +202,7 @@ class FichePosteService { * @param FicheTypeExterne $ficheTypeExterne * @return FicheTypeExterne */ - public function updateFicheTypeExterne($ficheTypeExterne) + public function updateFicheTypeExterne(FicheTypeExterne $ficheTypeExterne) { try { $this->getEntityManager()->flush($ficheTypeExterne); @@ -258,7 +216,7 @@ class FichePosteService { * @param FicheTypeExterne $ficheTypeExterne * @return FicheTypeExterne */ - public function deleteFicheTypeExterne($ficheTypeExterne) + public function deleteFicheTypeExterne(FicheTypeExterne $ficheTypeExterne) { try { $this->getEntityManager()->remove($ficheTypeExterne); @@ -274,7 +232,7 @@ class FichePosteService { * @param integer $id * @return FicheTypeExterne */ - public function getFicheTypeExterne($id) + public function getFicheTypeExterne(int $id) { $qb = $this->getEntityManager()->getRepository(FicheTypeExterne::class)->createQueryBuilder('externe') ->andWhere('externe.id = :id') @@ -302,11 +260,11 @@ class FichePosteService { * @param boolean $sousstructure * @return FichePoste[] */ - public function getFichesPostesByStructures($structures = [], $sousstructure = false) + public function getFichesPostesByStructures(array $structures = [], bool $sousstructure = true) { try { $today = new DateTime(); - $noEnd = DateTime::createFromFormat('d/m/Y H:i:s', '31/12/1999 00:00:00'); + //$noEnd = DateTime::createFromFormat('d/m/Y H:i:s', '31/12/1999 00:00:00'); } catch (Exception $e) { throw new RuntimeException("Problème lors de la création des dates"); } @@ -334,9 +292,11 @@ class FichePosteService { ->orderBy('agent.nomUsuel, agent.prenom') ; - $qb = $qb - ->andWhere('statut.structure IN (:structures)') - ->setParameter('structures', $structures); + if ($sousstructure) { + $qb = $qb + ->andWhere('statut.structure IN (:structures)') + ->setParameter('structures', $structures); + } $result = $qb->getQuery()->getResult(); return $result; @@ -345,10 +305,10 @@ class FichePosteService { /** * @param Structure[] $structures * @param boolean $sousstructure - * @param Agent $agent + * @param Agent|null $agent * @return FichePoste[] */ - public function getFichesPostesByStructuresAndAgent($structures = [], $sousstructure = false, $agent = null) + public function getFichesPostesByStructuresAndAgent(array $structures = [], bool $sousstructure = false, Agent $agent = null) { $fiches = $this->getFichesPostesByStructures($structures, $sousstructure); $niveau = $agent->getMeilleurNiveau(); @@ -371,7 +331,7 @@ class FichePosteService { * @param boolean $sousstructure * @return FichePoste[] */ - public function getFichesPostesSansAgentByStructure($structure, $sousstructure = false) + public function getFichesPostesSansAgentByStructure(Structure $structure, bool $sousstructure = false) { $qb = $this->getEntityManager()->getRepository(FichePoste::class)->createQueryBuilder('fiche') ->addSelect('poste')->join('fiche.poste', 'poste') @@ -524,10 +484,9 @@ class FichePosteService { /** * @param FichePoste $fiche - * @param DateTime $date * @return array */ - public function getActivitesDictionnaires(FichePoste $fiche, DateTime $date) { + public function getActivitesDictionnaires(FichePoste $fiche) { $dictionnaire = []; @@ -538,7 +497,7 @@ class FichePosteService { $activitesId = explode(';',$ficheTypeExterne->getActivites()); foreach ($ficheMetier->getActivites() as $metierTypeActivite) { $id = $metierTypeActivite->getActivite()->getId(); - $dictionnaire[$id]["object"] = $metierTypeActivite; //TODO voir si pertinent + $dictionnaire[$id]["object"] = $metierTypeActivite; $dictionnaire[$id]["conserve"] = (array_search($id, $activitesId) !== false); } } @@ -551,7 +510,7 @@ class FichePosteService { * @param DateTime $date * @return array */ - public function getApplicationsDictionnaires(FichePoste $fiche, DateTime $date) + public function getApplicationsDictionnaires(FichePoste $fiche) { $dictionnaire = []; @@ -604,7 +563,7 @@ class FichePosteService { * @param DateTime $date * @return array */ - public function getFormationsDictionnaires(FichePoste $fiche, DateTime $date) + public function getFormationsDictionnaires(FichePoste $fiche) { $dictionnaire = []; @@ -652,7 +611,7 @@ class FichePosteService { * @param DateTime $date * @return array */ - public function getCompetencesDictionnaires(FichePoste $fiche, DateTime $date) + public function getCompetencesDictionnaires(FichePoste $fiche) { $dictionnaire = []; diff --git a/module/Application/src/Application/Service/Grade/GradeService.php b/module/Application/src/Application/Service/Grade/GradeService.php index 4845327ba2334d4073db2e631e624e208b641090..ecf49c8bed058846e20ca78e44fcbe63cb1e1e4b 100644 --- a/module/Application/src/Application/Service/Grade/GradeService.php +++ b/module/Application/src/Application/Service/Grade/GradeService.php @@ -11,8 +11,6 @@ use Zend\Mvc\Controller\AbstractActionController; class GradeService { use EntityManagerAwareTrait; - /** REQUETAGE *****************************************************************************************************/ - public function createQueryBuilder() { $qb = $this->getEntityManager()->getRepository(Grade::class)->createQueryBuilder('grade'); @@ -22,14 +20,23 @@ class GradeService { /** * @param string $champ * @param string $ordre + * @param bool $avecAgent * @return Grade[] */ - public function getGrades($champ = 'libelleLong', $ordre ='ASC') + public function getGrades(string $champ = 'libelleLong', string $ordre ='ASC', bool $avecAgent = true) { $qb = $this->createQueryBuilder() ->andWhere("grade.histo IS NULL") ->orderBy('grade.' . $champ, $ordre) ; + + if ($avecAgent) { + $qb = $qb->addSelect('agentGrade')->join('grade.agentGrades', 'agentGrade') + ->addSelect('agent')->join('agentGrade.agent','agent') + ->andWhere('agent.delete IS NULL') + ; + } + $result = $qb->getQuery()->getResult(); return $result; } @@ -50,11 +57,13 @@ class GradeService { } /** + * @param string $champ + * @param string $ordre * @return array */ - public function getGradesAsOptions() + public function getGradesAsOptions($champ = 'libelleLong', $ordre ='ASC') { - $grades = $this->getGrades(); + $grades = $this->getGrades($champ, $ordre); $array = []; foreach ($grades as $grade) { @@ -65,15 +74,22 @@ class GradeService { /** * @param integer $id + * @param bool $avecAgent * @return Grade */ - public function getGrade($id) + public function getGrade(int $id, bool $avecAgent = true) { $qb = $this->createQueryBuilder() ->andWhere('grade.id = :id') ->setParameter('id', $id) ; + if ($avecAgent) { + $qb = $qb->addSelect('agentGrade')->join('grade.agentGrades', 'agentGrade') + ->addSelect('agent')->join('agentGrade.agent','agent') + ; + } + try { $result = $qb->getQuery()->getOneOrNullResult(); } catch (NonUniqueResultException $e) { @@ -87,7 +103,7 @@ class GradeService { * @param string $param * @return Grade */ - public function getRequestedGrade($controller, $param = "grade") + public function getRequestedGrade(AbstractActionController $controller, $param = "grade") { $id = $controller->params()->fromRoute($param); $grade = $this->getGrade($id); diff --git a/module/Application/src/Application/Service/Grade/GradeServiceAwareTrait.php b/module/Application/src/Application/Service/Grade/GradeServiceAwareTrait.php index b3f64bb9dba79415895df78542a9a69306397397..01fc95fd57a8dbc70e9fed9e05f44e2942e111d9 100644 --- a/module/Application/src/Application/Service/Grade/GradeServiceAwareTrait.php +++ b/module/Application/src/Application/Service/Grade/GradeServiceAwareTrait.php @@ -10,7 +10,7 @@ trait GradeServiceAwareTrait { /** * @return GradeService */ - public function getGradeService() + public function getGradeService() : GradeService { return $this->gradeService; } @@ -19,7 +19,7 @@ trait GradeServiceAwareTrait { * @param GradeService $gradeService * @return GradeService */ - public function setGradeService($gradeService) + public function setGradeService(GradeService $gradeService) : GradeService { $this->gradeService = $gradeService; return $this->gradeService; diff --git a/module/Application/src/Application/Service/ParcoursDeFormation/ParcoursDeFormationService.php b/module/Application/src/Application/Service/ParcoursDeFormation/ParcoursDeFormationService.php index de3d83b0ac8dc0acdfc31dac980d2f00893678b3..1035f7a750445305ac22b811261b46f3e0baa51a 100644 --- a/module/Application/src/Application/Service/ParcoursDeFormation/ParcoursDeFormationService.php +++ b/module/Application/src/Application/Service/ParcoursDeFormation/ParcoursDeFormationService.php @@ -81,6 +81,9 @@ class ParcoursDeFormationService { public function createQueryBuilder() { $qb = $this->getEntityManager()->getRepository(ParcoursDeFormation::class)->createQueryBuilder('parcours') + ->addSelect('formation')->leftJoin('parcours.formations', 'formation') + ->addSelect('groupe')->leftJoin('formation.groupe', 'groupe') + ; ; return $qb; } diff --git a/module/Application/src/Application/View/Helper/CompetencesViewHelper.php b/module/Application/src/Application/View/Helper/CompetenceBlocViewHelper.php similarity index 59% rename from module/Application/src/Application/View/Helper/CompetencesViewHelper.php rename to module/Application/src/Application/View/Helper/CompetenceBlocViewHelper.php index 2eceeb75e004a62cb79973007f341a9e6d80ae2e..45c226a7e3f59f3e0312c13ce91dbfaf5934b45d 100644 --- a/module/Application/src/Application/View/Helper/CompetencesViewHelper.php +++ b/module/Application/src/Application/View/Helper/CompetenceBlocViewHelper.php @@ -7,26 +7,19 @@ use Zend\View\Helper\AbstractHelper; use Zend\View\Helper\Partial; use Zend\View\Resolver\TemplatePathStack; -/** - * Class CompetenceViewHelper - * @package Application\View\Helper - * - * OPTION => li : affichée entre <li> </li> - * - */ -class CompetencesViewHelper extends AbstractHelper +class CompetenceBlocViewHelper extends AbstractHelper { /** * @param array $competences * @param array $options * @return string|Partial */ - public function __invoke($competences, $options = []) + public function __invoke(array $competences, $options = []) { /** @var PhpRenderer $view */ $view = $this->getView(); $view->resolver()->attach(new TemplatePathStack(['script_paths' => [__DIR__ . "/partial"]])); - return $view->partial('competences', ['competences' => $competences, 'options' => $options]); + return $view->partial('competence-bloc', ['competences' => $competences, 'options' => $options]); } } \ No newline at end of file diff --git a/module/Application/src/Application/View/Helper/CompetenceViewHelper.php b/module/Application/src/Application/View/Helper/CompetenceViewHelper.php deleted file mode 100644 index f1d34ae62647ce2b1a0fd4d23cc4aa5436487d6c..0000000000000000000000000000000000000000 --- a/module/Application/src/Application/View/Helper/CompetenceViewHelper.php +++ /dev/null @@ -1,33 +0,0 @@ -<?php - -namespace Application\View\Helper; - -use Application\Entity\Db\Competence; -use Application\View\Renderer\PhpRenderer; -use Zend\View\Helper\AbstractHelper; -use Zend\View\Helper\Partial; -use Zend\View\Resolver\TemplatePathStack; - -/** - * Class CompetenceViewHelper - * @package Application\View\Helper - * - * OPTION => li : affichée entre <li> </li> - * - */ -class CompetenceViewHelper extends AbstractHelper -{ - /** - * @param Competence $competence - * @param array $options - * @return string|Partial - */ - public function __invoke($competence, $options = []) - { - /** @var PhpRenderer $view */ - $view = $this->getView(); - $view->resolver()->attach(new TemplatePathStack(['script_paths' => [__DIR__ . "/partial"]])); - - return $view->partial('competence', ['competence' => $competence, 'options' => $options]); - } -} \ No newline at end of file diff --git a/module/Application/src/Application/View/Helper/partial/activite.phtml b/module/Application/src/Application/View/Helper/partial/activite.phtml index 3f0d1010398432d70622ccb020722b9715eee84c..9500d88219a25c5088b0c99986cb41b9183a5c7a 100644 --- a/module/Application/src/Application/View/Helper/partial/activite.phtml +++ b/module/Application/src/Application/View/Helper/partial/activite.phtml @@ -45,77 +45,77 @@ $nbFormation = count($formations); $nbObject = $nbCompetence + $nbFormation + $nbApplication; ?> +<!-- NOM DE L'ACTVITE ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> <div class="row"> + <div class="col-md-11" style="background-color:#d9edf7; margin-left: 2rem;"> + <div class="row"> + <div class="col-md-8"> + <h3 style="color:#3c6c8b;"> + <?php echo $activite->getLibelle(); ?> + <?php if ($canModifier AND $mode === 'modifier-activite') : ?> + <a + <?php /** @see ActiviteController::modifierLibelleAction() */?> + href="<?php echo $this->url("activite/modifier-libelle", ["activite" => $activite->getId()], [], true); ?>" + class="ajax-modal" + data-event="modification" + > + <span class="icon editer" title="Modifier le libellé associé à la mission"></span></a> + <?php endif; ?> + </h3> + </div> + <!-- DEPLACEMENT ET MANIPULATION DE LA LISTE DES ACTIVITES ------------------------------------------------> + <?php if ($mode == 'edition-fiche-metier') : ?> + <div class="col-md-4 pull-right"> + <?php /** @see ActiviteController::modifierAction() */ ?> + <a href="<?php echo $this->url('activite/modifier', ['activite' => $activite->getId()], [], true); ?>" + class="btn btn-default" + style="width:5rem; margin: 5px;" + target="_blank" + > + <span class="icon editer"></span><br/> + </a> - <!-- NOM DE L'ACTVITE ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> - <div class="col-md-10" style="margin-left:5rem;background-color:#d9edf7;"> - <h3 style="color:#3c6c8b;"> - <?php echo $activite->getLibelle(); ?> - <?php if ($canModifier AND $mode === 'modifier-activite') : ?> - <a - <?php /** @see ActiviteController::modifierLibelleAction() */?> - href="<?php echo $this->url("activite/modifier-libelle", ["activite" => $activite->getId()], [], true); ?>" - class="ajax-modal" - data-event="modification" - > - <span class="icon editer" title="Modifier le libellé associé à la mission"></span></a> - <?php endif; ?> - </h3> - </div> - <!-- SELECTION DES SOUS-ACTIVITE~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> - <div class="col-md-1" style="background-color:#d9edf7;"> - <h3> - <?php if ($mode === 'edition-fiche-poste') : ?> - <?php if ($ficheposte !== null AND $fichemetier !== null AND !empty($activite->getDescriptions())) : ?> - <a <?php /** @see \Application\Controller\FichePosteController::selectionnerDescriptionsRetireesAction() */ ?> - href="<?php echo $this->url('fiche-poste/selectionner-descriptions-retirees', ['fiche-poste' => $ficheposte->getId(), 'fiche-metier' => $fichemetier->getId(), 'activite' => $activite->getId()], [], true); ?>" - class="ajax-modal" data-event="modification"> - <span class="icon listing" title="Sélection des sous-activités"></span></a> - <?php else: ?> - <span class="icon listing" style="color:darkred;" title="Pas de fiche de poste, ou de fiche métier, ou pas de sous-activités"></span> + <?php /** @see FicheMetierController::retirerActiviteAction() */ ?> + <a href="<?php echo $this->url('fiche-metier-type/retirer-activite', ['id' => $type->getId()], [], true); ?>" + class="btn btn-default" + style="width:5rem; margin: 5px;"> + <span class="icon detruire"></span><br/> + </a> + + <?php /** @see FicheMetierController::deplacerActiviteAction() */ ?> + <a href="<?php echo $this->url('fiche-metier-type/deplacer-activite', ['id' => $type->getId(), 'direction' => 'up'], [], true); ?>" + class="btn btn-default" + style="width:5rem; margin: 5px;"> + <span class="icon monter"></span><br/> + </a> + + <?php /** @see FicheMetierController::deplacerActiviteAction() */ ?> + <a href="<?php echo $this->url('fiche-metier-type/deplacer-activite', ['id' => $type->getId(), 'direction' => 'down'], [], true); ?>" + class="btn btn-default" + style="width:5rem; margin: 5px;"> + <span class="icon descendre"></span><br/> + </a> + </div> <?php endif; ?> - <?php endif; ?> - - </h3> + <!-- SELECTION DES ACTIVITES ------------------------------------------------> + <?php if ($mode == 'edition-fiche-poste') : ?> + <div class="col-md-1 pull-right"> + <?php if ($ficheposte !== null AND $fichemetier !== null AND !empty($activite->getDescriptions())) : ?> + <a <?php /** @see \Application\Controller\FichePosteController::selectionnerDescriptionsRetireesAction() */ ?> + href="<?php echo $this->url('fiche-poste/selectionner-descriptions-retirees', ['fiche-poste' => $ficheposte->getId(), 'fiche-metier' => $fichemetier->getId(), 'activite' => $activite->getId()], [], true); ?>" + class="ajax-modal" data-event="modification"> + <span class="icon listing" title="Sélection des sous-activités"></span></a> + <?php else: ?> + <span class="icon listing" style="color:darkred;" title="Pas de fiche de poste, ou de fiche métier, ou pas de sous-activités"></span> + <?php endif; ?> + </div> + <?php endif ; ?> + </div> </div> </div> <div class="row"> -<!-- MODIFICATION DE L'ACTIVITE ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> -<?php if ($mode == 'edition-fiche-metier') : ?> - <div class="col-md-1" style="border:1px lightgray solid; padding: 5px; text-align: center;"> - <?php /** @see ActiviteController::modifierAction() */ ?> - <a href="<?php echo $this->url('activite/modifier', ['activite' => $activite->getId()], [], true); ?>" - class="btn btn-default" - style="width:5rem; margin: 5px;" - target="_blank" - > - <span class="icon editer"></span><br/> - </a> - <?php /** @see FicheMetierController::retirerActiviteAction() */ ?> - <a href="<?php echo $this->url('fiche-metier-type/retirer-activite', ['id' => $type->getId()], [], true); ?>" - class="btn btn-default" - style="width:5rem; margin: 5px;"> - <span class="icon detruire"></span><br/> - </a> - <?php /** @see FicheMetierController::deplacerActiviteAction() */ ?> - <a href="<?php echo $this->url('fiche-metier-type/deplacer-activite', ['id' => $type->getId(), 'direction' => 'up'], [], true); ?>" - class="btn btn-default" - style="width:5rem; margin: 5px;"> - <span class="icon monter"></span><br/> - </a> - <?php /** @see FicheMetierController::deplacerActiviteAction() */ ?> - <a href="<?php echo $this->url('fiche-metier-type/deplacer-activite', ['id' => $type->getId(), 'direction' => 'down'], [], true); ?>" - class="btn btn-default" - style="width:5rem; margin: 5px;"> - <span class="icon descendre"></span><br/> - </a> -</div> -<?php else: ?> - <div class="col-md-1"></div> -<?php endif; ?> - <!-- AFFICHAGE DES SOUS ACTIVITE ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> <div class="col-md-7"> <h4> diff --git a/module/Application/src/Application/View/Helper/partial/agent.phtml b/module/Application/src/Application/View/Helper/partial/agent.phtml index 43f358478e99dacf19aba7e1df8cfcaa89e9c724..a43e7e8bf3ffc4aea815be5516195a47ae23be87 100644 --- a/module/Application/src/Application/View/Helper/partial/agent.phtml +++ b/module/Application/src/Application/View/Helper/partial/agent.phtml @@ -32,10 +32,10 @@ if (isset($options["retour"])) $query["retour"] = $options["retour"]; <dd> <?php echo $agent->getNomUsuel(); ?> </dd> <dt> Quotité travaillée </dt> <dd> - <?php if ($agent->getQuotite() !== null) : ?> - <?php echo $agent->getQuotite(); ?>% - <?php else : ?> - <span style="color:darkred; font-style: italic;">Quotité travaillée non renseignée</span> + <?php if($quotite = $agent->getQuotiteCourante()) : ?> + <?php echo $quotite->getQuotite(); ?>% + <?php else: ?> + 100% <?php endif; ?> </dd> </dl> @@ -61,8 +61,7 @@ if (isset($options["retour"])) $query["retour"] = $options["retour"]; </div> </div> -<!-- todo si edition afficher tout de même --> -<?php if (!empty($agent->getMissionsSpecifiques())) : ?> +<?php if (!empty($agent->getMissionsSpecifiques()) OR $mode==='edition') : ?> <div class="row"> <div class="col-md-7"> <h2> @@ -73,10 +72,10 @@ if (isset($options["retour"])) $query["retour"] = $options["retour"]; <?php if ($mode === 'edition') : ?> <?php if ($canAjouterMission) : ?> <a - <?php /** @see \Application\Controller\AgentController::ajouterAgentMissionSpecifiqueAction() */?> - href="<?php echo $this->url('agent/ajouter-agent-mission-specifique', ['agent' => $agent->getId()], [], true); ?>" - class="ajax-modal btn btn-primary action pull-right" - data-event="modification" + <?php /** @see \Application\Controller\MissionSpecifiqueAffectationController::ajouterAction() */?> + href="<?php echo $this->url('mission-specifique/affectation/ajouter', [], ['query' => ['agent' => $agent->getId()]], true); ?>" + class="ajax-modal btn btn-primary action pull-right" + data-event="modification" > <span class="icon ajouter"></span>Ajouter une mission spécifique</a> <?php endif; ?> @@ -135,8 +134,8 @@ if (isset($options["retour"])) $query["retour"] = $options["retour"]; <?php endif; ?> <?php if ($canModifierMission) : ?> <a - <?php /** @see \Application\Controller\AgentController::modifierAgentMissionSpecifiqueAction() */?> - href="<?php echo $this->url('agent/modifier-agent-mission-specifique', ['agent-mission-specifique' => $mission->getId()], [], true); ?>" + <?php /** @see \Application\Controller\MissionSpecifiqueAffectationController::ajouterAction() */?> + href="<?php echo $this->url('mission-specifique/affectation/modifier', ['affectation' => $mission->getId()], ['query' => ['agent' => $agent->getId()]], true); ?>" class="ajax-modal" data-event="modification" > @@ -145,22 +144,22 @@ if (isset($options["retour"])) $query["retour"] = $options["retour"]; <?php if ($canHistoriserMission) : ?> <?php if ($mission->estNonHistorise()) : ?> <a - <?php /** @see \Application\Controller\AgentController::historiserAgentMissionSpecifiqueAction() */?> - href="<?php echo $this->url('agent/historiser-agent-mission-specifique', ['agent-mission-specifique' => $mission->getId()], ["query" => $query], true); ?>" + <?php /** @see \Application\Controller\MissionSpecifiqueAffectationController::historiserAction() */?> + href="<?php echo $this->url('mission-specifique/affectation/historiser', ['affectation' => $mission->getId()], ["query" => ["retour" => $options["retour"]]], true); ?>" > <span class="icon historiser"></span></a> <?php else : ?> <a - <?php /** @see \Application\Controller\AgentController::restaurerAgentMissionSpecifiqueAction() */?> - href="<?php echo $this->url('agent/restaurer-agent-mission-specifique', ['agent-mission-specifique' => $mission->getId()], ["query" => $query], true); ?>" + <?php /** @see \Application\Controller\MissionSpecifiqueAffectationController::restaurerAction() */?> + href="<?php echo $this->url('mission-specifique/affectation/restaurer', ['affectation' => $mission->getId()], ["query" => ["retour" => $options["retour"]]], true); ?>" > <span class="icon restaurer"></span></a> <?php endif; ?> <?php endif; ?> <?php if ($canDetruireMission) : ?> <a - <?php /** @see \Application\Controller\AgentController::detruireAgentMissionSpecifiqueAction() */?> - href="<?php echo $this->url('agent/detruire-agent-mission-specifique', ['agent-mission-specifique' => $mission->getId()], [], true); ?>" + <?php /** @see \Application\Controller\MissionSpecifiqueAffectationController::detruireAction() */?> + href="<?php echo $this->url('mission-specifique/affectation/detruire', ['affectation' => $mission->getId()], [], true); ?>" class="ajax-modal" data-event="modification" > diff --git a/module/Application/src/Application/View/Helper/partial/competence-bloc.phtml b/module/Application/src/Application/View/Helper/partial/competence-bloc.phtml new file mode 100644 index 0000000000000000000000000000000000000000..da3b83813a426c3dd07e7e6e538815b48fd94e73 --- /dev/null +++ b/module/Application/src/Application/View/Helper/partial/competence-bloc.phtml @@ -0,0 +1,101 @@ +<?php + +use Application\Entity\Db\Activite; +use Application\Entity\Db\Competence; +use Application\Entity\Db\FicheMetier; + +/** + * @var array $competences + * @var array $options + * + * la sutrcture de application est la suivante : + * + * $applications = [ + * ID => [ + * 'entite' => Application, + * 'display' => true|false, + * 'raison' => [ + * [ 'source', SourceEntity ], + * [ 'source', SourceEntity ], + * ... + * ] + * ], + * ... + * ] + */ + +$groupes = []; +$sansGroupe = "zzz"; +foreach ($competences as $item) { + /** @var Competence $competence */ + $competence = $item['entite']; + if ($competence) { + $libelleGroupe = ($competence->getType()) ? $competence->getType()->getLibelle() : $sansGroupe; + if ($item['conserve'] === true) $groupes[$libelleGroupe][] = $item; + } +} + +ksort($groupes); + +?> + +<table class="competences"> + <?php foreach ($groupes as $libelle => $groupe) : ?> + + <tr> + <?php if ($libelle !== $sansGroupe) : ?> + <th class="titre"> + <?php echo $groupe[0]['entite']->getType()->getLibelle(); ?> + </th> + <?php else : ?> + <th class="titre"> Sans groupe ... </th> + <?php endif; ?> + </tr> + + <?php usort ($groupe, function($a, $b) { return $a['entite']->getLibelle() > $b['entite']->getLibelle();}); ?> + + <?php foreach ($groupe as $item) : ?> + <tr> + <td class="libelle"> + <?php echo $item['entite']->getLibelle(); ?> + <?php foreach ($item['raison'] as $raison) : ?> + <?php $text = ""; + switch ($raison) { + case $raison instanceof FicheMetier : + $fm = $raison; + $text = $fm->getMetier()->getLibelle(); + $label = "F"; + $class = 'fiche-metier'; + break; + case $raison instanceof Activite : + $ac = $raison; + $text = $ac->getLibelle(); + $label = "A"; + $class = 'activite'; + } + ?> + <span class="<?php echo $class; ?>" title="<?php echo $text; ?>"><?php echo $label; ?></span> + <?php endforeach; ?> + </td> + </tr> + <?php endforeach; ?> + + <?php endforeach; ?> +</table> + +<style> + table.competences { + width:95%; + } + + table.applications th { + padding: 0.5rem; + color: white; + } + table.applications td.libelle { + padding-left: 1rem; + } + table.applications td.formation { + text-align: center; + } +</style> \ No newline at end of file diff --git a/module/Application/src/Application/View/Helper/partial/competence.phtml b/module/Application/src/Application/View/Helper/partial/competence.phtml deleted file mode 100644 index ac7af5ec51a049ffc308d8e42d8d6fdf2046f6fb..0000000000000000000000000000000000000000 --- a/module/Application/src/Application/View/Helper/partial/competence.phtml +++ /dev/null @@ -1,43 +0,0 @@ -<?php - -/** - * @var Competence $competence - * @var array $options - */ - -use Application\Entity\Db\Competence; - -$option_li = (isset($options['li']) AND $options['li'] === true ); -$option_theme = (isset($options['theme']) AND $options['theme'] === true ); -$option_type = (isset($options['type']) AND $options['type'] === true ); -$source = isset($options['source'])?$options['source']:[]; -?> - - -<?php if ($option_li) : ?> - <li> -<?php endif; ?> - <?php if ($option_type): ?> - <span class="badge <?php echo ($competence->getType())?$competence->getType()->getLibelle():"Sans type"; ?>"> - <?php echo ($competence->getType())?$competence->getType()->getLibelle():"Sans type"; ?> - </span> - <?php endif; ?> - <?php if ($option_theme): ?> - <?php echo ($competence->getTheme())?$competence->getTheme()->getLibelle():"Sans thème"; ?> - - <?php endif; ?> - <?php echo $competence->getLibelle(); ?> - <?php foreach($source as $item) : ?> - <?php $split = explode('|', $item); ?> - <?php if($split[0] === 'personne') : ?> - <span class="agent" title="Associée à l'agent'">P</span> - <?php endif; ?> - <?php if($split[0] === 'fiche') : ?> - <span class="fiche-metier" title="Associée à la fiche métier [<?php echo $split[1]; ?>]">F</span> - <?php endif; ?> - <?php if($split[0] === 'activite') : ?> - <span class="activite" title="Associée à l'activité [<?php echo $split[1]; ?>]">A</span> - <?php endif; ?> - <?php endforeach; ?> -<?php if ($option_li) : ?> - </li> -<?php endif; ?> diff --git a/module/Application/src/Application/View/Helper/partial/competences.phtml b/module/Application/src/Application/View/Helper/partial/competences.phtml deleted file mode 100644 index 52e9b61929c5ca2e52859f15782cc8d2e7137ab0..0000000000000000000000000000000000000000 --- a/module/Application/src/Application/View/Helper/partial/competences.phtml +++ /dev/null @@ -1,50 +0,0 @@ -<?php - -/** - * @var array $competences - * @var array $options - */ - -use Application\Entity\Db\Competence; -use Application\Entity\Db\CompetenceType; - -$option_theme = (isset($options['theme']) AND $options['theme'] === true ); -$option_type = (isset($options['type']) AND $options['type'] === true ); - -$types = []; -foreach ($competences as $id => $array) { - /** - * @var Competence $array['competence'] - * @var string[] $array['source'] - */ - $types[$array['competence']->getType()->getId()] = $array['competence']->getType(); -} - -$sortedTypes = []; -foreach ($types as $id => $type) { - $sortedTypes[] = $type; -} -usort($sortedTypes, function (CompetenceType $a, CompetenceType $b) { return $a->getOrdre()>$b->getOrdre();}); -$a= 1; -?> - -<?php foreach ($sortedTypes as $type) : ?> - <?php - $competencesType = []; - foreach ($competences as $id => $array) { - if ($array['competence']->getType()->getId() === $type->getId()) $competencesType[$id] = $array; - } - ?> - <h3> - <?php echo $type->getLibelle(); ?> - <span class="badge"> - <?php echo count($competencesType); ?> - </span> - </h3> - - <ul> - <?php foreach ($competencesType as $id => $array) : ?> - <?php echo $this->competence($array['competence'], ['li' => true, 'type' => $option_type, 'theme' => $option_theme, 'source' => $array['source']]); ?> - <?php endforeach; ?> - </ul> -<?php endforeach; ?> \ No newline at end of file diff --git a/module/Application/src/Application/View/Helper/partial/fiche-metier.phtml b/module/Application/src/Application/View/Helper/partial/fiche-metier.phtml index cf4ea7c5f8d667128ceed5183b5c01e7ba65b11d..1ae2ecb1bc39c5c6b214de0115f9fedfedef023a 100644 --- a/module/Application/src/Application/View/Helper/partial/fiche-metier.phtml +++ b/module/Application/src/Application/View/Helper/partial/fiche-metier.phtml @@ -1,29 +1,23 @@ <?php use Application\Controller\FicheMetierController; -use Application\Entity\Db\Application; -use Application\Entity\Db\Competence; use Application\Entity\Db\FicheMetier; use Application\Entity\Db\FicheMetierTypeActivite; use Application\Entity\Db\FichePoste; use Application\Entity\Db\FicheposteActiviteDescriptionRetiree; -use Application\Entity\Db\FicheposteApplicationRetiree; -use Application\Entity\Db\FicheposteCompetenceRetiree; -use Application\Entity\Db\ParcoursDeFormation; /** * @var FicheMetier $fichemetier * @var FichePoste $ficheposte + * @var array $options */ - $metier = $fichemetier->getMetier(); /** * @var FicheMetierTypeActivite[] $activites */ $activites = $fichemetier->getActivites(); -usort($activites, function (FicheMetierTypeActivite $a, FicheMetierTypeActivite $b) { return $a->getPosition() > $b->getPosition();}); $activitesListe = []; if (isset($options['activite-liste'])) { @@ -32,115 +26,125 @@ if (isset($options['activite-liste'])) { foreach ($activites as $activite) $activitesListe[] = $activite->getActivite()->getId(); } -$sansTitre = false; -if (isset($options['sans-titre'])) $sansTitre = ($options['sans-titre'] === true); +$sansTitre = (isset($options['sans-titre']) AND $options['sans-titre']); +$mode = $options['mode']; +?> + +<?php /** Watermark de l'identifiant de la fiche qui peut être utilisée pour des redirections **********************/ ?> +<span style="visibility:hidden;"> + Fiche métier #<?php echo $fichemetier->getId(); ?> +</span> -$parcours = (isset($options['parcours']))?$options['parcours']:null; +<?php /** DEBUG *****************************************************************************************************/?> -$a=1; +<?php + $DEBUG = false; + if ($DEBUG) : ?> +<div class="alert alert-warning"> + <h3> Debug de l'aide de vue FicheMetierViewHelper </h3> + + <dl class="dl-horizontal"> + <dt> FicheMetier.Id</dt> + <dd> <?php echo $fichemetier->getId(); ?> </dd> + <dt>Mode</dt> + <dd><?php echo $mode; ?></dd> + <dt>Titre</dt> + <dd><?php echo ($options['sans-titre'])?"Sans":"Avec"; ?></dd> + </dl> +</div> + +<?php endif; ?> + +<?php /** FICHE || ENTETE *******************************************************************************************/?> + <?php if ($sansTitre !== true) : ?> <div class="row"> <div class="col-md-8"> <h1 class="page-header"> - Fiche métier #<?php echo $fichemetier->getId(); ?> <br/> - <strong><?php echo $metier->getLibelle(); ?></strong> + <strong> <?php echo $metier->getLibelle(); ?> </strong> </h1> + + <?php if ($mode === 'affichage' OR $mode === 'edition-fiche-metier') : ?> + <?php if ($fichemetier->hasExpertise()) : ?> + <span class="label" style="background-color: darkgreen;"> Sujet à expertise </span> + <?php else: ?> + <span class="label" style="background-color: darkred;"> Non sujet à expertise </span> + <?php endif; ?> + <?php endif; ?> + + <?php if ($metier) : ?> + <?php foreach($metier->getReferences() as $reference) : ?> + <span class="label" style="background-color: #dfc4b2; margin-left: 1rem;"><a href="<?php echo $reference->getUrl(); ?>"> <?php echo $reference->getTitre(); ?> </a></span> + <?php endforeach; ?> + <?php endif; ?> </div> <div class="col-md-4"> - <?php if (isset($options['mode']) AND $options['mode'] === 'edition-fiche-metier') : ?> - <br/> - <br/> - <br/> <div class="pull-right" style="margin-right:1rem;"> - <?php /** @see FicheMetierController::editerLibelleAction() */ ?> - <a class="btn btn-primary action ajax-modal pull-right" - data-event="modification" - href="<?php echo $this->url('fiche-metier-type/editer-libelle', ['id' => $fichemetier->getId()], [] , true); ?>"> - <span class="icon editer"></span> - Modifier libellé - </a> - </div> - <?php endif; ?> - </div> - </div> - - <div class="row"> - <div class="col-md-8"> - <?php if ($fichemetier->hasExpertise()) : ?> - <span class="label" style="background-color: darkgreen;"> Expertise </span> - <?php else: ?> - <span class="label" style="background-color: darkred;"> Pas d'expertise </span> - <?php endif; ?> - - - - <?php if ($metier) : ?> - <?php foreach($metier->getReferences() as $reference) : ?> - <span class="badge" style="background-color: #dfc4b2"><a href="<?php echo $reference->getUrl(); ?>"> <?php echo $reference->getTitre(); ?> </a></span> - <?php endforeach; ?> - <?php endif; ?> - </div> - <div class="col-md-4"> - <div class="pull-right" style="margin-right:1rem;"> - <?php if (isset($options['mode']) AND $options['mode'] === 'edition-fiche-metier') : ?> - <a - <?php /** @see FicheMetierController::changerExpertiseAction() */?> - href="<?php echo $this->url('fiche-metier-type/changer-expertise', ['fiche' => $fichemetier->getId()], [], true); ?>" - class="btn btn-primary action" - > - <?php if ($fichemetier->hasExpertise()) : ?> - <span class="icon retirer"></span> - Retirer expertise - <?php else: ?> - <span class="icon ajouter"></span> - Ajouter expertise + <?php if (isset($options['mode']) AND $options['mode'] === 'edition-fiche-metier') : ?> + <br/> + <br/> + <br/> + <?php /** @see FicheMetierController::editerLibelleAction() */ ?> + <a class="btn btn-primary action ajax-modal pull-right" + data-event="modification" + href="<?php echo $this->url('fiche-metier-type/editer-libelle', ['id' => $fichemetier->getId()], [] , true); ?>"> + <span class="icon editer"></span> + Modifier libellé + </a> <?php endif; ?> - </a> - <?php endif; ?> + <?php if (isset($options['mode']) AND $options['mode'] === 'edition-fiche-metier') : ?> + <a + <?php /** @see FicheMetierController::changerExpertiseAction() */?> + href="<?php echo $this->url('fiche-metier-type/changer-expertise', ['fiche' => $fichemetier->getId()], [], true); ?>" + class="btn btn-primary action pull-right" + > + <?php if ($fichemetier->hasExpertise()) : ?> + <span class="icon retirer"></span> + Retirer expertise + <?php else: ?> + <span class="icon ajouter"></span> + Ajouter expertise + <?php endif; ?> + </a> + <?php endif; ?> + </div> </div> </div> -</div> <?php endif; ?> -<br/> - -<div class="main"> - -<!-- LIENS REFERENCE --------------------------------------------------------------------------------------------------> - - -<!-- MISSIONS PRINCIPALE ----------------------------------------------------------------------------------------------> +<?php /** FICHE || ACTIVITES / MISSIONS PRINCIPALES *****************************************************************/?> - <h2> Missions principales</h2> - <?php $nb = 0; ?> - - <ul> - <?php foreach ($activites as $activite) : ?> - <?php if (array_search($activite->getActivite()->getId(), $activitesListe) !== false) : ?> - <li> - <?php - $nb += 1; - echo $activite->getActivite()->getLibelle(); - ?> - </li> - <?php endif; ?> - <?php endforeach; ?> - </ul> -</div> - -<!-- ACTIVITES ASSOCIEES ------------------------------------------------------------------------------------------> +<?php + $activitesRestantes = $activites; + if ($ficheposte !== null) { + $activitesRestantes = []; + foreach ($activites as $activite) { + if (array_search($activite->getActivite()->getId(), $activitesListe) !== false) { + $activitesRestantes[] = $activite; + } + } + } +?> <div class="main"> + <div class="row"> - <div class="col-md-5"> + <div class="col-md-8"> <h2> - Activités associées - <span class="badge"> <?php echo $nb; ?>/<?php echo count($activites); ?> </span> + Missions principales + <span class="badge"> <?php echo count($activitesRestantes); ?>/<?php echo count($activites); ?> </span> </h2> + + <ul> + <?php foreach ($activitesRestantes as $activite) : ?> + <li> + <?php echo $activite->getActivite()->getLibelle(); ?> + </li> + <?php endforeach; ?> + </ul> </div> - <div class="pull-right" style="margin-right:1rem;"> - <br/> + <div class="col-md-4"> <?php if (isset($options['mode']) AND $options['mode'] === 'edition-fiche-metier') : ?> <?php /** @see FicheMetierController::ajouterNouvelleActiviteAction() */ ?> <a class="btn btn-primary action ajax-modal pull-right" @@ -150,6 +154,7 @@ $a=1; <span class="icon ajouter"></span> Ajouter une nouvelle activité </a> + <br/> <?php /** @see FicheMetierController::ajouterActiviteExistanteAction() */ ?> <a class="btn btn-primary action ajax-modal pull-right" data-event="modification" @@ -161,15 +166,12 @@ $a=1; </div> </div> - <?php $allRetirees = []; if ($ficheposte) $allRetirees = $ficheposte->getDescriptionsRetirees(); ?> - <?php foreach ($activites as $ficheActivite): ?> - <?php if (array_search($ficheActivite->getActivite()->getId(), $activitesListe) !== false) : ?> - <?php - $retirees = []; - if ($ficheposte) $retirees = FicheposteActiviteDescriptionRetiree::filtrer($ficheActivite->getActivite(), $allRetirees); - ?> - <?php echo $this->activite($ficheActivite, $options['mode'], ['ficheposte' => $ficheposte, 'fichemetier' => $fichemetier, 'retirees' => $retirees]); ?> - <?php endif; ?> + <?php foreach ($activitesRestantes as $ficheActivite): ?> + <?php + $retirees = []; + if ($ficheposte) $retirees = FicheposteActiviteDescriptionRetiree::filtrer($ficheActivite->getActivite(), $ficheposte->getDescriptionsRetirees()->toArray()); + ?> + <?php echo $this->activite($ficheActivite, $options['mode'], ['ficheposte' => $ficheposte, 'fichemetier' => $fichemetier, 'retirees' => $retirees]); ?> <?php endforeach;?> </div> @@ -177,53 +179,24 @@ $a=1; <?php if ($ficheposte === null) : ?> <div class="main"> -<!-- <h2> Parcours de formation pour la prise de poste</h2>--> - - <!-- COMPETENCES --------------------------------------------------------------------------------------------------> - <?php /** @var Competence $competence */ ?> - <?php - $dictionnaireCompetence = []; - foreach($fichemetier->getCompetences() as $competence) { - if ($ficheposte === null) { - $dictionnaireCompetence[$competence->getId()]['competence'] = $competence; - $dictionnaireCompetence[$competence->getId()]['source'][] = 'fiche|'. $metier->getLibelle(); - } - else { - $conservees = $ficheposte->getCompetencesRetirees(); - $found = null; - /** @var FicheposteCompetenceRetiree $conservee */ - foreach ($conservees as $conservee) { - if ($conservee->getHistoDestruction() === null AND $conservee->getCompetence() === $competence) { - $found = $conservee; - break; - } - } - if ($found === null) { - $dictionnaireCompetence[$competence->getId()]['competence'] = $competence; - $dictionnaireCompetence[$competence->getId()]['source'][] = 'fiche|'. $metier->getLibelle(); - } - } - } - foreach($fichemetier->getActivites() as $element) { - if (array_search($element->getActivite()->getId(), $activitesListe) !== false) { - foreach ($element->getActivite()->getCompetences() as $competence) { - $dictionnaireCompetence[$competence->getId()]['competence'] = $competence; - $dictionnaireCompetence[$competence->getId()]['source'][] = 'activite|' . $element->getActivite()->getLibelle(); - } - } - } - ?> + <!-- COMPETENCES --------------------------------------------------------------------------------------------------> - <div class="panel panel-info"> - <div class="panel-heading"> - <div class="row"> - <div class="col-md-8"> - <h2> - <span class="icon competence"></span> - Compétences - <span class="badge"> - <?php echo count($dictionnaireCompetence); ?> + <?php if (! isset($options['competences'])) : ?> + <div class="alert alert-danger"> + Le dictionnaire des compétences n'est pas fourni. + </div> + <?php else : ?> + <?php $dictionnaireCompetence = $options['competences']; ?> + <div class="panel panel-info"> + <div class="panel-heading"> + <div class="row"> + <div class="col-md-8"> + <h2> + <span class="icon competence"></span> + Compétences + <span class="badge"> + <?php echo count($dictionnaireCompetence); ?> </span> </h2> </div> @@ -242,107 +215,81 @@ $a=1; </div> </div> <div class="panel-body"> - <div class="row"> - <?php echo $this->competences($dictionnaireCompetence, ['type' => false, 'theme' => false]); ?> - </div> + <div class="col-md-1"></div> + <div class="col-md-10"><?php echo $this->competenceBloc($dictionnaireCompetence); ?></div> </div> </div> + <?php endif; ?> <!-- APPLICATION --------------------------------------------------------------------------------------------------> - <?php /** @var Application $application */ ?> - <?php - if (! isset($options['applications'])) { - $dictionnaireApplication = []; - foreach ($fichemetier->getApplications() as $application) { - if ($ficheposte === null) $dictionnaireApplication[$application->getLibelle()][] = 'fiche|' . $metier->getLibelle(); - else { - $conservees = $ficheposte->getApplicationsRetirees(); - $found = null; - /** @var FicheposteApplicationRetiree $conservee */ - foreach ($conservees as $conservee) { - if ($conservee->getHistoDestruction() === null and $conservee->getApplication() === $application) { - $found = $conservee; - break; - } - } - if ($found === null) { - $dictionnaireApplication[$application->getLibelle()][] = 'fiche|' . $metier->getLibelle(); - } - } - } - - foreach($fichemetier->getActivites() as $element) { - if (array_search($element->getActivite()->getId(), $activitesListe) !== false) { - foreach ($element->getActivite()->getApplications() as $application) { - $dictionnaireApplication[$application->getLibelle()][] = 'activite|' . $element->getActivite()->getLibelle(); - } - } - } - } else { - $dictionnaireApplication = $options['applications']; - } - ?> - - <div class="panel panel-info"> - <div class="panel-heading"> - <div class="row"> - <div class="col-md-8"> - <h2> - <span class="icon application"></span> - Applications - <span class="badge"> - <?php echo count($dictionnaireApplication); ?> - </span> - </h2> - </div> - <?php if (isset($options['mode']) AND $options['mode'] === 'edition-fiche-metier'): ?> - <div class="pull-right" style="margin-right:1rem;"> - <?php /** @see FicheMetierController::modifierApplicationAction() */ ?> - <a href="<?php echo $this->url('fiche-metier-type/modifier-application', ['id' => $fichemetier->getId()], [], true); ?>" - class="btn btn-primary action ajax-modal" - data-event="modification" - > - <span class="icon ajouter"></span> - Gérer les applications - </a> + <?php if (! isset($options['applications'])) : ?> + <div class="alert alert-danger"> + Le dictionnaire des applications n'est pas fourni. + </div> + <?php else : ?> + <?php $dictionnaireApplication = $options['applications']; ?> + <div class="panel panel-info"> + <div class="panel-heading"> + <div class="row"> + <div class="col-md-8"> + <h2> + <span class="icon application"></span> + Applications + <span class="badge"> + <?php echo count($dictionnaireApplication); ?> + </span> + </h2> + </div> + <?php if (isset($options['mode']) AND $options['mode'] === 'edition-fiche-metier'): ?> + <div class="pull-right" style="margin-right:1rem;"> + <?php /** @see FicheMetierController::modifierApplicationAction() */ ?> + <a href="<?php echo $this->url('fiche-metier-type/modifier-application', ['id' => $fichemetier->getId()], [], true); ?>" + class="btn btn-primary action ajax-modal" + data-event="modification" + > + <span class="icon ajouter"></span> + Gérer les applications + </a> + </div> + <?php endif; ?> </div> - <?php endif; ?> </div> - </div> - <div class="panel-body"> - <div class="row"> - <div class="col-md-1"></div> - <div class="col-md-10"><?php echo $this->applicationBloc($dictionnaireApplication); ?></div> + <div class="panel-body"> + <div class="row"> + <div class="col-md-1"></div> + <div class="col-md-10"><?php echo $this->applicationBloc($dictionnaireApplication); ?></div> + </div> </div> </div> - </div> + <?php endif; ?> <!-- FORMATION ----------------------------------------------------------------------------------------------------> - <!-- Parcours de formations --> - <div class="panel panel-info"> - <div class="panel-heading"> - <h2> - <span class="icon formation"></span> - Parcours de formation + <?php if (! isset($options['parcours'])) : ?> + <div class="alert alert-danger"> + Le parcours de formation n'est pas fourni. </div> - <div class="panel-body"> - - <?php if ($parcours[ParcoursDeFormation::TYPE_CATEGORIE] AND !empty($parcours[ParcoursDeFormation::TYPE_CATEGORIE])) : ?> - <div class="row"> - <div class="col-md-1"></div> - <div class="col-md-10"> - <?php foreach ($parcours[ParcoursDeFormation::TYPE_CATEGORIE] as $parcour) : ?> - <?php echo $this->parcoursDeFormation($parcour); ?> - <?php endforeach; ?> + <?php else : ?> + <?php $parcours = $options['parcours']['Catégorie']; ?> + <div class="panel panel-info"> + <div class="panel-heading"> + <h2> + <span class="icon formation"></span> + Parcours de formation + </div> + <div class="panel-body"> + <?php foreach ($parcours as $parcour) : ?> + <div class="row"> + <div class="col-md-1"></div> + <div class="col-md-10"> + <?php echo $this->parcoursDeFormation($parcour); ?> + </div> + </div> + <?php endforeach; ?> </div> </div> - <?php else : ?> - <span class="icon attention"> Aucun parcours de formation d'associé à cette fiche métier.</span> - <?php endif; ?> - </div> - </div> + <?php endif; ?> </div> <?php endif; ?> diff --git a/module/Application/src/Application/View/Helper/partial/parcours-de-formation.phtml b/module/Application/src/Application/View/Helper/partial/parcours-de-formation.phtml index 792e20c61122ce39110cb4aa4091bca9a796a433..b6763d13ac0ef2875c174678d7cdbca0d94e4034 100644 --- a/module/Application/src/Application/View/Helper/partial/parcours-de-formation.phtml +++ b/module/Application/src/Application/View/Helper/partial/parcours-de-formation.phtml @@ -2,7 +2,6 @@ use Application\Entity\Db\Agent; use Application\Entity\Db\Categorie; -use Formation\Entity\Db\Formation; use Formation\Entity\Db\FormationGroupe; use Application\Entity\Db\Metier; use Application\Entity\Db\ParcoursDeFormation; @@ -15,11 +14,19 @@ use Application\Entity\Db\ParcoursDeFormation; * @var array $option */ -$asListe = false; -$asArray=true; +/** Dans le tableau options, on retrouve une clef 'mode'. + * Si cette clef est omise alors la valeur par défaut "affichage" est utilisée. + * Valeur possible : + * - "affichage" ne fait que l'affichage (aucune interaction possible) + * >> Si un agent est renseigné affiche le "statut" du parcours de formation + * - "création" permet d'ajouter ou de retirer des formations au parcours + * - "modification" permet de valider le suivi d'une formations du parcours + * >> Si un agent est renseigné affiche le "statut" du parcours de formation + */ -$canModifier = isset($options['modification'])?$options['modification']:false; +$modesAutorises = ['affichage', 'creation', 'modification']; +/** Tri pour bonne affichage ******************************************************************************************/ $nogroup = "ZZZZ"; $formationArray = []; foreach ($parcours->getFormations() as $formation) { @@ -32,68 +39,79 @@ usort($formationArray, $ordre_a = ($a[0]->getGroupe())?$a[0]->getGroupe()->getOrdre():9999; $ordre_b = ($b[0]->getGroupe())?$b[0]->getGroupe()->getOrdre():9999; return $ordre_a > $ordre_b; -}); + }); +?> + +<?php /** Récupération du mode ****************************************************************************************/ + $mode = (isset($options['mode']))?$options['mode']:"affichage"; +?> + +<?php if (array_search($mode, $modesAutorises) === false) : ?> +<div class="alert alert-danger"> + Le <strong>mode</strong> [<?php echo $mode; ?>] est non géré par l'aide de vue [ParcoursDeFormationViewHelper]. +</div> +<?php endif; ?> +<?php /** Récupération du droit associé à la modification *************************************************************/ + $canModifier = isset($options['modification'])?$options['modification']:false; ?> -<h4> - <?php echo $parcours->getLibelle(); ?> -</h4> +<?php /** Titre du parcours de formation *****************************************************************************/ ?> -<?php if ($asListe) : ?> - <?php foreach ($formationArray as $groupe => $formationSubarray) : ?> - <?php if ($groupe !== $nogroup) : ?> - <?php echo $formationSubarray[0]->getGroupe()->getLibelle(); ?> - <?php else: ?> - <span class="badge">Sans groupe ...</span> +<div class="row"> + <div class="col-md-8"> + <h4> <?php echo $parcours->getLibelle(); ?> </h4> + </div> + <div class="pull-right"> + <?php if ($canModifier AND $mode === 'creation') : ?> + <?php /** @see \Application\Controller\ParcoursDeFormationController::ajouterFormationAction() */?> + <a href="<?php echo $this->url('parcours-de-formation/ajouter-formation', ['parcours-de-formation' => $parcours->getId()], [], true); ?>" + class="btn btn-primary action ajax-modal" data-event="modification"> + <span class="icon ajouter"></span>Ajouter des formations </a> <?php endif; ?> + </div> +</div> - <ul> - <?php foreach($formationSubarray as $formation) : ?> - <li> - <?php echo $formation->getLibelle(); ?> - <?php if ($agent !== null) : ?> - <?php $validatedFormation = $agent->hasValidatedFormation($formation); ?> - <?php if ($validatedFormation) : ?> - <span class="icon ok"></span> - <?php else : ?> - <span class="icon question"></span> - <?php endif; ?> - <?php endif; ?> - </li> - <?php endforeach; ?> - </ul> - <?php endforeach; ?> -<?php endif; ?> +<br/> + +<?php /** Affichage du tableau ****************************************************************************************/ ?> -<?php if ($asArray) : ?> +<div> <table class="parcours-de-formation"> <?php foreach ($formationArray as $groupe => $formationSubarray) : ?> + + <?php /** Barre de groupe de formation *******************************************************************/ ?> + <?php if ($groupe !== $nogroup) : ?> <?php /** @var FormationGroupe $groupe */ $groupe = $formationSubarray[0]->getGroupe(); ?> <tr> - <th class="titre" colspan="2"> + <th class="titre" colspan="3"> <?php echo ($groupe !== null)?$groupe->getLibelle():"Sans groupe ..."; ?> </th> </tr> <?php else : ?> <tr> - <th class="titre" colspan="2"> + <th class="titre" colspan="3"> Sans groupe ... </th> </tr> <?php endif; ?> + <?php /** Barre de formation ******************************************************************************/ ?> + <?php foreach($formationSubarray as $formation) : ?> <tr> <td class="libelle"> <?php echo $formation->getLibelle(); ?> </td> <td class="formation"> - <?php if ($agent !== null) : ?> - <?php $agentFormation = $agent->hasFormation($formation); ?> + <?php if ($mode === 'modification') : ?> + <?php + $agentFormation = ($agent !== null AND $agent->hasFormation($formation)) ? $agent->hasFormation($formation):null; + $agentValidation = ($agentFormation !== null AND $agentFormation->getValidation() !== null) ? $agentFormation->getValidation():null; + ?> <?php if ($agentFormation !== null) : ?> - <?php if ($agentFormation->getValidation()) : ?> - <?php if ($agentFormation->getValidation()->getValeur() === null) : ?> + <?php if ($agentValidation !== null) : ?> + <?php if ($agentValidation->getValeur() === null) : ?> <span class="icon ok" style="color: darkgreen;" data-toggle="tooltip" data-html="true" title="Validée le <?php echo $agentFormation->getValidation()->getHistoModification()->format('d/m/Y'); ?> par <?php echo $agentFormation->getValidation()->getHistoModificateur()->getDisplayName(); ?>" @@ -138,11 +156,20 @@ usort($formationArray, <?php endif; ?> <?php endif; ?> </td> + <td> + <?php if ($canModifier AND $mode === 'creation') : ?> + <?php /** @see \Application\Controller\ParcoursDeFormationController::retirerFormationAction() */ ?> + <a href="<?php echo $this->url('parcours-de-formation/retirer-formation', ['parcours-de-formation' => $parcours->getId(), 'formation' => $formation->getId()], [], true); ?>" + > + <span class="icon detruire" data-toogle="tooltip" data-html="true" title="Retirer la formation"></span> + </a> + <?php endif; ?> + </td> </tr> <?php endforeach; ?> <?php endforeach; ?> </table> -<?php endif; ?> +</div> <style> table.parcours-de-formation { diff --git a/module/Application/view/application/agent/afficher.phtml b/module/Application/view/application/agent/afficher.phtml index 4c2b8ea5e7cbae524313879dac4347d929c50364..cb6a0e893fea604a13afbd26485f98446bfe012d 100644 --- a/module/Application/view/application/agent/afficher.phtml +++ b/module/Application/view/application/agent/afficher.phtml @@ -3,15 +3,12 @@ use Application\Entity\Db\Agent; use Application\Entity\Db\EntretienProfessionnel; use Application\Provider\Privilege\AgentPrivileges; -use UnicaenUtilisateur\Entity\Db\Role; use UnicaenUtilisateur\Entity\Db\User; /** * @see AgentController::afficherAction() * @var Agent $agent * @var EntretienProfessionnel[] $entretiens - * @var User $user - * @var Role $role * @var User[] $responsables */ @@ -62,25 +59,12 @@ $this->headTitle("Affichage de l'agent : " . $agent->getDenomination()); <dd> <?php echo $agent->getNomUsuel(); ?> </dd> - <dt> Quotité travaillée - <?php if ($canModifier): ?> - <a - <?php /** @see \Application\Controller\AgentController::modifierAction() */?> - href="<?php echo $this->url('agent/modifier', ['agent' => $agent->getId()], [], true); ?>" - class="ajax-modal" - data-event="modification" - > - <span class="icon editer" data-toggle="tooltip" title="Modifier la quotité travaillée"></span></a> - <?php endif; ?> - </dt> + <dt> Quotité travaillée </dt> <dd> - <?php if($agent->getQuotite()) : ?> - <?php echo $agent->getQuotite(); ?>% + <?php if($quotite = $agent->getQuotiteCourante()) : ?> + <?php echo $quotite->getQuotite(); ?>% <?php else: ?> - <span class="probleme"> - <span class="icon attention"></span> - <em> Aucune quotité de renseignée </em> - </span> + 100% <?php endif; ?> </dd> </div> diff --git a/module/Application/view/application/agent/index.phtml b/module/Application/view/application/agent/index.phtml index f63a85b7aefb08b31e4f778d1791fd6dc5305dfd..ec918e8bce35c35bf267126ecfef5576bd5562d5 100644 --- a/module/Application/view/application/agent/index.phtml +++ b/module/Application/view/application/agent/index.phtml @@ -3,6 +3,7 @@ /** * @see \Application\Controller\AgentController::indexAction() * @var Agent[] $agents + * @var Boolean[] $filtres */ use Application\Entity\Db\Agent; @@ -32,6 +33,8 @@ $canAfficher = $this->isAllowed(AgentPrivileges::getResourceId(AgentPrivileges:: <div class="main"> + <?php echo $this->partial('partial/filtre_statut', ['url' => $this->url('agent'), 'filtres' => $filtres]); ?> + <?php if (count($agents) > 0) : ?> <table id="agents" class="datatable table table-condensed"> <thead> diff --git a/module/Application/view/application/agent/partial/filtre_statut.phtml b/module/Application/view/application/agent/partial/filtre_statut.phtml new file mode 100644 index 0000000000000000000000000000000000000000..4c13c1bf86bc07cd03367a1bae5c769157df06c1 --- /dev/null +++ b/module/Application/view/application/agent/partial/filtre_statut.phtml @@ -0,0 +1,50 @@ +<?php + +/** + * @var string $url + * @var Boolean[] $filtres $url + */ +?> + +<div class="filtre"> + <form method="get" action="<?php echo $url; ?>"> + <div class="row"> + <div class="col-md-7"> + <label for="titulaire">Titulaire </label> + <input id="titulaire" name="titulaire" type="checkbox" <?php if ($filtres['titulaire']) echo " checked "; ?>/> + <label for="cdi">C.D.I. </label> + <input id="cdi" name="cdi" type="checkbox" <?php if ($filtres['cdi']) echo " checked "; ?>/> + <label for="cdd">C.D.D. </label> + <input id="cdd" name="cdd" type="checkbox" <?php if ($filtres['cdd']) echo " checked "; ?>/> + <br/> + <label for="administratif">Administratif </label> + <input id="administratif" name="administratif" type="checkbox" <?php if ($filtres['administratif']) echo " checked "; ?>/> + <label for="chercheur">Chercheur </label> + <input id="chercheur" name="chercheur" type="checkbox" <?php if ($filtres['chercheur']) echo " checked "; ?>/> + <label for="enseignant">Enseignant </label> + <input id="enseignant" name="enseignant" type="checkbox" <?php if ($filtres['enseignant']) echo " checked "; ?>/> + <label for="vacataire">Vacataire </label> + <input id="vacataire" name="vacataire" type="checkbox" <?php if ($filtres['vacataire']) echo " checked "; ?>/> + </div> + <div class="col-md-3"> + <button class="btn btn-primary action"> + <span class="icon filtrer"></span> + Filtrer + </button> + </div> + </div> + </form> +</div> + +<style> + div.filtre { + border: 1px #123456 solid; + background: whitesmoke; + border-radius : 1rem; + padding : 1rem; + margin: 1rem; + } + label { + padding-left: 2rem; + } +</style> \ No newline at end of file diff --git a/module/Application/view/application/agent/partial/mission-specifique.phtml b/module/Application/view/application/agent/partial/mission-specifique.phtml index db8baaf280d2ba15abba7f150fcb4b670ffc1564..8c4682046bf01bc22fabd2f06c0663e0e552f207 100644 --- a/module/Application/view/application/agent/partial/mission-specifique.phtml +++ b/module/Application/view/application/agent/partial/mission-specifique.phtml @@ -17,15 +17,20 @@ $canDetruireMission = $droits['detruire']; ?> +<span id="mission_specifique"></span> +<br/> +<br/> + <div class="row"> <div class="col-md-8"> <h2> Missions spécifiques </h2> </div> <div class="pull-right"> <?php if ($canAjouterMission) : ?> + <br/> <a - <?php /** @see \Application\Controller\AgentController::ajouterAgentMissionSpecifiqueAction() */?> - href="<?php echo $this->url('agent/ajouter-agent-mission-specifique', ['agent' => $agent->getId()], [], true); ?>" + <?php /** @see \Application\Controller\MissionSpecifiqueAffectationController::ajouterAction() */?> + href="<?php echo $this->url('mission-specifique/affectation/ajouter', [], ['query' => ['agent' => $agent->getId()]], true); ?>" class="ajax-modal btn btn-primary action" data-event="modification" > @@ -35,6 +40,9 @@ $canDetruireMission = $droits['detruire']; <?php endif; ?> </div> </div> + +<br/> + <div> <table class="table table-condensed datatable"> <thead> @@ -78,8 +86,8 @@ $canDetruireMission = $droits['detruire']; <?php endif; ?> <?php if ($canModifierMission) : ?> <a - <?php /** @see \Application\Controller\AgentController::modifierAgentMissionSpecifiqueAction() */?> - href="<?php echo $this->url('agent/modifier-agent-mission-specifique', ['agent-mission-specifique' => $mission->getId()], [], true); ?>" + <?php /** @see \Application\Controller\MissionSpecifiqueAffectationController::modifierAction() */?> + href="<?php echo $this->url('mission-specifique/affectation/modifier', ['affectation' => $mission->getId()], ['query' => ['agent' => $agent->getId()]], true); ?>" class="ajax-modal" data-event="modification" > @@ -88,22 +96,22 @@ $canDetruireMission = $droits['detruire']; <?php if ($canHistoriserMission) : ?> <?php if ($mission->estNonHistorise()) : ?> <a - <?php /** @see \Application\Controller\AgentController::historiserAgentMissionSpecifiqueAction() */?> - href="<?php echo $this->url('agent/historiser-agent-mission-specifique', ['agent-mission-specifique' => $mission->getId()], [], true); ?>" + <?php /** @see \Application\Controller\MissionSpecifiqueAffectationController::historiserAction() */?> + href="<?php echo $this->url('mission-specifique/affectation/historiser', ['affectation' => $mission->getId()], ["query" => ["retour" => $this->url('agent/afficher', ['agent' => $agent->getId()], ['fragment' => 'mission_specifique'], true)]], true); ?>" > <span class="icon historiser"></span></a> <?php else : ?> <a - <?php /** @see \Application\Controller\AgentController::restaurerAgentMissionSpecifiqueAction() */?> - href="<?php echo $this->url('agent/restaurer-agent-mission-specifique', ['agent-mission-specifique' => $mission->getId()], [], true); ?>" + <?php /** @see \Application\Controller\MissionSpecifiqueAffectationController::restaurerAction() */?> + href="<?php echo $this->url('mission-specifique/affectation/restaurer', ['affectation' => $mission->getId()], ["query" => ["retour" => $this->url('agent/afficher', ['agent' => $agent->getId()], ['fragment' => 'mission_specifique'], true)]], true); ?>" > - <span class="icon historiser"></span></a> + <span class="icon restaurer"></span></a> <?php endif; ?> <?php endif; ?> <?php if ($canDetruireMission) : ?> <a - <?php /** @see \Application\Controller\AgentController::detruireAgentMissionSpecifiqueAction() */?> - href="<?php echo $this->url('agent/detruire-agent-mission-specifique', ['agent-mission-specifique' => $mission->getId()], [], true); ?>" + <?php /** @see \Application\Controller\MissionSpecifiqueAffectationController::detruireAction() */?> + href="<?php echo $this->url('mission-specifique/affectation/detruire', ['affectation' => $mission->getId()], [], true); ?>" class="ajax-modal" data-event="modification" > diff --git a/module/Application/view/application/corps/afficher-agents-avec-corps.phtml b/module/Application/view/application/corps/afficher-agents-avec-corps.phtml index 3c8907170bd196d662efd581df81459df225a099..034fba6a11ebba26990596669de6e1453c4d69ab 100644 --- a/module/Application/view/application/corps/afficher-agents-avec-corps.phtml +++ b/module/Application/view/application/corps/afficher-agents-avec-corps.phtml @@ -3,13 +3,16 @@ /** * @see \Application\Controller\CorpsController::afficherAgentsAvecCorpsAction(); * @var Corps $corps - * @var AgentGrade[] $agents */ use Application\Entity\Db\AgentGrade; use Application\Entity\Db\Corps; $now = new DateTime(); + +/** @var AgentGrade[] $agents */ +$agents = $corps->getAgentGrades(); +usort($agents, function(AgentGrade $a, AgentGrade $b) {return $a->getAgent()->getDenomination() > $b->getAgent()->getDenomination();}); ?> <dl class="dl-horizontal"> diff --git a/module/Application/view/application/corps/afficher-agents-avec-correspondance.phtml b/module/Application/view/application/corps/afficher-agents-avec-correspondance.phtml new file mode 100644 index 0000000000000000000000000000000000000000..9d3b30bf1466c9dbdcc9a1070f87c9dbad0b842a --- /dev/null +++ b/module/Application/view/application/corps/afficher-agents-avec-correspondance.phtml @@ -0,0 +1,47 @@ +<?php + +/** + * @see \Application\Controller\CorpsController::afficherAgentsAvecCorrespondanceAction(); + * @var Correspondance $correspondance + */ + +use Application\Entity\Db\AgentGrade; +use Application\Entity\Db\Correspondance; + +$now = new DateTime(); + +/** @var AgentGrade[] $agents */ +$agents = $correspondance->getAgentGrades(); +usort($agents, function(AgentGrade $a, AgentGrade $b) {return $a->getAgent()->getDenomination() > $b->getAgent()->getDenomination();}); +?> + +<dl class="dl-horizontal"> + <dt> Correspondance </dt> + <dd>[#<?php echo $correspondance->getId(); ?>] <?php echo $correspondance->getLibelleLong(); ?></dd> + <dt> #AgentGrade </dt> + <dd> <?php echo count($agents); ?></dd> +</dl> + +<table class="table table-condensed"> + <thead> + <tr> + <th> Id </th> + <th> Agent </th> + <th> Début </th> + <th> Fin </th> + </tr> + </thead> + <tbody> + <?php foreach ($agents as $agent) : ?> + <tr <?php if ($agent->getDateFin() AND $agent->getDateFin() < $now) echo 'class="historise"'; ?> > + <td> <?php echo $agent->getId(); ?> </td> + <td> <?php echo $agent->getAgent()->getDenomination(); ?> </td> + <td> <?php echo ($agent->getDateDebut()) ? $agent->getDateDebut()->format('d/m/Y') : "---"; ?> </td> + <td> <?php echo ($agent->getDateFin()) ? $agent->getDateFin()->format('d/m/Y') : "---"; ?> </td> + </tr> + <?php endforeach; ?> + </tbody> +</table> + + + diff --git a/module/Application/view/application/corps/afficher-agents-avec-grade.phtml b/module/Application/view/application/corps/afficher-agents-avec-grade.phtml index 7bf97cc82ef0b1aa263fdbcae0a0ca7c1b397582..09a46a49e3e8da20ee157857af1293a3ca462a71 100644 --- a/module/Application/view/application/corps/afficher-agents-avec-grade.phtml +++ b/module/Application/view/application/corps/afficher-agents-avec-grade.phtml @@ -3,13 +3,16 @@ /** * @see \Application\Controller\CorpsController::afficherAgentsAvecGradeAction(); * @var Grade $grade - * @var AgentGrade[] $agents */ use Application\Entity\Db\AgentGrade; use Application\Entity\Db\Grade; $now = new DateTime(); + +/** @var AgentGrade[] $agents */ +$agents = $grade->getAgentGrades(); +usort($agents, function(AgentGrade $a, AgentGrade $b) {return $a->getAgent()->getDenomination() > $b->getAgent()->getDenomination();}); ?> <dl class="dl-horizontal"> diff --git a/module/Application/view/application/corps/index.phtml b/module/Application/view/application/corps/index.phtml index 9a801761a25e5fc9ba5884767cdb4ccf88a283c2..5e5c6f38f473ac18a893776c902fc1491733fbc5 100644 --- a/module/Application/view/application/corps/index.phtml +++ b/module/Application/view/application/corps/index.phtml @@ -82,105 +82,17 @@ $canModifier = $this->isAllowed(CorpsPrivileges::getResourceId(CorpsPrivileges:: <!-- CORPS ------------------------------------------------------------------------------------------------> <div id="corps" class="tab-pane " role="tabpanel"> - <table class="datatable table table-condensed"> - <thead> - <tr> - <th> Libellé long</th> - <th> Libellé court</th> - <th> Code </th> - <th> Catégorie </th> - <th> Niveau </th> - <th style="width:3rem;"> Action </th> - </tr> - </thead> - <tbody> - <?php foreach($corps as $corp): ?> - <tr> - <td> <?php echo $corp->getLibelleLong(); ?> </td> - <td> <?php echo $corp->getLibelleCourt(); ?> </td> - <td> <?php echo $corp->getCode(); ?> </td> - <td> <?php echo $corp->getCategorie(); ?> </td> - <td> <?php echo $corp->getNiveau(); ?></td> - <td> - <?php if ($canModifier) : ?> - <a - <?php /** @see \Application\Controller\CorpsController::modifierNiveauAction() */ ?> - href="<?php echo $this->url('corps/modifier-niveau', ['corps' => $corp->getId()], ['fragment' => 'corps'], true); ?>" - class="ajax-modal" data-event="modification" - > - <span class="icon editer" data-toggle="tooltip" data-html="true" - title="Modifier le niveu du corps"></span></a> - <?php endif; ?> - <?php if ($canAfficher) : ?> - <a - <?php /** @see \Application\Controller\CorpsController::afficherAgentsAvecCorpsAction() */ ?> - href="<?php echo $this->url('corps/afficher-agents-avec-corps', ['corps' => $corp->getId()], ['fragment' => 'corps'], true); ?>" - class="ajax-modal" data-event="modification" - > - <span class="icon voir" data-toggle="tooltip" data-html="true" - title="Afficher les agents ayant ce corps"></span></a> - <?php endif; ?> - </td> - </tr> - <?php endforeach; ?> - </tbody> - </table> + <?php echo $this->partial('partial/index-corps', ['corps' => $corps, 'canAfficher' => $canAfficher, 'canModifier' => $canModifier]); ?> </div> <!-- GRADES -----------------------------------------------------------------------------------------------> <div id="grade" class="tab-pane " role="tabpanel"> - <table class="datatable table table-condensed"> - <thead> - <tr> - <th> Libellé long </th> - <th> Libellé court </th> - <th> Code </th> - <th> Action </th> - </tr> - </thead> - <tbody> - <?php foreach($grades as $grade): ?> - <tr> - <td> <?php echo $grade->getLibelleLong(); ?> </td> - <td> <?php echo $grade->getLibelleCourt(); ?> </td> - <td> <?php echo $grade->getCode(); ?> </td> - <td> - <?php if ($canAfficher) : ?> - <a - <?php /** @see \Application\Controller\CorpsController::afficherAgentsAvecGradeAction() */ ?> - href="<?php echo $this->url('corps/afficher-agents-avec-grade', ['grade' => $grade->getId()], ['fragment' => 'corps'], true); ?>" - class="ajax-modal" data-event="modification" - > - <span class="icon voir" data-toggle="tooltip" data-html="true" - title="Afficher les agents ayant ce grade"></span></a> - <?php endif; ?> - </td> - </tr> - <?php endforeach; ?> - </tbody> - </table> + <?php echo $this->partial('partial/index-grade', ['grades' => $grades, 'canAfficher' => $canAfficher, 'canModifier' => $canModifier]); ?> </div> <!-- CORRESPONDANCES --------------------------------------------------------------------------------------> <div id="correspondance" class="tab-pane " role="tabpanel"> - <table class="datatable table table-condensed"> - <thead> - <tr> - <th> Libellé long </th> - <th> Libellé court </th> - <th> Catégorie </th> - </tr> - </thead> - <tbody> - <?php foreach($correspondances as $correspondance): ?> - <tr> - <td> <?php echo $correspondance->getLibelleLong(); ?> </td> - <td> <?php echo $correspondance->getLibelleCourt(); ?> </td> - <td> <?php echo $correspondance->getCategorie(); ?> </td> - </tr> - <?php endforeach; ?> - </tbody> - </table> + <?php echo $this->partial('partial/index-correspondance', ['correspondances' => $correspondances, 'canAfficher' => $canAfficher, 'canModifier' => $canModifier]); ?> </div> </div> diff --git a/module/Application/view/application/corps/partial/index-corps.phtml b/module/Application/view/application/corps/partial/index-corps.phtml new file mode 100644 index 0000000000000000000000000000000000000000..da0c3688a29285f613468fa9bb3ebe8e6f6e0a8d --- /dev/null +++ b/module/Application/view/application/corps/partial/index-corps.phtml @@ -0,0 +1,60 @@ +<?php + +/** + * @var Corps[] $corps + * @var bool $canAfficher + * @var bool $canModifier + */ + +use Application\Entity\Db\Corps; + +?> + +<table class="datatable table table-condensed"> + <thead> + <tr> + <th style="width:70%;"> Libellé</th> + <th> #Agent/Grade </th> + <th> Catégorie </th> + <th> Niveau </th> + <th style="width:3rem;"> Action </th> + </tr> + </thead> + <tbody> + <?php foreach($corps as $corp): ?> + <tr> + <td> + <span + title="<?php echo $corp->generateTooltip(); ?>" + data-toggle="tooltip" data-html="true" + > + <?php echo $corp->getLibelleLong(); ?> + </span> + </td> + <td> <?php echo count($corp->getAgentGrades()); ?> </td> + <td> <?php echo $corp->getCategorie(); ?> </td> + <td> <?php echo $corp->getNiveau(); ?></td> + <td> + <?php if ($canModifier) : ?> + <a + <?php /** @see \Application\Controller\CorpsController::modifierNiveauAction() */ ?> + href="<?php echo $this->url('corps/modifier-niveau', ['corps' => $corp->getId()], ['fragment' => 'corps'], true); ?>" + class="ajax-modal" data-event="modification" + > + <span class="icon editer" data-toggle="tooltip" data-html="true" + title="Modifier le niveu du corps"></span></a> + <?php endif; ?> + <?php if ($canAfficher) : ?> + <a + <?php /** @see \Application\Controller\CorpsController::afficherAgentsAvecCorpsAction() */ ?> + href="<?php echo $this->url('corps/afficher-agents-avec-corps', ['corps' => $corp->getId()], ['fragment' => 'corps'], true); ?>" + class="ajax-modal" data-event="modification" + > + <span class="icon voir" data-toggle="tooltip" data-html="true" + title="Afficher les agents ayant ce corps"></span></a> + <?php endif; ?> + </td> + </tr> + <?php endforeach; ?> + </tbody> +</table> \ No newline at end of file diff --git a/module/Application/view/application/corps/partial/index-correspondance.phtml b/module/Application/view/application/corps/partial/index-correspondance.phtml new file mode 100644 index 0000000000000000000000000000000000000000..d9a75f5c334a25852960a978cece654c3bdb6ff0 --- /dev/null +++ b/module/Application/view/application/corps/partial/index-correspondance.phtml @@ -0,0 +1,46 @@ +<?php + +/** + * @var Correspondance[] $correspondances + * @var bool $canAfficher + * @var bool $canModifier + */ + +use Application\Entity\Db\Correspondance; + +?> +<table class="datatable table table-condensed"> + <thead> + <tr> + <th> Libellé long </th> + <th> Catégorie </th> + <th> #Agent/Grade </th> + <th> Action </th> + </tr> + </thead> + <tbody> + <?php foreach($correspondances as $correspondance): ?> + <tr> + <td> + <span title="<?php echo $correspondance->generateTooltip(); ?>" + data-toggle="tooltip" data-html="true"> + <?php echo $correspondance->getLibelleLong(); ?> + </span> + </td> + <td> <?php echo $correspondance->getCategorie(); ?> </td> + <td> <?php echo count($correspondance->getAgentGrades()); ?> </td> + <td> + <?php if ($canAfficher) : ?> + <a + <?php /** @see \Application\Controller\CorpsController::afficherAgentsAvecCorrespondanceAction() */ ?> + href="<?php echo $this->url('corps/afficher-agents-avec-correspondance', ['correspondance' => $correspondance->getId()], ['fragment' => 'correspondance'], true); ?>" + class="ajax-modal" data-event="modification" + > + <span class="icon voir" data-toggle="tooltip" data-html="true" + title="Afficher les agents ayant cette correspondance"></span></a> + <?php endif; ?> + </td> + </tr> + <?php endforeach; ?> + </tbody> +</table> \ No newline at end of file diff --git a/module/Application/view/application/corps/partial/index-grade.phtml b/module/Application/view/application/corps/partial/index-grade.phtml new file mode 100644 index 0000000000000000000000000000000000000000..509467edd274eb4395ccb13cef4e0210e7252542 --- /dev/null +++ b/module/Application/view/application/corps/partial/index-grade.phtml @@ -0,0 +1,47 @@ +<?php + +/** + * @var Grade[] $grades + * @var bool $canAfficher + * @var bool $canModifier + */ + +use Application\Entity\Db\Grade; + +?> + +<table class="datatable table table-condensed"> + <thead> + <tr> + <th style="width:70%;"> Libellé </th> + <th> #Agent/Grade </th> + <th> Action </th> + </tr> + </thead> + <tbody> + <?php foreach($grades as $grade): ?> + <tr> + <td> + <span + title="<?php echo $grade->generateTooltip(); ?>" + data-toggle="tooltip" data-html="true" + > + <?php echo $grade->getLibelleLong(); ?> + </span> + </td> + <td> <?php echo count($grade->getAgentGrades()); ?> </td> + <td> + <?php if ($canAfficher) : ?> + <a + <?php /** @see \Application\Controller\CorpsController::afficherAgentsAvecGradeAction() */ ?> + href="<?php echo $this->url('corps/afficher-agents-avec-grade', ['grade' => $grade->getId()], ['fragment' => 'corps'], true); ?>" + class="ajax-modal" data-event="modification" + > + <span class="icon voir" data-toggle="tooltip" data-html="true" + title="Afficher les agents ayant ce grade"></span></a> + <?php endif; ?> + </td> + </tr> + <?php endforeach; ?> + </tbody> +</table> \ No newline at end of file diff --git a/module/Application/view/application/entretien-professionnel/afficher.phtml b/module/Application/view/application/entretien-professionnel/afficher.phtml index 66b304d648e7ae02d882b450abeb371b1b7ed103..4b18b4a0c6557f592ab7105a45bc58d5ad4aa52a 100644 --- a/module/Application/view/application/entretien-professionnel/afficher.phtml +++ b/module/Application/view/application/entretien-professionnel/afficher.phtml @@ -23,34 +23,18 @@ $this->headTitle('Édition de l\'entretien professionnel'); <?php echo $this->partial('partial/header', ['entretien' => $entretien, 'agent' => $agent, 'fichespostes' => $fichespostes, 'fichesmetiers' => $fichesmetiers], [], true); ?> +<?php +$instance = $entretien->getFormulaireInstance(); +$formulaire = $instance->getFormulaire(); +$reponses = $instance->getReponses(); + +/** nécessaire car l'aide de vue var utiliser l'id du champ comme référence dans le tableau ... */ +$data = []; +foreach ($reponses as $reponse) { + $data[$reponse->getChamp()->getId()] = $reponse; +} - <div class="affichage-autoform"> - Chargment des informations provenant du formulaire ... - </div> - -<script> - //$( document ).ready(function() { - var url = <?php - /** - * @var Autoform\Entity\Db\Formulaire $formulaire - * @var string $retour - */ - $formulaire = $entretien->getFormulaireInstance()->getFormulaire(); - $retour = $this->url('entretien-professionnel/modifier', ['entretien' => $entretien->getId()], ['force_canonical' => false], true); - $url = $this->url('autoform/formulaire/afficher-resultat', ['formulaire' => $formulaire->getId(), 'instance' => $entretien->getFormulaireInstance()->getId()], ['query' => ['retour' => $retour], 'force_canonical' => false], true); - echo "'".$url."'"; - ?>; - console.log(url); - - $.ajax({ - type: "GET", - url: url, - success: - function (retour) { - $("div.affichage-autoform").html(retour); - } - }); - //}); -</script> +echo $this->instanceAsText()->render($instance); +?> diff --git a/module/Application/view/application/entretien-professionnel/partial/header.phtml b/module/Application/view/application/entretien-professionnel/partial/header.phtml index 19411aa265f149b20810dff76ec0f996aaae14af..8970bbb718c1b07cf2a8eb3f4ae58226c11f0d65 100644 --- a/module/Application/view/application/entretien-professionnel/partial/header.phtml +++ b/module/Application/view/application/entretien-professionnel/partial/header.phtml @@ -66,23 +66,8 @@ use Application\Entity\Db\FichePoste; </div> </div> - <div class="panel panel-info"> - <div class="panel-heading"> - <h2>Informations complémentaires</h2> - </div> - <div class="panel-body"> - <dl class="dl-horizontal"> - <dt> Responsable </dt> - <dd> <?php echo $entretien->getResponsable()->getDisplayName(); ?> </dd> - <dt> Année </dt> - <dd> <?php echo $entretien->getAnnee(); ?> </dd> - <dt> Date </dt> - <dd> <?php echo $entretien->getDateEntretien()->format('d/m/Y'); ?> </dd> - </dl> - </div> - </div> - </div> + </div> <div class="col-md-6"> <div class="panel panel-info"> <div class="panel-heading"> @@ -118,4 +103,67 @@ use Application\Entity\Db\FichePoste; </div> </div> </div> +</div> + +<div class="row"> + <div class="col-md-6"> + <div class="panel panel-info"> + <div class="panel-heading"> + <h2>Informations complémentaires</h2> + </div> + <div class="panel-body"> + <dl class="dl-horizontal"> + <dt> Responsable </dt> + <dd> <?php echo $entretien->getResponsable()->getDisplayName(); ?> </dd> + <dt> Année </dt> + <dd> <?php echo $entretien->getAnnee(); ?> </dd> + <dt> Date </dt> + <dd> <?php echo $entretien->getDateEntretien()->format('d/m/Y à H:i'); ?> </dd> + <dt> Lieu </dt> + <dd> <?php echo $entretien->getLieu(); ?> </dd> + </dl> + </div> + </div> + </div> + + <div class="col-md-6"> + <div class="panel panel-info"> + <div class="panel-heading"> + <h2>Validation de l'entretien</h2> + </div> + <div class="panel-body"> + <dl> + <dt>Validation initial de l'agent </dt> + <dd><?php echo ($entretien->getToken() === null) ? "Oui" : "Pas encore effectuée"; ?> </dd> + <dt>Validation du responsable hiérarchique </dt> + <dd> + <?php if ($entretien->getValidationResponsable()) : ?> + Faites par <?php echo $entretien->getValidationResponsable()->getHistoModificateur()->getDisplayName(); ?> + le <?php echo $entretien->getValidationResponsable()->getHistoModification()->format("d/m/Y à H:i"); ?>. + <?php else : ?> + Non effectuée + <?php endif; ?> + </dd> + <dt>Validation de l'agent </dt> + <dd> + <?php if ($entretien->getValidationAgent()) : ?> + Faites par <?php echo $entretien->getValidationAgent()->getHistoModificateur()->getDisplayName(); ?> + le <?php echo $entretien->getValidationAgent()->getHistoModification()->format("d/m/Y à H:i"); ?>. + <?php else : ?> + Non effectuée + <?php endif; ?> + </dd> + <dt>Validation du responsable de structure </dt> + <dd> + <?php if ($entretien->getValidationDRH()) : ?> + Faites par <?php echo $entretien->getValidationDRH()->getHistoModificateur()->getDisplayName(); ?> + le <?php echo $entretien->getValidationDRH()->getHistoModification()->format("d/m/Y à H:i"); ?>. + <?php else : ?> + Non effectuée + <?php endif; ?> + </dd> + </dl> + </div> + </div> + </div> </div> \ No newline at end of file diff --git a/module/Application/view/application/entretien-professionnel/partial/parcours.phtml b/module/Application/view/application/entretien-professionnel/partial/parcours.phtml index d25865313f440972067b91b3338d67240bf50e24..de2b5b03f262a876b6a7bc06cb8c2053c6f6bccb 100644 --- a/module/Application/view/application/entretien-professionnel/partial/parcours.phtml +++ b/module/Application/view/application/entretien-professionnel/partial/parcours.phtml @@ -37,11 +37,11 @@ $droits = [ 'valider' => $canValider, ]; $options = []; +$options['mode'] = 'modification'; $options['modification'] = $canModifier; $options['droits'] = $droits; $options['retour'] = $this->url('entretien-professionnel/renseigner', ['entretien' => $entretien->getId()], ['fragment' => 'parcours'], true); - /** @var AgentApplication $agentApplication */ /** @var AgentCompetence $agentCompetence */ /** @var AgentFormation $agentFormation */ @@ -114,10 +114,8 @@ foreach ($reponses as $reponse) { </div> <?php endif; ?> - <h2> Parcours obligatoire d'entrée dans le métier </h2> - <div class="row"> <div class="col-md-1"></div> <div class="col-md-10"> @@ -129,15 +127,6 @@ foreach ($reponses as $reponse) { <span class="icon attention">Pas de parcours de formation associé à la catégorie.</span> <?php endif; ?> </div> -<!-- <div class="col-md-6">--> -<!-- --><?php //if ($parcours[ParcoursDeFormation::TYPE_METIER] AND !empty($parcours[ParcoursDeFormation::TYPE_METIER])) : ?> -<!-- --><?php //foreach ($parcours[ParcoursDeFormation::TYPE_METIER] as $metierId => $parcour) : ?> -<!-- --><?php //echo $this->parcoursDeFormation($parcour, $agent, $options); ?> -<!-- --><?php //endforeach; ?> -<!-- --><?php //else: ?> -<!-- <span class="icon attention">Pas de parcours de formation associé au métier.</span>--> -<!-- --><?php //endif; ?> -<!-- </div>--> </div> <h2> Acquis de l'agent </h2> diff --git a/module/Application/view/application/fiche-metier/afficher.phtml b/module/Application/view/application/fiche-metier/afficher.phtml index 3c8bbe8f3a27394a94e4f65108ad39550cdd357d..af4c1a50966f47760331846650c068ab29aa6f96 100644 --- a/module/Application/view/application/fiche-metier/afficher.phtml +++ b/module/Application/view/application/fiche-metier/afficher.phtml @@ -3,16 +3,19 @@ /** * @see FicheMetierController::afficherAction() * @var FicheMetier $fiche - * @var ParcoursDeFormation $parcours + * @var array $competences * @var array $applications + * @var ParcoursDeFormation $parcours */ use Application\Entity\Db\FicheMetier; use Application\Entity\Db\ParcoursDeFormation; +$libelle = ($fiche->getMetier())?$fiche->getMetier()->getLibelle():"Aucun libellé"; +$this->headTitle('Affichage de la fiche métier #' . $fiche->getId(). " : " . $libelle); ?> <?php - echo $this->ficheMetier($fiche, null, ['mode' => 'affichage', 'parcours' => $parcours, 'applications' => $applications]); + echo $this->ficheMetier($fiche, null, ['mode' => 'affichage', 'competences' => $competences, 'applications' => $applications, 'parcours' => $parcours]); ?> diff --git a/module/Application/view/application/fiche-metier/ajouter-terminer.phtml b/module/Application/view/application/fiche-metier/ajouter-terminer.phtml new file mode 100644 index 0000000000000000000000000000000000000000..086687944dc977dfe0dc6c13820ce3aabdddb5d2 --- /dev/null +++ b/module/Application/view/application/fiche-metier/ajouter-terminer.phtml @@ -0,0 +1,12 @@ +<?php + +use Application\Entity\Db\FicheMetier; + +/** + * @see \Application\Controller\FicheMetierController::ajouterTerminerAction() + * @var FicheMetier $fiche + */ + +?> + +<p class="lead"> La fiche vient d'être créer, elle possède l'id #<?php echo $fiche->getId(); ?></p> diff --git a/module/Application/view/application/fiche-metier/editer.phtml b/module/Application/view/application/fiche-metier/editer.phtml index 39797cd6c7e8dda2a687330f337b1f13b480206c..213f0e771c5625c478548c31dcc37e53c224d341 100644 --- a/module/Application/view/application/fiche-metier/editer.phtml +++ b/module/Application/view/application/fiche-metier/editer.phtml @@ -2,11 +2,17 @@ use Application\Controller\FicheMetierController; use Application\Entity\Db\FicheMetier; +use Application\Entity\Db\ParcoursDeFormation; /** * @see FicheMetierController::editerAction() * @var FicheMetier $fiche + * @var array $competences * @var array $applications + * @var ParcoursDeFormation $parcours */ -echo $this->ficheMetier($fiche, null, ['mode' => 'edition-fiche-metier', 'applications' => $applications, 'parcours' => $parcours]); +$libelle = ($fiche->getMetier())?$fiche->getMetier()->getLibelle():"Aucun libellé"; +$this->headTitle('Modification de la fiche métier #' . $fiche->getId(). " : " . $libelle); + +echo $this->ficheMetier($fiche, null, ['mode' => 'edition-fiche-metier', 'competences' => $competences, 'applications' => $applications, 'parcours' => $parcours]); diff --git a/module/Application/view/application/fiche-metier/index.phtml b/module/Application/view/application/fiche-metier/index.phtml index 42e3e9537b31d02370ab06d4f7e9c78835023c65..c768fea93c5453f608eea63d9fab855ffd6ce931 100644 --- a/module/Application/view/application/fiche-metier/index.phtml +++ b/module/Application/view/application/fiche-metier/index.phtml @@ -120,7 +120,7 @@ $this->headTitle('Index des fiches métiers'); $(function() { $("body").on("modification", function (event) { event.div.modal('hide'); - window.location.href = 'fiche-metier-type/editer'; + window.location.reload(); }); }); diff --git a/module/Application/view/application/fiche-metier/partial/fiche-metier.phtml b/module/Application/view/application/fiche-metier/partial/fiche-metier.phtml index eb6911eb9e33087c3e19da57dc98d40fa54858c0..a68c9650993407f077c47e2e01ed0447b34d6c9a 100644 --- a/module/Application/view/application/fiche-metier/partial/fiche-metier.phtml +++ b/module/Application/view/application/fiche-metier/partial/fiche-metier.phtml @@ -22,9 +22,7 @@ $canDetruire = $this->isAllowed(FicheMetierPrivileges::getResourceId(FicheMet <div class="col-md-6"> <?php if ($canAjouter) : ?> <a href="<?php echo $this->url('fiche-metier-type/ajouter', [], [], true); ?>" - class="btn btn-primary action ajax-modal" - data-event="creation" - > + class="btn btn-primary action ajax-modal" data-event="creation"> <span class="icon ajouter"></span> Ajouter une fiche métier </a> diff --git a/module/Application/view/application/metier/index.phtml b/module/Application/view/application/metier/index.phtml index 779872caaaea83d4f5f5c4ac4b08bd551c7ff8c9..6531b71fea3d898b9cede212f26cedfa05811cfb 100644 --- a/module/Application/view/application/metier/index.phtml +++ b/module/Application/view/application/metier/index.phtml @@ -112,16 +112,6 @@ $droits = [ <script> - $(document).ready(function() { - $('.datatable').DataTable( { - // sorting: false, - // paging: false, - language: { - url: '/localisation/fr_FR.json' - } - } ); - } ); - $(function() { let hash = $(location).attr('hash'); let name = hash.substr(1); diff --git a/module/Application/view/application/metier/partial/listing-domaine.phtml b/module/Application/view/application/metier/partial/listing-domaine.phtml index 5272ea76961d66b87b952dd64e8cf04ffa812f6b..a4a5e3a75a59600a585fe7c97cea0f8fc1ea9313 100644 --- a/module/Application/view/application/metier/partial/listing-domaine.phtml +++ b/module/Application/view/application/metier/partial/listing-domaine.phtml @@ -35,7 +35,7 @@ $canEffacer = $droits["effacer"]; </div> </div> <br/> -<table class="datatable table table-condensed"> +<table id="domaines" class="datatable table table-condensed"> <thead> <tr> <th> Libelle </th> @@ -89,4 +89,16 @@ $canEffacer = $droits["effacer"]; </tr> <?php endforeach; ?> </tbody> -</table> \ No newline at end of file +</table> + +<script> + $(document).ready(function() { + $('#domaines').DataTable( { + sorting: false, + paging: false, + language: { + url: '/localisation/fr_FR.json' + } + } ); + } ); +</script> \ No newline at end of file diff --git a/module/Application/view/application/metier/partial/listing-famille.phtml b/module/Application/view/application/metier/partial/listing-famille.phtml index 23df44ad432381f28f82dfd34384feeee31e4011..6c579f633dd4236eb95ac2b69e57acb15b3ef651 100644 --- a/module/Application/view/application/metier/partial/listing-famille.phtml +++ b/module/Application/view/application/metier/partial/listing-famille.phtml @@ -37,7 +37,7 @@ $canEffacer = $droits["effacer"]; <br/> </div> <br/> -<table class="datatable table table-condensed"> +<table id="familles" class="datatable table table-condensed"> <thead> <tr> <th> Libelle </th> @@ -87,4 +87,16 @@ $canEffacer = $droits["effacer"]; </tr> <?php endforeach; ?> </tbody> -</table> \ No newline at end of file +</table> + +<script> + $(document).ready(function() { + $('#familles').DataTable( { + sorting: false, + paging: false, + language: { + url: '/localisation/fr_FR.json' + } + } ); + } ); +</script> \ No newline at end of file diff --git a/module/Application/view/application/metier/partial/listing-metier.phtml b/module/Application/view/application/metier/partial/listing-metier.phtml index f103f5a8de92cb93843789cb7ab16d0570f5d5a1..5fe8ad6d6a9893512cfcda37ada5e70b13309997 100644 --- a/module/Application/view/application/metier/partial/listing-metier.phtml +++ b/module/Application/view/application/metier/partial/listing-metier.phtml @@ -34,7 +34,7 @@ $canEffacer = $droits["effacer"]; </div> </div> <br/> -<table class="datatable table table-condensed"> +<table id="metiers" class="datatable table table-condensed"> <thead> <tr> <th> Libelle </th> @@ -140,4 +140,16 @@ $canEffacer = $droits["effacer"]; </tr> <?php endforeach; ?> </tbody> -</table> \ No newline at end of file +</table> + +<script> + $(document).ready(function() { + $('#metiers').DataTable( { + // sorting: false, + // paging: false, + language: { + url: '/localisation/fr_FR.json' + } + } ); + } ); +</script> \ No newline at end of file diff --git a/module/Application/view/application/metier/partial/listing-referentiel.phtml b/module/Application/view/application/metier/partial/listing-referentiel.phtml index 8ab941caadfa3e5525373cd35072feed29c87626..95ae5d2b24032eba7ac25e007b5bcac70599d02d 100644 --- a/module/Application/view/application/metier/partial/listing-referentiel.phtml +++ b/module/Application/view/application/metier/partial/listing-referentiel.phtml @@ -38,8 +38,7 @@ $canEffacer = $droits["effacer"]; <table class="datatable table table-condensed"> <thead> <tr> - <th> Libelle court</th> - <th> Libelle long </th> + <th> Libelle </th> <th> Préfix </th> <th class="cell-action"> Action </th> </tr> @@ -47,8 +46,10 @@ $canEffacer = $droits["effacer"]; <tbody> <?php foreach ($referentiels as $referentiel) : ?> <tr <?php if ($referentiel->estHistorise()) echo 'class="historise"'; ?>> - <td> <?php echo $referentiel->getLibelleCourt(); ?> </td> - <td> <?php echo $referentiel->getLibelleLong(); ?> </td> + <td> + [<strong><?php echo $referentiel->getLibelleCourt(); ?></strong>] + <?php echo $referentiel->getLibelleLong(); ?> + </td> <td> <?php if ($referentiel->getPrefix()) : ?> <span class="icon ok" style="color:darkgreen" title="<?php echo $referentiel->getPrefix(); ?>"></span> diff --git a/module/Application/view/application/mission-specifique-affectation/partial/filtre.phtml b/module/Application/view/application/mission-specifique-affectation/partial/filtre.phtml index 9bd3c47f75f31667edb8722eaf2b36b04c13c664..03f20f908bc829438783d856d1c945105d9b01f2 100644 --- a/module/Application/view/application/mission-specifique-affectation/partial/filtre.phtml +++ b/module/Application/view/application/mission-specifique-affectation/partial/filtre.phtml @@ -70,7 +70,8 @@ use UnicaenApp\Form\Element\SearchAndSelect; </div> </div> - <button class="btn btn-primary" id="filter"> + <button class="btn btn-primary action" id="filter"> + <span class="icon filtrer"></span> Filtrer </button> </form> diff --git a/module/Application/view/application/mission-specifique/index.phtml b/module/Application/view/application/mission-specifique/index.phtml index 33d4700f4eef52a71c8ae23f5cd799a966dee877..a41056b590672cf74bbc47906380a3c790b8da20 100644 --- a/module/Application/view/application/mission-specifique/index.phtml +++ b/module/Application/view/application/mission-specifique/index.phtml @@ -279,7 +279,7 @@ $this->headTitle("Missions spécifiques"); <?php endif; ?> <?php if ($canHistoriser) : ?> - <?php if ($type->estNonHistorise()) : ?> + <?php if ($theme->estNonHistorise()) : ?> <a <?php /** @see \Application\Controller\MissionSpecifiqueController::historiserThemeAction() */?> href="<?php echo $this->url('mission-specifique/theme/historiser', ['theme' => $theme->getId()], [], true); ?>" diff --git a/module/Application/view/application/parcours-de-formation/afficher.phtml b/module/Application/view/application/parcours-de-formation/afficher.phtml index e8a513e1824bde88ea8d1eb476f21f3490211357..2640e0e5d0579f6c97b71e59867651bac09af808 100644 --- a/module/Application/view/application/parcours-de-formation/afficher.phtml +++ b/module/Application/view/application/parcours-de-formation/afficher.phtml @@ -18,4 +18,4 @@ foreach ($parcours->getFormations() as $formation) { ksort($formationArray); ?> -<?php echo $this->parcoursDeFormation($parcours); ?> +<?php echo $this->parcoursDeFormation($parcours, null, ['mode' => 'affichage']); ?> diff --git a/module/Application/view/application/parcours-de-formation/modifier.phtml b/module/Application/view/application/parcours-de-formation/modifier.phtml index 2c7cdfe40ad50cbbacacc3b6ae675feaff05dd66..899d305c5fb75517e1de4163d1d6d972b38b8f42 100644 --- a/module/Application/view/application/parcours-de-formation/modifier.phtml +++ b/module/Application/view/application/parcours-de-formation/modifier.phtml @@ -15,6 +15,7 @@ use Formation\Provider\Privilege\FormationPrivileges; $canModifier = $this->isAllowed(FormationPrivileges::getResourceId(FormationPrivileges::FORMATION_MODIFIER)); +$this->headTitle('Modification du parcours de formation : ' . ($parcours->getLibelle())?:"non défini"); ?> <h1 class="page-header"> @@ -66,66 +67,7 @@ $canModifier = $this->isAllowed(FormationPrivileges::getResourceId(FormationPriv <?php $formations = $parcours->getFormations(); ?> - <div class="row"> - <div class="col-md-8"> - <h3> - #Formation : <?php echo count($formations); ?> - </h3> - </div> - <div class="pull-right"> - <?php if ($canModifier) : ?> - <a href="<?php echo $this->url('parcours-de-formation/ajouter-formation', ['parcours-de-formation' => $parcours->getId()], [], true); ?>" - class="btn btn-primary action ajax-modal" data-event="modification" - > - <span class="icon ajouter"></span>Ajouter des formations </a> - <?php endif; ?> - </div> - </div> - - <?php - $groupes = []; - foreach ($formations as $formation) { - $groupe = $formation->getGroupe(); - if ($groupe !== null) $groupes[$groupe->getId()] = $groupe; - } - - $dictionnaire = []; - usort($groupes, function (FormationGroupe $a, FormationGroupe $b) {return $a->getOrdre() > $b->getOrdre();}); - foreach ($groupes as $groupe) { - $dictionnaire[$groupe->getLibelle()] = []; - } - - - foreach ($formations as $formation) { - $groupe = ($formation->getGroupe())?$formation->getGroupe()->getLibelle():"ZZZ"; - $dictionnaire[$groupe][] = $formation; - } -// ksort($dictionnaire); - ?> - - <table class="parcours-de-formation" style="width:90%;"> - <?php foreach ($dictionnaire as $groupe => $gformations) : ?> - <?php usort($gformations, function (Formation $a, Formation $b) { return $a->getLibelle() > $b->getLibelle();}); ?> - <?php $init = $gformations[0]; ?> - <tr> <th colspan="2" class="titre"> - <?php echo ($groupe === "ZZZ")?"Sans groupe ...":$groupe; ?> - </th> </tr> - <?php foreach ($gformations as $formation) : ?> - <tr> - <td> <?php echo $formation->getLibelle(); ?> </td> - <td> - <?php if ($canModifier) : ?> - <?php /** @see \Application\Controller\ParcoursDeFormationController::retirerFormationAction() */ ?> - <a href="<?php echo $this->url('parcours-de-formation/retirer-formation', ['parcours-de-formation' => $parcours->getId(), 'formation' => $formation->getId()], [], true); ?>" - > - <span class="icon detruire" data-toogle="tooltip" data-html="true" title="Retirer la formation"></span> - </a> - <?php endif; ?> - </td> - </tr> - <?php endforeach; ?> - <?php endforeach; ?> - </table> + <?php echo $this->parcoursDeFormation($parcours, null, ['mode' => 'creation', 'modification' => $canModifier]); ?> </div> diff --git a/module/UnicaenPrivilege/src/UnicaenPrivilege/Entity/Db/Mapping/UnicaenPrivilege.Entity.Db.CategoriePrivilege.dcm.xml b/module/UnicaenPrivilege/src/UnicaenPrivilege/Entity/Db/Mapping/UnicaenPrivilege.Entity.Db.CategoriePrivilege.dcm.xml index fa169094e7bd26dc2deb159a7025bccd4c02b2ca..ccb6612b79e56e8f30313893257474a97a93ff07 100644 --- a/module/UnicaenPrivilege/src/UnicaenPrivilege/Entity/Db/Mapping/UnicaenPrivilege.Entity.Db.CategoriePrivilege.dcm.xml +++ b/module/UnicaenPrivilege/src/UnicaenPrivilege/Entity/Db/Mapping/UnicaenPrivilege.Entity.Db.CategoriePrivilege.dcm.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> - <entity name="UnicaenPrivilege\Entity\Db\CategoriePrivilege" table="categorie_privilege"> + <entity name="UnicaenPrivilege\Entity\Db\CategoriePrivilege" table="unicaen_privilege_categorie"> <id name="id" type="integer" column="id"> <generator strategy="IDENTITY"/> diff --git a/module/UnicaenPrivilege/src/UnicaenPrivilege/Entity/Db/Mapping/UnicaenPrivilege.Entity.Db.Privilege.dcm.xml b/module/UnicaenPrivilege/src/UnicaenPrivilege/Entity/Db/Mapping/UnicaenPrivilege.Entity.Db.Privilege.dcm.xml index db4743761fd0af95a7ebcbfd095bdfef2e9f2df2..70fd54f34e830890dfdc412e0a8286ca2d126be4 100644 --- a/module/UnicaenPrivilege/src/UnicaenPrivilege/Entity/Db/Mapping/UnicaenPrivilege.Entity.Db.Privilege.dcm.xml +++ b/module/UnicaenPrivilege/src/UnicaenPrivilege/Entity/Db/Mapping/UnicaenPrivilege.Entity.Db.Privilege.dcm.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> - <entity name="UnicaenPrivilege\Entity\Db\Privilege" table="privilege"> + <entity name="UnicaenPrivilege\Entity\Db\Privilege" table="unicaen_privilege_privilege"> <id name="id" type="integer" column="id"> <generator strategy="IDENTITY"/> diff --git a/module/UnicaenUtilisateur/src/UnicaenUtilisateur/Service/Role/RoleService.php b/module/UnicaenUtilisateur/src/UnicaenUtilisateur/Service/Role/RoleService.php index 0827edaa823bda46b271e5f2b58328d58899bc29..91c6b2fc6726385993f79f0b0b2347bc2cb6e50c 100644 --- a/module/UnicaenUtilisateur/src/UnicaenUtilisateur/Service/Role/RoleService.php +++ b/module/UnicaenUtilisateur/src/UnicaenUtilisateur/Service/Role/RoleService.php @@ -4,7 +4,9 @@ namespace UnicaenUtilisateur\Service\Role; use Doctrine\ORM\NonUniqueResultException; use Doctrine\ORM\ORMException; +use Doctrine\ORM\QueryBuilder; use UnicaenApp\Service\EntityManagerAwareTrait; +use UnicaenUtilisateur\Entity\Db\AbstractRole; use UnicaenUtilisateur\Entity\Db\Role; use UnicaenUtilisateur\Exception\RuntimeException; use Zend\Mvc\Controller\AbstractActionController; @@ -30,11 +32,23 @@ class RoleService } /** + * @return QueryBuilder + */ + public function createQueryBuilder() + { + $qb = $this->getEntityManager()->getRepository($this->roleEntityClass)->createQueryBuilder('role') + ; + return $qb; + } + + /** + * @param string $champ + * @param string $ordre * @return Role[] */ public function getRoles($champ = 'roleId', $ordre = 'ASC') { - $qb = $this->getEntityManager()->getRepository($this->roleEntityClass)->createQueryBuilder('role') + $qb = $this->createQueryBuilder() ->orderBy('role.' . $champ, $ordre) ; $result = $qb->getQuery()->getResult(); @@ -43,11 +57,11 @@ class RoleService /** * @param int $id - * @return Role[] + * @return Role */ - public function getRole($id) + public function getRole(int $id) { - $qb = $this->getEntityManager()->getRepository($this->roleEntityClass)->createQueryBuilder("role") + $qb = $this->createQueryBuilder() ->andWhere("role.id = :id") ->setParameter("id", $id); @@ -59,9 +73,13 @@ class RoleService return $result; } - public function getRoleByCode($code) + /** + * @param string $code + * @return Role + */ + public function getRoleByCode(string $code) { - $qb = $this->getEntityManager()->getRepository($this->roleEntityClass)->createQueryBuilder('role') + $qb = $this->createQueryBuilder() ->andWhere('role.roleId = :code') ->setParameter('code', $code) ; @@ -85,9 +103,9 @@ class RoleService /** * @param AbstractActionController $controller * @param string $paramName - * @return Role + * @return AbstractRole */ - public function getRequestedRole($controller, $paramName = 'role') + public function getRequestedRole(AbstractActionController $controller, string $paramName = 'role') { $id = $controller->params()->fromRoute($paramName); $role = $this->getRole($id); @@ -98,7 +116,7 @@ class RoleService * @param Role $role * @return Role */ - public function create($role) + public function create(Role $role) { try { $this->getEntityManager()->persist($role); @@ -113,7 +131,7 @@ class RoleService * @param Role $role * @return Role */ - public function update($role) + public function update(Role $role) { try { $this->getEntityManager()->flush($role); @@ -127,7 +145,7 @@ class RoleService * @param Role $role * @return Role */ - public function delete($role) + public function delete(Role $role) { try { $this->getEntityManager()->remove($role); diff --git a/public/css/icon.css b/public/css/icon.css index 00d15ceabfb40f19c92c2cc2895298e815103e3a..0cc485460e31958e4c7a497dc5be32886ea3fa0d 100644 --- a/public/css/icon.css +++ b/public/css/icon.css @@ -251,4 +251,8 @@ span.icon.euro:before { span.icon.paragraph:before { content: "\f039"; +} + +span.icon.filtrer:before { + content: "\f0b0"; } \ No newline at end of file