Loading SQL/00_requetes.sql +19 −0 Original line number Diff line number Diff line Loading @@ -11,3 +11,22 @@ select * from etudiant_etudiant where nom = 'DUFOUR' and prenom = 'CASSANDRA'; 22005546 22005546@etu.unicaen.fr dufour221 [pas de mail] */ -- view OCTO.V_INSC_SUAC_VILLE select distinct isa.ville_code as id, isa.ville_nom as nom from OCTO.IMMOBILIER_SITE_ADRESSE isa where isa.ville_code is not null and isa.ville_nom != 'Luc-sur-Mer' and isa.ville_nom != 'Villers-Bocage' ; -- create view OCTO.V_INSC_SUAC_SITE as select im.id, isa.ville_code as ville_id, im.LIBELLE_COMMUNICATION as libelle from immobilier_site im left join OCTO.IMMOBILIER_SITE_ADRESSE isa on im.id = isa.SITE_ID where im.HISTO_DESTRUCTION is null order by im.LIBELLE_COMMUNICATION , im.id; select * from immobilier_site where HISTO_DESTRUCTION is null; No newline at end of file module/Atelier/src/Controller/AtelierController.php +1 −1 Original line number Diff line number Diff line Loading @@ -255,7 +255,7 @@ class AtelierController extends AbstractActionController public function ficheAction(): ViewModel { $atelier = $this->getAtelierService()->getRequestedAtelier($this); $sessions = $this->getAtelierService()->getSessionsActives($atelier); $sessions = $atelier->getSessionsActives(); $user = $this->getUserService()->getConnectedUser(); $etudiant = $this->getEtudiantService()->getEtudiantByLogin($user->getUsername()); Loading module/Atelier/src/Entity/Db/Atelier.php +32 −4 Original line number Diff line number Diff line Loading @@ -2,6 +2,8 @@ namespace Atelier\Entity\Db; use Atelier\Provider\Etat\SessionEtats; use DateTime; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Fichier\Entity\Db\Fichier; Loading Loading @@ -76,11 +78,26 @@ class Atelier implements HistoriqueAwareInterface return $this->sessions->toArray(); } public function getSessionsActives(?DateTime $date = null): array { if ($date === null) $date = new DateTime(); $sessions = $this->getSessions(); $sessions = array_filter($sessions, function (Session $s) use ($date) { return $s->estNonHistorise() and $s->getEtatActif() !== null and in_array($s->getEtatActif()->getType()->getCode(), [SessionEtats::ETAT_INSCRIPTION_OUVERTE, SessionEtats::PREPARATION]) and $s->getDerniereSeance()->getDateTimeFin() > $date; }); return $sessions; } /** @return Ville[] */ public function getVilles(): array { $villes = new ArrayCollection(); foreach ($this->getSessions() as $session) { foreach ($this->getSessionsActives() as $session) { $ville = $session->getSite()?->getVille(); if ($ville and !$villes->contains($ville)) $villes[] = $ville; } Loading @@ -103,7 +120,7 @@ class Atelier implements HistoriqueAwareInterface public function getSites(): string { $sites = []; foreach ($this->getSessions() as $session) { foreach ($this->getSessionsActives() as $session) { $sites[] = $session->getSite()?->getLibelle(); } $sites = array_unique($sites); Loading @@ -123,6 +140,17 @@ class Atelier implements HistoriqueAwareInterface return $libelle; } public function getLieux(): string { $sessions = $this->getSessionsActives(); $lieux = ''; foreach ($sessions as $session) { $lieux .= ';' . $session->getLieu(); } return $lieux; } /** @return Programme[] */ public function getProgrammes(): array { Loading module/Atelier/src/Service/Atelier/AtelierService.php +0 −15 Original line number Diff line number Diff line Loading @@ -277,19 +277,4 @@ class AtelierService $this->create($atelier); return $atelier; } /** @return Session[] */ public function getSessionsActives(Atelier $atelier, ?DateTime $date = null): array { if ($date === null) $date = new DateTime(); $sessions = $atelier->getSessions(); $sessions = array_filter($sessions, function (Session $s) use ($date) { return $s->estNonHistorise() and $s->getEtatActif() !== null and in_array($s->getEtatActif()->getType()->getCode(), [SessionEtats::ETAT_INSCRIPTION_OUVERTE, SessionEtats::PREPARATION]) and $s->getDerniereSeance()->getDateTimeFin() > $date; }); return $sessions; } } module/Atelier/src/View/Helper/partial/ateliers.phtml +6 −6 Original line number Diff line number Diff line Loading @@ -39,7 +39,7 @@ foreach ($listing as $atelier) { <ul> <?php foreach ($ateliersByGroupes[$groupe->getId()] as $atelier) : ?> <?php $sessionsActives = $atelierService->getSessionsActives($atelier); ?> <?php $sessionsActives = $atelier->getSessionsActives(); ?> <?php $nb = count($sessionsActives); ?> <li class="<?php echo $nb!==0?"active":"inactive"; ?>"> Loading @@ -48,9 +48,9 @@ foreach ($listing as $atelier) { <?php /** @see \Atelier\Controller\AtelierController::ficheAction() */ ?> <a href="<?php echo $this->url('atelier/atelier/fiche', ['atelier' => $atelier->getId()], [], true); ?>" class="ajax-modal"> <?php echo $atelier->getLibelleEtVilles(); ?></a> <?php echo $atelier->getLibelle() . ' (' . $atelier->getSites() . ')'; ?></a> <?php else: ?> <?php echo $atelier->getLibelleEtVilles(); ?> <?php echo $atelier->getLibelle() . ' (' . $atelier->getSites() . ')'; ?> <?php endif; ?> <?php if ($nb > 0) : ?> Loading @@ -68,7 +68,7 @@ foreach ($listing as $atelier) { <ul> <?php foreach ($ateliersByGroupes[-1] as $atelier) : ?> <?php $sessionsActives = $atelierService->getSessionsActives($atelier); ?> <?php $sessionsActives = $atelier->getSessionsActives(); ?> <?php $nb = count($sessionsActives); ?> <li class="<?php echo $nb!==0?"active":"inactive"; ?>"> Loading @@ -78,9 +78,9 @@ foreach ($listing as $atelier) { <?php /** @see \Atelier\Controller\AtelierController::ficheAction() */ ?> <a href="<?php echo $this->url('atelier/atelier/fiche', ['atelier' => $atelier->getId()], [], true); ?>" class="ajax-modal"> <?php echo $atelier->getLibelleEtVilles(); ?></a> <?php echo $atelier->getLibelle() . ' (' . $atelier->getSites() . ')' ?></a> <?php else: ?> <?php echo $atelier->getLibelleEtVilles(); ?> <?php echo $atelier->getLibelle() . ' (' . $atelier->getSites() . ')' ?> <?php endif; ?> <?php if ($nb > 0) : ?> Loading Loading
SQL/00_requetes.sql +19 −0 Original line number Diff line number Diff line Loading @@ -11,3 +11,22 @@ select * from etudiant_etudiant where nom = 'DUFOUR' and prenom = 'CASSANDRA'; 22005546 22005546@etu.unicaen.fr dufour221 [pas de mail] */ -- view OCTO.V_INSC_SUAC_VILLE select distinct isa.ville_code as id, isa.ville_nom as nom from OCTO.IMMOBILIER_SITE_ADRESSE isa where isa.ville_code is not null and isa.ville_nom != 'Luc-sur-Mer' and isa.ville_nom != 'Villers-Bocage' ; -- create view OCTO.V_INSC_SUAC_SITE as select im.id, isa.ville_code as ville_id, im.LIBELLE_COMMUNICATION as libelle from immobilier_site im left join OCTO.IMMOBILIER_SITE_ADRESSE isa on im.id = isa.SITE_ID where im.HISTO_DESTRUCTION is null order by im.LIBELLE_COMMUNICATION , im.id; select * from immobilier_site where HISTO_DESTRUCTION is null; No newline at end of file
module/Atelier/src/Controller/AtelierController.php +1 −1 Original line number Diff line number Diff line Loading @@ -255,7 +255,7 @@ class AtelierController extends AbstractActionController public function ficheAction(): ViewModel { $atelier = $this->getAtelierService()->getRequestedAtelier($this); $sessions = $this->getAtelierService()->getSessionsActives($atelier); $sessions = $atelier->getSessionsActives(); $user = $this->getUserService()->getConnectedUser(); $etudiant = $this->getEtudiantService()->getEtudiantByLogin($user->getUsername()); Loading
module/Atelier/src/Entity/Db/Atelier.php +32 −4 Original line number Diff line number Diff line Loading @@ -2,6 +2,8 @@ namespace Atelier\Entity\Db; use Atelier\Provider\Etat\SessionEtats; use DateTime; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Fichier\Entity\Db\Fichier; Loading Loading @@ -76,11 +78,26 @@ class Atelier implements HistoriqueAwareInterface return $this->sessions->toArray(); } public function getSessionsActives(?DateTime $date = null): array { if ($date === null) $date = new DateTime(); $sessions = $this->getSessions(); $sessions = array_filter($sessions, function (Session $s) use ($date) { return $s->estNonHistorise() and $s->getEtatActif() !== null and in_array($s->getEtatActif()->getType()->getCode(), [SessionEtats::ETAT_INSCRIPTION_OUVERTE, SessionEtats::PREPARATION]) and $s->getDerniereSeance()->getDateTimeFin() > $date; }); return $sessions; } /** @return Ville[] */ public function getVilles(): array { $villes = new ArrayCollection(); foreach ($this->getSessions() as $session) { foreach ($this->getSessionsActives() as $session) { $ville = $session->getSite()?->getVille(); if ($ville and !$villes->contains($ville)) $villes[] = $ville; } Loading @@ -103,7 +120,7 @@ class Atelier implements HistoriqueAwareInterface public function getSites(): string { $sites = []; foreach ($this->getSessions() as $session) { foreach ($this->getSessionsActives() as $session) { $sites[] = $session->getSite()?->getLibelle(); } $sites = array_unique($sites); Loading @@ -123,6 +140,17 @@ class Atelier implements HistoriqueAwareInterface return $libelle; } public function getLieux(): string { $sessions = $this->getSessionsActives(); $lieux = ''; foreach ($sessions as $session) { $lieux .= ';' . $session->getLieu(); } return $lieux; } /** @return Programme[] */ public function getProgrammes(): array { Loading
module/Atelier/src/Service/Atelier/AtelierService.php +0 −15 Original line number Diff line number Diff line Loading @@ -277,19 +277,4 @@ class AtelierService $this->create($atelier); return $atelier; } /** @return Session[] */ public function getSessionsActives(Atelier $atelier, ?DateTime $date = null): array { if ($date === null) $date = new DateTime(); $sessions = $atelier->getSessions(); $sessions = array_filter($sessions, function (Session $s) use ($date) { return $s->estNonHistorise() and $s->getEtatActif() !== null and in_array($s->getEtatActif()->getType()->getCode(), [SessionEtats::ETAT_INSCRIPTION_OUVERTE, SessionEtats::PREPARATION]) and $s->getDerniereSeance()->getDateTimeFin() > $date; }); return $sessions; } }
module/Atelier/src/View/Helper/partial/ateliers.phtml +6 −6 Original line number Diff line number Diff line Loading @@ -39,7 +39,7 @@ foreach ($listing as $atelier) { <ul> <?php foreach ($ateliersByGroupes[$groupe->getId()] as $atelier) : ?> <?php $sessionsActives = $atelierService->getSessionsActives($atelier); ?> <?php $sessionsActives = $atelier->getSessionsActives(); ?> <?php $nb = count($sessionsActives); ?> <li class="<?php echo $nb!==0?"active":"inactive"; ?>"> Loading @@ -48,9 +48,9 @@ foreach ($listing as $atelier) { <?php /** @see \Atelier\Controller\AtelierController::ficheAction() */ ?> <a href="<?php echo $this->url('atelier/atelier/fiche', ['atelier' => $atelier->getId()], [], true); ?>" class="ajax-modal"> <?php echo $atelier->getLibelleEtVilles(); ?></a> <?php echo $atelier->getLibelle() . ' (' . $atelier->getSites() . ')'; ?></a> <?php else: ?> <?php echo $atelier->getLibelleEtVilles(); ?> <?php echo $atelier->getLibelle() . ' (' . $atelier->getSites() . ')'; ?> <?php endif; ?> <?php if ($nb > 0) : ?> Loading @@ -68,7 +68,7 @@ foreach ($listing as $atelier) { <ul> <?php foreach ($ateliersByGroupes[-1] as $atelier) : ?> <?php $sessionsActives = $atelierService->getSessionsActives($atelier); ?> <?php $sessionsActives = $atelier->getSessionsActives(); ?> <?php $nb = count($sessionsActives); ?> <li class="<?php echo $nb!==0?"active":"inactive"; ?>"> Loading @@ -78,9 +78,9 @@ foreach ($listing as $atelier) { <?php /** @see \Atelier\Controller\AtelierController::ficheAction() */ ?> <a href="<?php echo $this->url('atelier/atelier/fiche', ['atelier' => $atelier->getId()], [], true); ?>" class="ajax-modal"> <?php echo $atelier->getLibelleEtVilles(); ?></a> <?php echo $atelier->getLibelle() . ' (' . $atelier->getSites() . ')' ?></a> <?php else: ?> <?php echo $atelier->getLibelleEtVilles(); ?> <?php echo $atelier->getLibelle() . ' (' . $atelier->getSites() . ')' ?> <?php endif; ?> <?php if ($nb > 0) : ?> Loading