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

Transfert des gets en finds pour les écoles doctorales

parent 0454a4e1
Loading
Loading
Loading
Loading
+13 −13
Changes for module/Application/src/Application/Controller/EcoleDoctoraleController.php: 13 added lines, 13 removed lines.
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ class EcoleDoctoraleController extends AbstractController
             * @var StructureConcreteInterface $structure
             * @var Role[] $roles
             */
            $structure  = $this->ecoleDoctoraleService->getEcoleDoctoraleByStructureId($selected);
            $structure  = $this->getEcoleDoctoraleService()->getRepository()->findByStructureId($selected);
            $roles = $structure->getStructure()->getStructureDependantRoles();

            $effectifs = [];
@@ -49,7 +49,7 @@ class EcoleDoctoraleController extends AbstractController
            }
        }

        $structuresAll = $this->ecoleDoctoraleService->getEcolesDoctorales();
        $structuresAll = $this->getEcoleDoctoraleService()->getRepository()->findAll();

        /** retrait des structures substituées */
        //TODO faire cela dans le service ???
@@ -89,7 +89,7 @@ class EcoleDoctoraleController extends AbstractController
    {
        /** @var EcoleDoctorale $ecole */
        $ecoleId = $this->params()->fromRoute("ecoleDoctorale");
        $ecole  = $this->ecoleDoctoraleService->getEcoleDoctoraleByStructureId($ecoleId);
        $ecole  = $this->getEcoleDoctoraleService()->getRepository()->findByStructureId($ecoleId);
        $this->ecoleDoctoraleForm->bind($ecole);

        // si POST alors on revient du formulaire
@@ -116,7 +116,7 @@ class EcoleDoctoraleController extends AbstractController
                }
                // mise à jour des données relatives aux écoles doctorales
                $ecole = $this->ecoleDoctoraleForm->getData();
                $this->ecoleDoctoraleService->update($ecole);
                $this->getEcoleDoctoraleService()->update($ecole);

                $this->flashMessenger()->addSuccessMessage("École doctorale '$ecole' modifiée avec succès");
                return $this->redirect()->toRoute('ecole-doctorale', [], ['query' => ['selected' => $ecoleId]], true);
