Loading module/Evenementiel/src/Controller/ParticipantController.php +6 −9 Original line number Diff line number Diff line Loading @@ -9,6 +9,7 @@ use Etudiant\Service\Etudiant\EtudiantServiceAwareTrait; use Evenementiel\Entity\Db\Participant; use Evenementiel\Form\Participant\EtudiantFormAwareTrait; use Evenementiel\Form\Participant\PersonnelFormAwareTrait; use Evenementiel\Service\Evenement\EvenementServiceAwareTrait; use Laminas\Mvc\Controller\AbstractActionController; use Laminas\Mvc\Plugin\FlashMessenger\FlashMessenger; use Laminas\View\Model\JsonModel; Loading @@ -24,11 +25,11 @@ class ParticipantController extends AbstractActionController use ParticipantServiceAwareTrait, ParticipantFormAwareTrait; use EtudiantFormAwareTrait; use EtudiantServiceAwareTrait; use AnneeUnivIAServiceAwareTrait; use ComposanteIAServiceAwareTrait; use EtablissementIAServiceAwareTrait; use PersonnelFormAwareTrait; use PersonnelServiceAwareTrait; use EvenementServiceAwareTrait ; /** * Afficher la liste des entités Loading @@ -37,7 +38,7 @@ class ParticipantController extends AbstractActionController */ public function indexAction(): ViewModel { $anneeUnivIAasOptions = $this->getAnneeUnivIAService()->getAnneeUnivIAasOptions(); $anneeUnivAsOptions = $this->getEvenementService()->getAnneeUniv(); $etablissementIAasOptions = $this->getEtablissementIAService()->getEtablissementIAasOptions(); $composanteIAasOptions = $this->getComposanteIAService()->getComposanteIAasOptions(); $typeParticipantAsOptions = Participant::getTypesParticipant(); Loading @@ -45,15 +46,11 @@ class ParticipantController extends AbstractActionController $paramsQuery = $this->params()->fromQuery(); $paramsFiltre = null; $isEtudiant = null; if (array_key_exists('annee', $paramsQuery)) { $anneeUniv = $paramsQuery['annee'] ? $this->getAnneeUnivIAService()->getAnneeUnivIA($paramsQuery['annee']) : null; if ($anneeUniv) { $paramsFiltre['annee_univ'] = $anneeUniv->getAnneeUniv(); $isEtudiant = true; } $paramsFiltre['annee_univ'] = $paramsQuery['annee'] ; } $isEtudiant = null; if (array_key_exists('etablissement', $paramsQuery)) { $etablissement = $paramsQuery['etablissement'] ? $this->getEtablissementIAService()->getEtablissementIA($paramsQuery['etablissement']) : null; if ($etablissement) { Loading Loading @@ -95,7 +92,7 @@ class ParticipantController extends AbstractActionController return new ViewModel([ "participants" => $participants, 'paramsQuery' => $paramsQuery, 'anneeUnivIAasOptions' => $anneeUnivIAasOptions, 'anneeUnivAsOptions' => $anneeUnivAsOptions, 'etablissementIAasOptions' => $etablissementIAasOptions, 'composanteIAasOptions' => $composanteIAasOptions, 'typeParticipantAsOptions' => $typeParticipantAsOptions, Loading module/Evenementiel/src/Controller/ParticipantControllerFactory.php +4 −3 Original line number Diff line number Diff line Loading @@ -9,6 +9,7 @@ use Etudiant\Service\Etudiant\EtudiantService; use Evenementiel\Form\Participant\EtudiantForm; use Evenementiel\Form\Participant\ParticipantForm; use Evenementiel\Form\Participant\PersonnelForm; use Evenementiel\Service\Evenement\EvenementService; use Evenementiel\Service\Participant\ParticipantService; use Personnel\Service\Personnel\PersonnelService; use Psr\Container\ContainerInterface; Loading @@ -32,7 +33,7 @@ class ParticipantControllerFactory * @var EtudiantService $etudiantService * @var PersonnelForm $personnelForm * @var PersonnelService $personnelService * @var AnneeUnivIAService $anneeUnivIAService * @var EvenementService $evenementService * @var ComposanteIAService $composanteIAService * @var EtablissementIAService $etablissementIAService */ Loading @@ -41,7 +42,7 @@ class ParticipantControllerFactory $participantForm = $container->get("FormElementManager")->get(ParticipantForm::class); $etudiantform = $container->get("FormElementManager")->get(EtudiantForm::class); $etudiantService = $container->get(EtudiantService::class); $anneeUnivIAService = $container->get(AnneeUnivIAService::class); $evenementService = $container->get(EvenementService::class); $composanteIAService = $container->get(ComposanteIAService::class); $etablissementIAService = $container->get(EtablissementIAService::class); $personnelForm = $container->get("FormElementManager")->get(PersonnelForm::class); Loading @@ -55,7 +56,7 @@ class ParticipantControllerFactory $controller->setPersonnelForm($personnelForm); $controller->setPersonnelService($personnelService); $controller->setAnneeUnivIAService($anneeUnivIAService); $controller->setEvenementService($evenementService); $controller->setComposanteIAService($composanteIAService); $controller->setEtablissementIAService($etablissementIAService); Loading module/Evenementiel/src/Entity/Db/Mapping/Evenementiel.Entity.Db.Participant.dcm.xml +3 −1 Original line number Diff line number Diff line Loading @@ -18,6 +18,8 @@ <join-column name="personnel_id" referenced-column-name="id" nullable="true" unique="true"/> </one-to-one> <one-to-many field="inscriptions" target-entity="Evenementiel\Entity\Db\Inscription" mapped-by="participant" /> <!-- HISTORISATION ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> <field name="histoCreation" type="datetime" column="histo_creation" nullable="false"/> <field name="histoModification" type="datetime" column="histo_modification" nullable="false"/> Loading module/Evenementiel/src/Entity/Db/Participant.php +22 −1 Original line number Diff line number Diff line Loading @@ -2,6 +2,8 @@ namespace Evenementiel\Entity\Db; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Etudiant\Entity\Db\Etudiant; use Personnel\Entity\Db\Personnel; use UnicaenUtilisateur\Entity\Db\HistoriqueAwareInterface; Loading @@ -21,10 +23,16 @@ class Participant implements HistoriqueAwareInterface private ?string $typeParticipant = null; private ?Etudiant $etudiant = null; private ?Personnel $personnel = null; private Collection $inscriptions; const EXTERNE = 'externe'; const ETUDIANT = 'etudiant'; const PERSONNEL = 'personnel'; public function __construct() { $this->inscriptions = new ArrayCollection(); } public function getId(): ?int { return $this->id; Loading Loading @@ -126,6 +134,19 @@ class Participant implements HistoriqueAwareInterface $this->personnel = $personnel; } /** * @return Inscription[] */ public function getInscriptions(): array { return $this->inscriptions->toArray(); } public function setInscriptions(Collection $inscriptions): void { $this->inscriptions = $inscriptions; } public function setUsager(Etudiant|Personnel|UserInterface $usager): void { if ($usager instanceof Etudiant) { Loading module/Evenementiel/src/Service/Participant/ParticipantService.php +21 −1 Original line number Diff line number Diff line Loading @@ -167,9 +167,10 @@ class ParticipantService } } $keysIA = ['annee_univ', 'etablissement', 'composante']; $keysIA = ['etablissement', 'composante']; $isEtudiant = false; $keysParticipant = ['typeParticipant', 'id']; $keysEvenement = ['annee_univ']; $qb = $this->createQueryBuilder(); $qb->leftJoin('entity.etudiant', 'etudiant'); Loading @@ -188,6 +189,25 @@ class ParticipantService $qb = $qb->andWhere('entity.' . $key . ' = :' . $key)->setParameter($key, $value); } } if(in_array($key, $keysEvenement, true)) { if ($key == 'annee_univ') { /* un participant est considéré “inscrit à un évènement pour une année universitaire” s’il a au moins une inscription vers un évènement dont jourDebut est dans la plage [$debut, $fin) */ $debut = new \DateTimeImmutable($value . '-09-01 00:00:00'); $fin = $debut->modify('+1 year'); $qb->distinct() ->leftJoin('entity.inscriptions', 'inscription') ->leftJoin('inscription.evenement', 'evenement') ->andWhere('evenement.jourDebut >= :debutAnneeUniv') ->andWhere('evenement.jourDebut < :finAnneeUniv') ->setParameter('debutAnneeUniv', $debut) ->setParameter('finAnneeUniv', $fin); } } } if ($isEtudiant or $typeParticipantValue == Participant::ETUDIANT) { Loading Loading
module/Evenementiel/src/Controller/ParticipantController.php +6 −9 Original line number Diff line number Diff line Loading @@ -9,6 +9,7 @@ use Etudiant\Service\Etudiant\EtudiantServiceAwareTrait; use Evenementiel\Entity\Db\Participant; use Evenementiel\Form\Participant\EtudiantFormAwareTrait; use Evenementiel\Form\Participant\PersonnelFormAwareTrait; use Evenementiel\Service\Evenement\EvenementServiceAwareTrait; use Laminas\Mvc\Controller\AbstractActionController; use Laminas\Mvc\Plugin\FlashMessenger\FlashMessenger; use Laminas\View\Model\JsonModel; Loading @@ -24,11 +25,11 @@ class ParticipantController extends AbstractActionController use ParticipantServiceAwareTrait, ParticipantFormAwareTrait; use EtudiantFormAwareTrait; use EtudiantServiceAwareTrait; use AnneeUnivIAServiceAwareTrait; use ComposanteIAServiceAwareTrait; use EtablissementIAServiceAwareTrait; use PersonnelFormAwareTrait; use PersonnelServiceAwareTrait; use EvenementServiceAwareTrait ; /** * Afficher la liste des entités Loading @@ -37,7 +38,7 @@ class ParticipantController extends AbstractActionController */ public function indexAction(): ViewModel { $anneeUnivIAasOptions = $this->getAnneeUnivIAService()->getAnneeUnivIAasOptions(); $anneeUnivAsOptions = $this->getEvenementService()->getAnneeUniv(); $etablissementIAasOptions = $this->getEtablissementIAService()->getEtablissementIAasOptions(); $composanteIAasOptions = $this->getComposanteIAService()->getComposanteIAasOptions(); $typeParticipantAsOptions = Participant::getTypesParticipant(); Loading @@ -45,15 +46,11 @@ class ParticipantController extends AbstractActionController $paramsQuery = $this->params()->fromQuery(); $paramsFiltre = null; $isEtudiant = null; if (array_key_exists('annee', $paramsQuery)) { $anneeUniv = $paramsQuery['annee'] ? $this->getAnneeUnivIAService()->getAnneeUnivIA($paramsQuery['annee']) : null; if ($anneeUniv) { $paramsFiltre['annee_univ'] = $anneeUniv->getAnneeUniv(); $isEtudiant = true; } $paramsFiltre['annee_univ'] = $paramsQuery['annee'] ; } $isEtudiant = null; if (array_key_exists('etablissement', $paramsQuery)) { $etablissement = $paramsQuery['etablissement'] ? $this->getEtablissementIAService()->getEtablissementIA($paramsQuery['etablissement']) : null; if ($etablissement) { Loading Loading @@ -95,7 +92,7 @@ class ParticipantController extends AbstractActionController return new ViewModel([ "participants" => $participants, 'paramsQuery' => $paramsQuery, 'anneeUnivIAasOptions' => $anneeUnivIAasOptions, 'anneeUnivAsOptions' => $anneeUnivAsOptions, 'etablissementIAasOptions' => $etablissementIAasOptions, 'composanteIAasOptions' => $composanteIAasOptions, 'typeParticipantAsOptions' => $typeParticipantAsOptions, Loading
module/Evenementiel/src/Controller/ParticipantControllerFactory.php +4 −3 Original line number Diff line number Diff line Loading @@ -9,6 +9,7 @@ use Etudiant\Service\Etudiant\EtudiantService; use Evenementiel\Form\Participant\EtudiantForm; use Evenementiel\Form\Participant\ParticipantForm; use Evenementiel\Form\Participant\PersonnelForm; use Evenementiel\Service\Evenement\EvenementService; use Evenementiel\Service\Participant\ParticipantService; use Personnel\Service\Personnel\PersonnelService; use Psr\Container\ContainerInterface; Loading @@ -32,7 +33,7 @@ class ParticipantControllerFactory * @var EtudiantService $etudiantService * @var PersonnelForm $personnelForm * @var PersonnelService $personnelService * @var AnneeUnivIAService $anneeUnivIAService * @var EvenementService $evenementService * @var ComposanteIAService $composanteIAService * @var EtablissementIAService $etablissementIAService */ Loading @@ -41,7 +42,7 @@ class ParticipantControllerFactory $participantForm = $container->get("FormElementManager")->get(ParticipantForm::class); $etudiantform = $container->get("FormElementManager")->get(EtudiantForm::class); $etudiantService = $container->get(EtudiantService::class); $anneeUnivIAService = $container->get(AnneeUnivIAService::class); $evenementService = $container->get(EvenementService::class); $composanteIAService = $container->get(ComposanteIAService::class); $etablissementIAService = $container->get(EtablissementIAService::class); $personnelForm = $container->get("FormElementManager")->get(PersonnelForm::class); Loading @@ -55,7 +56,7 @@ class ParticipantControllerFactory $controller->setPersonnelForm($personnelForm); $controller->setPersonnelService($personnelService); $controller->setAnneeUnivIAService($anneeUnivIAService); $controller->setEvenementService($evenementService); $controller->setComposanteIAService($composanteIAService); $controller->setEtablissementIAService($etablissementIAService); Loading
module/Evenementiel/src/Entity/Db/Mapping/Evenementiel.Entity.Db.Participant.dcm.xml +3 −1 Original line number Diff line number Diff line Loading @@ -18,6 +18,8 @@ <join-column name="personnel_id" referenced-column-name="id" nullable="true" unique="true"/> </one-to-one> <one-to-many field="inscriptions" target-entity="Evenementiel\Entity\Db\Inscription" mapped-by="participant" /> <!-- HISTORISATION ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> <field name="histoCreation" type="datetime" column="histo_creation" nullable="false"/> <field name="histoModification" type="datetime" column="histo_modification" nullable="false"/> Loading
module/Evenementiel/src/Entity/Db/Participant.php +22 −1 Original line number Diff line number Diff line Loading @@ -2,6 +2,8 @@ namespace Evenementiel\Entity\Db; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Etudiant\Entity\Db\Etudiant; use Personnel\Entity\Db\Personnel; use UnicaenUtilisateur\Entity\Db\HistoriqueAwareInterface; Loading @@ -21,10 +23,16 @@ class Participant implements HistoriqueAwareInterface private ?string $typeParticipant = null; private ?Etudiant $etudiant = null; private ?Personnel $personnel = null; private Collection $inscriptions; const EXTERNE = 'externe'; const ETUDIANT = 'etudiant'; const PERSONNEL = 'personnel'; public function __construct() { $this->inscriptions = new ArrayCollection(); } public function getId(): ?int { return $this->id; Loading Loading @@ -126,6 +134,19 @@ class Participant implements HistoriqueAwareInterface $this->personnel = $personnel; } /** * @return Inscription[] */ public function getInscriptions(): array { return $this->inscriptions->toArray(); } public function setInscriptions(Collection $inscriptions): void { $this->inscriptions = $inscriptions; } public function setUsager(Etudiant|Personnel|UserInterface $usager): void { if ($usager instanceof Etudiant) { Loading
module/Evenementiel/src/Service/Participant/ParticipantService.php +21 −1 Original line number Diff line number Diff line Loading @@ -167,9 +167,10 @@ class ParticipantService } } $keysIA = ['annee_univ', 'etablissement', 'composante']; $keysIA = ['etablissement', 'composante']; $isEtudiant = false; $keysParticipant = ['typeParticipant', 'id']; $keysEvenement = ['annee_univ']; $qb = $this->createQueryBuilder(); $qb->leftJoin('entity.etudiant', 'etudiant'); Loading @@ -188,6 +189,25 @@ class ParticipantService $qb = $qb->andWhere('entity.' . $key . ' = :' . $key)->setParameter($key, $value); } } if(in_array($key, $keysEvenement, true)) { if ($key == 'annee_univ') { /* un participant est considéré “inscrit à un évènement pour une année universitaire” s’il a au moins une inscription vers un évènement dont jourDebut est dans la plage [$debut, $fin) */ $debut = new \DateTimeImmutable($value . '-09-01 00:00:00'); $fin = $debut->modify('+1 year'); $qb->distinct() ->leftJoin('entity.inscriptions', 'inscription') ->leftJoin('inscription.evenement', 'evenement') ->andWhere('evenement.jourDebut >= :debutAnneeUniv') ->andWhere('evenement.jourDebut < :finAnneeUniv') ->setParameter('debutAnneeUniv', $debut) ->setParameter('finAnneeUniv', $fin); } } } if ($isEtudiant or $typeParticipantValue == Participant::ETUDIANT) { Loading