Commit 4e773ae1 authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

Refonte menu : module Soutenance

parent 8f9266bd
Loading
Loading
Loading
Loading
+6 −6
Changes for module/Application/config/others/these.config.php: 6 added lines, 6 removed lines.
Original line number Diff line number Diff line
@@ -907,7 +907,7 @@ return [
                     * Navigation pour LA thèse courante.
                     */
                    // DEPTH = 1
                    'these' => [
                    'these_selectionnee' => [
                        'label' => 'Thèse sélectionnée',
                        'route' => 'these/identite',
                        'withtarget' => true,
@@ -974,7 +974,7 @@ return [
                                'class' => 'divider',
                            ],
                            //---------------------------------------------------
                            'depot' => $depotPages = [
                            'depot' => [
                                'label' => 'Dépôt',
                                'order' => 60,
                                'route' => 'these/roadmap',
@@ -1189,7 +1189,7 @@ return [
                     * @see ApplicationNavigationFactory::processPage()
                     */
                    // DEPTH = 1
                    'MA_THESE_PLACEHOLDER' => [
                    ApplicationNavigationFactory::MA_THESE_PAGE_ID => [
                        'order' => -200,
                        'label' => 'Ma thèse',
                        'route' => 'these/identite',
@@ -1206,7 +1206,7 @@ return [
                     * @see ApplicationNavigationFactory::processPage()
                     */
                    // DEPTH = 1
                    'MES_THESES_PLACEHOLDER' => [
                    ApplicationNavigationFactory::MES_THESES_PAGE_ID => [
                        'order' => -200,
                        'label' => 'Mes thèses',
                        'uri' => '',
@@ -1231,7 +1231,7 @@ return [
                     * @see ApplicationNavigationFactory::processPage()
                     */
                    // DEPTH = 1
                    'NOS_THESES_PLACEHOLDER' => [
                    ApplicationNavigationFactory::NOS_THESES_PAGE_ID => [
                        'order' => -200,
                        'label' => 'Nos thèses',
                        'route' => 'these/recherche/notres',
@@ -1239,7 +1239,7 @@ return [
                        'pages' => [
                            // DEPTH = 2
                            'THESES' => [
                                'label' => '(Structure)',
                                'label' => '(Thèses Structure)',
                                'route' => 'these/recherche/notres',
                                'params' => [],
                                'query' => [], // injection automatique du filtre "structure"
+53 −30
Changes for module/Application/src/Application/Navigation/ApplicationNavigationFactory.php: 53 added lines, 30 removed lines.
Original line number Diff line number Diff line
@@ -2,6 +2,8 @@

namespace Application\Navigation;

use Application\Entity\Db\Doctorant;
use Application\Entity\Db\Individu;
use Application\Entity\Db\Role;
use Application\Entity\Db\These;
use Application\Search\EcoleDoctorale\EcoleDoctoraleSearchFilter;
@@ -9,6 +11,7 @@ use Application\Search\Etablissement\EtablissementSearchFilter;
use Application\Search\UniteRecherche\UniteRechercheSearchFilter;
use Application\Service\These\TheseServiceAwareTrait;
use Application\Service\UserContextServiceAwareTrait;
use Interop\Container\ContainerInterface;
use UnicaenApp\Util;
use Zend\Router\RouteMatch;

@@ -20,9 +23,36 @@ class ApplicationNavigationFactory extends NavigationFactory
    use UserContextServiceAwareTrait;
    use TheseServiceAwareTrait;

    const MA_THESE_PAGE_PLACEHOLDER_ID = 'MA_THESE_PLACEHOLDER';
    const MES_THESES_PAGE_PLACEHOLDER_ID = 'MES_THESES_PLACEHOLDER';
    const NOS_THESES_PAGE_PLACEHOLDER_ID = 'NOS_THESES_PLACEHOLDER';
    const MA_THESE_PAGE_ID = 'MA_THESE';
    const MES_THESES_PAGE_ID = 'MES_THESES';
    const NOS_THESES_PAGE_ID = 'NOS_THESES';

    /**
     * @var Doctorant|null
     */
    private $doctorant;

    /**
     * @var Role|null
     */
    private $role;

    /**
     * @var Individu|null
     */
    private $individu;

    /**
     * @inheritDoc
     */
    protected function preparePages(ContainerInterface $container, $pages): ?array
    {
        $this->doctorant = $this->userContextService->getIdentityDoctorant();
        $this->role = $this->userContextService->getSelectedIdentityRole();
        $this->individu = $this->userContextService->getIdentityIndividu();

        return parent::preparePages($container, $pages);
    }

    /**
     * @inheritDoc
@@ -48,7 +78,7 @@ class ApplicationNavigationFactory extends NavigationFactory
     */
    protected function processPage(array &$page, RouteMatch $routeMatch = null)
    {
        $this->generateDynamicChildrenPages($page);
        $this->handleDynamicPage($page);

        parent::processPage($page, $routeMatch);
    }
@@ -56,18 +86,19 @@ class ApplicationNavigationFactory extends NavigationFactory
    /**
     * @param array $page
     */
    protected function generateDynamicChildrenPages(array &$page)
    protected function handleDynamicPage(array &$page)
    {
        /**
         * Ma thèse
         */
        // Rôle Doctorant : génération d'une page "Ma thèse" pour chaque thèse du doctorant
        if ($protoPage = $page['pages'][$key = self::MA_THESE_PAGE_PLACEHOLDER_ID] ?? null) {
            if ($doctorant = $this->userContextService->getIdentityDoctorant()) {
                $theses = $this->theseService->getRepository()->findThesesByDoctorant($doctorant, [These::ETAT_EN_COURS]);
        if ($protoPage = $page['pages'][$key = self::MA_THESE_PAGE_ID] ?? null) {
            if ($this->doctorant !== null) {
                $theses = $this->theseService->getRepository()->findThesesByDoctorant($this->doctorant, [These::ETAT_EN_COURS]);
                /////////////////////////////////// LOUVRY Isabelle 33383 : 2 thèses E et S
                $newPages = $this->createPagesMaThese($protoPage, $theses);
                $page['pages'] = array_merge($page['pages'], $newPages);
                $page['visible'] = true;
            }
            unset($page['pages'][$key]);
        }
@@ -76,12 +107,10 @@ class ApplicationNavigationFactory extends NavigationFactory
         * Mes thèses
         */
        // Rôles acteurs de thèses (Dir, Codir, etc.) : génération d'une page "Mes thèses" contenant une page fille par thèse
        if ($protoPage = $page['pages'][$key = self::MES_THESES_PAGE_PLACEHOLDER_ID] ?? null) {
        if ($protoPage = $page['pages'][$key = self::MES_THESES_PAGE_ID] ?? null) {
            /** @var Role $role */
            $role = $this->userContextService->getSelectedIdentityRole();
            $individu = $this->userContextService->getIdentityIndividu();
            if ($role !== null && $role->isActeurDeThese()) {
                $theses = $this->theseService->getRepository()->findThesesByActeur($individu, $role, [These::ETAT_EN_COURS]);
            if ($this->role !== null && $this->role->isActeurDeThese()) {
                $theses = $this->theseService->getRepository()->findThesesByActeur($this->individu, $role, [These::ETAT_EN_COURS]);
                $newPages = $this->createPageMesTheses($protoPage, $theses);
                $page['pages'][$key]['pages'] = $newPages;
            } else {
@@ -93,11 +122,9 @@ class ApplicationNavigationFactory extends NavigationFactory
         * Nos thèses
         */
        // Rôles ED, UR, MDD, etc. : génération d'une page "Nos thèses" contenant une page fille indiquant la structure filtrante
        if ($protoPage = $page['pages'][$key = self::NOS_THESES_PAGE_PLACEHOLDER_ID] ?? null) {
            /** @var Role $role */
            $role = $this->userContextService->getSelectedIdentityRole();
            if ($role !== null && ($role->isEcoleDoctoraleDependant() || $role->isUniteRechercheDependant() || $role->isEtablissementDependant())) {
                $newPages = $this->createPageNosTheses($protoPage, $role);
        if ($protoPage = $page['pages'][$key = self::NOS_THESES_PAGE_ID] ?? null) {
            if ($this->role !== null && ($this->role->isEcoleDoctoraleDependant() || $this->role->isUniteRechercheDependant() || $this->role->isEtablissementDependant())) {
                $newPages = $this->createPageNosTheses($protoPage, $this->role);
                $page['pages'][$key]['pages'] = $newPages;
            } else {
                unset($page['pages'][$key]);
@@ -129,16 +156,6 @@ class ApplicationNavigationFactory extends NavigationFactory
            $newPage['title'] = $these->getTitre();
            // injection du paramètre de route 'these' dans la page et ses filles
            $this->setParamInPage($newPage, 'these', $these->getId());
//            $newPage['params']['these'] = $these->getId();
//            // injection du paramètre de route 'these' dans les pages filles (profondeur 1)
//            if ($childrenPages = $newPage['pages'] ?? []) {
//                foreach ($childrenPages as $key => $childPage) {
//                    if (isset($childPage['params']['these'])) {
//                        $childrenPages[$key]['params']['these'] = $these->getId();
//                    }
//                }
//                $newPage['pages'] = $childrenPages;
//            }

            $newPages['ma-these-' . ($i + 1)] = $newPage;
        }
@@ -199,7 +216,7 @@ class ApplicationNavigationFactory extends NavigationFactory
                break;
            case $role->isEtablissementDependant():
                $etab = $role->getStructure()->getEtablissement();
                $label = $etab->getLibelle();
                $label = $etab->getCode();
                $query = [EtablissementSearchFilter::NAME => $etab->getSourceCode()];
                break;
            default:
@@ -213,11 +230,17 @@ class ApplicationNavigationFactory extends NavigationFactory
        $protoPage = $parentPage['pages']['THESES'];
        $page = $protoPage;
        // label
        $page['label'] = $label;
        $page['label'] = "Thèses " . $label;
        // params
        $page['query'] = $page['query'] ?? [];
        $page['query'] = array_merge($page['query'], $query);
        $newPages[] = $page;

        // génération d'une page fille emmenant vers les soutenances
        $protoPage = $parentPage['pages']['SOUTENANCES'];
        $page = $protoPage;
        // label
        $page['label'] = "Soutenances " . $label;
        $newPages[] = $page;

        return $newPages;
+16 −16
Changes for module/Soutenance/config/module.config.php: 16 added lines, 16 removed lines.
Original line number Diff line number Diff line
@@ -2,13 +2,12 @@

namespace Soutenance;

use Application\Provider\Privilege\UtilisateurPrivileges;
use Application\Navigation\ApplicationNavigationFactory;
use Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain;
use Doctrine\DBAL\Driver\OCI8\Driver as OCI8;
use Doctrine\ORM\Mapping\Driver\XmlDriver;
use Soutenance\Controller\AvisController;
use Soutenance\Controller\EngagementImpartialiteController;
use Soutenance\Controller\InterventionController;
use Soutenance\Provider\Privilege\PresoutenancePrivileges;
use Soutenance\Provider\Privilege\PropositionPrivileges;
use Soutenance\Service\Membre\MembreService;
@@ -67,15 +66,16 @@ return array(
                     * Navigation pour LA thèse courante.
                     */
                    // DEPTH = 1
                    'these' => [
                    'these_selectionnee' => [
                        'pages' => [
                            // DEPTH = 2
                            'soutenance' => [
                                'order' => 60,
                                'label' => 'Soutenance',
                                'route' => 'soutenance/index-acteur',
                                'params' => [
                                    'these' => 0,
                                'route' => 'soutenance/proposition',
                                'withtarget' => true,
                                'paramsInject' => [
                                    'these',
                                ],
                                'icon' => 'fab fa-slideshare',
                                'resource' => PresoutenancePrivileges::getResourceId(PropositionPrivileges::PROPOSITION_VISUALISER),
@@ -123,12 +123,12 @@ return array(
                                            'Acteur',
                                        ],
                                    ],
                                    'retard' => [
                                        'label' => 'Notifier attente de rapport',
                                        'route' => 'soutenance/notifier-retard-rapport-presoutenance',
                                        'order' => 500,
                                        'resource' => UtilisateurPrivileges::getResourceId(UtilisateurPrivileges::UTILISATEUR_MODIFICATION),
                                    ],
//                                    'retard' => [
//                                        'label' => 'Notifier attente de rapport',
//                                        'route' => 'soutenance/notifier-retard-rapport-presoutenance',
//                                        'order' => 500,
//                                        'resource' => UtilisateurPrivileges::getResourceId(UtilisateurPrivileges::UTILISATEUR_MODIFICATION),
//                                    ],
                                ],
                            ],
                        ]
@@ -140,13 +140,13 @@ return array(
                     * @see ApplicationNavigationFactory::processPage()
                     */
                    // DEPTH = 1
                    'MA_THESE_PLACEHOLDER' => [ /** {@see ApplicationNavigationFactory::processPage()} */
                    ApplicationNavigationFactory::MA_THESE_PAGE_ID => [
                        'pages' => [
                            // DEPTH = 2
                            'soutenance' => [
                                'order' => 60,
                                'label' => 'Soutenance',
                                'route' => 'soutenance/index-acteur',
                                'route' => 'soutenance/proposition',
                                'params' => [
                                    'these' => 0,
                                ],
@@ -163,7 +163,7 @@ return array(
                     * @see ApplicationNavigationFactory::processPage()
                     */
                    // DEPTH = 1
                    'MES_THESES_PLACEHOLDER' => [
                    ApplicationNavigationFactory::MES_THESES_PAGE_ID => [
                        'pages' => [
                            // Déclinée en 'these-1', 'these-2', etc.
                            // DEPTH = 2
@@ -173,7 +173,7 @@ return array(
                                    'soutenance' => [
                                        'order' => 50,
                                        'label' => 'Soutenance',
                                        'route' => 'soutenance/index-acteur',
                                        'route' => 'soutenance/proposition',
                                        'params' => [
                                            'these' => 0,
                                        ],
+1 −1
Changes for module/Soutenance/config/others/avis.config.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -68,7 +68,7 @@ return array(
                        'type' => Segment::class,
                        'may_terminate' => true,
                        'options' => [
                            'route' => '/avis-soutenance/:these/:rapporteur',
                            'route' => '/avis-soutenance/:rapporteur',
                            'defaults' => [
                                'controller' => AvisController::class,
                                'action' => 'index',
+1 −1
Changes for module/Soutenance/config/others/engagement.config.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -80,7 +80,7 @@ return array(
                        'type' => Segment::class,
                        'may_terminate' => true,
                        'options' => [
                            'route' => '/engagement-impartialite/:these/:membre',
                            'route' => '/engagement-impartialite/:membre',
                            'defaults' => [
                                'controller' => EngagementImpartialiteController::class,
                                'action' => 'engagement-impartialite',
Loading