- [x] [view/users] Affichage des groupes des utilisateurs

This commit is contained in:
xdrm-brackets 2016-02-14 13:55:06 +01:00
parent 65f7b1b06c
commit 81ae09c4c4
3 changed files with 21 additions and 25 deletions

View File

@ -25,34 +25,24 @@
// Pour chaque entree // Pour chaque entree
foreach( $json as $user ){ foreach( $json as $user ){
$insertRequest = Database::getPDO()->prepare("INSERT INTO user(id_user, code, username, firstname, lastname, mail, password, status) // Creation de la requete
VALUES( $request = new ModuleRequest('userDefault/create', array(
DEFAULT, $user['code'],
:code, $user['username'],
:username, $user['firstname'],
:firstname, $user['lastname'],
:lastname, $user['email'],
:mail, $user['password'],
:password, $user['status']
: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']
)); ));
$answer = $request->dispatch();
var_dump( $status ); // Debug error
var_dump( $answer->error == ManagerError::Success );
} }
return true; return true;
}// insertUsersFromJSON(); }insertUsersFromJSON();

View File

@ -39,6 +39,7 @@
######## ########
# FAIT # # FAIT #
######## ########
- [x] [view/users] Affichage des groupes des utilisateurs
- [x] [cluster::link/unlink] Ajout/Suppression d'association des utilisateurs/machines a des groupes - [x] [cluster::link/unlink] Ajout/Suppression d'association des utilisateurs/machines a des groupes
- [x] [user::getClusters] Recuperation des groupes d'un utilisateur - [x] [user::getClusters] Recuperation des groupes d'un utilisateur
- [x] [manager/repo/]Creation des repos - [x] [manager/repo/]Creation des repos

View File

@ -3,6 +3,7 @@
use \manager\ModuleRequest; use \manager\ModuleRequest;
use \manager\ManagerError; use \manager\ManagerError;
use \manager\ResourceDispatcher; use \manager\ResourceDispatcher;
use \manager\Repo;
?> ?>
<!-- [1] Gestion du sous-menu de gauche --> <!-- [1] Gestion du sous-menu de gauche -->
@ -73,6 +74,9 @@
// Si aucune erreur, on affiche les resultats // Si aucune erreur, on affiche les resultats
else{ else{
foreach( $answer->get('users') as $user){ foreach( $answer->get('users') as $user){
$clusters = new Repo('user/getClusters', array($user['id_user']));
$clusters = $clusters->answer();
echo "<article class='inline-box'>"; echo "<article class='inline-box'>";
// Prenom Nom // Prenom Nom
echo "<span class='title'>".$user['username']." <span>(".$user['firstname']." ".$user['lastname'].")</span></span>"; echo "<span class='title'>".$user['username']." <span>(".$user['firstname']." ".$user['lastname'].")</span></span>";
@ -99,8 +103,9 @@
echo "<span class='groups'>"; echo "<span class='groups'>";
echo ResourceDispatcher::getResource('f/svg/group/st/container'); echo ResourceDispatcher::getResource('f/svg/group/st/container');
echo "<span>a</span>"; if( $clusters != false )
echo "<span>a</span>"; foreach($clusters as $cluster)
echo "<span>".$cluster['name']."</span>";
echo"</span>"; echo"</span>";