Skip to content
Snippets Groups Projects
Select Git revision
  • dd9a1abb0c830aa8036ee9a30472b9d169862cdd
  • master default protected
  • b24
  • ll-workflow
  • alc-scindage-donnees-pj
  • FJ_LL_Tbl_Contrat
  • alc-docker-node
  • ll-apiplatform
  • php84
  • ll-rgpd
  • b23
  • alc-filtre-type-intervenant
  • ll-sans-mdb5
  • formules-ancienne-infra
  • ll-formules
  • alc-intervenant-dmep
  • ll-suppr-v_vol-s
  • b20
  • ll-postgresql
  • b23.0.1
  • b22
  • 24.8
  • 24.7
  • 24.6
  • 24.5
  • 24.4
  • 24.3
  • 24.2
  • 24.1
  • 24.0
  • 23.15
  • 24.0-beta19
  • 24.0-beta18
  • 24.0-beta17
  • 24.0-beta16
  • 24.0-beta15
  • 24.0-beta14
  • 24.0-beta13
  • 23.14
  • 24.0-beta12
  • 24.0-beta11
41 results

local.php.dist

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    IndexController.php 2.88 KiB
    <?php
    
    namespace Application\Controller;
    
    use Application\Acl\Role;
    use Application\Provider\Privilege\Privileges;
    use Application\Service\Traits\AnneeServiceAwareTrait;
    use Application\Service\Traits\ContextServiceAwareTrait;
    use Application\Service\Traits\IntervenantServiceAwareTrait;
    use Application\Service\Traits\ParametresServiceAwareTrait;
    use UnicaenAuth\Service\Traits\UserContextServiceAwareTrait;
    use Laminas\View\Model\ViewModel;
    
    /**
     *
     */
    class IndexController extends AbstractController
    {
        use ContextServiceAwareTrait;
        use AnneeServiceAwareTrait;
        use IntervenantServiceAwareTrait;
        use UserContextServiceAwareTrait;
        use ParametresServiceAwareTrait;
    
    
        /**
         *
         * @return type
         */
        public function indexAction()
        {
            $role = $this->serviceUserContext->getSelectedIdentityRole();
    
            $documentation = [
                'vacataires' => $this->getServiceParametres()->get('doc-intervenant-vacataires'),
                'permanents' => $this->getServiceParametres()->get('doc-intervenant-permanents'),
            ];
    
            $view = new ViewModel([
                'annee'                     => $this->getServiceContext()->getAnnee(),
                'documentation'             => $documentation,
                'context'                   => $this->getServiceContext(),
                'pageAccueil'               => $this->getServiceParametres()->get('page_accueil'),
                'connexionNonAutorise'      => $this->getServiceParametres()->get('connexion_non_autorise'),
                'connexionSansRoleNiStatut' => $this->getServiceParametres()->get('connexion_sans_role_ni_statut'),
            ]);
    
            if ($role && $this->isAllowed(Privileges::getResourceId(Privileges::INDICATEUR_VISUALISATION))) {
                // URL de la page affichant les indicateurs auxquels est abonné l'utilisateur
                $view->setVariable('abonnementsUrl', $this->url()->fromRoute('indicateur/abonnements'));
            }
    
            return $view;
        }
    
    
        public function changementAnneeAction()
        {
            /* Prise en compte du changement d'année!! */
            $annee = $this->params()->fromRoute('annee');
            if ($annee) {
                $annee = $this->getServiceAnnee()->get($annee);
                $this->getServiceContext()->setAnnee($annee);
    
                $role = $this->getServiceContext()->getSelectedIdentityRole();
                if ($role instanceof Role && $role->getIntervenant()) {
                    $intervenant = $this->getServiceIntervenant()->getByCode($role->getIntervenant()->getCode());
                    if ($intervenant) {
                        //Correction mauvais refresh du role lors du changement d'année
                        $this->serviceUserContext->setSelectedIdentityRole($intervenant->getStatut()->getRoleId());