Commit 178b7ce4 authored by Thibaut Vallee's avatar Thibaut Vallee
Browse files

Mise en page pour Boostrap5

parent cc9ebe77
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -41,7 +41,7 @@ return [
                        'attribuer',
                    ],
                    'privileges' => [
                        PrivilegePrivileges::PRIVILEGE_ATTRIBUER,
                        PrivilegePrivileges::PRIVILEGE_AFFECTER,
                    ],
                ],
                [
+1 −1
Original line number Diff line number Diff line
@@ -53,7 +53,7 @@ class PrivilegeCategorieController extends AbstractActionController
        }

        $view = new ViewModel();
        $view->setTemplate('unicaen-privilege/categorie/template/form-categorie');
        $view->setTemplate('unicaen-privilege/privilege-categorie/template/form-categorie');
        $view->setVariables([
            'title' => "Ajout d'une nouvelle catégorie",
            'form' => $form,
+1 −1
Original line number Diff line number Diff line
@@ -8,5 +8,5 @@ class PrivilegePrivileges extends Privileges
    const PRIVILEGE_AJOUTER = 'privilege-privilege_ajouter';
    const PRIVILEGE_MODIFIER = 'privilege-privilege_modifier';
    const PRIVILEGE_SUPPRIMER = 'privilege-privilege_supprimer';
    const PRIVILEGE_ATTRIBUER = 'privilege-privilege_affecter';
    const PRIVILEGE_AFFECTER = 'privilege-privilege_affecter';
}
 No newline at end of file
+2 −2
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ class PrivilegeViewHelper extends AbstractHelper
     */
    public function renderLienAjouter($role)
    {
        return $this->view->isAllowed(PrivilegePrivileges::getResourceId(PrivilegePrivileges::PRIVILEGE_ATTRIBUER))
        return $this->view->isAllowed(PrivilegePrivileges::getResourceId(PrivilegePrivileges::PRIVILEGE_AFFECTER))
            ? sprintf(
                '<a href="%s" class="modifier-privilege"
                    data-toggle="tooltip" 
@@ -62,7 +62,7 @@ class PrivilegeViewHelper extends AbstractHelper
     */
    public function renderLienSupprimer($role)
    {
        return $this->view->isAllowed(PrivilegePrivileges::getResourceId(PrivilegePrivileges::PRIVILEGE_ATTRIBUER))
        return $this->view->isAllowed(PrivilegePrivileges::getResourceId(PrivilegePrivileges::PRIVILEGE_AFFECTER))
            ? sprintf(
                '<a href="%s" class="modifier-privilege"
                    data-toggle="tooltip" 
+167 −125
Original line number Diff line number Diff line
@@ -28,9 +28,13 @@ $canProvider = $this->isAllowed(PrivilegePrivileges::getResourceId(Pr

<?php echo $this->messenger()->addMessagesFromFlashMessenger(); ?>

<?php if ($canVoir || $canAjouterPrivilege) : ?>
    <div class="row mb-3">
        <div class="col-md-12">
            <?php if ($canVoir) : ?>
                <?php /** @see PrivilegeCategorieController::indexAction() */ ?>
    <a href="<?php echo $this->url('unicaen-privilege/categorie', [], [], true); ?>" class="btn btn-primary">
                <a href="<?php echo $this->url('unicaen-privilege/categorie', [], [], true); ?>"
                   class="btn btn-primary">
                    <i class="fas fa-tag"></i>
                    Gérer les catégories
                </a>
@@ -44,36 +48,50 @@ $canProvider = $this->isAllowed(PrivilegePrivileges::getResourceId(Pr
                    Ajouter un privilège
                </a>
            <?php endif; ?>
        </div>
    </div>
<?php endif; ?>

<p></p>

<div class="panel panel-info">
    <div class="panel-heading">
<div class="card border-default mb-3">
    <div class="card-header bg-default">
        Information sur la catégorie #<?php echo $categorie->getId() ?>
    </div>
    <table class="table">
        <tbody>
        <tr>
            <th class="col-md-4">Libellé</th>
            <td><?php echo $categorie->getLibelle(); ?></td>
        </tr>
        <tr>
            <th>Code</th>
            <td><?php echo $categorie->getCode(); ?></td>
        </tr>
        <tr>
            <th>Namespace</th>
            <td>
                <code><?php echo $categorie->getNamespace(); ?></code>
            </td>
        </tr>
        <tr>
            <th>Ordre</th>
            <td><?php echo $categorie->getOrdre(); ?></td>
        </tr>
        </tbody>
    </table>
    <div class="panel-footer">
    <ul class="list-group list-group-flush">
        <li class="list-group-item">
            <div class="row">
                <div class="col-md-4"><b>Libellé</b></div>
                <div class="col-md-8">
                    <?php echo $categorie->getLibelle(); ?>
                </div>
            </div>
        </li>
        <li class="list-group-item">
            <div class="row">
                <div class="col-md-4"><b>Code</b></div>
                <div class="col-md-8">
                    <?php echo $categorie->getCode(); ?>
                </div>
            </div>
        </li>
        <li class="list-group-item">
            <div class="row">
                <div class="col-md-4"><b>Namespace</b></div>
                <div class="col-md-8">
                    <?php echo $categorie->getNamespace(); ?>
                </div>
            </div>
        </li>
        <li class="list-group-item">
            <div class="row">
                <div class="col-md-4"><b>Ordre</b></div>
                <div class="col-md-8">
                    <?php echo $categorie->getOrdre(); ?>
                </div>
            </div>
        </li>
    </ul>
    <div class="card-footer">
        <?php if ($canEditerCategorie) : ?>
            <?php /** @see PrivilegeCategorieController::modifierAction()() */ ?>
            <a href="<?php echo $this->url('unicaen-privilege/categorie/modifier', ['categorie' => $categorie->getId()], [], true); ?>"
@@ -90,7 +108,7 @@ $canProvider = $this->isAllowed(PrivilegePrivileges::getResourceId(Pr
            </a>
        <?php endif; ?>

        <?php if ($canDetruireCategorie) : ?>
        <?php if ($canDetruireCategorie && sizeof($privileges) == 0) : ?>
            <?php /** @see PrivilegeCategorieController::supprimerAction() */ ?>
            <a href="<?php echo $this->url('unicaen-privilege/categorie/supprimer', ['categorie' => $categorie->getId()], [], true); ?>"
               class="btn btn-danger pop-ajax"
@@ -110,27 +128,34 @@ $canProvider = $this->isAllowed(PrivilegePrivileges::getResourceId(Pr
                        </div>">
                <i class="fas fa-trash-alt"></i> Supprimer la catégorie
            </a>
        <?php elseif ($canDetruireCategorie) : ?>
            <?php /** @see PrivilegeCategorieController::supprimerAction() */ ?>
            <a class="btn btn-danger disabled">
                <i class="fas fa-trash-alt"></i> Supprimer la catégorie
            </a>

        <?php endif; ?>
    </div>
</div>

<h2>
    Liste des privilèges
    <span class="badge">
        <?php echo $categorie->getPrivileges()->count(); ?>
    </span>
</h2>
<div class="card border-default mb-3">
    <div class="card-header bg-default">
        <h2>Liste des privilèges</h2>
    </div>

    <div class="card-body">
<table id="privilege-liste" class="table table-condensed">
    <thead>
    <tr>
        <th>Libellé</th>
        <th>Code</th>
        <th class="col-md-1">
                Constante <i class="fa fa-info-circle" title="Vérification de l'existence de la constante associée au privilège"></i>
            Constante <i class="fa fa-info-circle"
                         title="Vérification de l'existence de la constante associée au privilège"></i>
        </th>
        <th class="col-md-1">
                Valeur <i class="fa fa-info-circle" title="Vérification de la valeur de la constante associée au privilège"></i>
            Valeur <i class="fa fa-info-circle"
                      title="Vérification de la valeur de la constante associée au privilège"></i>
        </th>
        <th class="col-md-1">Ordre</th>
        <th class="col-md-1">Action</th>
@@ -154,16 +179,20 @@ $canProvider = $this->isAllowed(PrivilegePrivileges::getResourceId(Pr
            ?>
            <td>
                <?php if ($value) : ?>
                        <i class="fas fa-check-circle text-success" title="La constante associée au privilège existe : <?php echo $constant ?>"></i>
                    <i class="fas fa-check-circle text-success"
                       title="La constante associée au privilège existe : <?php echo $constant ?>"></i>
                <?php else : ?>
                        <i class="fas fa-exclamation-triangle text-warning" title="La constante associée au privilège n'existe pas : <?php echo $constant ?>"></i>
                    <i class="fas fa-exclamation-triangle text-warning"
                       title="La constante associée au privilège n'existe pas : <?php echo $constant ?>"></i>
                <?php endif; ?>
            </td>
            <td>
                <?php if ($value === $privilege->getFullCode()) : ?>
                        <i class="fas fa-check-circle text-success" title="La valeur de la constante associée au privilège correspond au code du privilège : '<?php echo $privilege->getFullCode() ?>'"></i>
                    <i class="fas fa-check-circle text-success"
                       title="La valeur de la constante associée au privilège correspond au code du privilège : '<?php echo $privilege->getFullCode() ?>'"></i>
                <?php else : ?>
                        <i class="fas fa-exclamation-triangle text-warning" title="La valeur de la constante associée au privilège ne correspond pas au code du privilège : '<?php echo $privilege->getFullCode() ?>'"></i>
                    <i class="fas fa-exclamation-triangle text-warning"
                       title="La valeur de la constante associée au privilège ne correspond pas au code du privilège : '<?php echo $privilege->getFullCode() ?>'"></i>
                <?php endif; ?>
            </td>
            <td><?php echo $privilege->getOrdre(); ?></td>
@@ -201,12 +230,17 @@ $canProvider = $this->isAllowed(PrivilegePrivileges::getResourceId(Pr
    <?php endforeach; ?>
    </tbody>
</table>
    </div>
</div>

<script>
    $(function () {
        $('#privilege-liste').DataTable({
            "lengthMenu": [[10, 25, 50, 100, -1], [10, 25, 50, 100, "Tous"]],
            "order": [[4, 'asc']],
            "columnDefs": [
                {targets: 5, orderable: false, searchable: false},
            ],
            "language": {
                'lengthMenu': "Afficher _MENU_ &eacute;l&eacute;ments",
                "search": "Filtre de recherche : _INPUT_",
@@ -230,5 +264,13 @@ $canProvider = $this->isAllowed(PrivilegePrivileges::getResourceId(Pr
            event.div.modal('hide');
            window.location.reload();
        });

        $("body").on("event-unicaen-privilege-supprimer", function (event) {
            window.location.reload();
        });

        $("body").on("event-unicaen-privilege-categorie-supprimer", function (event) {
            window.location.href = "/privilege/categorie";
        });
    });
</script>
 No newline at end of file
Loading