@@ -150,7 +150,7 @@ class EcoleDoctoraleController extends AbstractController
            if ($this->ecoleDoctoraleForm->isValid()) {
                /** @var EcoleDoctorale $ecole */
                $ecole = $this->ecoleDoctoraleForm->getData();
                $ecole = $this->ecoleDoctoraleService->create($ecole, $this->userContextService->getIdentityDb());
                $ecole = $this->getEcoleDoctoraleService()->create($ecole, $this->userContextService->getIdentityDb());

                // sauvegarde du logo si fourni
                if ($file['cheminLogo']['tmp_name'] !== '') {
@@ -179,9 +179,9 @@ class EcoleDoctoraleController extends AbstractController
    public function supprimerAction()
    {
        $ecoleId = $this->params()->fromRoute("ecoleDoctorale");
        $ecole  = $this->ecoleDoctoraleService->getEcoleDoctoraleByStructureId($ecoleId);
        $ecole  = $this->getEcoleDoctoraleService()->getRepository()->findByStructureId($ecoleId);

        $this->ecoleDoctoraleService->deleteSoftly($ecole, $this->userContextService->getIdentityDb());
        $this->getEcoleDoctoraleService()->deleteSoftly($ecole, $this->userContextService->getIdentityDb());

        $this->flashMessenger()->addSuccessMessage("École doctorale '$ecole' supprimée avec succès");

@@ -191,9 +191,9 @@ class EcoleDoctoraleController extends AbstractController
    public function restaurerAction()
    {
        $ecoleId = $this->params()->fromRoute("ecoleDoctorale");
        $ecole  = $this->ecoleDoctoraleService->getEcoleDoctoraleByStructureId($ecoleId);
        $ecole  = $this->getEcoleDoctoraleService()->getRepository()->findByStructureId($ecoleId);

        $this->ecoleDoctoraleService->undelete($ecole);
        $this->getEcoleDoctoraleService()->undelete($ecole);

        $this->flashMessenger()->addSuccessMessage("École doctorale '$ecole' restaurée avec succès");

@@ -231,9 +231,9 @@ class EcoleDoctoraleController extends AbstractController
    public function supprimerLogoEcoleDoctorale()
    {
        $ecoleId = $this->params()->fromRoute("ecoleDoctorale");
        $ecole  = $this->ecoleDoctoraleService->getEcoleDoctoraleByStructureId($ecoleId);
        $ecole  = $this->getEcoleDoctoraleService()->getRepository()->findByStructureId($ecoleId);

        $this->ecoleDoctoraleService->deleteLogo($ecole);
        $this->getEcoleDoctoraleService()->deleteLogo($ecole);
        $filename   = EcoleDoctoraleController::getLogoFilename($ecole, true);
        if (file_exists($filename)) {
            $result = unlink($filename);
@@ -264,14 +264,14 @@ class EcoleDoctoraleController extends AbstractController

        if ($ecole === null) {
            $ecoleId = $this->params()->fromRoute("ecoleDoctorale");
            $ecole  = $this->ecoleDoctoraleService->getEcoleDoctoraleByStructureId($ecoleId);
            $ecole  = $this->getEcoleDoctoraleService()->getRepository()->findByStructureId($ecoleId);
        }
        $chemin     = EcoleDoctoraleController::getLogoFilename($ecole, false);
        $filename   = EcoleDoctoraleController::getLogoFilename($ecole, true);
        $result = rename($cheminLogoUploade, $filename);
        if ($result) {
            $this->flashMessenger()->addSuccessMessage("Le logo de l'école doctorale {$ecole->getLibelle()} vient d'être ajouté.");
            $this->ecoleDoctoraleService->setLogo($ecole,$chemin);
            $this->getEcoleDoctoraleService()->setLogo($ecole,$chemin);
        } else {
            $this->flashMessenger()->addErrorMessage("Erreur lors de l'enregistrement du logo de l'école doctorale <strong>{$ecole->getLibelle()}.</strong>");
        }
+2 −2
Changes for module/Application/src/Application/Controller/StatistiqueController.php: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ class StatistiqueController extends AbstractController
        $qb = $this->decorateWithDate($qb, $dateType, $dateDebut, $dateFin);

        $theses = $qb->getQuery()->execute();
        $ecoles = $this->ecoleDoctoraleService->getEcolesDoctorales();
        $ecoles = $this->getEcoleDoctoraleService()->getRepository()->findAll();
        $unites = $this->uniteRechercheService->getUnitesRecherches();
        $etablissements = $this->getEtablissementService()->getRepository()->findAll();
        return new ViewModel([
@@ -66,7 +66,7 @@ class StatistiqueController extends AbstractController
        if ($type !== null && $id !== null) {
            switch($type) {
                case "ED" :
                    $ecole = $this->ecoleDoctoraleService->getEcoleDoctoraleById($id);
                    $ecole = $this->getEcoleDoctoraleService()->getRepository()->find($id);
                    return  $qb->andWhere("t.ecoleDoctorale = :ed")
                                ->setParameter(":ed", $ecole);
                case "UR" :
+1 −1
Changes for module/Application/src/Application/Controller/StructureController.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -75,7 +75,7 @@ class StructureController extends AbstractController

        switch($type) {
            case TypeStructure::CODE_ECOLE_DOCTORALE :
                $ecole = $this->getEcoleDoctoraleService()->getEcoleDoctoraleByStructureId($id);
                $ecole = $this->getEcoleDoctoraleService()->getRepository()->findByStructureId($id);
                $this->getRoleService()->addRoleByStructure($ecole);
                $this->redirect()->toRoute('ecole-doctorale', [], ['query' => ['selected' => $id]]);
                break;
+1 −1
Changes for module/Application/src/Application/Controller/SubstitutionController.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -349,7 +349,7 @@ class SubstitutionController extends AbstractController
        $structures = [];
        switch($type) {
            case (TypeStructure::CODE_ECOLE_DOCTORALE):
                $structures = $this->ecoleDoctoraleService->getEcolesDoctorales();
                $structures = $this->getEcoleDoctoraleService()->getRepository()->findAll();
                break;
            case (TypeStructure::CODE_ETABLISSEMENT):
                $structures = $this->getEtablissementService()->getRepository()->findAll();
+1 −1
Changes for module/Application/src/Application/Controller/UtilisateurController.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -69,7 +69,7 @@ class UtilisateurController extends \UnicaenAuth\Controller\UtilisateurControlle
        $roles = $this->roleService->getRoles();
        $etablissements = $this->getEtablissementService()->getRepository()->findAll();
        $unites = $this->uniteRechercheService->getUnitesRecherches();
        $ecoles = $this->ecoleDoctoraleService->getEcolesDoctorales();
        $ecoles = $this->getEcoleDoctoraleService()->getRepository()->findAll();

        return new ViewModel([
            'individu' => $individu,
Loading