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

debut de controller pour les co-encadrants

parent a5e15dc4
Loading
Loading
Loading
Loading
+117 −0
Changes for module/Application/config/others/coencadrant.config.php: 117 added lines, 0 removed lines.
Original line number Diff line number Diff line
<?php

namespace Application;

use Application\Controller\CoEncadrantController;
use Application\Controller\Factory\CoEncadrantControllerFactory;
use Application\Form\Factory\RechercherCoEncadrantFormFactory;
use Application\Form\RechercherCoEncadrantForm;
use UnicaenAuth\Guard\PrivilegeController;
use Zend\Router\Http\Literal;
use Zend\Router\Http\Segment;

return [
    'bjyauthorize'    => [
        'guards' => [
            PrivilegeController::class => [
                [
                    'controller' => CoEncadrantController::class,
                    'action'     => [
                        'index',
                        'historique',
                        'ajouter-co-encadrant',
                        'retirer-co-encadrant',
                    ],
//                    'privileges' => [],
                    'roles' => [],
                ],
            ],
        ],
    ],

    'router'          => [
        'routes' => [
            'co-encadrant' => [
                'type'          => Literal::class,
                'options'       => [
                    'route'    => '/co-encadrant',
                    'defaults' => [
                        'controller'    => CoEncadrantController::class,
                        'action'        => 'index',
                    ],
                ],
                'may_terminate' => true,
                'child_routes'  => [
                    'historique' => [
                        'type'          => Segment::class,
                        'options'       => [
                            'route'    => '/historique/:co-encadrant',
                            'defaults' => [
                                'controller'    => CoEncadrantController::class,
                                'action'        => 'historique',
                            ],
                        ],
                    ],
                    'ajouter-co-encadrant' => [
                        'type'          => Segment::class,
                        'options'       => [
                            'route'    => '/ajouter-co-encadrant/:these/:co-encadrant',
                            'defaults' => [
                                'controller'    => CoEncadrantController::class,
                                'action'        => 'ajouter-co-encadrant',
                            ],
                        ],
                    ],
                    'retirer-co-encadrant' => [
                        'type'          => Segment::class,
                        'options'       => [
                            'route'    => '/retirer-co-encadrant/:these/:co-encadrant',
                            'defaults' => [
                                'controller'    => CoEncadrantController::class,
                                'action'        => 'retirer-co-encadrant',
                            ],
                        ],
                    ],
                ],
            ],
        ],
    ],

    'navigation'      => [
        'default' => [
            'home' => [
                'pages' => [
                    'admin' => [
                        'pages' => [
                            'co-encadrant' => [
                                'label'    => 'Co-encadrant',
                                'route'    => 'co-encadrant',
                                'resource' => PrivilegeController::getResourceId(CoEncadrantController::class, 'index'),

                                'order'    => 1000,
                                'pages' => [
                                    'historique' => [
                                        'label'    => 'Historique',
                                        'route'    => 'co-encadrant/historique',
                                        'resource' => PrivilegeController::getResourceId(CoEncadrantController::class, 'historique'),
                                    ],
                                ],
                            ],
                        ],
                    ],
                ],
            ],
        ],
    ],

    'controllers' => [
        'factories' => [
            CoEncadrantController::class => CoEncadrantControllerFactory::class,
        ],
    ],
    'form_elements' => [
        'factories' => [
            RechercherCoEncadrantForm::class => RechercherCoEncadrantFormFactory::class,
        ],
    ],
];
+35 −4
Changes for module/Application/config/others/these.config.php: 35 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -21,10 +21,10 @@ use Application\Form\Factory\PointsDeVigilanceHydratorFactory;
use Application\Form\Factory\RdvBuHydratorFactory;
use Application\Form\Factory\RdvBuTheseDoctorantFormFactory;
use Application\Form\Factory\RdvBuTheseFormFactory;
use Application\Provider\Privilege\DoctorantPrivileges;
use Application\Provider\Privilege\RapportAnnuelPrivileges;
use Application\Provider\Privilege\ThesePrivileges;
use Application\Service\Acteur\ActeurService;
use Application\Service\Acteur\ActeurServiceFactory;
use Application\Service\Financement\FinancementService;
use Application\Service\Financement\FinancementServiceFactory;
use Application\Service\Message\DiffusionMessages;
@@ -38,6 +38,7 @@ use Application\Service\TheseAnneeUniv\TheseAnneeUnivServiceFactory;
use Application\View\Helper\Url\UrlTheseHelperFactory;
use UnicaenAuth\Guard\PrivilegeController;
use UnicaenAuth\Provider\Rule\PrivilegeRuleProvider;
use Zend\Router\Http\Segment;

