Commit f91e939d authored by Florian Joriot's avatar Florian Joriot
Browse files

Correction service affiché résumé et détail

parent 09267cfb
Loading
Loading
Loading
Loading
+17 −2
Changes for module/Application/src/Controller/ServiceController.php: 17 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -97,13 +97,20 @@ class ServiceController extends AbstractController
        $canAddService = Privileges::ENSEIGNEMENT_PREVU_EDITION || Privileges::ENSEIGNEMENT_REALISE_EDITION;

        $action             = $this->getRequest()->getQuery('action', null); // ne pas afficher par défaut, sauf si demandé explicitement
        $element             = $this->getRequest()->getQuery('element-pedagogique', null); // ne pas afficher par défaut, sauf si demandé explicitement
        $params             = $this->getEvent()->getRouteMatch()->getParams();
        $params['action']   = 'recherche';
        $rechercheViewModel = $this->forward()->dispatch('Application\Controller\Service', $params);
        $viewModel->addChild($rechercheViewModel, 'recherche');

        $recherche = $this->getServiceService()->loadRecherche();

        if($recherche->getEtape() != null && $recherche->getStructureEns() != null){
            if(isset($element['element-liste'])&& $element['element-liste'] != null){
                $recherche->setElementPedagogique($this->getServiceElementPedagogique()->get($element['element-liste']));
            }else{
                $recherche->setElementPedagogique(null);
            }
        }
        /* Préparation et affichage */
        if ('afficher' === $action) {
            $services = $this->getProcessusService()->getServices(null, $recherche);
@@ -234,13 +241,21 @@ class ServiceController extends AbstractController
            $recherche->setIntervenant($intervenant);
        }

        $viewModel = new \Laminas\View\Model\ViewModel();

        $viewModel = new \Laminas\View\Model\ViewModel();
        $params           = $this->getEvent()->getRouteMatch()->getParams();
        $params['action'] = 'recherche';
        $listeViewModel   = $this->forward()->dispatch('Application\Controller\Service', $params);
        $viewModel->addChild($listeViewModel, 'recherche');

        if($recherche->getEtape() != null && $recherche->getStructureEns() != null){
            if(isset($element['element-liste'])&& $element['element-liste'] != null){
                $recherche->setElementPedagogique($this->getServiceElementPedagogique()->get($element['element-liste']));
            }else{
                $recherche->setElementPedagogique(null);
            }
        }

        if ('afficher' == $action || 'trier' == $action) {
            $params = [
                'tri'              => $tri,