Commit 6e22d7a1 authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

Ajout ergonomique pour la gestion des profils

parent 9d7d78fc
Loading
Loading
Loading
Loading
+13 −2
Changes for module/Application/src/Application/Controller/PrivilegeController.php: 13 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -68,6 +68,18 @@ class PrivilegeController extends AbstractController
        $role = $this->entityManager->getRepository(Role::class)->find($role_id);

        $value = null;

        // /!\ si le role à un privilège desactivé la modification
        if (! $role->getProfils()->isEmpty()) {
            if( array_search($role, $privilege->getRole()->toArray()) !== false) {
                $value = 1;
            } else {
                $value = 0;
            }
        }

        else {

            if (array_search($role, $privilege->getRole()->toArray()) !== false) {
                $privilege->removeRole($role);
                try {
@@ -87,9 +99,8 @@ class PrivilegeController extends AbstractController
            }
            // retrait des profils associés à un role
            $this->getRoleService()->removeProfils($role);
        }


        $queryParams = $this->params()->fromQuery();
        return new ViewModel([
            'value' => $value,
        ]);
+2 −0
Changes for module/Application/src/Application/Controller/ProfilController.php: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ class ProfilController extends AbstractActionController {

        /** @var ProfilForm $form */
        $form = $this->getServiceLocator()->get('FormElementManager')->get(ProfilForm::class);
        $form->setAttribute('action', $this->url()->fromRoute('profil/editer', ['profil' => $profil->getId()], [], true));
        $form->bind($profil);

        /** @var Request $request */
@@ -57,6 +58,7 @@ class ProfilController extends AbstractActionController {
        }

        return new ViewModel([
            'title' => 'Édition d\'un profil',
            'form' => $form,
        ]);
    }
+8 −0
Changes for module/Application/view/application/profil/gerer-roles.phtml: 8 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -12,6 +12,14 @@
    Gestion des rôles associées au profil
</h1>

<a href="<?php echo $this->url('profil', [], [], true); ?>" class="btn btn-info">
    <span class="glyphicon glyphicon-chevron-left"></span>
    Retour à la gestion des profils
</a>

<br/>
<br/>

<div class="panel panel-info">
    <div class="panel-heading">
        Information sur le profil sélectionné
+2 −2
Changes for module/Application/view/application/profil/index.phtml: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ $canChangePrivilege = true;

<h2> Liste des profils </h2>

<a href="<?php echo $this->url('profil/editer', [], [], true); ?>" class="btn btn-primary">
<a href="<?php echo $this->url('profil/editer', [], [], true); ?>" class="btn btn-primary ajax-modal" data-event="modification">
    <span class="glyphicon glyphicon-plus"></span> Ajouter un nouveau profil
</a>

@@ -44,7 +44,7 @@ $canChangePrivilege = true;
            <td> <?php echo count($profil->getRoles()); ?></td>
            <td>
                <?php if ($canEdit) : ?>
                    <a href="<?php echo $this->url('profil/editer', ['profil' => $profil->getId()], [], true);?>">
                    <a href="<?php echo $this->url('profil/editer', ['profil' => $profil->getId()], [], true);?>" class="ajax-modal" data-event="modification">
                        <span class="glyphicon glyphicon-pencil" title="Éditer les informations du profil"></span>
                    </a>
                <?php endif; ?>