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

Changelog et nettoyage de parties mises initialement dans TheseController

parent 2b6b0fb8
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
Journal des modifications
=========================

2.1.2 (en cours)
-----
- Ajout de la gestion des co-encadrants

2.1.1
-----
- Liste des thèses : tri par date de 1ere inscription décroissante
+26 −0
Original line number Diff line number Diff line
# Version 2.1.1

## 1. Sur le serveur d'application
  
- RAPPEL : depuis la version 2.0.0, l'application requiert PHP 7.3. 
    
- Placez-vous dans le répertoire de l'application puis lancez la commande suivante 
pour installer la nouvelle version :

```bash
git fetch --tags && git checkout --force 2.1.1 && bash ./install.sh
```

- Selon le moteur PHP que vous avez installé, rechargez le service, exemple :
  - php7.3-fpm         : `service php7.3-fpm reload`
  - apache2-mod-php7.3 : `service apache2 reload`

## 2. Dans la base de données

Ajout de privilèges associés à la gestion des co-encadrants
```SQL
INSERT INTO CATEGORIE_PRIVILEGE (ID, CODE, LIBELLE, ORDRE) VALUES (102, 'co-encadrant', 'Gestion des co-encadrants', '21');
INSERT INTO PRIVILEGE (ID, CATEGORIE_ID, CODE, LIBELLE, ORDRE) VALUES (PRIVILEGE_ID_SEQ.nextval, 102, 'co-encadrant_afficher', 'Affichage des historiques de co-encadrants', 10);
INSERT INTO PRIVILEGE (ID, CATEGORIE_ID, CODE, LIBELLE, ORDRE) VALUES (PRIVILEGE_ID_SEQ.nextval, 102, 'co-encadrant_gerer', 'Gérer les co-encadrants', 20);
```
+13 −3
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@ use Application\Controller\CoEncadrantController;
use Application\Controller\Factory\CoEncadrantControllerFactory;
use Application\Form\Factory\RechercherCoEncadrantFormFactory;
use Application\Form\RechercherCoEncadrantForm;
use Application\Provider\Privilege\CoEncadrantPrivileges;
use Application\Service\CoEncadrant\CoEncadrantService;
use Application\Service\CoEncadrant\CoEncadrantServiceFactory;
use UnicaenAuth\Guard\PrivilegeController;
@@ -22,11 +23,20 @@ return [
                        'index',
                        'historique',
                        'rechercher-co-encadrant',
                    ],
                    'privileges' => [
                        CoEncadrantPrivileges::COENCADRANT_AFFICHER,
                    ],
                ],
                [
                    'controller' => CoEncadrantController::class,
                    'action'     => [
                        'ajouter-co-encadrant',
                        'retirer-co-encadrant',
                    ],
//                    'privileges' => [],
                    'roles' => [],
                    'privileges' => [
                        CoEncadrantPrivileges::COENCADRANT_GERER,
                    ],
                ],
            ],
        ],
@@ -68,7 +78,7 @@ return [
                    'ajouter-co-encadrant' => [
                        'type'          => Segment::class,
                        'options'       => [
                            'route'    => '/ajouter-co-encadrant/:these/:co-encadrant',
                            'route'    => '/ajouter-co-encadrant/:these',
                            'defaults' => [
                                'controller'    => CoEncadrantController::class,
                                'action'        => 'ajouter-co-encadrant',
+0 −32
Original line number Diff line number Diff line
@@ -103,14 +103,6 @@ return [
                    ],
                    'roles' => 'user',
                ],
                [
                    'controller' => 'Application\Controller\These',
                    'action'     => [
                        'ajouter-co-encadrant',
                        'retirer-co-encadrant',
                    ],
                    'roles' => 'user',
                ],
                [
                    'controller' => 'Application\Controller\These',
                    'action'     => [
@@ -392,30 +384,6 @@ 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'       => [
+49 −1
Original line number Diff line number Diff line
@@ -2,16 +2,22 @@

namespace Application\Controller;

use Application\Entity\Db\Acteur;
use Application\Entity\Db\Individu;
use Application\Entity\Db\These;
use Application\Form\RechercherCoEncadrantFormAwareTrait;
use Application\Service\Acteur\ActeurServiceAwareTrait;
use Application\Service\CoEncadrant\CoEncadrantServiceAwareTrait;
use Application\Service\Individu\IndividuServiceAwareTrait;
use Application\Service\These\TheseServiceAwareTrait;
use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\JsonModel;
use Zend\View\Model\ViewModel;

class CoEncadrantController extends AbstractActionController {
    use ActeurServiceAwareTrait;
    use CoEncadrantServiceAwareTrait;
    use IndividuServiceAwareTrait;
    use TheseServiceAwareTrait;
    use RechercherCoEncadrantFormAwareTrait;

@@ -45,7 +51,7 @@ class CoEncadrantController extends AbstractActionController {
                // mise en forme attendue par l'aide de vue FormSearchAndSelect
                $label = $acteur->getIndividu()->getPrenom() . ' ' . $acteur->getIndividu()->getNomUsuel();
                $extra = ($acteur->getIndividu()->getEmail())?:$acteur->getIndividu()->getSourceCode();
                $result[$acteur->getId()] = array(
                $result[$acteur->getIndividu()->getId()] = array(
                    'id' => $acteur->getId(),   // identifiant unique de l'item
                    'label' => $label,          // libellé de l'item
                    'extra' => $extra,          // infos complémentaires (facultatives) sur l'item
@@ -80,4 +86,46 @@ class CoEncadrantController extends AbstractActionController {
            'closes' => $closes,
        ]);
    }

    public function ajouterCoEncadrantAction()
    {
        /** @var These $these */
        $theseId = $this->params()->fromRoute('these');
        $these = $this->getTheseService()->getRepository()->find($theseId);

        $form = $this->getRechercherCoEncadrantForm();
        $form->setAttribute('action', $this->url()->fromRoute('these/ajouter-co-encadrant', [], [], true));
        $form->setUrlCoEncadrant($this->url()->fromRoute('utilisateur/rechercher-individu', [], [], true));

        $request = $this->getRequest();
        if ($request->isPost()) {
            $data = $request->getPost();

            if (isset($data['co-encadrant']['id'])) {
                /** @var Individu $individu */
                $individu = $this->getIndividuService()->getRepository()->find($data['co-encadrant']['id']);
                $this->getActeurService()->ajouterCoEncradrant($these, $individu);
            }
        }

        return new ViewModel([
            'title' => "Ajout d'un co-encadrant pour la thèse de ". $these->getDoctorant()->getIndividu()->getPrenom() . " " . $these->getDoctorant()->getIndividu()->getNomUsuel(),
            'form' => $form,
        ]);
    }

    public function retirerCoEncadrantAction()
    {
        /** @var These $these */
        $theseId = $this->params()->fromRoute('these');
        $these = $this->getTheseService()->getRepository()->find($theseId);
        $acteurId = $this->params()->fromRoute('co-encadrant');

        /** @var Acteur $acteur */
        $acteur = $this->getActeurService()->getRepository()->find($acteurId);
        if ($acteur !== null AND $acteur->getThese() === $these) $this->getActeurService()->delete($acteur);

        $this->redirect()->toRoute('these/identite', ['these' => $these->getId()], [], true);

    }
}
 No newline at end of file
Loading