Loading config/merged/categorie.config.php +12 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ return [ 'controller' => CategorieController::class, 'action' => [ 'index', 'index2', ], 'privileges' => ParametrecategoriePrivileges::PARAMETRECATEGORIE_INDEX, ], Loading Loading @@ -65,6 +66,17 @@ return [ ], 'may_terminate' => false, 'child_routes' => [ 'index2' => [ 'type' => Segment::class, 'options' => [ 'route' => '/index2[/:categorie]', 'defaults' => [ 'controller' => CategorieController::class, 'action' => 'index2' ], ], 'may_terminate' => true, ], 'index' => [ 'type' => Segment::class, 'options' => [ Loading src/UnicaenParametre/Controller/CategorieController.php +14 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,20 @@ class CategorieController extends AbstractActionController { ]); } public function index2Action() : ViewModel { $categories = $this->getCategorieService()->getCategories(); $selection = $this->getCategorieService()->getRequestedCategorie($this); if ($selection === null) $selection = current($categories); $parametres = $this->getParametreService()->getParametresByCategorie($selection); return new ViewModel([ 'categories' => $categories, 'parametres' => $parametres, 'selection' => $selection, ]); } public function ajouterAction() : ViewModel { Loading src/UnicaenParametre/Form/Categorie/CategorieForm.php +9 −4 Original line number Diff line number Diff line Loading @@ -22,7 +22,8 @@ class CategorieForm extends Form { 'type' => Text::class, 'name' => 'code', 'options' => [ 'label' => "Code de la catégorie : ", 'label' => "Code de la catégorie <span class='icon icon-obligatoire' title='Champ obligatoire'></span> : ", 'label_options' => ['disable_html_escape' => true, ], 'label_attributes' => [ 'class' => 'required', ], Loading @@ -44,7 +45,8 @@ class CategorieForm extends Form { 'type' => Text::class, 'name' => 'libelle', 'options' => [ 'label' => "Libellé de la catégorie : ", 'label' => "Libellé de la catégorie <span class='icon icon-obligatoire' title='Champ obligatoire'></span> : ", 'label_options' => ['disable_html_escape' => true, ], 'label_attributes' => [ 'class' => 'required', ], Loading @@ -70,13 +72,16 @@ class CategorieForm extends Form { 'type' => Number::class, 'name' => 'ordre', 'options' => [ 'label' => "Ordre de la catégorie : ", 'label' => "Ordre de la catégorie <span class='icon icon-obligatoire' title='Champ obligatoire'></span> : ", 'label_options' => ['disable_html_escape' => true, ], 'label_attributes' => [ 'class' => 'required', ], ], 'attributes' => [ 'id' => 'ordre', 'min' => 1, 'max' => 9999, ], ]); //button Loading Loading @@ -113,7 +118,7 @@ class CategorieForm extends Form { ], 'libelle' => [ 'required' => true, ], 'description' => [ 'required' => false, ], 'ordre' => [ 'required' => false, ], 'ordre' => [ 'required' => true, ], ])); } Loading src/UnicaenParametre/Form/Parametre/ParametreForm.php +12 −6 Original line number Diff line number Diff line Loading @@ -24,7 +24,8 @@ class ParametreForm extends Form { 'type' => Text::class, 'name' => 'code', 'options' => [ 'label' => "Code du paramètre : ", 'label' => "Code du paramètre <span class='icon icon-obligatoire' title='Champ obligatoire'></span> : ", 'label_options' => ['disable_html_escape' => true, ], 'label_attributes' => [ 'class' => 'required', ], Loading Loading @@ -53,7 +54,8 @@ class ParametreForm extends Form { 'type' => Text::class, 'name' => 'libelle', 'options' => [ 'label' => "Libellé du paramètre : ", 'label' => "Libellé du paramètre <span class='icon icon-obligatoire' title='Champ obligatoire'></span> : ", 'label_options' => ['disable_html_escape' => true, ], 'label_attributes' => [ 'class' => 'required', ], Loading @@ -67,7 +69,7 @@ class ParametreForm extends Form { 'type' => Textarea::class, 'name' => 'description', 'options' => [ 'label' => "Description de la catégorie : ", 'label' => "Description du paramètres : ", ], 'attributes' => [ 'id' => 'description', Loading @@ -79,13 +81,16 @@ class ParametreForm extends Form { 'type' => Number::class, 'name' => 'ordre', 'options' => [ 'label' => "Ordre de la catégorie : ", 'label' => "Ordre dans la catégorie <span class='icon icon-obligatoire' title='Champ obligatoire'></span> : ", 'label_options' => ['disable_html_escape' => true, ], 'label_attributes' => [ 'class' => 'required', ], ], 'attributes' => [ 'id' => 'ordre', 'min' => 1, 'max' => 9999, ], ]); //possibles Loading @@ -93,7 +98,8 @@ class ParametreForm extends Form { 'type' => Text::class, 'name' => 'possibles', 'options' => [ 'label' => "Valeurs possibles (String, Boolean, Number, énumération avec '|' comme séparateur) : ", 'label' => "Valeurs possibles (String, Boolean, Number, énumération avec '|' comme séparateur) <span class='icon icon-obligatoire' title='Champ obligatoire'></span> : ", 'label_options' => ['disable_html_escape' => true, ], ], 'attributes' => [ 'id' => 'possibles', Loading Loading @@ -154,7 +160,7 @@ class ParametreForm extends Form { ]], ], 'libelle' => [ 'required' => true, ], 'possibles' => [ 'required' => false, ], 'possibles' => [ 'required' => true, ], 'ordre' => [ 'required' => true, ], 'modifiable' => [ 'required' => false, ], 'affichable' => [ 'required' => false, ], Loading view/unicaen-parametre/categorie/index2.phtml 0 → 100644 +235 −0 Original line number Diff line number Diff line <?php /** * @see \UnicaenParametre\Controller\CategorieController::index2Action() * @var Categorie[] $categories * @var Categorie $selection * @var Parametre[] $parametres */ use UnicaenParametre\Entity\Db\Categorie; use UnicaenParametre\Entity\Db\Parametre; use UnicaenParametre\Provider\Privilege\ParametrecategoriePrivileges; use UnicaenParametre\Provider\Privilege\ParametrePrivileges; $canAjouterCategorie = $this->isAllowed(ParametrecategoriePrivileges::getResourceId(ParametrecategoriePrivileges::PARAMETRECATEGORIE_AJOUTER)); $canModifierCategorie = $this->isAllowed(ParametrecategoriePrivileges::getResourceId(ParametrecategoriePrivileges::PARAMETRECATEGORIE_MODIFIER)); $canSupprimerCategorie = $this->isAllowed(ParametrecategoriePrivileges::getResourceId(ParametrecategoriePrivileges::PARAMETRECATEGORIE_SUPPRIMER)); $canValeurParametre = $this->isAllowed(ParametrePrivileges::getResourceId(ParametrePrivileges::PARAMETRE_VALEUR)); $canAjouterParametre = $this->isAllowed(ParametrePrivileges::getResourceId(ParametrePrivileges::PARAMETRE_AJOUTER)); $canModifierParametre = $this->isAllowed(ParametrePrivileges::getResourceId(ParametrePrivileges::PARAMETRE_MODIFIER)); $canSupprimerParametre = $this->isAllowed(ParametrePrivileges::getResourceId(ParametrePrivileges::PARAMETRE_SUPPRIMER)); $canAfficherParametreMasquer = $this->isAllowed(ParametrePrivileges::getResourceId(ParametrePrivileges::PARAMETRE_AFFICHER_MASQUER)); $urlRetour = $this->url('parametre/index2', ['categorie' => $selection->getId()], [], true); $this->headTitle("Paramètres"); $canColumnAction = $canModifierParametre || $canSupprimerParametre || $canValeurParametre; ?> <h1 class="page-header"> Paramètres </h1> <?php if ($canAjouterCategorie) : ?> <a <?php /** @see \UnicaenParametre\Controller\CategorieController::ajouterAction() */ ?> href="<?php echo $this->url('parametre/categorie/ajouter', ['categorie' => -1], [], true); ?>" class="btn btn-primary ajax-modal" data-event="modification"> <i class="fas fa-plus"></i> Ajouter une catégorie </a> <?php endif; ?> <div class="nav nav-tabs" id="nav-tab" role="tablist"> <?php foreach ($categories as $categorie) : ?> <button class="nav-link <?php if ($categorie === $selection) echo " active "; ?> " id="categorie_<?php echo $categorie->getId(); ?>-tab" data-bs-toggle="tab" data-bs-target="#categorie_<?php echo $categorie->getId(); ?>" type="button" role="tab" aria-controls="categorie_<?php echo $categorie->getId(); ?>" aria-selected="true" onclick="location.href='<?php echo $this->url('parametre/index2', ['categorie' => $categorie->getId()], [], true); ?>'"> <?php echo $categorie->getLibelle(); ?> </button> <?php endforeach; ?> </div> <div class="tab-content"> <div id="boutons" style="padding: 0.5rem 0;"> <?php if ($canAjouterParametre) : ?> <a <?php /** @see \UnicaenParametre\Controller\ParametreController::ajouterAction() */ ?> href="<?php echo $this->url('parametre/ajouter', ['categorie' => $selection->getId()], [], true); ?>" class="btn btn-primary ajax-modal" data-event="modification"> <i class="fas fa-plus"></i> Ajouter un paramètre </a> <?php endif; ?> <?php if ($canModifierCategorie) : ?> <a <?php /** @see \UnicaenParametre\Controller\CategorieController::modifierAction() */ ?> href="<?php echo $this->url('parametre/categorie/modifier', ['categorie' => $selection->getId()], [], true); ?>" class="btn btn-primary ajax-modal" data-event="modification"> <i class="fas fa-pencil-alt"></i> Modifier la catégorie </a> <?php endif; ?> <?php if ($canSupprimerCategorie) : ?> <?php if (!isset($parametres) or empty($parametres)) : ?> <a <?php /** @see \UnicaenParametre\Controller\CategorieController::supprimerAction() */ ?> href="<?php echo $this->url('parametre/categorie/supprimer', ['categorie' => $selection->getId()], [], true); ?>" class="btn btn-danger ajax-modal" data-event="modification"> <i class="fas fa-times"></i> Supprimer la catégorie </a> <?php else : ?> <span class="btn btn-danger disabled" data-bs-toggle="tooltip" data-bs-html="true" title="La catégorie est non vide et ne peut être supprimée" > <i class="fas fa-times"></i> Supprimer la catégorie </span> <?php endif; ?> <?php endif; ?> </div> <?php if ($selection->getDescription()) : ?> <div class="alert alert-info"> <?php echo $selection->getDescription(); ?> </div> <?php endif; ?> <?php if (!isset($parametres)) : ?> Aucun paramètre pour cette catégorie <?php else : ?> <table class="table table-condensed"> <thead> <tr> <th class="col-md-<?php echo ($canColumnAction)?"5":"6"; ?>"> Libellé </th> <th class="col-md-<?php echo ($canColumnAction)?"5":"6"; ?>"> Valeur </th> <?php if ($canColumnAction) : ?> <th class="col-md-2 action"> Action </th> <?php endif; ?> </tr> </thead> <tbody> <?php foreach ($parametres as $parametre) : ?> <?php if ($parametre->isAffichable() or $canAfficherParametreMasquer) : ?> <tr> <td data-column-id="Libellé"> <strong><?php echo $parametre->getLibelle(); ?></strong> <br> <span style="color:grey"> <?php if ($parametre->getDescription()) : ?> <?php echo $parametre->getDescription(); ?> <?php else : ?> <p><em> Aucune description</em></p> <?php endif; ?> </span> <?php if ($parametre->isAffichable()) : ?> <span class="badge bg-success"> <span class="icon icon-checked"></span> Affichable </span> <?php else : ?> <span class="badge bg-danger"> <span class="icon icon-unchecked"></span> Masquer </span> <?php endif; ?> <?php if ($parametre->isModifiable()) : ?> <span class="badge bg-success"> <span class="icon icon-checked"></span> Modifiable </span> <?php else : ?> <span class="badge bg-danger"> <span class="icon icon-unchecked"></span> Immuable </span> <?php endif; ?> </td> <td data-column-id="Valeur"> <?php $valeur = $parametre->getValeur(); ?> <?php echo match ($valeur) { 'true' => '<i class="fas fa-check" style="color:darkgreen;"></i>', 'false' => '<i class="fas fa-times" style="color:darkred;"></i>', null => '<em style="color: lightcoral">Aucune valeur</em>', default => $valeur, }; ?> </td> <?php if ($canColumnAction) : ?> <td data-column-id="Action" class="action"> <?php if ($canValeurParametre and $parametre->isModifiable()) : ?> <a <?php /** @see \UnicaenParametre\Controller\ParametreController::modifierValeurAction() */ ?> href="<?php echo $this->url('parametre/modifier-valeur', ['parametre' => $parametre->getId()], [], true); ?>" title="Modifier la valeur du paramètre [<?php echo $parametre->getCode(); ?>]" class="ajax-modal action primary " data-event="modification"> <span class="icon icon-modifier"></span> Modifier </a> <?php endif; ?> <?php if ($canModifierParametre) : ?> <?php if ($canValeurParametre and $parametre->isModifiable()) : ?> <br> <?php endif; ?> <a <?php /** @see \UnicaenParametre\Controller\ParametreController::modifierAction() */ ?> href="<?php echo $this->url('parametre/modifier', ['parametre' => $parametre->getId()], [], true); ?>" title="Modifier le paramètre [<?php echo $parametre->getCode(); ?>]" class="ajax-modal action primary" data-event="modification"> <span class="icon icon-gerer"></span> Gérer </a> <?php endif; ?> <?php if ($canValeurParametre) : ?> <br> <a <?php /** @see \UnicaenParametre\Controller\ParametreController::reinitialiserValeurAction() */ ?> href="<?php echo $this->url('parametre/reinitialiser-valeur', ['parametre' => $parametre->getId()], ["query" => ["retour" => $urlRetour]], true); ?>" title="Reinitialiser la valeur du paramètre [<?php echo $parametre->getCode(); ?>]" class="action warning" > <span class="icon icon-gommer"></span> Reinitialiser </a> <?php endif; ?> <?php if ($canSupprimerParametre) : ?> <br> <a <?php /** @see \UnicaenParametre\Controller\ParametreController::supprimerAction() */ ?> href="<?php echo $this->url('parametre/supprimer', ['parametre' => $parametre->getId()], [], true); ?>" title="Supprimer le paramètre [<?php echo $parametre->getCode(); ?>]" class="ajax-modal action danger" data-event="modification" disabled> <span class="icon icon-unchecked"></span> Supprimer </a> <?php endif; ?> </td> <?php endif; ?> </tr> <?php endif; ?> <?php endforeach; ?> </tbody> </table> <?php endif; ?> <script> $(function () { $('body') .on("modification", function (event) { event.div.modal('hide'); window.location.reload(); }) .tooltip({ selector: '[data-bs-toggle="tooltip"]', placement: "bottom", html: true }); }); </script> Loading
config/merged/categorie.config.php +12 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ return [ 'controller' => CategorieController::class, 'action' => [ 'index', 'index2', ], 'privileges' => ParametrecategoriePrivileges::PARAMETRECATEGORIE_INDEX, ], Loading Loading @@ -65,6 +66,17 @@ return [ ], 'may_terminate' => false, 'child_routes' => [ 'index2' => [ 'type' => Segment::class, 'options' => [ 'route' => '/index2[/:categorie]', 'defaults' => [ 'controller' => CategorieController::class, 'action' => 'index2' ], ], 'may_terminate' => true, ], 'index' => [ 'type' => Segment::class, 'options' => [ Loading
src/UnicaenParametre/Controller/CategorieController.php +14 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,20 @@ class CategorieController extends AbstractActionController { ]); } public function index2Action() : ViewModel { $categories = $this->getCategorieService()->getCategories(); $selection = $this->getCategorieService()->getRequestedCategorie($this); if ($selection === null) $selection = current($categories); $parametres = $this->getParametreService()->getParametresByCategorie($selection); return new ViewModel([ 'categories' => $categories, 'parametres' => $parametres, 'selection' => $selection, ]); } public function ajouterAction() : ViewModel { Loading
src/UnicaenParametre/Form/Categorie/CategorieForm.php +9 −4 Original line number Diff line number Diff line Loading @@ -22,7 +22,8 @@ class CategorieForm extends Form { 'type' => Text::class, 'name' => 'code', 'options' => [ 'label' => "Code de la catégorie : ", 'label' => "Code de la catégorie <span class='icon icon-obligatoire' title='Champ obligatoire'></span> : ", 'label_options' => ['disable_html_escape' => true, ], 'label_attributes' => [ 'class' => 'required', ], Loading @@ -44,7 +45,8 @@ class CategorieForm extends Form { 'type' => Text::class, 'name' => 'libelle', 'options' => [ 'label' => "Libellé de la catégorie : ", 'label' => "Libellé de la catégorie <span class='icon icon-obligatoire' title='Champ obligatoire'></span> : ", 'label_options' => ['disable_html_escape' => true, ], 'label_attributes' => [ 'class' => 'required', ], Loading @@ -70,13 +72,16 @@ class CategorieForm extends Form { 'type' => Number::class, 'name' => 'ordre', 'options' => [ 'label' => "Ordre de la catégorie : ", 'label' => "Ordre de la catégorie <span class='icon icon-obligatoire' title='Champ obligatoire'></span> : ", 'label_options' => ['disable_html_escape' => true, ], 'label_attributes' => [ 'class' => 'required', ], ], 'attributes' => [ 'id' => 'ordre', 'min' => 1, 'max' => 9999, ], ]); //button Loading Loading @@ -113,7 +118,7 @@ class CategorieForm extends Form { ], 'libelle' => [ 'required' => true, ], 'description' => [ 'required' => false, ], 'ordre' => [ 'required' => false, ], 'ordre' => [ 'required' => true, ], ])); } Loading
src/UnicaenParametre/Form/Parametre/ParametreForm.php +12 −6 Original line number Diff line number Diff line Loading @@ -24,7 +24,8 @@ class ParametreForm extends Form { 'type' => Text::class, 'name' => 'code', 'options' => [ 'label' => "Code du paramètre : ", 'label' => "Code du paramètre <span class='icon icon-obligatoire' title='Champ obligatoire'></span> : ", 'label_options' => ['disable_html_escape' => true, ], 'label_attributes' => [ 'class' => 'required', ], Loading Loading @@ -53,7 +54,8 @@ class ParametreForm extends Form { 'type' => Text::class, 'name' => 'libelle', 'options' => [ 'label' => "Libellé du paramètre : ", 'label' => "Libellé du paramètre <span class='icon icon-obligatoire' title='Champ obligatoire'></span> : ", 'label_options' => ['disable_html_escape' => true, ], 'label_attributes' => [ 'class' => 'required', ], Loading @@ -67,7 +69,7 @@ class ParametreForm extends Form { 'type' => Textarea::class, 'name' => 'description', 'options' => [ 'label' => "Description de la catégorie : ", 'label' => "Description du paramètres : ", ], 'attributes' => [ 'id' => 'description', Loading @@ -79,13 +81,16 @@ class ParametreForm extends Form { 'type' => Number::class, 'name' => 'ordre', 'options' => [ 'label' => "Ordre de la catégorie : ", 'label' => "Ordre dans la catégorie <span class='icon icon-obligatoire' title='Champ obligatoire'></span> : ", 'label_options' => ['disable_html_escape' => true, ], 'label_attributes' => [ 'class' => 'required', ], ], 'attributes' => [ 'id' => 'ordre', 'min' => 1, 'max' => 9999, ], ]); //possibles Loading @@ -93,7 +98,8 @@ class ParametreForm extends Form { 'type' => Text::class, 'name' => 'possibles', 'options' => [ 'label' => "Valeurs possibles (String, Boolean, Number, énumération avec '|' comme séparateur) : ", 'label' => "Valeurs possibles (String, Boolean, Number, énumération avec '|' comme séparateur) <span class='icon icon-obligatoire' title='Champ obligatoire'></span> : ", 'label_options' => ['disable_html_escape' => true, ], ], 'attributes' => [ 'id' => 'possibles', Loading Loading @@ -154,7 +160,7 @@ class ParametreForm extends Form { ]], ], 'libelle' => [ 'required' => true, ], 'possibles' => [ 'required' => false, ], 'possibles' => [ 'required' => true, ], 'ordre' => [ 'required' => true, ], 'modifiable' => [ 'required' => false, ], 'affichable' => [ 'required' => false, ], Loading
view/unicaen-parametre/categorie/index2.phtml 0 → 100644 +235 −0 Original line number Diff line number Diff line <?php /** * @see \UnicaenParametre\Controller\CategorieController::index2Action() * @var Categorie[] $categories * @var Categorie $selection * @var Parametre[] $parametres */ use UnicaenParametre\Entity\Db\Categorie; use UnicaenParametre\Entity\Db\Parametre; use UnicaenParametre\Provider\Privilege\ParametrecategoriePrivileges; use UnicaenParametre\Provider\Privilege\ParametrePrivileges; $canAjouterCategorie = $this->isAllowed(ParametrecategoriePrivileges::getResourceId(ParametrecategoriePrivileges::PARAMETRECATEGORIE_AJOUTER)); $canModifierCategorie = $this->isAllowed(ParametrecategoriePrivileges::getResourceId(ParametrecategoriePrivileges::PARAMETRECATEGORIE_MODIFIER)); $canSupprimerCategorie = $this->isAllowed(ParametrecategoriePrivileges::getResourceId(ParametrecategoriePrivileges::PARAMETRECATEGORIE_SUPPRIMER)); $canValeurParametre = $this->isAllowed(ParametrePrivileges::getResourceId(ParametrePrivileges::PARAMETRE_VALEUR)); $canAjouterParametre = $this->isAllowed(ParametrePrivileges::getResourceId(ParametrePrivileges::PARAMETRE_AJOUTER)); $canModifierParametre = $this->isAllowed(ParametrePrivileges::getResourceId(ParametrePrivileges::PARAMETRE_MODIFIER)); $canSupprimerParametre = $this->isAllowed(ParametrePrivileges::getResourceId(ParametrePrivileges::PARAMETRE_SUPPRIMER)); $canAfficherParametreMasquer = $this->isAllowed(ParametrePrivileges::getResourceId(ParametrePrivileges::PARAMETRE_AFFICHER_MASQUER)); $urlRetour = $this->url('parametre/index2', ['categorie' => $selection->getId()], [], true); $this->headTitle("Paramètres"); $canColumnAction = $canModifierParametre || $canSupprimerParametre || $canValeurParametre; ?> <h1 class="page-header"> Paramètres </h1> <?php if ($canAjouterCategorie) : ?> <a <?php /** @see \UnicaenParametre\Controller\CategorieController::ajouterAction() */ ?> href="<?php echo $this->url('parametre/categorie/ajouter', ['categorie' => -1], [], true); ?>" class="btn btn-primary ajax-modal" data-event="modification"> <i class="fas fa-plus"></i> Ajouter une catégorie </a> <?php endif; ?> <div class="nav nav-tabs" id="nav-tab" role="tablist"> <?php foreach ($categories as $categorie) : ?> <button class="nav-link <?php if ($categorie === $selection) echo " active "; ?> " id="categorie_<?php echo $categorie->getId(); ?>-tab" data-bs-toggle="tab" data-bs-target="#categorie_<?php echo $categorie->getId(); ?>" type="button" role="tab" aria-controls="categorie_<?php echo $categorie->getId(); ?>" aria-selected="true" onclick="location.href='<?php echo $this->url('parametre/index2', ['categorie' => $categorie->getId()], [], true); ?>'"> <?php echo $categorie->getLibelle(); ?> </button> <?php endforeach; ?> </div> <div class="tab-content"> <div id="boutons" style="padding: 0.5rem 0;"> <?php if ($canAjouterParametre) : ?> <a <?php /** @see \UnicaenParametre\Controller\ParametreController::ajouterAction() */ ?> href="<?php echo $this->url('parametre/ajouter', ['categorie' => $selection->getId()], [], true); ?>" class="btn btn-primary ajax-modal" data-event="modification"> <i class="fas fa-plus"></i> Ajouter un paramètre </a> <?php endif; ?> <?php if ($canModifierCategorie) : ?> <a <?php /** @see \UnicaenParametre\Controller\CategorieController::modifierAction() */ ?> href="<?php echo $this->url('parametre/categorie/modifier', ['categorie' => $selection->getId()], [], true); ?>" class="btn btn-primary ajax-modal" data-event="modification"> <i class="fas fa-pencil-alt"></i> Modifier la catégorie </a> <?php endif; ?> <?php if ($canSupprimerCategorie) : ?> <?php if (!isset($parametres) or empty($parametres)) : ?> <a <?php /** @see \UnicaenParametre\Controller\CategorieController::supprimerAction() */ ?> href="<?php echo $this->url('parametre/categorie/supprimer', ['categorie' => $selection->getId()], [], true); ?>" class="btn btn-danger ajax-modal" data-event="modification"> <i class="fas fa-times"></i> Supprimer la catégorie </a> <?php else : ?> <span class="btn btn-danger disabled" data-bs-toggle="tooltip" data-bs-html="true" title="La catégorie est non vide et ne peut être supprimée" > <i class="fas fa-times"></i> Supprimer la catégorie </span> <?php endif; ?> <?php endif; ?> </div> <?php if ($selection->getDescription()) : ?> <div class="alert alert-info"> <?php echo $selection->getDescription(); ?> </div> <?php endif; ?> <?php if (!isset($parametres)) : ?> Aucun paramètre pour cette catégorie <?php else : ?> <table class="table table-condensed"> <thead> <tr> <th class="col-md-<?php echo ($canColumnAction)?"5":"6"; ?>"> Libellé </th> <th class="col-md-<?php echo ($canColumnAction)?"5":"6"; ?>"> Valeur </th> <?php if ($canColumnAction) : ?> <th class="col-md-2 action"> Action </th> <?php endif; ?> </tr> </thead> <tbody> <?php foreach ($parametres as $parametre) : ?> <?php if ($parametre->isAffichable() or $canAfficherParametreMasquer) : ?> <tr> <td data-column-id="Libellé"> <strong><?php echo $parametre->getLibelle(); ?></strong> <br> <span style="color:grey"> <?php if ($parametre->getDescription()) : ?> <?php echo $parametre->getDescription(); ?> <?php else : ?> <p><em> Aucune description</em></p> <?php endif; ?> </span> <?php if ($parametre->isAffichable()) : ?> <span class="badge bg-success"> <span class="icon icon-checked"></span> Affichable </span> <?php else : ?> <span class="badge bg-danger"> <span class="icon icon-unchecked"></span> Masquer </span> <?php endif; ?> <?php if ($parametre->isModifiable()) : ?> <span class="badge bg-success"> <span class="icon icon-checked"></span> Modifiable </span> <?php else : ?> <span class="badge bg-danger"> <span class="icon icon-unchecked"></span> Immuable </span> <?php endif; ?> </td> <td data-column-id="Valeur"> <?php $valeur = $parametre->getValeur(); ?> <?php echo match ($valeur) { 'true' => '<i class="fas fa-check" style="color:darkgreen;"></i>', 'false' => '<i class="fas fa-times" style="color:darkred;"></i>', null => '<em style="color: lightcoral">Aucune valeur</em>', default => $valeur, }; ?> </td> <?php if ($canColumnAction) : ?> <td data-column-id="Action" class="action"> <?php if ($canValeurParametre and $parametre->isModifiable()) : ?> <a <?php /** @see \UnicaenParametre\Controller\ParametreController::modifierValeurAction() */ ?> href="<?php echo $this->url('parametre/modifier-valeur', ['parametre' => $parametre->getId()], [], true); ?>" title="Modifier la valeur du paramètre [<?php echo $parametre->getCode(); ?>]" class="ajax-modal action primary " data-event="modification"> <span class="icon icon-modifier"></span> Modifier </a> <?php endif; ?> <?php if ($canModifierParametre) : ?> <?php if ($canValeurParametre and $parametre->isModifiable()) : ?> <br> <?php endif; ?> <a <?php /** @see \UnicaenParametre\Controller\ParametreController::modifierAction() */ ?> href="<?php echo $this->url('parametre/modifier', ['parametre' => $parametre->getId()], [], true); ?>" title="Modifier le paramètre [<?php echo $parametre->getCode(); ?>]" class="ajax-modal action primary" data-event="modification"> <span class="icon icon-gerer"></span> Gérer </a> <?php endif; ?> <?php if ($canValeurParametre) : ?> <br> <a <?php /** @see \UnicaenParametre\Controller\ParametreController::reinitialiserValeurAction() */ ?> href="<?php echo $this->url('parametre/reinitialiser-valeur', ['parametre' => $parametre->getId()], ["query" => ["retour" => $urlRetour]], true); ?>" title="Reinitialiser la valeur du paramètre [<?php echo $parametre->getCode(); ?>]" class="action warning" > <span class="icon icon-gommer"></span> Reinitialiser </a> <?php endif; ?> <?php if ($canSupprimerParametre) : ?> <br> <a <?php /** @see \UnicaenParametre\Controller\ParametreController::supprimerAction() */ ?> href="<?php echo $this->url('parametre/supprimer', ['parametre' => $parametre->getId()], [], true); ?>" title="Supprimer le paramètre [<?php echo $parametre->getCode(); ?>]" class="ajax-modal action danger" data-event="modification" disabled> <span class="icon icon-unchecked"></span> Supprimer </a> <?php endif; ?> </td> <?php endif; ?> </tr> <?php endif; ?> <?php endforeach; ?> </tbody> </table> <?php endif; ?> <script> $(function () { $('body') .on("modification", function (event) { event.div.modal('hide'); window.location.reload(); }) .tooltip({ selector: '[data-bs-toggle="tooltip"]', placement: "bottom", html: true }); }); </script>