Loading config/merged/etat-categorie.config.php +9 −0 Original line number Diff line number Diff line Loading @@ -14,6 +14,8 @@ use UnicaenEtat\Provider\Privilege\EtatPrivileges; use UnicaenEtat\Service\EtatCategorie\EtatCategorieService; use UnicaenEtat\Service\EtatCategorie\EtatCategorieServiceFactory; use UnicaenEtat\View\Helper\EtatCategorieViewHelper; use UnicaenEtat\View\Helper\EtatLegendeViewHelper; use UnicaenEtat\View\Helper\EtatLegendeViewHelperFactory; use UnicaenPrivilege\Guard\PrivilegeController; return [ Loading Loading @@ -161,7 +163,14 @@ return [ 'view_helpers' => [ 'invokables' => [ 'etatcategorie' => EtatCategorieViewHelper::class, ], 'factories' => [ EtatLegendeViewHelper::class => EtatLegendeViewHelperFactory::class, ], 'aliases' => [ 'etatlegende' => EtatLegendeViewHelper::class, ] ], Loading public/css/unicaen-etat.css +10 −0 Original line number Diff line number Diff line Loading @@ -29,3 +29,13 @@ text-align: center; height: 1.75rem; } .cartouche { border-radius: 0.25rem; border: 1px gray solid; padding: 1rem; } .element { padding: 0.25rem; } No newline at end of file src/UnicaenEtat/View/Helper/EtatCategorieViewHelper.php +3 −1 Original line number Diff line number Diff line Loading @@ -11,11 +11,13 @@ use Laminas\View\Resolver\TemplatePathStack; class EtatCategorieViewHelper extends AbstractHelper { /** * -- OPTIONS -- * 'display-libelle' : affiche de le libelle de la catégorie | default: false; * @param EtatCategorie $etatCategorie * @param array $options * @return string|Partial */ public function __invoke(EtatCategorie $etatCategorie, array $options = []) public function __invoke(EtatCategorie $etatCategorie, array $options = []): string|Partial { /** @var PhpRenderer $view */ $view = $this->getView(); Loading src/UnicaenEtat/View/Helper/EtatLegendeViewHelper.php 0 → 100644 +38 −0 Original line number Diff line number Diff line <?php namespace UnicaenEtat\View\Helper; use Laminas\View\Renderer\PhpRenderer; use RuntimeException; use UnicaenEtat\Entity\Db\EtatCategorie; use Laminas\View\Helper\AbstractHelper; use Laminas\View\Helper\Partial; use Laminas\View\Resolver\TemplatePathStack; use UnicaenEtat\Service\EtatCategorie\EtatCategorieServiceAwareTrait; class EtatLegendeViewHelper extends AbstractHelper { use EtatCategorieServiceAwareTrait; /** * TODO :: par code aussi * * @param EtatCategorie|string $etatCategorie * @param array $options * @return string|Partial */ public function __invoke(EtatCategorie|string $etatCategorie, array $options = []): Partial|string { if (is_string($etatCategorie)) { $code = $etatCategorie; $etatCategorie = $this->getEtatCategorieService()->getEtatCategorieByCode($code); if ($etatCategorie === null) throw new RuntimeException("Aucune catégorie d'état ne correspond au code [".$code."]"); } /** @var PhpRenderer $view */ $view = $this->getView(); $view->resolver()->attach(new TemplatePathStack(['script_paths' => [__DIR__ . "/partial"]])); return $view->partial('etat-legende', ['etatCategorie' => $etatCategorie, 'options' => $options]); } } No newline at end of file src/UnicaenEtat/View/Helper/EtatLegendeViewHelperFactory.php 0 → 100644 +28 −0 Original line number Diff line number Diff line <?php namespace UnicaenEtat\View\Helper; use Psr\Container\ContainerExceptionInterface; use Psr\Container\ContainerInterface; use Psr\Container\NotFoundExceptionInterface; use UnicaenEtat\Service\EtatCategorie\EtatCategorieService; class EtatLegendeViewHelperFactory { /** * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ public function __invoke(ContainerInterface $container): EtatLegendeViewHelper { /** * @var EtatCategorieService $etatCategorieService */ $etatCategorieService = $container->get(EtatCategorieService::class); $helper = new EtatLegendeViewHelper(); $helper->setEtatCategorieService($etatCategorieService); return $helper; } } No newline at end of file Loading
config/merged/etat-categorie.config.php +9 −0 Original line number Diff line number Diff line Loading @@ -14,6 +14,8 @@ use UnicaenEtat\Provider\Privilege\EtatPrivileges; use UnicaenEtat\Service\EtatCategorie\EtatCategorieService; use UnicaenEtat\Service\EtatCategorie\EtatCategorieServiceFactory; use UnicaenEtat\View\Helper\EtatCategorieViewHelper; use UnicaenEtat\View\Helper\EtatLegendeViewHelper; use UnicaenEtat\View\Helper\EtatLegendeViewHelperFactory; use UnicaenPrivilege\Guard\PrivilegeController; return [ Loading Loading @@ -161,7 +163,14 @@ return [ 'view_helpers' => [ 'invokables' => [ 'etatcategorie' => EtatCategorieViewHelper::class, ], 'factories' => [ EtatLegendeViewHelper::class => EtatLegendeViewHelperFactory::class, ], 'aliases' => [ 'etatlegende' => EtatLegendeViewHelper::class, ] ], Loading
public/css/unicaen-etat.css +10 −0 Original line number Diff line number Diff line Loading @@ -29,3 +29,13 @@ text-align: center; height: 1.75rem; } .cartouche { border-radius: 0.25rem; border: 1px gray solid; padding: 1rem; } .element { padding: 0.25rem; } No newline at end of file
src/UnicaenEtat/View/Helper/EtatCategorieViewHelper.php +3 −1 Original line number Diff line number Diff line Loading @@ -11,11 +11,13 @@ use Laminas\View\Resolver\TemplatePathStack; class EtatCategorieViewHelper extends AbstractHelper { /** * -- OPTIONS -- * 'display-libelle' : affiche de le libelle de la catégorie | default: false; * @param EtatCategorie $etatCategorie * @param array $options * @return string|Partial */ public function __invoke(EtatCategorie $etatCategorie, array $options = []) public function __invoke(EtatCategorie $etatCategorie, array $options = []): string|Partial { /** @var PhpRenderer $view */ $view = $this->getView(); Loading
src/UnicaenEtat/View/Helper/EtatLegendeViewHelper.php 0 → 100644 +38 −0 Original line number Diff line number Diff line <?php namespace UnicaenEtat\View\Helper; use Laminas\View\Renderer\PhpRenderer; use RuntimeException; use UnicaenEtat\Entity\Db\EtatCategorie; use Laminas\View\Helper\AbstractHelper; use Laminas\View\Helper\Partial; use Laminas\View\Resolver\TemplatePathStack; use UnicaenEtat\Service\EtatCategorie\EtatCategorieServiceAwareTrait; class EtatLegendeViewHelper extends AbstractHelper { use EtatCategorieServiceAwareTrait; /** * TODO :: par code aussi * * @param EtatCategorie|string $etatCategorie * @param array $options * @return string|Partial */ public function __invoke(EtatCategorie|string $etatCategorie, array $options = []): Partial|string { if (is_string($etatCategorie)) { $code = $etatCategorie; $etatCategorie = $this->getEtatCategorieService()->getEtatCategorieByCode($code); if ($etatCategorie === null) throw new RuntimeException("Aucune catégorie d'état ne correspond au code [".$code."]"); } /** @var PhpRenderer $view */ $view = $this->getView(); $view->resolver()->attach(new TemplatePathStack(['script_paths' => [__DIR__ . "/partial"]])); return $view->partial('etat-legende', ['etatCategorie' => $etatCategorie, 'options' => $options]); } } No newline at end of file
src/UnicaenEtat/View/Helper/EtatLegendeViewHelperFactory.php 0 → 100644 +28 −0 Original line number Diff line number Diff line <?php namespace UnicaenEtat\View\Helper; use Psr\Container\ContainerExceptionInterface; use Psr\Container\ContainerInterface; use Psr\Container\NotFoundExceptionInterface; use UnicaenEtat\Service\EtatCategorie\EtatCategorieService; class EtatLegendeViewHelperFactory { /** * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ public function __invoke(ContainerInterface $container): EtatLegendeViewHelper { /** * @var EtatCategorieService $etatCategorieService */ $etatCategorieService = $container->get(EtatCategorieService::class); $helper = new EtatLegendeViewHelper(); $helper->setEtatCategorieService($etatCategorieService); return $helper; } } No newline at end of file