Loading module/Structure/src/Structure/Controller/StructureController.php +4 −37 Changes for module/Structure/src/Structure/Controller/StructureController.php: 4 added lines, 37 removed lines. Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ namespace Structure\Controller; use Application\Entity\Db\Agent; use Application\Entity\Db\FichePoste; use Application\Form\AgentMissionSpecifique\AgentMissionSpecifiqueFormAwareTrait; use Application\Form\HasDescription\HasDescriptionFormAwareTrait; Loading Loading @@ -95,43 +96,9 @@ class StructureController extends AbstractActionController { $agentsForces = array_map(function (StructureAgentForce $a) { return $a->getAgent(); }, $structure->getAgentsForces()); $allAgents = array_merge($agents, $agentsForces); /** Récupération des fiches de postes liées aux structures */ // $fichesPostes = $this->getFichePosteService()->getFichesPostesByStructures($structures); $fichesCompletes = []; $fichesIncompletes = []; // var_dump($fichesPostes); // foreach ($fichesPostes as $agentId => $fiches) { // $best = $fiches[0]; // var_dump($fiches); // foreach ($fiches as $fiche) { // var_dump($fiche); // if ($fiche['etat'] === FichePoste::ETAT_CODE_SIGNEE) { // $best = $fiche; // break; // } // } // if ($best['agent_id'] !== null AND $best['fiche_principale']) { // $fichesCompletes[] = $best; // } else { // $fichesIncompletes[] = $best; // } // } $fichesRecrutements = $this->getStructureService()->getFichesPostesRecrutementsByStructures($structures); $ficheBestByAgent = []; foreach ($allAgents as $agent) { $ficheBestByAgent[$agent->getId()] = $agent->getFichePosteBest(); if ($ficheBestByAgent[$agent->getId()] !== null) { if ($ficheBestByAgent[$agent->getId()]->isComplete()) { $fichesCompletes[] = $ficheBestByAgent[$agent->getId()]; } else { $fichesIncompletes[] = $ficheBestByAgent[$agent->getId()]; } } else { $agentsSansFiche[] = $agent; } } $postes = $this->getPosteService()->getPostesByStructures($structures); usort($allAgents, function (Agent $a, Agent $b) { $aaa = $a->getNomUsuel() . " ". $a->getPrenom(); $bbb = $b->getNomUsuel() . " ". $b->getPrenom(); return $aaa > $bbb;}); /** Campagne */ $last = $this->getCampagneService()->getLastCampagne(); Loading @@ -140,6 +107,8 @@ class StructureController extends AbstractActionController { $agentsForcesLast = array_map(function (StructureAgentForce $a) { return $a->getAgent(); }, $structure->getAgentsForces()); $allAgentsLast = array_merge($agentsLast, $agentsForcesLast); $campagnes = $this->getCampagneService()->getCampagnesActives(); $entretiens = []; Loading @@ -157,8 +126,6 @@ class StructureController extends AbstractActionController { 'missions' => $missionsSpecifiques, 'fichespostes' => $this->getFichePosteService()->getFichesPostesbyAgents($allAgents), 'fichesCompletes' => $fichesCompletes, 'fichesIncompletes' => $fichesIncompletes, 'fichesRecrutements' => $fichesRecrutements, 'profils' => $profils, 'inscriptions' => $inscriptions, Loading module/Structure/view/structure/structure/partial/fiches-postes.phtml +9 −20 Changes for module/Structure/view/structure/structure/partial/fiches-postes.phtml: 9 added lines, 20 removed lines. Original line number Diff line number Diff line Loading @@ -4,21 +4,8 @@ * @see \Structure\Controller\StructureController::afficherAction() * @var Agent[] $agents * @var Structure $structure * @var FichePoste[] $fichesCompletes * @var FichePoste[] $fichesIncompletes */ //usort($fichesCompletes, // function ( $a, $b) { // $denA = $a['nom_usage'] . " ".$a['prenom']; // $denB = $b['nom_usage'] . " ".$b['prenom']; // return $denA > $denB;}); //usort($fichesIncompletes, // function ( $a, $b) { // $denA = $a['nom_usage'] . " ".$a['prenom']; // $denB = $b['nom_usage'] . " ".$b['prenom']; // return $denA > $denB;}); use Application\Entity\Db\Agent; use Application\Entity\Db\FichePoste; use Application\Provider\Privilege\FichePostePrivileges; Loading @@ -34,6 +21,8 @@ $canDetruireFichePoste = $this->isAllowed(FichePostePrivileges::getResource $date = new DateTime(); ?> <h2> Agents et fiches de poste </h2> <table class="table table-condensed"> <thead> <tr> Loading @@ -48,8 +37,8 @@ $date = new DateTime(); <strong><?php echo $agent->getDenomination(); ?></strong> <br/> <?php $affectation = $agent->getAffectationPrincipale(); $structure = ($affectation !== null)?$affectation->getStructure():null; echo ($structure !== null)?$structure->getLibelleCourt():"Aucune affectation principale"; $structure_ = ($affectation !== null)?$affectation->getStructure():null; echo ($structure_ !== null)?$structure_->getLibelleCourt():"Aucune affectation principale"; ?> </td> <td> Loading Loading @@ -79,7 +68,7 @@ $date = new DateTime(); <table class="fichespostes"> <?php foreach ($fichespostes[$agent->getId()] as $ficheposte) : ?> <tr class=" <?php if ($fichespostes['destruction']) echo " historise " ?> <?php if ($ficheposte['histo_destruction']) echo " historise " ?> "> <?php //var_dump($ficheposte); ?> <!-- <td class="structure">--><?php //echo $ficheposte['structure']; ?><!-- </td>--> Loading @@ -93,7 +82,7 @@ $date = new DateTime(); <td class="encours"> <?php $fin = ($ficheposte["en_cours"] !== null)?DateTime::createFromFormat('Y-m-d H:i:s', $ficheposte["en_cours"]):null; ?> <?php if (($fin === null OR $fin >= $date) AND $ficheposte['etat_code'] === FichePoste::ETAT_CODE_SIGNEE) echo "<span class='icon ok' style='color:darkgreen;'></span>"; ?> <?php if ($fin !== null AND $fin < $date AND $ficheposte['etat_code'] === FichePoste::ETAT_CODE_SIGNEE) echo "<span class='icon ko' style='color:darkred;' title='Fin de validité au ".$fin->format('d/m/Y')."'></span>"; ?> <?php if ($fin !== null AND $fin < $date AND $ficheposte['etat_code'] === FichePoste::ETAT_CODE_SIGNEE) echo "<span style='color:darkred;'>".$fin->format('d/m/Y')."</span>"; ?> <?php if ($fin === null AND $ficheposte['etat_code'] !== FichePoste::ETAT_CODE_SIGNEE) echo "<span class='icon sursis' style='color:cadetblue;'></span>"; ?> </td> <td class="etat"> Loading Loading @@ -125,13 +114,13 @@ $date = new DateTime(); <span class="icon editer nope"></span> <?php endif; ?> <?php if ($canHistoriserFichePoste AND $ficheposte['etat_code'] !== FichePoste::ETAT_CODE_SIGNEE) : ?> <?php if ($fichespostes['destruction']) : ?> <?php if ($ficheposte['histo_destruction']) : ?> <?php /** @see \Application\Controller\FichePosteController::restaurerAction() */ ?> <a href="<?php echo $this->url('fiche-poste/restaurer', ['fiche-poste' => $ficheposte['id']], [], true); ?>" > <a href="<?php echo $this->url('fiche-poste/restaurer', ['fiche-poste' => $ficheposte['id']], ['query' => ['retour' => $this->url('structure/afficher', ['structure' => $structure->getId()], ['fragment' => 'informations'], true)]], true); ?>" > <span class="icon restaurer" data-toggle="tooltip" data-html="true" title="Restaurer la fiche de poste"></span></a> <?php else : ?> <?php /** @see \Application\Controller\FichePosteController::historiserAction() */ ?> <a href="<?php echo $this->url('fiche-poste/historiser', ['fiche-poste' => $ficheposte['id']], [], true); ?>" > <a href="<?php echo $this->url('fiche-poste/historiser', ['fiche-poste' => $ficheposte['id']], ['query' => ['retour' => $this->url('structure/afficher', ['structure' => $structure->getId()], ['fragment' => 'informations'], true)]], true); ?>" > <span class="icon historiser" data-toggle="tooltip" data-html="true" title="Historiser la fiche de poste"></span></a> <?php endif; ?> <?php else : ?> Loading Loading
module/Structure/src/Structure/Controller/StructureController.php +4 −37 Changes for module/Structure/src/Structure/Controller/StructureController.php: 4 added lines, 37 removed lines. Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ namespace Structure\Controller; use Application\Entity\Db\Agent; use Application\Entity\Db\FichePoste; use Application\Form\AgentMissionSpecifique\AgentMissionSpecifiqueFormAwareTrait; use Application\Form\HasDescription\HasDescriptionFormAwareTrait; Loading Loading @@ -95,43 +96,9 @@ class StructureController extends AbstractActionController { $agentsForces = array_map(function (StructureAgentForce $a) { return $a->getAgent(); }, $structure->getAgentsForces()); $allAgents = array_merge($agents, $agentsForces); /** Récupération des fiches de postes liées aux structures */ // $fichesPostes = $this->getFichePosteService()->getFichesPostesByStructures($structures); $fichesCompletes = []; $fichesIncompletes = []; // var_dump($fichesPostes); // foreach ($fichesPostes as $agentId => $fiches) { // $best = $fiches[0]; // var_dump($fiches); // foreach ($fiches as $fiche) { // var_dump($fiche); // if ($fiche['etat'] === FichePoste::ETAT_CODE_SIGNEE) { // $best = $fiche; // break; // } // } // if ($best['agent_id'] !== null AND $best['fiche_principale']) { // $fichesCompletes[] = $best; // } else { // $fichesIncompletes[] = $best; // } // } $fichesRecrutements = $this->getStructureService()->getFichesPostesRecrutementsByStructures($structures); $ficheBestByAgent = []; foreach ($allAgents as $agent) { $ficheBestByAgent[$agent->getId()] = $agent->getFichePosteBest(); if ($ficheBestByAgent[$agent->getId()] !== null) { if ($ficheBestByAgent[$agent->getId()]->isComplete()) { $fichesCompletes[] = $ficheBestByAgent[$agent->getId()]; } else { $fichesIncompletes[] = $ficheBestByAgent[$agent->getId()]; } } else { $agentsSansFiche[] = $agent; } } $postes = $this->getPosteService()->getPostesByStructures($structures); usort($allAgents, function (Agent $a, Agent $b) { $aaa = $a->getNomUsuel() . " ". $a->getPrenom(); $bbb = $b->getNomUsuel() . " ". $b->getPrenom(); return $aaa > $bbb;}); /** Campagne */ $last = $this->getCampagneService()->getLastCampagne(); Loading @@ -140,6 +107,8 @@ class StructureController extends AbstractActionController { $agentsForcesLast = array_map(function (StructureAgentForce $a) { return $a->getAgent(); }, $structure->getAgentsForces()); $allAgentsLast = array_merge($agentsLast, $agentsForcesLast); $campagnes = $this->getCampagneService()->getCampagnesActives(); $entretiens = []; Loading @@ -157,8 +126,6 @@ class StructureController extends AbstractActionController { 'missions' => $missionsSpecifiques, 'fichespostes' => $this->getFichePosteService()->getFichesPostesbyAgents($allAgents), 'fichesCompletes' => $fichesCompletes, 'fichesIncompletes' => $fichesIncompletes, 'fichesRecrutements' => $fichesRecrutements, 'profils' => $profils, 'inscriptions' => $inscriptions, Loading
module/Structure/view/structure/structure/partial/fiches-postes.phtml +9 −20 Changes for module/Structure/view/structure/structure/partial/fiches-postes.phtml: 9 added lines, 20 removed lines. Original line number Diff line number Diff line Loading @@ -4,21 +4,8 @@ * @see \Structure\Controller\StructureController::afficherAction() * @var Agent[] $agents * @var Structure $structure * @var FichePoste[] $fichesCompletes * @var FichePoste[] $fichesIncompletes */ //usort($fichesCompletes, // function ( $a, $b) { // $denA = $a['nom_usage'] . " ".$a['prenom']; // $denB = $b['nom_usage'] . " ".$b['prenom']; // return $denA > $denB;}); //usort($fichesIncompletes, // function ( $a, $b) { // $denA = $a['nom_usage'] . " ".$a['prenom']; // $denB = $b['nom_usage'] . " ".$b['prenom']; // return $denA > $denB;}); use Application\Entity\Db\Agent; use Application\Entity\Db\FichePoste; use Application\Provider\Privilege\FichePostePrivileges; Loading @@ -34,6 +21,8 @@ $canDetruireFichePoste = $this->isAllowed(FichePostePrivileges::getResource $date = new DateTime(); ?> <h2> Agents et fiches de poste </h2> <table class="table table-condensed"> <thead> <tr> Loading @@ -48,8 +37,8 @@ $date = new DateTime(); <strong><?php echo $agent->getDenomination(); ?></strong> <br/> <?php $affectation = $agent->getAffectationPrincipale(); $structure = ($affectation !== null)?$affectation->getStructure():null; echo ($structure !== null)?$structure->getLibelleCourt():"Aucune affectation principale"; $structure_ = ($affectation !== null)?$affectation->getStructure():null; echo ($structure_ !== null)?$structure_->getLibelleCourt():"Aucune affectation principale"; ?> </td> <td> Loading Loading @@ -79,7 +68,7 @@ $date = new DateTime(); <table class="fichespostes"> <?php foreach ($fichespostes[$agent->getId()] as $ficheposte) : ?> <tr class=" <?php if ($fichespostes['destruction']) echo " historise " ?> <?php if ($ficheposte['histo_destruction']) echo " historise " ?> "> <?php //var_dump($ficheposte); ?> <!-- <td class="structure">--><?php //echo $ficheposte['structure']; ?><!-- </td>--> Loading @@ -93,7 +82,7 @@ $date = new DateTime(); <td class="encours"> <?php $fin = ($ficheposte["en_cours"] !== null)?DateTime::createFromFormat('Y-m-d H:i:s', $ficheposte["en_cours"]):null; ?> <?php if (($fin === null OR $fin >= $date) AND $ficheposte['etat_code'] === FichePoste::ETAT_CODE_SIGNEE) echo "<span class='icon ok' style='color:darkgreen;'></span>"; ?> <?php if ($fin !== null AND $fin < $date AND $ficheposte['etat_code'] === FichePoste::ETAT_CODE_SIGNEE) echo "<span class='icon ko' style='color:darkred;' title='Fin de validité au ".$fin->format('d/m/Y')."'></span>"; ?> <?php if ($fin !== null AND $fin < $date AND $ficheposte['etat_code'] === FichePoste::ETAT_CODE_SIGNEE) echo "<span style='color:darkred;'>".$fin->format('d/m/Y')."</span>"; ?> <?php if ($fin === null AND $ficheposte['etat_code'] !== FichePoste::ETAT_CODE_SIGNEE) echo "<span class='icon sursis' style='color:cadetblue;'></span>"; ?> </td> <td class="etat"> Loading Loading @@ -125,13 +114,13 @@ $date = new DateTime(); <span class="icon editer nope"></span> <?php endif; ?> <?php if ($canHistoriserFichePoste AND $ficheposte['etat_code'] !== FichePoste::ETAT_CODE_SIGNEE) : ?> <?php if ($fichespostes['destruction']) : ?> <?php if ($ficheposte['histo_destruction']) : ?> <?php /** @see \Application\Controller\FichePosteController::restaurerAction() */ ?> <a href="<?php echo $this->url('fiche-poste/restaurer', ['fiche-poste' => $ficheposte['id']], [], true); ?>" > <a href="<?php echo $this->url('fiche-poste/restaurer', ['fiche-poste' => $ficheposte['id']], ['query' => ['retour' => $this->url('structure/afficher', ['structure' => $structure->getId()], ['fragment' => 'informations'], true)]], true); ?>" > <span class="icon restaurer" data-toggle="tooltip" data-html="true" title="Restaurer la fiche de poste"></span></a> <?php else : ?> <?php /** @see \Application\Controller\FichePosteController::historiserAction() */ ?> <a href="<?php echo $this->url('fiche-poste/historiser', ['fiche-poste' => $ficheposte['id']], [], true); ?>" > <a href="<?php echo $this->url('fiche-poste/historiser', ['fiche-poste' => $ficheposte['id']], ['query' => ['retour' => $this->url('structure/afficher', ['structure' => $structure->getId()], ['fragment' => 'informations'], true)]], true); ?>" > <span class="icon historiser" data-toggle="tooltip" data-html="true" title="Historiser la fiche de poste"></span></a> <?php endif; ?> <?php else : ?> Loading