Commit fd0cffc5 authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

Début de l'administration des établissements

parent 2a66137c
Loading
Loading
Loading
Loading
+x+168
Changes for module/Application/config/others/etablissement.php: 168 added lines, 0 removed lines.
Original line number Diff line number Diff line
<?php

use Application\Controller\Factory\EcoleDoctoraleControllerFactory;
use Application\Form\Factory\EcoleDoctoraleFormFactory;
use Application\Provider\Privilege\EcoleDoctoralePrivileges;
use Application\Service\EcoleDoctorale\EcoleDoctoraleService;
use Application\View\Helper\EcoleDoctoraleHelper;
use UnicaenAuth\Guard\PrivilegeController;

return [
    'bjyauthorize'    => [
        'guards' => [
            PrivilegeController::class => [
                [
                    'controller' => 'Application\Controller\Etablissement',
                    'action'     => [
                        'index',
                    ],
                    'privileges' => EcoleDoctoralePrivileges::ECOLE_DOCT_CONSULTATION,
                ],
//                [
//                    'controller' => 'Application\Controller\Etablissement',
//                    'action'     => [
//                        'ajouter',
//                        'supprimer',
//                        'restaurer',
//                        'modifier',
//                        'ajouter-individu',
//                        'retirer-individu',
//                    ],
//                    'privileges' => EcoleDoctoralePrivileges::ECOLE_DOCT_MODIFICATION,
//                ],
            ],
        ],
    ],
    'router'          => [
        'routes' => [
            'ecole-doctorale' => [
                'type'          => 'Segment',
                'options'       => [
                    'route'    => '/[:language/]etablissement',
                    'defaults' => [
                        '__NAMESPACE__' => 'Application\Controller',
                        'controller'    => 'Etablissement',
                        'action'        => 'index',
                        'language'      => 'fr_FR',
                    ],
                ],
                'may_terminate' => true,
//                'child_routes'  => [
//                    'ajouter' => [
//                        'type'          => 'Segment',
//                        'options'       => [
//                            'route'       => '/ajouter',
//                            'defaults'    => [
//                                'action' => 'ajouter',
//                            ],
//                        ],
//                    ],
//                    'supprimer' => [
//                        'type'          => 'Segment',
//                        'options'       => [
//                            'route'       => '/:ecoleDoctorale/supprimer',
//                            'constraints' => [
//                                'ecoleDoctorale' => '\d+',
//                            ],
//                            'defaults'    => [
//                                'action' => 'supprimer',
//                            ],
//                        ],
//                    ],
//                    'restaurer' => [
//                        'type'          => 'Segment',
//                        'options'       => [
//                            'route'       => '/:ecoleDoctorale/restaurer',
//                            'constraints' => [
//                                'ecoleDoctorale' => '\d+',
//                            ],
//                            'defaults'    => [
//                                'action' => 'restaurer',
//                            ],
//                        ],
//                    ],
//                    'modifier' => [
//                        'type'          => 'Segment',
//                        'options'       => [
//                            'route'       => '/:ecoleDoctorale/modifier',
//                            'constraints' => [
//                                'ecoleDoctorale' => '\d+',
//                            ],
//                            'defaults'    => [
//                                'action' => 'modifier',
//                            ],
//                        ],
//                    ],
//                    'ajouter-individu' => [
//                        'type'          => 'Segment',
//                        'options'       => [
//                            'route'       => '/:ecoleDoctorale/ajouter-individu',
//                            'constraints' => [
//                                'ecoleDoctorale' => '\d+',
//                            ],
//                            'defaults'    => [
//                                'action' => 'ajouter-individu',
//                            ],
//                        ],
//                    ],
//                    'retirer-individu' => [
//                        'type'          => 'Segment',
//                        'options'       => [
//                            'route'       => '/:ecoleDoctorale/retirer-individu/:edi',
//                            'constraints' => [
//                                'ecoleDoctorale' => '\d+',
//                                'edi' => '\d+',
//                            ],
//                            'defaults'    => [
//                                'action' => 'retirer-individu',
//                            ],
//                        ],
//                    ],
//                ],
            ],
        ],
    ],
    'navigation'      => [
        'default' => [
            'home' => [
                'pages' => [
                    'admin' => [
                        'pages' => [
                            'ecole-doctorale' => [
                                'label'    => 'Établissement',
                                'route'    => 'etablissement',
                                'resource' => PrivilegeController::getResourceId('Application\Controller\Etablissement', 'index'),
                            ],
                        ],
                    ],
                ],
            ],
        ],
    ],
    'service_manager' => [
//        'invokables' => [
//            'EcoleDoctoraleService' => EcoleDoctoraleService::class,
//        ],
//        'factories' => [
//        ],
    ],
    'controllers'     => [
        'invokables' => [
        ],
        'factories' => [
            'Application\Controller\Etablissement' => EtablissementControllerFactory::class,
        ],
    ],
    'form_elements'   => [
//        'invokables' => [
//        ],
//        'factories' => [
//            'EcoleDoctoraleForm' => EtablissementFormFactory::class,
//        ],
    ],
    'view_helpers' => [
//        'invokables' => [
//            'ed' => EcoleDoctoraleHelper::class,
//        ],
    ],
];
+38
Changes for module/Application/src/Application/Controller/EtablissementController.php: 38 added lines, 0 removed lines.
Original line number Diff line number Diff line
<?php

namespace Application\Controller;

class EtablissementController extends AbstractController
{

    public function indexAction()
    {
        $selected = $this->params()->fromQuery('selected');
        $etablissements = null;

        /** la pagination est desactivée pour le moment */
//        /** @var DefaultQueryBuilder $qb */
//        $qb = $this->etablissementService->getRepository()->createQueryBuilder('ed');
//        $qb->addOrderBy('ed.libelle');
//
//        $paginator = new \Zend\Paginator\Paginator(new DoctrinePaginator(new Paginator($qb, true)));
//        $paginator
//            ->setPageRange(30)
//            ->setItemCountPerPage(20)
//            ->setCurrentPageNumber(1);

        /** les individus sont desactivés pour le moment */
//        $ecoleDoctoraleIndividus = null;
//        if ($selected) {
//            /** @var EcoleDoctorale $ed */
//            $ed = $this->ecoleDoctoraleService->getRepository()->find($selected);
//            $ecoleDoctoraleIndividus = $ed->getEcoleDoctoraleIndividus();
//        }

        return new ViewModel([
            'etablissements' => $etablissements,
            'selected' => $selected,

        ]);
    }
}
 No newline at end of file
+22
Changes for module/Application/src/Application/Controller/Factory/EtablissementControllerFactory.php: 22 added lines, 0 removed lines.
Original line number Diff line number Diff line
<?php

namespace Application\Controller\Factory;

use Application\Controller\EtablissementController;
use Zend\Mvc\Controller\ControllerManager;

class EtablissementControllerFactory
{
    /**
     * Create service
     *
     * @param ControllerManager $controllerManager
     * @return EtablissementController
     */
    public function __invoke(ControllerManager $controllerManager)
    {
        $controller = new EtablissementController();

        return $controller;
    }
}
 No newline at end of file