From 81ae09c4c4ee9931c3bd1acc3ec6b75a74c7864a Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Sun, 14 Feb 2016 13:55:06 +0100 Subject: [PATCH] - [x] [view/users] Affichage des groupes des utilisateurs --- automate.php | 36 +++++++++++++----------------------- todo.md | 1 + view/users.php | 9 +++++++-- 3 files changed, 21 insertions(+), 25 deletions(-) diff --git a/automate.php b/automate.php index cefd6a8..4042503 100755 --- a/automate.php +++ b/automate.php @@ -25,34 +25,24 @@ // Pour chaque entree foreach( $json as $user ){ - $insertRequest = Database::getPDO()->prepare("INSERT INTO user(id_user, code, username, firstname, lastname, mail, password, status) - VALUES( - DEFAULT, - :code, - :username, - :firstname, - :lastname, - :mail, - :password, - :status - )"); - - $status = $insertRequest->execute(array( - ':code' => $user['code'], - ':username' => $user['username'], - ':firstname' => $user['firstname'], - ':lastname' => $user['lastname'], - ':mail' => $user['email'], - ':password' => $user['password'], - ':status' => $user['status'] + // Creation de la requete + $request = new ModuleRequest('userDefault/create', array( + $user['code'], + $user['username'], + $user['firstname'], + $user['lastname'], + $user['email'], + $user['password'], + $user['status'] )); - - var_dump( $status ); + $answer = $request->dispatch(); + // Debug error + var_dump( $answer->error == ManagerError::Success ); } return true; - }// insertUsersFromJSON(); + }insertUsersFromJSON(); diff --git a/todo.md b/todo.md index a29d16b..5f1011a 100755 --- a/todo.md +++ b/todo.md @@ -39,6 +39,7 @@ ######## # FAIT # ######## +- [x] [view/users] Affichage des groupes des utilisateurs - [x] [cluster::link/unlink] Ajout/Suppression d'association des utilisateurs/machines a des groupes - [x] [user::getClusters] Recuperation des groupes d'un utilisateur - [x] [manager/repo/]Creation des repos diff --git a/view/users.php b/view/users.php index d05015e..f3b3ad9 100755 --- a/view/users.php +++ b/view/users.php @@ -3,6 +3,7 @@ use \manager\ModuleRequest; use \manager\ManagerError; use \manager\ResourceDispatcher; + use \manager\Repo; ?> @@ -73,6 +74,9 @@ // Si aucune erreur, on affiche les resultats else{ foreach( $answer->get('users') as $user){ + $clusters = new Repo('user/getClusters', array($user['id_user'])); + $clusters = $clusters->answer(); + echo "
"; // Prenom Nom echo "".$user['username']." (".$user['firstname']." ".$user['lastname'].")"; @@ -99,8 +103,9 @@ echo ""; echo ResourceDispatcher::getResource('f/svg/group/st/container'); - echo "a"; - echo "a"; + if( $clusters != false ) + foreach($clusters as $cluster) + echo "".$cluster['name'].""; echo"";