Loading module/Evenementiel/src/Controller/InscriptionController.php +3 −3 Original line number Diff line number Diff line Loading @@ -203,17 +203,17 @@ class InscriptionController extends AbstractActionController { $inscription = $this->getInscriptionService()->getRequestedEntity($this); if ($inscription->getNombrePlacesPointees() >= $inscription->getNombrePlacesDemandees()) { $this->flashMessenger()->addErrorMessage("Le pointage pour " $this->flashMessenger()->addWarningMessage("Tous les pointages associés au compte de " . "<strong>" . $inscription->getParticipantDenomination() . "</strong>" . " à l'évènement " . "<strong>" . $inscription->getEvenement()->getLibelle() . "</strong>" . " n'a pu être fait"); . " ont déjà été effectués"); } else { $inscription->pointer(); $this->getInscriptionService()->update($inscription); $this->flashMessenger()->addSuccessMessage("Le pointage pour <strong>" . "<strong>" . $inscription->getParticipantDenomination() . "</strong>" . " à l'évènement " . "<strong>" . $inscription->getEvenement()->getLibelle() . "</strong>" . "</strong> est fait."); . "</strong> a bien été enregistré. " . $inscription->getStringNombrePlacesLibres()) ; } $retour = $this->getRequest()->getQuery("retour"); if ($retour) return $this->redirect()->toUrl($retour); Loading module/Evenementiel/src/Entity/Db/Inscription.php +26 −10 Original line number Diff line number Diff line <?php namespace Evenementiel\Entity\Db; use DateTime; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; Loading Loading @@ -117,6 +118,24 @@ class Inscription implements HistoriqueAwareInterface, HasEtatsInterface, Resour $this->nombrePlacesPointees = $nombrePlacesPointees; } public function getNombrePlacesLibres(): ?int { return $this->getNombrePlacesDemandees() - $this->getNombrePlacesPointees(); } public function getStringNombrePlacesLibres(): string { $placesLibres = $this->getNombrePlacesLibres(); switch ($placesLibres) { case 0 : return "L'enregistrement est complet."; case 1 : return "Il reste encore 1 place disponible."; default : return "Il reste " . $placesLibres . " places disponibles."; } } public function pointer(): void { $this->setNombrePlacesPointees($this->getNombrePlacesPointees() + 1); Loading @@ -140,8 +159,7 @@ class Inscription implements HistoriqueAwareInterface, HasEtatsInterface, Resour public function setPlaces(?Collection $places): void { foreach ($places as $place) { foreach ($places as $place) { /** @var InscriptionPlace $place */ $place->setInscription($this); } Loading Loading @@ -209,8 +227,7 @@ class Inscription implements HistoriqueAwareInterface, HasEtatsInterface, Resour public function getArrayDenominationPlaces(): array { $tab = []; foreach($this->getPlaces() as $place) { foreach ($this->getPlaces() as $place) { /** @var InscriptionPlace $place */ $tab[] = $place->getDenomination(); } Loading Loading @@ -259,5 +276,4 @@ class Inscription implements HistoriqueAwareInterface, HasEtatsInterface, Resour } } No newline at end of file module/Qr/config/module.config.php +2 −3 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ use Doctrine\ORM\Mapping\Driver\XmlDriver; use Doctrine\Persistence\Mapping\Driver\MappingDriverChain; use Laminas\Router\Http\Literal; use Qr\Controller\ScanController; use Qr\Controller\ScanControllerFactory; use UnicaenPrivilege\Guard\PrivilegeController; return array( Loading Loading @@ -85,9 +86,7 @@ return array( ], 'controllers' => [ 'factories' => [ ScanController::class => function ($container) { return new ScanController(); }, ScanController::class => ScanControllerFactory::class, ], ], 'view_helpers' => [ Loading module/Qr/src/Controller/ScanController.php +19 −1 Original line number Diff line number Diff line <?php namespace Qr\Controller; use Evenementiel\Service\Inscription\InscriptionServiceAwareTrait; use Laminas\Mvc\Controller\AbstractActionController; use Laminas\View\Model\ViewModel; use Laminas\View\Model\JsonModel; Loading @@ -8,6 +9,7 @@ use Laminas\Uri\Uri; class ScanController extends AbstractActionController { use InscriptionServiceAwareTrait ; /** * GET /qr/scan * Affiche la page avec le flux webcam + décodage client. Loading Loading @@ -62,11 +64,27 @@ class ScanController extends AbstractActionController return new JsonModel(['ok' => false, 'error' => 'Path mismatch']); } $inscriptionId = (int) $m[1]; $inscription = $this->getInscriptionService()->getEntity($inscriptionId); if ($inscription->getNombrePlacesPointees() >= $inscription->getNombrePlacesDemandees()) { $msg = "Tous les pointages associés au compte de " . $inscription->getParticipantDenomination() . " à l'évènement " . "<strong>" . $inscription->getEvenement()->getLibelle() . "</strong>" . " ont déjà été effectués"; } else { $inscription->pointer(); $this->getInscriptionService()->update($inscription); $msg = "Le pointage pour " . $inscription->getParticipantDenomination() . " à l'évènement " . $inscription->getEvenement()->getLibelle() . "</strong> a bien été enregistré. " . $inscription->getStringNombrePlacesLibres() ; } return new JsonModel([ 'ok' => true, 'valid' => $valid, 'payload' => $payload, 'msg' => $msg, ]); } } module/Qr/src/Controller/ScanControllerFactory.php 0 → 100644 +30 −0 Original line number Diff line number Diff line <?php namespace Qr\Controller; use Evenementiel\Service\Inscription\InscriptionService; use Psr\Container\ContainerInterface; use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; class ScanControllerFactory { /** * @param ContainerInterface $container * @return ScanController * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ public function __invoke($container) { /** * @var InscriptionService $inscriptionService */ $inscriptionService = $container->get(InscriptionService::class); $controller = new ScanController(); $controller->setInscriptionService($inscriptionService); return $controller ; } } No newline at end of file module/Qr/view/qr/scan/index.phtml +2 −2 File changed.Contains only whitespace changes. Show changes Loading
module/Evenementiel/src/Controller/InscriptionController.php +3 −3 Original line number Diff line number Diff line Loading @@ -203,17 +203,17 @@ class InscriptionController extends AbstractActionController { $inscription = $this->getInscriptionService()->getRequestedEntity($this); if ($inscription->getNombrePlacesPointees() >= $inscription->getNombrePlacesDemandees()) { $this->flashMessenger()->addErrorMessage("Le pointage pour " $this->flashMessenger()->addWarningMessage("Tous les pointages associés au compte de " . "<strong>" . $inscription->getParticipantDenomination() . "</strong>" . " à l'évènement " . "<strong>" . $inscription->getEvenement()->getLibelle() . "</strong>" . " n'a pu être fait"); . " ont déjà été effectués"); } else { $inscription->pointer(); $this->getInscriptionService()->update($inscription); $this->flashMessenger()->addSuccessMessage("Le pointage pour <strong>" . "<strong>" . $inscription->getParticipantDenomination() . "</strong>" . " à l'évènement " . "<strong>" . $inscription->getEvenement()->getLibelle() . "</strong>" . "</strong> est fait."); . "</strong> a bien été enregistré. " . $inscription->getStringNombrePlacesLibres()) ; } $retour = $this->getRequest()->getQuery("retour"); if ($retour) return $this->redirect()->toUrl($retour); Loading
module/Evenementiel/src/Entity/Db/Inscription.php +26 −10 Original line number Diff line number Diff line <?php namespace Evenementiel\Entity\Db; use DateTime; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; Loading Loading @@ -117,6 +118,24 @@ class Inscription implements HistoriqueAwareInterface, HasEtatsInterface, Resour $this->nombrePlacesPointees = $nombrePlacesPointees; } public function getNombrePlacesLibres(): ?int { return $this->getNombrePlacesDemandees() - $this->getNombrePlacesPointees(); } public function getStringNombrePlacesLibres(): string { $placesLibres = $this->getNombrePlacesLibres(); switch ($placesLibres) { case 0 : return "L'enregistrement est complet."; case 1 : return "Il reste encore 1 place disponible."; default : return "Il reste " . $placesLibres . " places disponibles."; } } public function pointer(): void { $this->setNombrePlacesPointees($this->getNombrePlacesPointees() + 1); Loading @@ -140,8 +159,7 @@ class Inscription implements HistoriqueAwareInterface, HasEtatsInterface, Resour public function setPlaces(?Collection $places): void { foreach ($places as $place) { foreach ($places as $place) { /** @var InscriptionPlace $place */ $place->setInscription($this); } Loading Loading @@ -209,8 +227,7 @@ class Inscription implements HistoriqueAwareInterface, HasEtatsInterface, Resour public function getArrayDenominationPlaces(): array { $tab = []; foreach($this->getPlaces() as $place) { foreach ($this->getPlaces() as $place) { /** @var InscriptionPlace $place */ $tab[] = $place->getDenomination(); } Loading Loading @@ -259,5 +276,4 @@ class Inscription implements HistoriqueAwareInterface, HasEtatsInterface, Resour } } No newline at end of file
module/Qr/config/module.config.php +2 −3 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ use Doctrine\ORM\Mapping\Driver\XmlDriver; use Doctrine\Persistence\Mapping\Driver\MappingDriverChain; use Laminas\Router\Http\Literal; use Qr\Controller\ScanController; use Qr\Controller\ScanControllerFactory; use UnicaenPrivilege\Guard\PrivilegeController; return array( Loading Loading @@ -85,9 +86,7 @@ return array( ], 'controllers' => [ 'factories' => [ ScanController::class => function ($container) { return new ScanController(); }, ScanController::class => ScanControllerFactory::class, ], ], 'view_helpers' => [ Loading
module/Qr/src/Controller/ScanController.php +19 −1 Original line number Diff line number Diff line <?php namespace Qr\Controller; use Evenementiel\Service\Inscription\InscriptionServiceAwareTrait; use Laminas\Mvc\Controller\AbstractActionController; use Laminas\View\Model\ViewModel; use Laminas\View\Model\JsonModel; Loading @@ -8,6 +9,7 @@ use Laminas\Uri\Uri; class ScanController extends AbstractActionController { use InscriptionServiceAwareTrait ; /** * GET /qr/scan * Affiche la page avec le flux webcam + décodage client. Loading Loading @@ -62,11 +64,27 @@ class ScanController extends AbstractActionController return new JsonModel(['ok' => false, 'error' => 'Path mismatch']); } $inscriptionId = (int) $m[1]; $inscription = $this->getInscriptionService()->getEntity($inscriptionId); if ($inscription->getNombrePlacesPointees() >= $inscription->getNombrePlacesDemandees()) { $msg = "Tous les pointages associés au compte de " . $inscription->getParticipantDenomination() . " à l'évènement " . "<strong>" . $inscription->getEvenement()->getLibelle() . "</strong>" . " ont déjà été effectués"; } else { $inscription->pointer(); $this->getInscriptionService()->update($inscription); $msg = "Le pointage pour " . $inscription->getParticipantDenomination() . " à l'évènement " . $inscription->getEvenement()->getLibelle() . "</strong> a bien été enregistré. " . $inscription->getStringNombrePlacesLibres() ; } return new JsonModel([ 'ok' => true, 'valid' => $valid, 'payload' => $payload, 'msg' => $msg, ]); } }
module/Qr/src/Controller/ScanControllerFactory.php 0 → 100644 +30 −0 Original line number Diff line number Diff line <?php namespace Qr\Controller; use Evenementiel\Service\Inscription\InscriptionService; use Psr\Container\ContainerInterface; use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; class ScanControllerFactory { /** * @param ContainerInterface $container * @return ScanController * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ public function __invoke($container) { /** * @var InscriptionService $inscriptionService */ $inscriptionService = $container->get(InscriptionService::class); $controller = new ScanController(); $controller->setInscriptionService($inscriptionService); return $controller ; } } No newline at end of file