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

Possibilité de saisir l'établissement du co-encadrant (si différent de...

Possibilité de saisir l'établissement du co-encadrant (si différent de l'établissement d'inscription)
parent 1a525f28
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@ Journal des modifications
- Rapport activité : augmentation à 10 min du timeout CSRF dans le formulaire de création/modification.
- Possibilité de déclarer des missions d'enseignement
- Les avis de soutenance deviennent des FichierThese afin de pouvoir être afficher sur la page des fichiers divers
- Possibilité de saisir l'établissement du co-encadrant (si différent de l'établissement d'inscription)

6.0.2
-----
+26 −17
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@ use Fichier\Service\Fichier\FichierStorageServiceAwareTrait;
use Fichier\Service\Storage\Adapter\Exception\StorageAdapterException;
use Individu\Entity\Db\Individu;
use Individu\Service\IndividuServiceAwareTrait;
use Laminas\Http\Response;
use Laminas\Mvc\Controller\AbstractActionController;
use Laminas\View\Model\JsonModel;
use Laminas\View\Model\ViewModel;
@@ -15,6 +16,7 @@ use Laminas\View\Renderer\PhpRenderer;
use Structure\Entity\Db\EcoleDoctorale;
use Structure\Entity\Db\UniteRecherche;
use Structure\Service\EcoleDoctorale\EcoleDoctoraleServiceAwareTrait;
use Structure\Service\Etablissement\EtablissementServiceAwareTrait;
use Structure\Service\UniteRecherche\UniteRechercheServiceAwareTrait;
use These\Entity\Db\Acteur;
use These\Entity\Db\These;
@@ -25,7 +27,8 @@ use These\Service\CoEncadrant\Exporter\JustificatifCoencadrements\JustificatifCo
use These\Service\These\TheseServiceAwareTrait;
use UnicaenApp\View\Model\CsvModel;

class CoEncadrantController extends AbstractActionController {
class CoEncadrantController extends AbstractActionController
{
    use ActeurServiceAwareTrait;
    use CoEncadrantServiceAwareTrait;
    use IndividuServiceAwareTrait;
@@ -33,6 +36,7 @@ class CoEncadrantController extends AbstractActionController {
    use TheseServiceAwareTrait;
    use RechercherCoEncadrantFormAwareTrait;
    use EcoleDoctoraleServiceAwareTrait;
    use EtablissementServiceAwareTrait;
    use UniteRechercheServiceAwareTrait;


@@ -47,7 +51,7 @@ class CoEncadrantController extends AbstractActionController {
        $this->renderer = $renderer;
    }

    public function indexAction()
    public function indexAction(): ViewModel
    {
        $form = $this->getRechercherCoEncadrantForm();
        $form->setAttribute('action', $this->url()->fromRoute('co-encadrant', [], [], true));
@@ -68,7 +72,7 @@ class CoEncadrantController extends AbstractActionController {
        ]);
    }