return [
    'bjyauthorize'    => [
@@ -102,6 +103,14 @@ return [
                    ],
                    'roles' => 'user',
                ],
                [
                    'controller' => 'Application\Controller\These',
                    'action'     => [
                        'ajouter-co-encadrant',
                        'retirer-co-encadrant',
                    ],
                    'roles' => 'user',
                ],
                [
                    'controller' => 'Application\Controller\These',
                    'action'     => [
@@ -383,6 +392,30 @@ return [
                            ],
                        ],
                    ],
                    'ajouter-co-encadrant' => [
                        'type'          => Segment::class,
                        'options'       => [
                            'route'       => '/ajouter-co-encadrant/:these',
                            'constraints' => [
                                'these' => '\d+',
                            ],
                            'defaults'    => [
                                'action' => 'ajouter-co-encadrant',
                            ],
                        ],
                    ],
                    'retirer-co-encadrant' => [
                        'type'          => Segment::class,
                        'options'       => [
                            'route'       => '/retirer-co-encadrant/:these/:co-encadrant',
                            'constraints' => [
                                'these' => '\d+',
                            ],
                            'defaults'    => [
                                'action' => 'retirer-co-encadrant',
                            ],
                        ],
                    ],
                    'generate' => [
                        'type'          => 'Segment',
                        'options'       => [
@@ -1097,10 +1130,8 @@ return [
        )
    ),
    'service_manager' => [
        'invokables' => array(
            ActeurService::class => ActeurService::class,
        ),
        'factories' => [
            ActeurService::class           => ActeurServiceFactory::class,
            'TheseService'                 => TheseServiceFactory::class,
            'TheseRechercheService'        => TheseRechercheServiceFactory::class,
            'TheseObserverService'         => TheseObserverServiceFactory::class,
+42 −0
Changes for module/Application/src/Application/Controller/CoEncadrantController.php: 42 added lines, 0 removed lines.
Original line number Diff line number Diff line
<?php

namespace Application\Controller;

use Application\Form\RechercherCoEncadrantFormAwareTrait;
use Zend\Form\Element\Button;
use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;

class CoEncadrantController extends AbstractActionController {
    use RechercherCoEncadrantFormAwareTrait;

    public function indexAction()
    {
        $form = $this->getRechercherCoEncadrantForm();
        $form->setAttribute('action', $this->url()->fromRoute('co-encadrant', [], [], true));
        //todo !doit remonter un acteur
        $form->setUrlCoEncadrant($this->url()->fromRoute('utilisateur/rechercher-individu', [], [], true));
        $form->get('bouton')->setLabel("Afficher l'historique de co-encadrement");

        $request = $this->getRequest();
        if ($request->isPost()) {
            $data = $request->getPost();
            if ($data['co-encadrant']['id'] !== "") {
                $this->redirect()->toRoute('co-encadrant/historique',['co-encadrant' => $data['co-encadrant']['id']]);
            }
        }

        return new ViewModel([
            'form' => $form,
        ]);
    }

    public function historiqueAction()
    {
        $coencadrant = null;

        return new ViewModel([
            'coencadrant' => $coencadrant,
        ]);
    }
}
 No newline at end of file
+26 −0
Changes for module/Application/src/Application/Controller/Factory/CoEncadrantControllerFactory.php: 26 added lines, 0 removed lines.
Original line number Diff line number Diff line
<?php

namespace Application\Controller\Factory;

use Application\Controller\CoEncadrantController;
use Application\Form\RechercherCoEncadrantForm;
use Interop\Container\ContainerInterface;

class CoEncadrantControllerFactory {

    /**
     * @param ContainerInterface $container
     * @return CoEncadrantController
     */
    public function __invoke(ContainerInterface $container)
    {
        /**
         * @var RechercherCoEncadrantForm $rechercheCoEncadrantForm
         */
        $rechercheCoEncadrantForm = $container->get('FormElementManager')->get(RechercherCoEncadrantForm::class);

        $controller = new CoEncadrantController();
        $controller->setRechercherCoEncadrantForm($rechercheCoEncadrantForm);
        return $controller;
    }
}
 No newline at end of file
+15 −1
Changes for module/Application/src/Application/Controller/Factory/TheseControllerFactory.php: 15 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -9,9 +9,12 @@ use Application\Form\MetadonneeTheseForm;
use Application\Form\PointsDeVigilanceForm;
use Application\Form\RdvBuTheseDoctorantForm;
use Application\Form\RdvBuTheseForm;
use Application\Form\RechercherCoEncadrantForm;
use Application\Service\Acteur\ActeurService;
use Application\Service\Etablissement\EtablissementService;
use Application\Service\FichierThese\FichierTheseService;
use Application\Service\File\FileService;
use Application\Service\Individu\IndividuService;
use Application\Service\MailConfirmationService;
use Application\Service\Notification\NotifierService;
use Application\Service\Role\RoleService;
@@ -58,6 +61,8 @@ class TheseControllerFactory
         * @var EntityManager           $entityManager
         * @var ImportService           $importService
         * @var UtilisateurService      $utilisateurService
         * @var ActeurService           $acteurService
         * @var IndividuService         $indivdiService
         */
        $variableService = $container->get('VariableService');
        $validationService = $container->get('ValidationService');
@@ -75,6 +80,8 @@ class TheseControllerFactory
        $notifierService = $container->get(NotifierService::class);
        $importService = $container->get('ImportService');
        $utilisateurService = $container->get('UtilisateurService');
        $acteurService = $container->get(ActeurService::class);
        $individuService = $container->get('IndividuService');

        /**
         * @var RdvBuTheseDoctorantForm $rdvBuTheseDoctorantForm
@@ -89,8 +96,12 @@ class TheseControllerFactory
        $diffusionTheseForm = $container->get('FormElementManager')->get('DiffusionTheseForm');
        /** @var MetadonneeTheseForm $metadonneeTheseForm */
        $metadonneeTheseForm = $container->get('FormElementManager')->get('MetadonneeTheseForm');
        /** @var PointsDeVigilanceForm $pointsDeVigilanceForm */
        /**
         * @var PointsDeVigilanceForm $pointsDeVigilanceForm
         * @var RechercherCoEncadrantForm $rechercherCoEncadrantForm
         */
        $pointsDeVigilanceForm = $container->get('FormElementManager')->get('PointsDeVigilanceForm');
        $rechercherCoEncadrantForm = $container->get('FormElementManager')->get(RechercherCoEncadrantForm::class);

        /* @var $renderer PhpRenderer */
        $renderer = $container->get('ViewRenderer');
@@ -109,6 +120,8 @@ class TheseControllerFactory
        $controller->setEtablissementService($etablissementService);
        $controller->setUniteRechercheService($uniteService);
        $controller->setMailConfirmationService($mailConfirmationService);
        $controller->setActeurService($acteurService);
        $controller->setIndividuService($individuService);
        $controller->setEntityManager($entityManager);
        $controller->setNotifierService($notifierService);
        $controller->setImportService($importService);
@@ -119,6 +132,7 @@ class TheseControllerFactory
        $controller->setDiffusionTheseForm($diffusionTheseForm);
        $controller->setMetadonneeTheseForm($metadonneeTheseForm);
        $controller->setPointsDeVigilanceForm($pointsDeVigilanceForm);
        $controller->setRechercherCoEncadrantForm($rechercherCoEncadrantForm);
        $controller->setRenderer($renderer);
        /**
         * @var SourceCodeStringHelper $sourceCodeHelper
Loading