From 06f9acc202d86391e03277da0bcfca3843957960 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Mon, 18 Jul 2016 16:49:00 +0200 Subject: [PATCH] Affichage des groupes d'utilisateurs dans la page 'users/groups' idem pour les machines dans la page 'machines/groups' --- manager/view/machine/groups.php | 117 ++++++++++++++++++++++++++++++++ manager/view/user/groups.php | 1 - view/machines.php | 16 ++++- 3 files changed, 131 insertions(+), 3 deletions(-) create mode 100644 manager/view/machine/groups.php diff --git a/manager/view/machine/groups.php b/manager/view/machine/groups.php new file mode 100644 index 0000000..f8b0999 --- /dev/null +++ b/manager/view/machine/groups.php @@ -0,0 +1,117 @@ + + @name + + "; + break; + + + case 'machine_cluster': return " +
+ @name #@name + @icon_remove + + @icon_edit + + + @icon_type + utilisateurs (@count) + + + + @icon_group + @machines + + + + +
"; + break; + + + default: return " + + @clusterlist"; + break; + + } + } + + public static function view($params){ + $view = ''; + + /* [1] On récupère la liste des utilisateurs + =========================================================*/ + $request = new ModuleRequest('clusterDefault/getAll', [ + 'class' => 1 + ]); + $answer = $request->dispatch(); + + // si erreur, on affiche l'explicitation + if( $answer->error != ManagerError::Success ) + return View::$htmlError; + + $CLUSTERLIST = $answer->get('clusters'); + + + foreach($CLUSTERLIST as $c=>$cluster){ + $machinesReq = new ModuleRequest('clusterDefault/getMembers', [ + 'id_cluster' => $cluster['id_machine_cluster'], + 'class' => 1 + ]); + $machinesRes = $machinesReq->dispatch(); + + /* (2) Gestion si erreur */ + if( $machinesRes->error == ManagerError::Success ) $machines = $machinesRes->get('members'); + else $machines = []; + + $CLUSTERLIST[$c]['count'] = count($machines); + + $CLUSTERLIST[$c]['machines'] = View::replaceMultiple( + self::template('machine'), + $machines, + [ 'id_machine_cluster' => $cluster['id_machine_cluster'] ] + ); + } + + + $view_cluster = View::replaceMultiple( + self::template('machine_cluster'), + $CLUSTERLIST, [ + 'icon_remove' => file_get_contents( __ROOT__.'/src/static/sub-menu-side/remove.svg' ), + 'icon_edit' => file_get_contents( __ROOT__.'/src/static/sub-menu-side/edit.svg' ), + 'icon_card' => file_get_contents( __ROOT__.'/src/static/container/card.svg' ), + 'icon_mail' => file_get_contents( __ROOT__.'/src/static/container/mail.svg' ), + 'icon_group' => file_get_contents( __ROOT__.'/src/static/container/group.svg' ), + ]); + + + + + + return View::replaceSingle(self::template(), [ 'clusterlist' => $view_cluster ]); + } + + + + + + + + + } + + +?> diff --git a/manager/view/user/groups.php b/manager/view/user/groups.php index 374f28a..8215a7b 100644 --- a/manager/view/user/groups.php +++ b/manager/view/user/groups.php @@ -50,7 +50,6 @@ } public static function view($params){ - debug(); $view = ''; /* [1] On récupère la liste des utilisateurs diff --git a/view/machines.php b/view/machines.php index db45cc5..f9087c1 100755 --- a/view/machines.php +++ b/view/machines.php @@ -29,9 +29,9 @@ Modification - + - Filtrer + Groupes @@ -138,3 +138,15 @@ echo ""; echo ''; + + + + + /* [4] Gestion des groupes + =========================================================*/ + echo "
"; + + $grouplist = new View('machine.groups', []); + $grouplist->view(); + + echo '
';