Loading module/Application/config/merged/agent.config.php +0 −1 Original line number Diff line number Diff line Loading @@ -449,7 +449,6 @@ return [ 'invokables' => [ 'agent' => AgentViewHelper::class, 'agentAffectation' => AgentAffectationViewHelper::class, 'agentFormation' => AgentFormationViewHelper::class, 'agentStatut' => AgentStatutViewHelper::class, 'agentGrade' => AgentGradeViewHelper::class, ], Loading module/Application/config/merged/element.config.php +6 −0 Original line number Diff line number Diff line Loading @@ -8,6 +8,7 @@ use Application\Provider\Privilege\AgentPrivileges; use Application\Provider\Privilege\ApplicationPrivileges; use Application\Provider\Privilege\CompetencePrivileges; use Application\Provider\Privilege\FicheMetierPrivileges; use Application\View\Helper\FormationBlocViewHelper; use Formation\Provider\Privilege\FormationPrivileges; use UnicaenPrivilege\Guard\PrivilegeController; use Zend\Router\Http\Literal; Loading Loading @@ -117,6 +118,11 @@ return [ ], 'hydrators' => [ 'factories' => [], ], 'view_helpers' => [ 'invokables' => [ 'formationBloc' => FormationBlocViewHelper::class, ], ] ]; No newline at end of file module/Application/src/Application/View/Helper/ApplicationBlocViewHelper.php +3 −3 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ namespace Application\View\Helper; use Application\Entity\Db\Interfaces\HasCompetenceCollectionInterface; use Application\Entity\Db\Interfaces\HasApplicationCollectionInterface; use Application\View\Renderer\PhpRenderer; use Zend\View\Helper\AbstractHelper; use Zend\View\Helper\Partial; Loading @@ -17,11 +17,11 @@ class ApplicationBlocViewHelper extends AbstractHelper */ /** * @param array $applications * @param HasCompetenceCollectionInterface|null $objet * @param HasApplicationCollectionInterface|null $objet * @param array $options * @return string|Partial */ public function __invoke(array $applications, ?HasCompetenceCollectionInterface $objet = null, $options = []) public function __invoke(array $applications, ?HasApplicationCollectionInterface $objet = null, $options = []) { /** @var PhpRenderer $view */ $view = $this->getView(); Loading module/Application/src/Application/View/Helper/AgentFormationViewHelper.php→module/Application/src/Application/View/Helper/FormationBlocViewHelper.php +13 −6 Original line number Diff line number Diff line Loading @@ -2,25 +2,32 @@ namespace Application\View\Helper; use Application\Entity\Db\Agent; use Application\Entity\Db\Interfaces\HasCompetenceCollectionInterface; use Application\View\Renderer\PhpRenderer; use Formation\Entity\Db\Interfaces\HasFormationCollectionInterface; use Zend\View\Helper\AbstractHelper; use Zend\View\Helper\Partial; use Zend\View\Renderer\PhpRenderer; use Zend\View\Resolver\TemplatePathStack; class AgentFormationViewHelper extends AbstractHelper class FormationBlocViewHelper extends AbstractHelper { /** * @param Agent $agent * @param array $formations * @param array $options * @return string|Partial */ public function __invoke($agent, $options = []) /** * @param array $formations * @param HasFormationCollectionInterface|null $objet * @param array $options * @return string|Partial */ public function __invoke(array $formations, ?HasFormationCollectionInterface $objet = null, $options = []) { /** @var PhpRenderer $view */ $view = $this->getView(); $view->resolver()->attach(new TemplatePathStack(['script_paths' => [__DIR__ . "/partial"]])); return $view->partial('agent-formation', ['agent' => $agent, 'options' => $options]); return $view->partial('formation-bloc', ['formations' => $formations, 'objet' => $objet, 'options' => $options]); } } No newline at end of file module/Application/src/Application/View/Helper/partial/agent-formation.phtmldeleted 100644 → 0 +0 −206 Original line number Diff line number Diff line <?php use Application\Controller\ElementController; use Application\Entity\Db\Agent; use Formation\Entity\Db\FormationElement; /** * @see \Application\View\Helper\AgentFormationViewHelper * @var Agent $agent * @var array $options */ $canVoir = (isset($options['droits']) AND isset($options['droits']['afficher'])) ? $options['droits']['afficher'] : false; $canAjouter = (isset($options['droits']) AND isset($options['droits']['ajouter'])) ? $options['droits']['ajouter'] : false; $canModifier = (isset($options['droits']) AND isset($options['droits']['modifier'])) ? $options['droits']['modifier'] : false; $canHistoriser = (isset($options['droits']) AND isset($options['droits']['historiser'])) ? $options['droits']['historiser'] : false; $canDetruire = (isset($options['droits']) AND isset($options['droits']['detruire'])) ? $options['droits']['detruire'] : false; $canValider = (isset($options['droits']) AND isset($options['droits']['valider'])) ? $options['droits']['valider'] : false; $canVoirHistorique = (isset($options['droits']) AND isset($options['droits']['voirHistorique'])) ? $options['droits']['voirHistorique'] : false; $retour = (isset($options['retour'])) ? $options['retour'] : null; ?> <div class="row"> <div class="col-md-8" style="border-bottom: 1px solid #31708f"> <h3> <span class="icon formation"></span> Formations</h3> </div> <div class="pull-right"> <br/> <?php if ($canAjouter) : ?> <a <?php /** @see \Application\Controller\AgentController::ajouterFormationAction() */?> href="<?php echo $this->url('agent/ajouter-formation', ['agent' => $agent->getId()], [], true); ?>" class="ajax-modal btn btn-primary action" data-event="modification" > <span class="icon ajouter" title="Ajouter une formation pour l'agent"></span> Ajouter une formation </a> <?php endif; ?> </div> </div> <br/> <?php $noGroupe = "ZZZZ"; $dictionnaire = []; foreach ($agent->getFOrmationListe(true) as $formationElement) { $formation = $formationElement->getFormation(); $groupe = $formation->getGroupe(); $libelle = ($groupe)?$groupe->getLibelle():$noGroupe; $dictionnaire[$libelle][] = $formationElement; } ksort($dictionnaire); ?> <div class="row"> <div class="col-md-1"></div> <div class="col-md-10"> <?php if ($canVoirHistorique) : ?> <div class="form-group"> <div class="checkbox"> <label> <input type="checkbox" id="formations-historisees"> Afficher les formations historisées </label> </div> </div> <?php endif; ?> <table class="elements" id="formations"> <tbody> <?php foreach ($dictionnaire as $key => $liste) : ?> <?php usort($liste, function(FormationElement $a, FormationElement $b) {return $a->getFormation()->getLibelle() > $b->getFormation()->getLibelle();}); ?> <?php $allHisto = true; foreach ($liste as $formationElement) { if ($formationElement->estNonHistorise()) { $allHisto = false; break; } } ?> <tr> <?php if ($key !== $noGroupe) : ?> <?php $groupe = $liste[0]->getFormation()->getGroupe(); ?> <th colspan="4" class="titre <?php if ($allHisto) echo 'historise'; ?>"> <?php echo $groupe->getLibelle(); ?> </th> <?php else :?> <th colspan="4" class="titre <?php if ($allHisto) echo 'historise'; ?>"> Sans groupe ... </th> <?php endif; ?> </tr> <?php foreach ($liste as $formationElement) : ?> <tr <?php if ($formationElement->estHistorise()) echo 'class="historise"'; ?>> <td class="libelle-cell"> <?php echo $formationElement->getFormation()->getLibelle(); ?> </td> <td class="info-cell"> <?php echo $formationElement->getCommentaire() ?> </td> <td class="validation-cell"> <?php if ($formationElement->getValidation()) : ?> <?php $validation = $formationElement->getValidation(); ?> <?php if ($validation->getValeur() === null) : ?> <span style="color:darkgreen;" title=" Par <?php echo $validation->getHistoModificateur()->getDisplayName(); ?> le <?php echo $validation->getHistoModification()->format("d/m/Y"); ?>"> <span class="icon ok"></span> Validée </span> <?php else: ?> <span style="color:darkred;" title=" Par <?php echo $validation->getHistoModificateur()->getDisplayName(); ?> le <?php echo $validation->getHistoModification()->format("d/m/Y"); ?>"> <span class="icon ko"></span> Refusée <?php endif; ?> <?php else : ?> Aucune validation <?php endif; ?> </td> <td class="action-cell"> <?php if ($canVoir) : ?> <a <?php /** @see \Application\Controller\ElementController::afficherAction() */?> href="<?php echo $this->url('element/afficher', ['type' => ElementController::TYPE_FORMATION, 'id' => $formationElement->getId()], [], true); ?>" class="ajax-modal" > <span class="icon voir" title="Afficher une formation liée à l'agent"></span></a> <?php endif; ?> <?php if ($canModifier) : ?> <a <?php /** @see \Application\Controller\AgentController::modifierFormationAction() */?> href="<?php echo $this->url('agent/modifier-formation', ['formation-element' => $formationElement->getId(), 'agent' => $agent->getId()], [], true); ?>" class="ajax-modal" data-event="modification" > <span class="icon editer" title="Modifier une formation liée à l'agent"></span></a> <?php endif; ?> <?php if ($canHistoriser) : ?> <?php if ($formationElement->estNonHistorise()) : ?> <a <?php /** @see \Application\Controller\AgentController::historiserFormationAction() */?> href="<?php echo $this->url('agent/historiser-formation', ['formation-element' => $formationElement->getId(), 'agent' => $agent->getId()], ['query' => ['retour' => $retour]], true); ?>" > <span class="icon historiser" title="Historiser une formation liée à l'agent"></span></a> <?php else: ?> <a <?php /** @see \Application\Controller\AgentController::restaurerFormationAction() */?> href="<?php echo $this->url('agent/restaurer-formation', ['formation-element' => $formationElement->getId(), 'agent' => $agent->getId()], ['query' => ['retour' => $retour]], true); ?>" > <span class="icon restaurer" title="Restaurer une formation liéesà l'agent"></span></a> <?php endif; ?> <?php endif; ?> <?php if ($canDetruire) : ?> <a <?php /** @see \Application\Controller\AgentController::detruireFormationAction() */?> href="<?php echo $this->url('agent/detruire-formation', ['formation-element' => $formationElement->getId(), 'agent' => $agent->getId()], [], true); ?>" class="ajax-modal" data-event="modification" > <span class="icon detruire" title="Supprimer définitivement une compétence liée à l'agent"></span> </a> <?php endif; ?> <?php if ($canValider) : ?> <?php if ($formationElement->getValidation() === null) : ?> <a <?php /** @see \Application\Controller\AgentController::validerElementAction() */ ?> href="<?php echo $this->url('agent/valider-element', ['type' => "AgentFormation", 'id' => $formationElement->getId()], [], true); ?>" class="ajax-modal" data-event="modification" > <span class="icon validation-do" title="Valider la formation"></span></a> <?php else: ?> <a <?php /** @see \Application\Controller\AgentController::revoquerElementAction() */ ?> href="<?php echo $this->url('agent/revoquer-element', ['validation' => $formationElement->getValidation()->getId()], ['query' => ['retour' => $retour]], true); ?>" > <span class="icon validation-undo" title="Dévalider la formation"></span></a> <?php endif; ?> <?php endif; ?> </td> </tr> <?php endforeach; ?> <?php endforeach; ?> </tbody> </table> </div> </div> <script> function toogleFormationsHistorisees() { let checked = $('input#formations-historisees').prop('checked'); if (checked === true) { $('table#formations th.historise').show(); $('table#formations tr.historise').show(); } else { $('table#formations th.historise').hide(); $('table#formations tr.historise').hide(); } } $(document).ready(function() { toogleFormationsHistorisees(); }); $('input#formations-historisees').change(function() { toogleFormationsHistorisees(); }); </script> No newline at end of file Loading
module/Application/config/merged/agent.config.php +0 −1 Original line number Diff line number Diff line Loading @@ -449,7 +449,6 @@ return [ 'invokables' => [ 'agent' => AgentViewHelper::class, 'agentAffectation' => AgentAffectationViewHelper::class, 'agentFormation' => AgentFormationViewHelper::class, 'agentStatut' => AgentStatutViewHelper::class, 'agentGrade' => AgentGradeViewHelper::class, ], Loading
module/Application/config/merged/element.config.php +6 −0 Original line number Diff line number Diff line Loading @@ -8,6 +8,7 @@ use Application\Provider\Privilege\AgentPrivileges; use Application\Provider\Privilege\ApplicationPrivileges; use Application\Provider\Privilege\CompetencePrivileges; use Application\Provider\Privilege\FicheMetierPrivileges; use Application\View\Helper\FormationBlocViewHelper; use Formation\Provider\Privilege\FormationPrivileges; use UnicaenPrivilege\Guard\PrivilegeController; use Zend\Router\Http\Literal; Loading Loading @@ -117,6 +118,11 @@ return [ ], 'hydrators' => [ 'factories' => [], ], 'view_helpers' => [ 'invokables' => [ 'formationBloc' => FormationBlocViewHelper::class, ], ] ]; No newline at end of file
module/Application/src/Application/View/Helper/ApplicationBlocViewHelper.php +3 −3 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ namespace Application\View\Helper; use Application\Entity\Db\Interfaces\HasCompetenceCollectionInterface; use Application\Entity\Db\Interfaces\HasApplicationCollectionInterface; use Application\View\Renderer\PhpRenderer; use Zend\View\Helper\AbstractHelper; use Zend\View\Helper\Partial; Loading @@ -17,11 +17,11 @@ class ApplicationBlocViewHelper extends AbstractHelper */ /** * @param array $applications * @param HasCompetenceCollectionInterface|null $objet * @param HasApplicationCollectionInterface|null $objet * @param array $options * @return string|Partial */ public function __invoke(array $applications, ?HasCompetenceCollectionInterface $objet = null, $options = []) public function __invoke(array $applications, ?HasApplicationCollectionInterface $objet = null, $options = []) { /** @var PhpRenderer $view */ $view = $this->getView(); Loading
module/Application/src/Application/View/Helper/AgentFormationViewHelper.php→module/Application/src/Application/View/Helper/FormationBlocViewHelper.php +13 −6 Original line number Diff line number Diff line Loading @@ -2,25 +2,32 @@ namespace Application\View\Helper; use Application\Entity\Db\Agent; use Application\Entity\Db\Interfaces\HasCompetenceCollectionInterface; use Application\View\Renderer\PhpRenderer; use Formation\Entity\Db\Interfaces\HasFormationCollectionInterface; use Zend\View\Helper\AbstractHelper; use Zend\View\Helper\Partial; use Zend\View\Renderer\PhpRenderer; use Zend\View\Resolver\TemplatePathStack; class AgentFormationViewHelper extends AbstractHelper class FormationBlocViewHelper extends AbstractHelper { /** * @param Agent $agent * @param array $formations * @param array $options * @return string|Partial */ public function __invoke($agent, $options = []) /** * @param array $formations * @param HasFormationCollectionInterface|null $objet * @param array $options * @return string|Partial */ public function __invoke(array $formations, ?HasFormationCollectionInterface $objet = null, $options = []) { /** @var PhpRenderer $view */ $view = $this->getView(); $view->resolver()->attach(new TemplatePathStack(['script_paths' => [__DIR__ . "/partial"]])); return $view->partial('agent-formation', ['agent' => $agent, 'options' => $options]); return $view->partial('formation-bloc', ['formations' => $formations, 'objet' => $objet, 'options' => $options]); } } No newline at end of file
module/Application/src/Application/View/Helper/partial/agent-formation.phtmldeleted 100644 → 0 +0 −206 Original line number Diff line number Diff line <?php use Application\Controller\ElementController; use Application\Entity\Db\Agent; use Formation\Entity\Db\FormationElement; /** * @see \Application\View\Helper\AgentFormationViewHelper * @var Agent $agent * @var array $options */ $canVoir = (isset($options['droits']) AND isset($options['droits']['afficher'])) ? $options['droits']['afficher'] : false; $canAjouter = (isset($options['droits']) AND isset($options['droits']['ajouter'])) ? $options['droits']['ajouter'] : false; $canModifier = (isset($options['droits']) AND isset($options['droits']['modifier'])) ? $options['droits']['modifier'] : false; $canHistoriser = (isset($options['droits']) AND isset($options['droits']['historiser'])) ? $options['droits']['historiser'] : false; $canDetruire = (isset($options['droits']) AND isset($options['droits']['detruire'])) ? $options['droits']['detruire'] : false; $canValider = (isset($options['droits']) AND isset($options['droits']['valider'])) ? $options['droits']['valider'] : false; $canVoirHistorique = (isset($options['droits']) AND isset($options['droits']['voirHistorique'])) ? $options['droits']['voirHistorique'] : false; $retour = (isset($options['retour'])) ? $options['retour'] : null; ?> <div class="row"> <div class="col-md-8" style="border-bottom: 1px solid #31708f"> <h3> <span class="icon formation"></span> Formations</h3> </div> <div class="pull-right"> <br/> <?php if ($canAjouter) : ?> <a <?php /** @see \Application\Controller\AgentController::ajouterFormationAction() */?> href="<?php echo $this->url('agent/ajouter-formation', ['agent' => $agent->getId()], [], true); ?>" class="ajax-modal btn btn-primary action" data-event="modification" > <span class="icon ajouter" title="Ajouter une formation pour l'agent"></span> Ajouter une formation </a> <?php endif; ?> </div> </div> <br/> <?php $noGroupe = "ZZZZ"; $dictionnaire = []; foreach ($agent->getFOrmationListe(true) as $formationElement) { $formation = $formationElement->getFormation(); $groupe = $formation->getGroupe(); $libelle = ($groupe)?$groupe->getLibelle():$noGroupe; $dictionnaire[$libelle][] = $formationElement; } ksort($dictionnaire); ?> <div class="row"> <div class="col-md-1"></div> <div class="col-md-10"> <?php if ($canVoirHistorique) : ?> <div class="form-group"> <div class="checkbox"> <label> <input type="checkbox" id="formations-historisees"> Afficher les formations historisées </label> </div> </div> <?php endif; ?> <table class="elements" id="formations"> <tbody> <?php foreach ($dictionnaire as $key => $liste) : ?> <?php usort($liste, function(FormationElement $a, FormationElement $b) {return $a->getFormation()->getLibelle() > $b->getFormation()->getLibelle();}); ?> <?php $allHisto = true; foreach ($liste as $formationElement) { if ($formationElement->estNonHistorise()) { $allHisto = false; break; } } ?> <tr> <?php if ($key !== $noGroupe) : ?> <?php $groupe = $liste[0]->getFormation()->getGroupe(); ?> <th colspan="4" class="titre <?php if ($allHisto) echo 'historise'; ?>"> <?php echo $groupe->getLibelle(); ?> </th> <?php else :?> <th colspan="4" class="titre <?php if ($allHisto) echo 'historise'; ?>"> Sans groupe ... </th> <?php endif; ?> </tr> <?php foreach ($liste as $formationElement) : ?> <tr <?php if ($formationElement->estHistorise()) echo 'class="historise"'; ?>> <td class="libelle-cell"> <?php echo $formationElement->getFormation()->getLibelle(); ?> </td> <td class="info-cell"> <?php echo $formationElement->getCommentaire() ?> </td> <td class="validation-cell"> <?php if ($formationElement->getValidation()) : ?> <?php $validation = $formationElement->getValidation(); ?> <?php if ($validation->getValeur() === null) : ?> <span style="color:darkgreen;" title=" Par <?php echo $validation->getHistoModificateur()->getDisplayName(); ?> le <?php echo $validation->getHistoModification()->format("d/m/Y"); ?>"> <span class="icon ok"></span> Validée </span> <?php else: ?> <span style="color:darkred;" title=" Par <?php echo $validation->getHistoModificateur()->getDisplayName(); ?> le <?php echo $validation->getHistoModification()->format("d/m/Y"); ?>"> <span class="icon ko"></span> Refusée <?php endif; ?> <?php else : ?> Aucune validation <?php endif; ?> </td> <td class="action-cell"> <?php if ($canVoir) : ?> <a <?php /** @see \Application\Controller\ElementController::afficherAction() */?> href="<?php echo $this->url('element/afficher', ['type' => ElementController::TYPE_FORMATION, 'id' => $formationElement->getId()], [], true); ?>" class="ajax-modal" > <span class="icon voir" title="Afficher une formation liée à l'agent"></span></a> <?php endif; ?> <?php if ($canModifier) : ?> <a <?php /** @see \Application\Controller\AgentController::modifierFormationAction() */?> href="<?php echo $this->url('agent/modifier-formation', ['formation-element' => $formationElement->getId(), 'agent' => $agent->getId()], [], true); ?>" class="ajax-modal" data-event="modification" > <span class="icon editer" title="Modifier une formation liée à l'agent"></span></a> <?php endif; ?> <?php if ($canHistoriser) : ?> <?php if ($formationElement->estNonHistorise()) : ?> <a <?php /** @see \Application\Controller\AgentController::historiserFormationAction() */?> href="<?php echo $this->url('agent/historiser-formation', ['formation-element' => $formationElement->getId(), 'agent' => $agent->getId()], ['query' => ['retour' => $retour]], true); ?>" > <span class="icon historiser" title="Historiser une formation liée à l'agent"></span></a> <?php else: ?> <a <?php /** @see \Application\Controller\AgentController::restaurerFormationAction() */?> href="<?php echo $this->url('agent/restaurer-formation', ['formation-element' => $formationElement->getId(), 'agent' => $agent->getId()], ['query' => ['retour' => $retour]], true); ?>" > <span class="icon restaurer" title="Restaurer une formation liéesà l'agent"></span></a> <?php endif; ?> <?php endif; ?> <?php if ($canDetruire) : ?> <a <?php /** @see \Application\Controller\AgentController::detruireFormationAction() */?> href="<?php echo $this->url('agent/detruire-formation', ['formation-element' => $formationElement->getId(), 'agent' => $agent->getId()], [], true); ?>" class="ajax-modal" data-event="modification" > <span class="icon detruire" title="Supprimer définitivement une compétence liée à l'agent"></span> </a> <?php endif; ?> <?php if ($canValider) : ?> <?php if ($formationElement->getValidation() === null) : ?> <a <?php /** @see \Application\Controller\AgentController::validerElementAction() */ ?> href="<?php echo $this->url('agent/valider-element', ['type' => "AgentFormation", 'id' => $formationElement->getId()], [], true); ?>" class="ajax-modal" data-event="modification" > <span class="icon validation-do" title="Valider la formation"></span></a> <?php else: ?> <a <?php /** @see \Application\Controller\AgentController::revoquerElementAction() */ ?> href="<?php echo $this->url('agent/revoquer-element', ['validation' => $formationElement->getValidation()->getId()], ['query' => ['retour' => $retour]], true); ?>" > <span class="icon validation-undo" title="Dévalider la formation"></span></a> <?php endif; ?> <?php endif; ?> </td> </tr> <?php endforeach; ?> <?php endforeach; ?> </tbody> </table> </div> </div> <script> function toogleFormationsHistorisees() { let checked = $('input#formations-historisees').prop('checked'); if (checked === true) { $('table#formations th.historise').show(); $('table#formations tr.historise').show(); } else { $('table#formations th.historise').hide(); $('table#formations tr.historise').hide(); } } $(document).ready(function() { toogleFormationsHistorisees(); }); $('input#formations-historisees').change(function() { toogleFormationsHistorisees(); }); </script> No newline at end of file