79 lines
2.0 KiB
PHP
79 lines
2.0 KiB
PHP
<?php
|
|
|
|
namespace view\group\view;
|
|
|
|
use \generic\core\i_view;
|
|
use \api\core\Request;
|
|
use \error\core\Err;
|
|
use \generic\core\View;
|
|
|
|
|
|
class main extends i_view{
|
|
|
|
public function __construct(){
|
|
|
|
/* (1) Setup attributes
|
|
---------------------------------------------------------*/
|
|
/* (1) Fill attributes */
|
|
$this->icon = [
|
|
'remove' => file_get_contents( __PUBLIC__.'/src/static/sub-menu-side/remove.svg' ),
|
|
'edit' => file_get_contents( __PUBLIC__.'/src/static/sub-menu-side/edit.svg' ),
|
|
'device' => file_get_contents( __PUBLIC__.'/src/static/menu-side/device.svg' ),
|
|
'user' => file_get_contents( __PUBLIC__.'/src/static/menu-side/users.svg' ),
|
|
'group' => file_get_contents( __PUBLIC__.'/src/static/container/group.svg' ),
|
|
'option' => file_get_contents( __PUBLIC__.'/src/static/container/option.svg' )
|
|
];
|
|
|
|
$this->theme = $_SESSION['WAREHOUSE']['theme'];
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function get_clusters($class){
|
|
/* (1) On récupère les groupes */
|
|
$getClustersReq = new Request('clusterDefault/getAll', ['class' => $class]);
|
|
$getClusters = $getClustersReq->dispatch();
|
|
|
|
/* (2) si erreur, on retourne rien par défaut */
|
|
if( $getClusters->error->get() != Err::Success )
|
|
return [];
|
|
|
|
/* (3) On enregistre le résultat */
|
|
return $getClusters->get('clusters');
|
|
}
|
|
|
|
|
|
public function get_members($id_cluster, $class){
|
|
$membersReq = new Request('clusterDefault/getMembers', [
|
|
'id_cluster' => (int) $id_cluster,
|
|
'class' => $class
|
|
]);
|
|
|
|
$membersRes = $membersReq->dispatch();
|
|
//
|
|
// si erreur, on affiche rien par défaut
|
|
if( $membersRes->error->get() != Err::Success )
|
|
return [];
|
|
|
|
return $membersRes->get('members');
|
|
}
|
|
|
|
|
|
public function get_options($id_cluster){
|
|
$modReq = new Request('clusterDefault/getEtrees', [
|
|
'id_machine_cluster' => (int) $id_cluster
|
|
]);
|
|
|
|
$modRes = $modReq->dispatch();
|
|
|
|
// si erreur, on affiche rien par défaut
|
|
if( $modRes->error->get() != Err::Success )
|
|
return [];
|
|
|
|
return $modRes->get('etrees');
|
|
}
|
|
|
|
|
|
} |