Loading module/Atelier/config/merged/atelier.config.php +3 −1 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ use Atelier\Service\Atelier\AtelierServiceFactory; use Atelier\View\Helper\AtelierInformationViewHelper; use Atelier\View\Helper\AtelierInformationViewHelperFactory; use Atelier\View\Helper\AteliersViewHelper; use Atelier\View\Helper\AteliersViewHelperFactory; use Laminas\Router\Http\Literal; use Laminas\Router\Http\Segment; use UnicaenPrivilege\Guard\PrivilegeController; Loading Loading @@ -273,12 +274,13 @@ return [ ], 'view_helpers' => [ 'invokables' => [ 'ateliers' => AteliersViewHelper::class, ], 'factories' => [ AtelierInformationViewHelper::class => AtelierInformationViewHelperFactory::class, AteliersViewHelper::class => AteliersViewHelperFactory::class, ], 'aliases' => [ 'ateliers' => AteliersViewHelper::class, 'atelierInformation' => AtelierInformationViewHelper::class, ], ], Loading module/Atelier/src/Controller/AtelierController.php +2 −2 Original line number Diff line number Diff line Loading @@ -9,6 +9,7 @@ use Atelier\Provider\Etat\SessionEtats; use Atelier\Service\Atelier\AtelierServiceAwareTrait; use Atelier\Service\Inscription\InscriptionServiceAwareTrait; use Atelier\Service\Session\SessionServiceAwareTrait; use DateTime; use Etudiant\Service\Etudiant\EtudiantServiceAwareTrait; use UnicaenEnquete\Service\Enquete\EnqueteServiceAwareTrait; use UnicaenEnquete\Service\Resultat\ResultatServiceAwareTrait; Loading Loading @@ -245,8 +246,7 @@ class AtelierController extends AbstractActionController public function ficheAction(): ViewModel { $atelier = $this->getAtelierService()->getRequestedAtelier($this); $sessions = $this->getSessionService()->getSessionsByAtelier($atelier); $sessions = array_filter($sessions, function(Session $s) {return $s->getEtatActif()->getType()->getCode() !== SessionEtats::ETAT_INSCRIPTION_OUVERTE; }); $sessions = $this->getAtelierService()->getSessionsActives($atelier); $user = $this->getUserService()->getConnectedUser(); $etudiant = $this->getEtudiantService()->getEtudiantByLogin($user->getUsername()); Loading module/Atelier/src/Entity/Db/Session.php +0 −44 Original line number Diff line number Diff line Loading @@ -204,50 +204,6 @@ class Session implements HistoriqueAwareInterface, HasEtatsInterface, HasEveneme return $maximum; } public function getDateTimeDebut(bool $datetime = false): string|DateTime|null { $minimum = null; foreach ($this->seances as $seance) { if ($seance->estNonHistorise()) { if ($seance->getType() === Seance::TYPE_SEANCE) { $date = $seance->getDateTimeDebut(); if ($date !== null and ($minimum === null or $date < $minimum)) $minimum = $date; } if ($seance->getType() === Seance::TYPE_VOLUME) { if ($seance->getVolumeFin()) { $debut = $seance->getVolumeDebut(); if ($minimum === null or $debut < $minimum) $minimum = $debut; } } } } if ($minimum === null) return null; if ($datetime) return $minimum; return $minimum->format('d/m/Y H:i'); } public function getDateTimeFin(bool $datetime = false): string|DateTime|null { $maximum = null; foreach ($this->seances as $seance) { if ($seance->estNonHistorise()) { if ($seance->getType() === Seance::TYPE_SEANCE) { $date = $seance->getDateTimeFin(); if ($date !== null and ($maximum === null or $date > $maximum)) $maximum = $date; } if ($seance->getType() === Seance::TYPE_VOLUME) { if ($seance->getVolumeFin()) { $fin = $seance->getVolumeFin(); if ($maximum === null or $fin > $maximum) $maximum = $fin; } } } } if ($maximum === null) return null; if ($datetime) return $maximum; return $maximum->format('d/m/Y H:i'); } public function hasSeance(): bool { /** @var Seance $journee */ Loading module/Atelier/src/Event/CloturerSession/CloturerSessionEvenement.php +9 −7 Original line number Diff line number Diff line Loading @@ -40,19 +40,21 @@ class CloturerSessionEvenement extends EvenementService public function traiter(Evenement $evenement) : string { $log = ""; try { $parametres = json_decode($evenement->getParametres(), true); /** @var Session|null $session */ $session = $this->getSessionService()->getSession($parametres['session']); if ($session AND $session->estNonHistorise() AND $session->getEtatActif() AND $session->getEtatActif()->getType()->getCode() === SessionEtats::ETAT_ATTENTE_RETOURS) { $this->getSessionService()->cloturer($session); $etatTypeCode = $session->getEtatActif()?->getType()->getCode(); if ($etatTypeCode === SessionEtats::ETAT_ATTENTE_RETOURS) { $this->getSessionService()->envoyerConvocation($session); $log = "Session #" . $session->getId() . " " . $session->getAtelier()->getLibelle() . " : Clôture de la session "; } else { $log = "Etat [" . ($etatTypeCode ?? "Aucun état") . "] incompatible avec le traitement"; $evenement->setLog($log); $this->update($evenement); return Etat::ECHEC; } } catch (Exception $e) { $evenement->setLog($e->getMessage()); return Etat::ECHEC; Loading module/Atelier/src/Event/ConvoquerSession/ConvoquerSessionEvenement.php +12 −4 Original line number Diff line number Diff line Loading @@ -47,14 +47,22 @@ class ConvoquerSessionEvenement extends EvenementService /** @var Session|null $session */ $session = $this->getSessionService()->getSession($parametres['session']); if ($session AND $session->estNonHistorise() AND $session->getEtatActif() AND $session->getEtatActif()->getType()->getCode() === SessionEtats::ETAT_INSCRIPTION_FERMEE) { if ($session AND $session->estNonHistorise()) { $etatTypeCode = $session->getEtatActif()?->getType()->getCode(); if ($etatTypeCode === SessionEtats::ETAT_INSCRIPTION_FERMEE) { $this->getSessionService()->envoyerConvocation($session); $log = "Session #" . $session->getId() . " " . $session->getAtelier()->getLibelle() . " : Convocation "; } else { $log = "Etat [".($etatTypeCode??"Aucun état")."] incompatible avec le traitement"; $evenement->setLog($log); $this->update($evenement); return Etat::ECHEC; } } } catch (Exception $e) { $evenement->setLog($e->getMessage()); $this->update($evenement); return Etat::ECHEC; } $evenement->setLog($log); Loading Loading
module/Atelier/config/merged/atelier.config.php +3 −1 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ use Atelier\Service\Atelier\AtelierServiceFactory; use Atelier\View\Helper\AtelierInformationViewHelper; use Atelier\View\Helper\AtelierInformationViewHelperFactory; use Atelier\View\Helper\AteliersViewHelper; use Atelier\View\Helper\AteliersViewHelperFactory; use Laminas\Router\Http\Literal; use Laminas\Router\Http\Segment; use UnicaenPrivilege\Guard\PrivilegeController; Loading Loading @@ -273,12 +274,13 @@ return [ ], 'view_helpers' => [ 'invokables' => [ 'ateliers' => AteliersViewHelper::class, ], 'factories' => [ AtelierInformationViewHelper::class => AtelierInformationViewHelperFactory::class, AteliersViewHelper::class => AteliersViewHelperFactory::class, ], 'aliases' => [ 'ateliers' => AteliersViewHelper::class, 'atelierInformation' => AtelierInformationViewHelper::class, ], ], Loading
module/Atelier/src/Controller/AtelierController.php +2 −2 Original line number Diff line number Diff line Loading @@ -9,6 +9,7 @@ use Atelier\Provider\Etat\SessionEtats; use Atelier\Service\Atelier\AtelierServiceAwareTrait; use Atelier\Service\Inscription\InscriptionServiceAwareTrait; use Atelier\Service\Session\SessionServiceAwareTrait; use DateTime; use Etudiant\Service\Etudiant\EtudiantServiceAwareTrait; use UnicaenEnquete\Service\Enquete\EnqueteServiceAwareTrait; use UnicaenEnquete\Service\Resultat\ResultatServiceAwareTrait; Loading Loading @@ -245,8 +246,7 @@ class AtelierController extends AbstractActionController public function ficheAction(): ViewModel { $atelier = $this->getAtelierService()->getRequestedAtelier($this); $sessions = $this->getSessionService()->getSessionsByAtelier($atelier); $sessions = array_filter($sessions, function(Session $s) {return $s->getEtatActif()->getType()->getCode() !== SessionEtats::ETAT_INSCRIPTION_OUVERTE; }); $sessions = $this->getAtelierService()->getSessionsActives($atelier); $user = $this->getUserService()->getConnectedUser(); $etudiant = $this->getEtudiantService()->getEtudiantByLogin($user->getUsername()); Loading
module/Atelier/src/Entity/Db/Session.php +0 −44 Original line number Diff line number Diff line Loading @@ -204,50 +204,6 @@ class Session implements HistoriqueAwareInterface, HasEtatsInterface, HasEveneme return $maximum; } public function getDateTimeDebut(bool $datetime = false): string|DateTime|null { $minimum = null; foreach ($this->seances as $seance) { if ($seance->estNonHistorise()) { if ($seance->getType() === Seance::TYPE_SEANCE) { $date = $seance->getDateTimeDebut(); if ($date !== null and ($minimum === null or $date < $minimum)) $minimum = $date; } if ($seance->getType() === Seance::TYPE_VOLUME) { if ($seance->getVolumeFin()) { $debut = $seance->getVolumeDebut(); if ($minimum === null or $debut < $minimum) $minimum = $debut; } } } } if ($minimum === null) return null; if ($datetime) return $minimum; return $minimum->format('d/m/Y H:i'); } public function getDateTimeFin(bool $datetime = false): string|DateTime|null { $maximum = null; foreach ($this->seances as $seance) { if ($seance->estNonHistorise()) { if ($seance->getType() === Seance::TYPE_SEANCE) { $date = $seance->getDateTimeFin(); if ($date !== null and ($maximum === null or $date > $maximum)) $maximum = $date; } if ($seance->getType() === Seance::TYPE_VOLUME) { if ($seance->getVolumeFin()) { $fin = $seance->getVolumeFin(); if ($maximum === null or $fin > $maximum) $maximum = $fin; } } } } if ($maximum === null) return null; if ($datetime) return $maximum; return $maximum->format('d/m/Y H:i'); } public function hasSeance(): bool { /** @var Seance $journee */ Loading
module/Atelier/src/Event/CloturerSession/CloturerSessionEvenement.php +9 −7 Original line number Diff line number Diff line Loading @@ -40,19 +40,21 @@ class CloturerSessionEvenement extends EvenementService public function traiter(Evenement $evenement) : string { $log = ""; try { $parametres = json_decode($evenement->getParametres(), true); /** @var Session|null $session */ $session = $this->getSessionService()->getSession($parametres['session']); if ($session AND $session->estNonHistorise() AND $session->getEtatActif() AND $session->getEtatActif()->getType()->getCode() === SessionEtats::ETAT_ATTENTE_RETOURS) { $this->getSessionService()->cloturer($session); $etatTypeCode = $session->getEtatActif()?->getType()->getCode(); if ($etatTypeCode === SessionEtats::ETAT_ATTENTE_RETOURS) { $this->getSessionService()->envoyerConvocation($session); $log = "Session #" . $session->getId() . " " . $session->getAtelier()->getLibelle() . " : Clôture de la session "; } else { $log = "Etat [" . ($etatTypeCode ?? "Aucun état") . "] incompatible avec le traitement"; $evenement->setLog($log); $this->update($evenement); return Etat::ECHEC; } } catch (Exception $e) { $evenement->setLog($e->getMessage()); return Etat::ECHEC; Loading
module/Atelier/src/Event/ConvoquerSession/ConvoquerSessionEvenement.php +12 −4 Original line number Diff line number Diff line Loading @@ -47,14 +47,22 @@ class ConvoquerSessionEvenement extends EvenementService /** @var Session|null $session */ $session = $this->getSessionService()->getSession($parametres['session']); if ($session AND $session->estNonHistorise() AND $session->getEtatActif() AND $session->getEtatActif()->getType()->getCode() === SessionEtats::ETAT_INSCRIPTION_FERMEE) { if ($session AND $session->estNonHistorise()) { $etatTypeCode = $session->getEtatActif()?->getType()->getCode(); if ($etatTypeCode === SessionEtats::ETAT_INSCRIPTION_FERMEE) { $this->getSessionService()->envoyerConvocation($session); $log = "Session #" . $session->getId() . " " . $session->getAtelier()->getLibelle() . " : Convocation "; } else { $log = "Etat [".($etatTypeCode??"Aucun état")."] incompatible avec le traitement"; $evenement->setLog($log); $this->update($evenement); return Etat::ECHEC; } } } catch (Exception $e) { $evenement->setLog($e->getMessage()); $this->update($evenement); return Etat::ECHEC; } $evenement->setLog($log); Loading