87 lines
1.9 KiB
PHP
87 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace view\machine\group;
|
|
|
|
use \generic\core\i_view;
|
|
use \api\core\Request;
|
|
use \error\core\Err;
|
|
|
|
|
|
class main extends i_view{
|
|
|
|
/* (1) Attributes
|
|
---------------------------------------------------------*/
|
|
public $icon;
|
|
public $theme;
|
|
|
|
|
|
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' ),
|
|
'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(){
|
|
$request = new Request('clusterDefault/getAll', [
|
|
'class' => 1
|
|
]);
|
|
|
|
$answer = $request->dispatch();
|
|
|
|
// si erreur, on affiche rien par défaut
|
|
if( $answer->error->get() != Err::Success )
|
|
return [];
|
|
|
|
return $answer->get('clusters');
|
|
}
|
|
|
|
|
|
|
|
|
|
public function get_members($id_cluster){
|
|
$usersReq = new Request('clusterDefault/getMembers', [
|
|
'id_cluster' => (int) $id_cluster,
|
|
'class' => 1
|
|
]);
|
|
|
|
$usersRes = $usersReq->dispatch();
|
|
// si erreur, on affiche rien par défaut
|
|
if( $usersRes->error->get() != Err::Success )
|
|
return [];
|
|
|
|
return $usersRes->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');
|
|
}
|
|
|
|
|
|
} |