    public function rechercherCoEncadrantAction()
    public function rechercherCoEncadrantAction(): JsonModel
    {
        if (($term = $this->params()->fromQuery('term'))) {
            $acteurs = $this->getCoEncadrantService()->findByText($term);
@@ -92,7 +96,7 @@ class CoEncadrantController extends AbstractActionController {
        exit;
    }

    public function ajouterCoEncadrantAction()
    public function ajouterCoEncadrantAction(): ViewModel
    {
        /** @var These $these */
        $theseId = $this->params()->fromRoute('these');
@@ -102,6 +106,7 @@ class CoEncadrantController extends AbstractActionController {
        $form->setAttribute('action', $this->url()->fromRoute('co-encadrant/ajouter-co-encadrant', [], [], true));
        /** @see UtilisateurController::rechercherIndividuAction() */
        $form->setUrlCoEncadrant($this->url()->fromRoute('utilisateur/rechercher-individu', [], ["query" => []], true));
        $form->setUrlEtablisssement($this->url()->fromRoute('etablissement/rechercher', [], ["query" => []], true));

        $request = $this->getRequest();
        if ($request->isPost()) {
@@ -110,7 +115,8 @@ class CoEncadrantController extends AbstractActionController {
            if (isset($data['co-encadrant']['id'])) {
                /** @var Individu $individu */
                $individu = $this->getIndividuService()->getRepository()->find($data['co-encadrant']['id']);
                $this->getActeurService()->ajouterCoEncradrant($these, $individu);
                $etablissement = (isset($data['etablissement']['id']) && $data['etablissement']['id'] !== '')?$this->getEtablissementService()->getRepository()->find($data['etablissement']['id']):null;
                $this->getActeurService()->ajouterCoEncradrant($these, $individu, $etablissement);
            }
        }

@@ -120,7 +126,7 @@ class CoEncadrantController extends AbstractActionController {
        ]);
    }

    public function retirerCoEncadrantAction()
    public function retirerCoEncadrantAction(): Response
    {
        /** @var These $these */
        $theseId = $this->params()->fromRoute('these');
@@ -129,12 +135,12 @@ class CoEncadrantController extends AbstractActionController {

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

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

    public function historiqueAction()
    public function historiqueAction(): ViewModel|Response
    {
        $coencadrant = $this->getCoEncadrantService()->getRequestedCoEncadrant($this);
        if ($coencadrant === null) {
@@ -143,7 +149,8 @@ class CoEncadrantController extends AbstractActionController {

        $theses = $this->getTheseService()->getRepository()->fetchThesesByCoEncadrant($coencadrant->getIndividu());

        $encours = []; $closes = [];
        $encours = [];
        $closes = [];
        foreach ($theses as $these) {
            if ($these->getEtatThese() === These::ETAT_EN_COURS) {
                $encours[] = $these;
@@ -159,7 +166,7 @@ class CoEncadrantController extends AbstractActionController {
        ]);
    }

    public function genererJustificatifCoencadrementsAction()
    public function genererJustificatifCoencadrementsAction(): void
    {
        $coencadrant = $this->getCoEncadrantService()->getRequestedCoEncadrant($this);
        $theses = $this->getTheseService()->getRepository()->fetchThesesByCoEncadrant($coencadrant->getIndividu());
@@ -181,7 +188,7 @@ class CoEncadrantController extends AbstractActionController {
        $export->export('justificatif_coencadrement_' . $coencadrant->getIndividu()->getId() . ".pdf");
    }

    public function genererExportCsvAction()
    public function genererExportCsvAction(): CsvModel
    {
        $structureType = $this->params()->fromRoute('structure-type');
        $structureId = $this->params()->fromRoute('structure-id');
@@ -201,7 +208,9 @@ class CoEncadrantController extends AbstractActionController {
            $entry['Co-endrant'] = $item['co-encadrant']->getIndividu()->getPrenom1() . " " . $item['co-encadrant']->getIndividu()->getNomUsuel();
            $entry['Nombre d\'encadrements actuels'] = count($item['theses']);
            $entry['Listing'] = implode(';',
                array_map(function(These $t) {return $t->getDoctorant()->getIndividu()->getPrenom1() . " " . $t->getDoctorant()->getIndividu()->getNomUsuel();}, $item['theses'])
                array_map(function (These $t) {
                    return $t->getDoctorant()->getIndividu()->getPrenom1() . " " . $t->getDoctorant()->getIndividu()->getNomUsuel();
                }, $item['theses'])
            );
            $records[] = $entry;
        }
+11 −2
Original line number Diff line number Diff line
@@ -6,7 +6,10 @@ use Fichier\Service\Fichier\FichierStorageService;
use Individu\Service\IndividuService;
use Interop\Container\ContainerInterface;
use Laminas\View\Renderer\PhpRenderer;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use Structure\Service\EcoleDoctorale\EcoleDoctoraleService;
use Structure\Service\Etablissement\EtablissementService;
use Structure\Service\UniteRecherche\UniteRechercheService;
use These\Controller\CoEncadrantController;
use These\Form\CoEncadrant\RechercherCoEncadrantForm;
@@ -14,18 +17,22 @@ use These\Service\Acteur\ActeurService;
use These\Service\CoEncadrant\CoEncadrantService;
use These\Service\These\TheseService;

class CoEncadrantControllerFactory {
class CoEncadrantControllerFactory
{

    /**
     * @param ContainerInterface $container
     * @return CoEncadrantController
     * @throws ContainerExceptionInterface
     * @throws NotFoundExceptionInterface
     */
    public function __invoke(ContainerInterface $container)
    public function __invoke(ContainerInterface $container): CoEncadrantController
    {
        /**
         * @var ActeurService $acteurService
         * @var CoEncadrantService $coEncadrantService
         * @var EcoleDoctoraleService $ecoleDoctoraleService
         * @var EtablissementService $etablissementService
         * @var IndividuService $individuService
         * @var FichierStorageService $fileService
         * @var TheseService $theseService
@@ -34,6 +41,7 @@ class CoEncadrantControllerFactory {
        $acteurService = $container->get(ActeurService::class);
        $coEncadrantService = $container->get(CoEncadrantService::class);
        $ecoleDoctoraleService = $container->get(EcoleDoctoraleService::class);
        $etablissementService = $container->get(EtablissementService::class);
        $individuService = $container->get(IndividuService::class);
        $fileService = $container->get(FichierStorageService::class);
        $theseService = $container->get('TheseService');
@@ -51,6 +59,7 @@ class CoEncadrantControllerFactory {
        $controller->setActeurService($acteurService);
        $controller->setCoEncadrantService($coEncadrantService);
        $controller->setEcoleDoctoraleService($ecoleDoctoraleService);
        $controller->setEtablissementService($etablissementService);
        $controller->setIndividuService($individuService);
        $controller->setFichierStorageService($fileService);
        $controller->setTheseService($theseService);
+21 −7
Original line number Diff line number Diff line
@@ -9,29 +9,42 @@ use UnicaenApp\Form\Element\SearchAndSelect;

class RechercherCoEncadrantForm extends Form {

    private $urlCoEncadrant;
    private ?string $urlCoEncadrant = null;
    private ?string $urlEtablissement = null;

    /**
     * @param string $urlCoEncadrant
     */
    public function setUrlCoEncadrant(string $urlCoEncadrant): void
    {
        $this->urlCoEncadrant = $urlCoEncadrant;
        $this->get('co-encadrant')->setAutocompleteSource($this->urlCoEncadrant);
    }
    public function setUrlEtablisssement(string $urlEtablissement): void
    {
        $this->urlEtablissement = $urlEtablissement;
        $this->get('etablissement')->setAutocompleteSource($this->urlEtablissement);
    }

    public function init()
    public function init(): void
    {
        /**
         * SearchAndSelect sur les Individus de la structure fictives
         */
        $coEncadrant = new SearchAndSelect('co-encadrant', ['label' => "Co-encadrant * :"]);
        $coEncadrant = new SearchAndSelect('co-encadrant', ['label' => "Co-encadrant·e * :"]);
        $coEncadrant
            ->setAutocompleteSource($this->urlCoEncadrant)
            ->setSelectionRequired(true)
            ->setAttributes([
                'id' => 'co-encadrant',
                'placeholder' => "Sélectionner un co-encadrant ... ",
                'placeholder' => "Sélectionner un·e co-encadrant·e ... ",
            ]);
        $this->add($coEncadrant);

        $coEncadrant = new SearchAndSelect('etablissement', ['label' => "Établissement (laisser vide si établissement d'inscription) :"]);
        $coEncadrant
            ->setAutocompleteSource($this->urlEtablissement)
            ->setSelectionRequired(true)
            ->setAttributes([
                'id' => 'etablissement',
                'placeholder' => "Sélectionner un établissement ... ",
            ]);
        $this->add($coEncadrant);

@@ -52,6 +65,7 @@ class RechercherCoEncadrantForm extends Form {

        $this->setInputFilter((new Factory())->createInputFilter([
            'co-encadrant' => [ 'required' => true ],
            'etablissement' => [ 'required' => false ],
        ]));
    }
}
 No newline at end of file
+4 −12
Original line number Diff line number Diff line
@@ -2,27 +2,19 @@

namespace These\Form\CoEncadrant;

trait RechercherCoEncadrantFormAwareTrait {
trait RechercherCoEncadrantFormAwareTrait
{

    /** @var RechercherCoEncadrantForm */
    private $rechercherCoEncadrantForm;
    private RechercherCoEncadrantForm $rechercherCoEncadrantForm;

    /**
     * @return RechercherCoEncadrantForm
     */
    public function getRechercherCoEncadrantForm(): RechercherCoEncadrantForm
    {
        return $this->rechercherCoEncadrantForm;
    }

    /**
     * @param RechercherCoEncadrantForm $rechercherCoEncadrantForm
     * @return RechercherCoEncadrantForm
     */
    public function setRechercherCoEncadrantForm(RechercherCoEncadrantForm $rechercherCoEncadrantForm): RechercherCoEncadrantForm
    public function setRechercherCoEncadrantForm(RechercherCoEncadrantForm $rechercherCoEncadrantForm): void
    {
        $this->rechercherCoEncadrantForm = $rechercherCoEncadrantForm;
        return $this->rechercherCoEncadrantForm;
    }


Loading