Gestion de l'affichage des repos 'machine_cluster' et 'user_cluster' sur les pages 'machines/view' et 'users/view'

This commit is contained in:
xdrm-brackets 2016-07-18 12:51:32 +02:00
parent 24450bd87a
commit 79e3bf6a75
7 changed files with 30 additions and 31 deletions

View File

@ -52,7 +52,7 @@
/* [3] Creation du groupe de meme nom que l'username
=========================================================*/
$create_cluster = new Repo('cluster/create', [
$create_cluster = new Repo('user_cluster/create', [
$_SESSION['WAREHOUSE']['id'],
$username,
clusterRepo::USER_CLASS,
@ -92,7 +92,7 @@
/* [1] Creation de l'association
=========================================================*/
$link_user = new Repo('cluster/link', [
$link_user = new Repo('user_cluster/link', [
$_SESSION['WAREHOUSE']['id'],
$id_cluster,
$id_user,
@ -121,7 +121,7 @@
/* [1] Suppression de l'association
=========================================================*/
$link_user = new Repo('cluster/unlink', [
$link_user = new Repo('user_cluster/unlink', [
$_SESSION['WAREHOUSE']['id'],
$id_cluster,
$id_user,
@ -399,7 +399,7 @@
/* [2] On récupère le groupe personnel
=========================================================*/
$get_personal_cluster = new Repo('cluster/getPersonal', [
$get_personal_cluster = new Repo('user_cluster/getPersonal', [
$id_warehouse,
$id_user,
clusterRepo::USER_CLASS
@ -414,7 +414,7 @@
/* [3] On supprime le groupe personnel
=========================================================*/
$del_cluster = new Repo('cluster/delete', [
$del_cluster = new Repo('user_cluster/delete', [
$id_warehouse,
$personal_cluster['id_cluster']
]);

View File

@ -94,18 +94,17 @@
public static function getClusters($id_warehouse, $id_machine){
/* [1] On redige/execute la requete
=========================================================*/
$get_clusters = Database::getPDO()->prepare("SELECT c.id_cluster, c.name
FROM cluster as c, cluster_merge as cm, machine as m
WHERE cm.id_cluster = c.id_cluster
AND cm.id_entity = m.id_machine
$get_clusters = Database::getPDO()->prepare("SELECT c.*
FROM machine_cluster as c, machine_cluster_merge as cm, machine as m
WHERE cm.id_machine_cluster = c.id_machine_cluster
AND cm.id_machine = m.id_machine
AND cm.id_machine = :id_machine
AND c.id_warehouse = m.id_warehouse
AND m.id_warehouse = :id_warehouse
AND cm.id_entity = :id_machine
AND c.class = :class
ORDER BY c.id_cluster");
ORDER BY c.name");
$get_clusters->execute([
':id_warehouse' => $id_warehouse,
':id_machine' => $id_machine,
':class' => clusterRepo::MACHINE_CLASS
':id_machine' => $id_machine
]);
/* [2] On retourne la liste des groupes

View File

@ -2,7 +2,7 @@
namespace manager\repo;
use \manager\Database;
use \manager\repo\cluster as clusterRepo;
use \manager\repo\uesr_cluster;
class user extends parentRepo{
@ -110,18 +110,17 @@
public static function getClusters($id_warehouse, $id_user){
/* [1] On redige/execute la requete
=========================================================*/
$get_clusters = Database::getPDO()->prepare("SELECT c.id_cluster, c.name
FROM cluster as c, cluster_merge as cm, user as u
WHERE cm.id_cluster = c.id_cluster
AND cm.id_entity = u.id_user
AND cm.id_entity = :id_user
AND c.class = :class
$get_clusters = Database::getPDO()->prepare("SELECT c.*
FROM user_cluster as c, user_cluster_merge as cm, user as u
WHERE cm.id_user_cluster = c.id_user_cluster
AND cm.id_user = u.id_user
AND cm.id_user = :id_user
AND c.id_warehouse = u.id_warehouse
AND u.id_warehouse = :id_warehouse
ORDER BY c.id_cluster");
ORDER BY c.name");
$get_clusters->execute([
':id_warehouse' => $id_warehouse,
':id_user' => $id_user,
':class' => clusterRepo::USER_CLASS
':id_user' => $id_user
]);
/* [2] On retourne la liste des groupes

View File

@ -337,9 +337,10 @@
debug();
$req = new Repo('user_cluster/delete', [
$req = new Repo('machine_cluster/link', [
7,
1
2,
3
]);
var_dump( $req->error );

View File

@ -39,6 +39,7 @@
<?php
debug();
$post = [];
foreach($_POST as $k=>$v)

View File

@ -40,7 +40,6 @@
<?php
$post = [];
foreach($_POST as $k=>$v)
array_push($post, $k);
@ -53,7 +52,7 @@
=========================================================*/
echo "<section data-sublink='view' class='list'>";
$userlist = new View('user.view');
$userlist = new View('user.view', []);
$userlist->view();
echo '</section>';