Loading src/UnicaenEtat/Controller/EtatTypeController.php +11 −2 Original line number Diff line number Diff line Loading @@ -7,18 +7,27 @@ use Laminas\Mvc\Controller\AbstractActionController; use Laminas\View\Model\ViewModel; use UnicaenEtat\Entity\Db\EtatType; use UnicaenEtat\Form\EtatType\EtatTypeFormAwareTrait; use UnicaenEtat\Service\EtatCategorie\EtatCategorieServiceAwareTrait; use UnicaenEtat\Service\EtatType\EtatTypeServiceAwareTrait; class EtatTypeController extends AbstractActionController { use EtatTypeServiceAwareTrait; use EtatCategorieServiceAwareTrait; use EtatTypeFormAwareTrait; public function indexAction() : ViewModel { $types = $this->getEtatTypeService()->getEtatsTypes(); $categories = $this->getEtatCategorieService()->getEtatsCategories(); $dictionnaire = []; foreach ($categories as $categorie) { $types = $this->getEtatTypeService()->getEtatsTypesByCategorie($categorie); $dictionnaire[$categorie->getId()] = $types; } return new ViewModel([ 'types' => $types, 'categories' => $categories, 'dictionnaire' => $dictionnaire, ]); } Loading src/UnicaenEtat/Controller/EtatTypeControllerFactory.php +4 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ namespace UnicaenEtat\Controller; use Interop\Container\ContainerInterface; use UnicaenEtat\Form\EtatType\EtatTypeForm; use UnicaenEtat\Service\EtatCategorie\EtatCategorieService; use UnicaenEtat\Service\EtatType\EtatTypeService; class EtatTypeControllerFactory { Loading @@ -17,8 +18,10 @@ class EtatTypeControllerFactory { public function __invoke(ContainerInterface $container) : EtatTypeController { /** * @var EtatCategorieService $etatCategorieService * @var EtatTypeService $etatTypeService */ $etatCategorieService = $container->get(EtatCategorieService::class); $etatTypeService = $container->get(EtatTypeService::class); /** Loading @@ -27,6 +30,7 @@ class EtatTypeControllerFactory { $etatTypeForm = $container->get('FormElementManager')->get(EtatTypeForm::class); $controller = new EtatTypeController(); $controller->setEtatCategorieService($etatCategorieService); $controller->setEtatTypeService($etatTypeService); $controller->setEtatTypeForm($etatTypeForm); return $controller; Loading view/unicaen-etat/etat-type/index.phtml +56 −5 Original line number Diff line number Diff line Loading @@ -2,9 +2,11 @@ /** * @see \UnicaenEtat\Controller\EtatTypeController::indexAction() * @var EtatType[] $types * @var EtatCategorie[] $categories * @var array[] $dictionnaire */ use \UnicaenEtat\Entity\Db\EtatCategorie; use UnicaenEtat\Entity\Db\EtatType; $this->headTitle("Types d'état") Loading @@ -13,12 +15,11 @@ $this->headTitle("Types d'état") <div class="col-md-8"> <h1 class="page-header"> Types d'état <span class="badge"><?php echo count($types); ?></span> </h1> <?php /** @see \UnicaenEtat\Controller\EtatController::ajouterAction() */ ?> <a href="<?php echo $this->url('unicaen-etat/etat-type/ajouter', [], [], true); ?>" class="btn btn-primary action ajax-modal" data-event="modification"> class="btn btn-primary ajax-modal" data-event="modification"> <span class="icon icon-ajouter"></span> Ajouter un type d'état </a> Loading @@ -26,13 +27,13 @@ $this->headTitle("Types d'état") <div class="col-md-4"> <?php /** @see \UnicaenEtat\Controller\EtatCategorieController::indexAction() */ ?> <a href="<?php echo $this->url('unicaen-etat/etat-categorie', [], [], true); ?>" class="btn btn-secondary action"> class="btn btn-secondary"> <span class="icon icon-listing"></span> Accéder aux catégories </a> <br/> <a href="<?php echo $this->url('unicaen-etat/etat-instance', [], [], true); ?>" class="btn btn-secondary action"> class="btn btn-secondary"> <span class="icon icon-listing"></span> Accéder aux instances </a> Loading @@ -43,6 +44,56 @@ $this->headTitle("Types d'état") <div class="main"> <?php foreach ($categories as $categorie): ?> <h2> [<?php echo $categorie->getCode(); ?>] <?php echo $categorie->getLibelle(); ?> </h2> <table id="categorie_<?php echo $categorie->getCode(); ?>" class="datatable table table-condensed"> <thead> <tr> <th class="col-md-1">Badge</th> <th class="col-md-3">Code</th> <th class="col-md-5">Libelle</th> <th class="col-md-1">Type</th> <th class="col-md-1">Ordre</th> <th class="col-md-1">Action</th> </tr> </thead> <?php foreach ($dictionnaire[$categorie->getId()] as $type) : ?> <tr> <td> <?php echo $this->etattype($type, []); ?> </td> <td> <?php echo $type->getCode(); ?> </td> <td> <?php echo $type->getLibelle(); ?> </td> <td> <?php echo $type->getOrdre(); ?> </td> <td> <?php if ($type->getCategorie()) : ?> <?php echo $this->etatcategorie($type->getCategorie()); ?> <?php else : ?> Aucune <?php endif; ?> </td> <td class="action"> <?php /** @see \UnicaenEtat\Controller\EtatController::modifierAction() */ ?> <a href="<?php echo $this->url('unicaen-etat/etat-type/modifier', ['type' => $type->getId()], [], true); ?>" class="ajax-modal action primary" data-event="modification"> <span class="icon icon-editer"></span> Modifier </a> <br> <?php /** @see \UnicaenEtat\Controller\EtatController::supprimerAction() */ ?> <a href="<?php echo $this->url('unicaen-etat/etat-type/supprimer', ['type' => $type->getId()], [], true); ?>" class="ajax-modal action danger" data-event="modification"> <span class="icon icon-unchecked"></span> Supprimer </a> </td> </tr> <?php endforeach; ?> </table> <?php endforeach; ?> <?php if (empty($types)) : ?> Aucun type d'état <?php else : ?> Loading Loading
src/UnicaenEtat/Controller/EtatTypeController.php +11 −2 Original line number Diff line number Diff line Loading @@ -7,18 +7,27 @@ use Laminas\Mvc\Controller\AbstractActionController; use Laminas\View\Model\ViewModel; use UnicaenEtat\Entity\Db\EtatType; use UnicaenEtat\Form\EtatType\EtatTypeFormAwareTrait; use UnicaenEtat\Service\EtatCategorie\EtatCategorieServiceAwareTrait; use UnicaenEtat\Service\EtatType\EtatTypeServiceAwareTrait; class EtatTypeController extends AbstractActionController { use EtatTypeServiceAwareTrait; use EtatCategorieServiceAwareTrait; use EtatTypeFormAwareTrait; public function indexAction() : ViewModel { $types = $this->getEtatTypeService()->getEtatsTypes(); $categories = $this->getEtatCategorieService()->getEtatsCategories(); $dictionnaire = []; foreach ($categories as $categorie) { $types = $this->getEtatTypeService()->getEtatsTypesByCategorie($categorie); $dictionnaire[$categorie->getId()] = $types; } return new ViewModel([ 'types' => $types, 'categories' => $categories, 'dictionnaire' => $dictionnaire, ]); } Loading
src/UnicaenEtat/Controller/EtatTypeControllerFactory.php +4 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ namespace UnicaenEtat\Controller; use Interop\Container\ContainerInterface; use UnicaenEtat\Form\EtatType\EtatTypeForm; use UnicaenEtat\Service\EtatCategorie\EtatCategorieService; use UnicaenEtat\Service\EtatType\EtatTypeService; class EtatTypeControllerFactory { Loading @@ -17,8 +18,10 @@ class EtatTypeControllerFactory { public function __invoke(ContainerInterface $container) : EtatTypeController { /** * @var EtatCategorieService $etatCategorieService * @var EtatTypeService $etatTypeService */ $etatCategorieService = $container->get(EtatCategorieService::class); $etatTypeService = $container->get(EtatTypeService::class); /** Loading @@ -27,6 +30,7 @@ class EtatTypeControllerFactory { $etatTypeForm = $container->get('FormElementManager')->get(EtatTypeForm::class); $controller = new EtatTypeController(); $controller->setEtatCategorieService($etatCategorieService); $controller->setEtatTypeService($etatTypeService); $controller->setEtatTypeForm($etatTypeForm); return $controller; Loading
view/unicaen-etat/etat-type/index.phtml +56 −5 Original line number Diff line number Diff line Loading @@ -2,9 +2,11 @@ /** * @see \UnicaenEtat\Controller\EtatTypeController::indexAction() * @var EtatType[] $types * @var EtatCategorie[] $categories * @var array[] $dictionnaire */ use \UnicaenEtat\Entity\Db\EtatCategorie; use UnicaenEtat\Entity\Db\EtatType; $this->headTitle("Types d'état") Loading @@ -13,12 +15,11 @@ $this->headTitle("Types d'état") <div class="col-md-8"> <h1 class="page-header"> Types d'état <span class="badge"><?php echo count($types); ?></span> </h1> <?php /** @see \UnicaenEtat\Controller\EtatController::ajouterAction() */ ?> <a href="<?php echo $this->url('unicaen-etat/etat-type/ajouter', [], [], true); ?>" class="btn btn-primary action ajax-modal" data-event="modification"> class="btn btn-primary ajax-modal" data-event="modification"> <span class="icon icon-ajouter"></span> Ajouter un type d'état </a> Loading @@ -26,13 +27,13 @@ $this->headTitle("Types d'état") <div class="col-md-4"> <?php /** @see \UnicaenEtat\Controller\EtatCategorieController::indexAction() */ ?> <a href="<?php echo $this->url('unicaen-etat/etat-categorie', [], [], true); ?>" class="btn btn-secondary action"> class="btn btn-secondary"> <span class="icon icon-listing"></span> Accéder aux catégories </a> <br/> <a href="<?php echo $this->url('unicaen-etat/etat-instance', [], [], true); ?>" class="btn btn-secondary action"> class="btn btn-secondary"> <span class="icon icon-listing"></span> Accéder aux instances </a> Loading @@ -43,6 +44,56 @@ $this->headTitle("Types d'état") <div class="main"> <?php foreach ($categories as $categorie): ?> <h2> [<?php echo $categorie->getCode(); ?>] <?php echo $categorie->getLibelle(); ?> </h2> <table id="categorie_<?php echo $categorie->getCode(); ?>" class="datatable table table-condensed"> <thead> <tr> <th class="col-md-1">Badge</th> <th class="col-md-3">Code</th> <th class="col-md-5">Libelle</th> <th class="col-md-1">Type</th> <th class="col-md-1">Ordre</th> <th class="col-md-1">Action</th> </tr> </thead> <?php foreach ($dictionnaire[$categorie->getId()] as $type) : ?> <tr> <td> <?php echo $this->etattype($type, []); ?> </td> <td> <?php echo $type->getCode(); ?> </td> <td> <?php echo $type->getLibelle(); ?> </td> <td> <?php echo $type->getOrdre(); ?> </td> <td> <?php if ($type->getCategorie()) : ?> <?php echo $this->etatcategorie($type->getCategorie()); ?> <?php else : ?> Aucune <?php endif; ?> </td> <td class="action"> <?php /** @see \UnicaenEtat\Controller\EtatController::modifierAction() */ ?> <a href="<?php echo $this->url('unicaen-etat/etat-type/modifier', ['type' => $type->getId()], [], true); ?>" class="ajax-modal action primary" data-event="modification"> <span class="icon icon-editer"></span> Modifier </a> <br> <?php /** @see \UnicaenEtat\Controller\EtatController::supprimerAction() */ ?> <a href="<?php echo $this->url('unicaen-etat/etat-type/supprimer', ['type' => $type->getId()], [], true); ?>" class="ajax-modal action danger" data-event="modification"> <span class="icon icon-unchecked"></span> Supprimer </a> </td> </tr> <?php endforeach; ?> </table> <?php endforeach; ?> <?php if (empty($types)) : ?> Aucun type d'état <?php else : ?> Loading