Loading module/Formation/config/module.config.php +4 Changes for module/Formation/config/module.config.php: 4 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -12,6 +12,8 @@ use Formation\View\Helper\EtatViewHelper; use Formation\View\Helper\FormateursViewHelper; use Formation\View\Helper\ModaliteViewHelper; use Formation\View\Helper\SeancesViewHelper; use Formation\View\Helper\SessionInscriptionViewHelper; use Formation\View\Helper\SessionLibelleViewHelper; use Formation\View\Helper\SiteViewHelper; use Formation\View\Helper\TypeViewHelper; use Soutenance\Controller\AvisController; Loading Loading @@ -88,6 +90,8 @@ return array( 'etat' => EtatViewHelper::class, 'seances' => SeancesViewHelper::class, 'formateurs' => FormateursViewHelper::class, 'sessionInscription' => SessionInscriptionViewHelper::class, 'sessionLibelle' => SessionLibelleViewHelper::class, ] ], Loading module/Formation/config/others/index.config.php +26 Changes for module/Formation/config/others/index.config.php: 26 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -31,6 +31,15 @@ return [ IndexPrivileges::INDEX_DOCTORANT, ], ], [ 'controller' => IndexController::class, 'action' => [ 'index-formateur', ], 'privileges' => [ IndexPrivileges::INDEX_FORMATEUR, ], ], ], ], ], Loading @@ -51,6 +60,12 @@ return [ 'resource' => PrivilegeController::getResourceId(IndexController::class, 'index-doctorant') , 'order' => 9999, ], 'formation-formateur' => [ 'label' => 'Mes formations', 'route' => 'formation/index-formateur', 'resource' => PrivilegeController::getResourceId(IndexController::class, 'index-formateur') , 'order' => 9999, ], ], ], ], Loading Loading @@ -80,6 +95,17 @@ return [ ], ], ], 'index-formateur' => [ 'type' => Segment::class, 'may_terminate' => true, 'options' => [ 'route' => '/index-formateur[/:formateur]', 'defaults' => [ 'controller' => IndexController::class, 'action' => 'index-formateur', ], ], ], ], ], ], Loading module/Formation/src/Formation/Controller/IndexController.php +29 Changes for module/Formation/src/Formation/Controller/IndexController.php: 29 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ namespace Formation\Controller; use Application\Controller\AbstractController; use Application\Entity\Db\Doctorant; use Application\Entity\Db\Individu; use Formation\Entity\Db\EnqueteReponse; use Formation\Entity\Db\Inscription; use Formation\Entity\Db\Session; Loading Loading @@ -59,4 +60,32 @@ class IndexController extends AbstractController ]); } public function indexFormateurAction() { /** @var Individu $individu */ $individuId = $this->params()->fromRoute('formateur'); if ($individuId !== null) { $individu = $this->getEntityManager()->getRepository(Individu::class)->find($individuId); } else { $individu = null; } if($individu) { $passees = $this->getEntityManager()->getRepository(Session::class)->findSessionsPasseesByFormateur($individu); $courantes = $this->getEntityManager()->getRepository(Session::class)->findSessionsCourantesByFormateur($individu); $futures = $this->getEntityManager()->getRepository(Session::class)->findSessionsFuturesByFormateur($individu); } else { $passees = []; $courantes = []; $futures = []; } return new ViewModel([ 'individu' => $individu, 'passees' => $passees, 'courantes' => $courantes, 'futures' => $futures, ]); } } No newline at end of file module/Formation/src/Formation/Entity/Db/Repository/SessionRepository.php +69 Changes for module/Formation/src/Formation/Entity/Db/Repository/SessionRepository.php: 69 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ namespace Formation\Entity\Db\Repository; use Application\Entity\Db\Doctorant; use Application\Entity\Db\Individu; use Application\Entity\Db\These; use Doctrine\ORM\EntityRepository; use Doctrine\ORM\QueryBuilder; Loading Loading @@ -118,4 +119,72 @@ class SessionRepository extends EntityRepository return $result; } /** * @param Individu $individu * @return array */ public function findSessionsPasseesByFormateur(Individu $individu) : array { $etats = [ Etat::CODE_CLOTURER ]; $qb = $this->createQB('session') ->leftJoin('session.formateurs', 'formateur') ->leftJoin('session.formateurs', 'aformateur')->addSelect('aformateur') ->andWhere('formateur.individu = :individu') ->setParameter('individu', $individu) ->andWhere('session.etat in (:etats)') ->andWhere('session.histoDestruction IS NULL') ->andWhere('formateur.histoDestruction IS NULL') ->setParameter('etats', $etats) ->orderBy('session.id', 'ASC') ; $result = $qb->getQuery()->getResult(); return $result; } /** * @param Individu $individu * @return array */ public function findSessionsCourantesByFormateur(Individu $individu) : array { $etats = [ Etat::CODE_FERME ]; $qb = $this->createQB('session') ->leftJoin('session.formateurs', 'formateur') ->leftJoin('session.formateurs', 'aformateur')->addSelect('aformateur') ->andWhere('formateur.individu = :individu') ->setParameter('individu', $individu) ->andWhere('session.etat in (:etats)') ->andWhere('session.histoDestruction IS NULL') ->andWhere('formateur.histoDestruction IS NULL') ->setParameter('etats', $etats) ->orderBy('session.id', 'ASC') ; $result = $qb->getQuery()->getResult(); return $result; } /** * @param Individu $individu * @return array */ public function findSessionsFuturesByFormateur(Individu $individu) : array { $etats = [ Etat::CODE_OUVERTE, Etat::CODE_PREPARATION ]; $qb = $this->createQB('session') ->leftJoin('session.formateurs', 'formateur') ->leftJoin('session.formateurs', 'aformateur')->addSelect('aformateur') ->andWhere('formateur.individu = :individu') ->setParameter('individu', $individu) ->andWhere('session.etat in (:etats)') ->andWhere('session.histoDestruction IS NULL') ->andWhere('formateur.histoDestruction IS NULL') ->setParameter('etats', $etats) ->orderBy('session.id', 'ASC') ; $result = $qb->getQuery()->getResult(); return $result; } } No newline at end of file module/Formation/src/Formation/Provider/Privilege/IndexPrivileges.php +1 Changes for module/Formation/src/Formation/Provider/Privilege/IndexPrivileges.php: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -9,4 +9,5 @@ class IndexPrivileges extends Privileges { const INDEX_AFFICHER = 'formation-index'; const INDEX_DOCTORANT = 'formation-index_doctorant'; const INDEX_FORMATEUR = 'formation-index_formateur'; } No newline at end of file Loading
module/Formation/config/module.config.php +4 Changes for module/Formation/config/module.config.php: 4 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -12,6 +12,8 @@ use Formation\View\Helper\EtatViewHelper; use Formation\View\Helper\FormateursViewHelper; use Formation\View\Helper\ModaliteViewHelper; use Formation\View\Helper\SeancesViewHelper; use Formation\View\Helper\SessionInscriptionViewHelper; use Formation\View\Helper\SessionLibelleViewHelper; use Formation\View\Helper\SiteViewHelper; use Formation\View\Helper\TypeViewHelper; use Soutenance\Controller\AvisController; Loading Loading @@ -88,6 +90,8 @@ return array( 'etat' => EtatViewHelper::class, 'seances' => SeancesViewHelper::class, 'formateurs' => FormateursViewHelper::class, 'sessionInscription' => SessionInscriptionViewHelper::class, 'sessionLibelle' => SessionLibelleViewHelper::class, ] ], Loading
module/Formation/config/others/index.config.php +26 Changes for module/Formation/config/others/index.config.php: 26 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -31,6 +31,15 @@ return [ IndexPrivileges::INDEX_DOCTORANT, ], ], [ 'controller' => IndexController::class, 'action' => [ 'index-formateur', ], 'privileges' => [ IndexPrivileges::INDEX_FORMATEUR, ], ], ], ], ], Loading @@ -51,6 +60,12 @@ return [ 'resource' => PrivilegeController::getResourceId(IndexController::class, 'index-doctorant') , 'order' => 9999, ], 'formation-formateur' => [ 'label' => 'Mes formations', 'route' => 'formation/index-formateur', 'resource' => PrivilegeController::getResourceId(IndexController::class, 'index-formateur') , 'order' => 9999, ], ], ], ], Loading Loading @@ -80,6 +95,17 @@ return [ ], ], ], 'index-formateur' => [ 'type' => Segment::class, 'may_terminate' => true, 'options' => [ 'route' => '/index-formateur[/:formateur]', 'defaults' => [ 'controller' => IndexController::class, 'action' => 'index-formateur', ], ], ], ], ], ], Loading
module/Formation/src/Formation/Controller/IndexController.php +29 Changes for module/Formation/src/Formation/Controller/IndexController.php: 29 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ namespace Formation\Controller; use Application\Controller\AbstractController; use Application\Entity\Db\Doctorant; use Application\Entity\Db\Individu; use Formation\Entity\Db\EnqueteReponse; use Formation\Entity\Db\Inscription; use Formation\Entity\Db\Session; Loading Loading @@ -59,4 +60,32 @@ class IndexController extends AbstractController ]); } public function indexFormateurAction() { /** @var Individu $individu */ $individuId = $this->params()->fromRoute('formateur'); if ($individuId !== null) { $individu = $this->getEntityManager()->getRepository(Individu::class)->find($individuId); } else { $individu = null; } if($individu) { $passees = $this->getEntityManager()->getRepository(Session::class)->findSessionsPasseesByFormateur($individu); $courantes = $this->getEntityManager()->getRepository(Session::class)->findSessionsCourantesByFormateur($individu); $futures = $this->getEntityManager()->getRepository(Session::class)->findSessionsFuturesByFormateur($individu); } else { $passees = []; $courantes = []; $futures = []; } return new ViewModel([ 'individu' => $individu, 'passees' => $passees, 'courantes' => $courantes, 'futures' => $futures, ]); } } No newline at end of file
module/Formation/src/Formation/Entity/Db/Repository/SessionRepository.php +69 Changes for module/Formation/src/Formation/Entity/Db/Repository/SessionRepository.php: 69 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ namespace Formation\Entity\Db\Repository; use Application\Entity\Db\Doctorant; use Application\Entity\Db\Individu; use Application\Entity\Db\These; use Doctrine\ORM\EntityRepository; use Doctrine\ORM\QueryBuilder; Loading Loading @@ -118,4 +119,72 @@ class SessionRepository extends EntityRepository return $result; } /** * @param Individu $individu * @return array */ public function findSessionsPasseesByFormateur(Individu $individu) : array { $etats = [ Etat::CODE_CLOTURER ]; $qb = $this->createQB('session') ->leftJoin('session.formateurs', 'formateur') ->leftJoin('session.formateurs', 'aformateur')->addSelect('aformateur') ->andWhere('formateur.individu = :individu') ->setParameter('individu', $individu) ->andWhere('session.etat in (:etats)') ->andWhere('session.histoDestruction IS NULL') ->andWhere('formateur.histoDestruction IS NULL') ->setParameter('etats', $etats) ->orderBy('session.id', 'ASC') ; $result = $qb->getQuery()->getResult(); return $result; } /** * @param Individu $individu * @return array */ public function findSessionsCourantesByFormateur(Individu $individu) : array { $etats = [ Etat::CODE_FERME ]; $qb = $this->createQB('session') ->leftJoin('session.formateurs', 'formateur') ->leftJoin('session.formateurs', 'aformateur')->addSelect('aformateur') ->andWhere('formateur.individu = :individu') ->setParameter('individu', $individu) ->andWhere('session.etat in (:etats)') ->andWhere('session.histoDestruction IS NULL') ->andWhere('formateur.histoDestruction IS NULL') ->setParameter('etats', $etats) ->orderBy('session.id', 'ASC') ; $result = $qb->getQuery()->getResult(); return $result; } /** * @param Individu $individu * @return array */ public function findSessionsFuturesByFormateur(Individu $individu) : array { $etats = [ Etat::CODE_OUVERTE, Etat::CODE_PREPARATION ]; $qb = $this->createQB('session') ->leftJoin('session.formateurs', 'formateur') ->leftJoin('session.formateurs', 'aformateur')->addSelect('aformateur') ->andWhere('formateur.individu = :individu') ->setParameter('individu', $individu) ->andWhere('session.etat in (:etats)') ->andWhere('session.histoDestruction IS NULL') ->andWhere('formateur.histoDestruction IS NULL') ->setParameter('etats', $etats) ->orderBy('session.id', 'ASC') ; $result = $qb->getQuery()->getResult(); return $result; } } No newline at end of file
module/Formation/src/Formation/Provider/Privilege/IndexPrivileges.php +1 Changes for module/Formation/src/Formation/Provider/Privilege/IndexPrivileges.php: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -9,4 +9,5 @@ class IndexPrivileges extends Privileges { const INDEX_AFFICHER = 'formation-index'; const INDEX_DOCTORANT = 'formation-index_doctorant'; const INDEX_FORMATEUR = 'formation-index_formateur'; } No newline at end of file