Schema updated for modules (also called 'extensions') + the view 'analytics' became 'extensions' and now there is the default layout for choosing extensions + TODO: extensions.js + POST::link / POST::unlink to add to 'clusterDefault' or create 'extensionDefault' + TODO: rename module to extension

This commit is contained in:
xdrm-brackets 2017-09-23 19:05:54 +02:00
parent fd0d9cef56
commit fd7bc472ec
13 changed files with 543 additions and 35 deletions

View File

@ -326,7 +326,7 @@
*/
public function addPermission($params){
extract($params);
/* [1] On crée la relation via le repo
=========================================================*/
/* (1) On rédige la requête */
@ -340,7 +340,7 @@
=========================================================*/
return [ 'error' => $res ];
}
/* SUPPRIME UNE PERMISSION
*
* @id_target<int> UID du groupe de machine cible
@ -350,7 +350,7 @@
*/
public function remPermission($params){
extract($params);
/* [1] On supprime la relation via le repo
=========================================================*/
/* (1) On rédige la requête */
@ -383,7 +383,7 @@
/* (2) On exécute et récupère la réponse */
$res = $req->answer();
// Gestion erreur
if( !is_array($res) )
return ['error' => new Error(Err::NoMatchFound)];
@ -416,7 +416,45 @@
return ['clusters' => $res];
}
/* RETOURNE LA LISTE DES MODULE D'UN GROUPE DE MACHINES
*
* @id_cluster<int> UID du groupe de machine
*
* @return modules<Array> Liste des modules autorisés pour le groupe de machines
*
*/
public static function getModules($params){
extract($params);
/* [1] On récupère les modules
=========================================================*/
/* (1) Récupération */
$mod_req = new Repo('module/getByMachineCluster', [
$_SESSION['WAREHOUSE']['id'],
$id_cluster
]);
$answer = $mod_req->answer();
/* (2) Gestion erreur */
if( $answer === false )
return ['error' => new Error(Err::NoMatchFound)]; // no error
/* [3] On retourne la liste
=========================================================*/
return [ 'modules' => $answer ];
}
}

View File

@ -0,0 +1,236 @@
<?php
namespace database\repo;
use \database\core\DatabaseDriver;
use \error\core\Err;
use \database\core\Repo;
use \orm\core\Table;
use \orm\core\Rows;
class module extends parentRepo{
protected static function table_name(){ static $table_name = 'module'; return $table_name; }
/* [1] Fetch all modules
*
* @return modules<Array> The list of modules
* FALSE on error
*
=========================================================*/
public static function getAll(){
return Table::get('module')->select('*')->fetch();
}
/* [2] Fetch all modules for the given warehouse
*
* @id_warehouse<int> UID of the given warehouse
*
* @return modules<Array> The list of modules
* FALSE on error
*
=========================================================*/
public static function getByWarehouse($id_warehouse){
/* (1) Build request */
$modules = Table::get('module')->select('*');
$merge = Table::get('module_availability')->whereIdWarehouse($id_warehouse);
$merge->join('id_module', $modules);
return $merge->fetch();
}
/* [3] Fetch all modules for the given machine_cluster
*
* @id_warehouse<int> UID of the given warehouse
* @id_machine_cluster<int> UID of the given machine_cluster
*
* @return modules<Array> The list of modules
* FALSE on error
*
=========================================================*/
public static function getByMachineCluster($id_warehouse, $id_machine_cluster){
/* (1) Build request */
$modules = Table::get('module')->select('*');
$merge = Table::get('module_merge')
->whereIdWarehouse($id_warehouse)
->whereIdMachineCluster($id_machine_cluster);
$merge->join('id_module', $modules);
return $merge->fetch();
}
/* [4] Adds a module to machine cluster of a warehouse
*
* @id_warehouse<int> UID of the given warehouse
* @id_machine_cluster<int> UID of the given machine_cluster
* @id_module UID of the given module
*
* @return status<bool> TRUE on success
*
=========================================================*/
public static function link($id_warehouse, $id_machine_cluster, $id_module){
/* (1) Check module
---------------------------------------------------------*/
/* (1) Check if module exists (by its id) */
$module = Table::get('module')
->select('*')
->unique()
->whereId($id_module);
if( !$module->fetch() )
return false;
/* (2) Check if the module is allowed in the warehouse */
$module_m = Table::get('module_availability')
->select('*')
->unique()
->whereIdWarehouse($id_warehouse)
->whereIdModule($id_module);
// if not allowed in the warehouse -> error
if( !$module->fetch() )
return false;
/* (2) Check machine_cluster
---------------------------------------------------------*/
/* (1) Check if machine_cluster exists (by its id) */
$machine_cluster = Table::get('machine_cluster')
->select('*')
->unique()
->whereIdWarehouse($id_warehouse)
->whereId($id_machine_cluster);
if( !$machine_cluster->fetch() )
return false;
/* (2) Check link does not already exists */
$exists = Table::get('module_merge')
->select('*')
->unique()
->whereIdWarehouse($id_warehouse)
->whereIdMachineCluster($id_machine_cluster)
->whereIdModule($id_module);
if( !!$exists->fetch() )
return true; // returns all right (even if nothing done)
/* (3) Create link
---------------------------------------------------------*/
$inserted = Table::get('module_merge')->insert([
'id_warehouse' => $id_warehouse,
'id_module' => $id_module,
'id_machine_cluster' => $id_machine_cluster
]);
// return TRUE only if PDO insert successful
return $inserted;
}
/* [5] Removes a module from machine cluster of a warehouse
*
* @id_warehouse<int> UID of the given warehouse
* @id_machine_cluster<int> UID of the given machine_cluster
* @id_module UID of the given module
*
* @return status<bool> TRUE on success
*
=========================================================*/
public static function unlink($id_warehouse, $id_machine_cluster, $id_module){
/* (1) Check module
---------------------------------------------------------*/
/* (1) Check if module exists (by its id) */
$module = Table::get('module')
->select('*')
->unique()
->whereId($id_module);
if( !$module->fetch() )
return false;
/* (2) Check machine_cluster
---------------------------------------------------------*/
/* (1) Check if machine_cluster exists (by its id) */
$machine_cluster = Table::get('machine_cluster')
->select('*')
->unique()
->whereIdWarehouse($id_warehouse)
->whereId($id_machine_cluster);
if( !$machine_cluster->fetch() )
return false;
/* (2) Check if link already exists */
$exists = Table::get('module_merge')
->select('*')
->unique()
->whereIdWarehouse($id_warehouse)
->whereIdMachineCluster($id_machine_cluster)
->whereIdModule($id_module);
if( !$exists->fetch() )
return false; // returns all right (even if nothing done)
/* (3) Remove link
---------------------------------------------------------*/
$deleted = Table::get('module_merge')
->whereIdWarehouse($id_warehouse)
->whereIdModule($id_module)
->whereIdMachineCluster($id_machine_cluster)
->delete();
// return TRUE only if PDO delete successful
return $deleted;
}
}
?>

View File

@ -2,6 +2,7 @@
namespace database\repo;
use \database\core\DatabaseDriver;
use \database\core\Repo;
use \manager\sessionManager;
use \orm\core\Table;
use \orm\core\Rows;
@ -97,20 +98,22 @@
public static function getModules($id_warehouse){
/* [1] On récupère les modules
=========================================================*/
$module = Table::get('module')
->select('id_module')
->select('name');
/* (1) Récupération */
$mod_req = new Repo('module/getByWarehouse', [$id_warehouse]);
$merge = Table::get('module_merge')
->whereIdWarehouse($id_warehouse)
->join('id_module', $module);
$answer = $mod_req->answer();
/* (2) Gestion erreur */
if( $answer === false )
return []; // no error
$modules = $merge->fetch();
/* [2] On formatte les données pour avoir 1 niveau de tableau
=========================================================*/
foreach($modules as $m=>$module)
$modules[$m] = $module['name'];
$modules = []; // id => name
foreach($answer as $module)
$modules[$module['id_module']] = $module['name'];
/* [3] On retourne la liste

View File

@ -0,0 +1,72 @@
<?php
namespace viewer\view\extension;
use \viewer\core\Viewer;
use \api\core\Request;
use \api\core\Authentification;
use \error\core\Error;
use \error\core\Err;
class view{
public static function render(){
/* [1] Init Twig
=========================================================*/
$loader = new \Twig_Loader_Filesystem(__BUILD__.'/viewer/view');
$twig = new \Twig_Environment($loader, []);
/* [2] Store variables
=========================================================*/
$variables = [
'p_icon' => [
'group' => file_get_contents( __PUBLIC__.'/src/static/container/extension.svg' )
],
'p_theme' => $_SESSION['WAREHOUSE']['theme']
];
/* [3] Store functions
=========================================================*/
$twig->addFunction(new \Twig_Function('f_clusters', function(){
$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');
}));
$twig->addFunction(new \Twig_Function('f_modules', function($id_cluster){
$extReq = new Request('clusterDefault/getModules', [
'id_cluster' => (int) $id_cluster
]);
$extRes = $extReq->dispatch();
// si erreur, on affiche rien par défaut
if( $extRes->error->get() != Err::Success )
return [];
return $extRes->get('modules');
}));
/* [4] Build the whole stuff
=========================================================*/
return $twig->render('extension/view.twig', [
'p_icon' => $variables['p_icon'],
'p_theme' => $variables['p_theme']
]);
}
}
?>

View File

@ -0,0 +1,42 @@
<input type='text' class='searchbar' placeholder='Recherche'>
{% for cluster in f_clusters() %}
<article class='inline-box' id='{{ cluster.id_machine_cluster }}'>
{% set modulelist = f_modules(cluster.id_machine_cluster) %}
<span class='title' style='color: {{ p_theme }}'>{{ cluster.name }}</span>
<span class='link_remove' data-cluster='{{ cluster.id_machine_cluster }}'>{{ p_icon.remove | raw }}</span>
<span class='link_edit' data-cluster='{{ cluster.id_machine_cluster }}'>{{ p_icon.edit | raw }}</span>
<span class='code'>
{{ p_icon.device | raw }}
<span>{{ modulelist | length }} modules</span>
</span>
<span class='groups'>
{{ p_icon.group | raw }}
<span class='ignore'>
{% for module in modulelist %}
<span>
{{ module.name }}
<span class='rem-member' data-module='{{ module.id_module }}' data-cluster='{{ cluster.id_machine_cluster }}'></span>
</span>
{% endfor %}
</span>
<span class='add-member' data-cluster='{{ cluster.id_machine_cluster }}'>+</span>
</span>
</article>
{# if no result #}
{% else %}
<article class='inline-box'>
<span>Aucun groupe trouvé.</span>
</article>
{% endfor %}

View File

@ -66,7 +66,7 @@
"name": { "type": "varchar(50)" }
},
"module_merge": {
"module_availability": {
"#id_warehouse": { "type": "int", "ref": [ "warehouse", "id_warehouse" ] },
"#id_module": { "type": "int", "ref": [ "module", "id_module" ] }
},

View File

@ -503,6 +503,17 @@
"output": {
"clusters": { "description": "Liste des groupes d'utilisateurs.", "type": "array" }
}
},
"POST::getModules": {
"description": "Retourne les modules d'un groupe de machines",
"permissions": [["admin"]],
"parameters": {
"id_cluster": { "description": "UID du groupe de machines", "type": "id" }
},
"output": {
"modules": { "description": "Modules du groupe", "type": "array<mixed>" }
}
}
},

View File

@ -1,4 +1,13 @@
{
"module": [
"getAll",
"getByWarehouse",
"getByMachineCluster",
"link",
"unlink"
],
"history": [
"create",
"delete",

View File

@ -236,7 +236,8 @@
&.add-permission,
&.add-group,
&.add-member{
&.add-member,
&.add-extension{
border-radius: 3px;
cursor: pointer;
@ -291,7 +292,8 @@
& > span.rem-group,
& > span.icon-permission,
& > span.rem-permission,
& > span.rem-member{
& > span.rem-member,
& > span.rem-extension{
display: block;
position: absolute;
top: -1px;

View File

@ -39,7 +39,7 @@
width: $menu-side-width;
height: $menu-side-width;
background: transparent url('/src/static/logout@e0e7ed.svg') center center no-repeat;
background-size: 40%;

View File

@ -248,30 +248,36 @@
cursor: default;
}
#WRAPPER > #CONTAINER > section > .inline-box .groups > span:not(.ignore).add-permission, #WRAPPER > #CONTAINER > section > .inline-box .groups > span:not(.ignore).add-group, #WRAPPER > #CONTAINER > section > .inline-box .groups > span:not(.ignore).add-member,
#WRAPPER > #CONTAINER > section > .inline-box .groups > span:not(.ignore).add-permission, #WRAPPER > #CONTAINER > section > .inline-box .groups > span:not(.ignore).add-group, #WRAPPER > #CONTAINER > section > .inline-box .groups > span:not(.ignore).add-member, #WRAPPER > #CONTAINER > section > .inline-box .groups > span:not(.ignore).add-extension,
#WRAPPER > #CONTAINER > section > .inline-box .groups > span.ignore > span.add-permission,
#WRAPPER > #CONTAINER > section > .inline-box .groups > span.ignore > span.add-group,
#WRAPPER > #CONTAINER > section > .inline-box .groups > span.ignore > span.add-member,
#WRAPPER > #CONTAINER > section > .inline-box .groups > span.ignore > span.add-extension,
#WRAPPER > #CONTAINER > section > .inline-row .groups > span:not(.ignore).add-permission,
#WRAPPER > #CONTAINER > section > .inline-row .groups > span:not(.ignore).add-group,
#WRAPPER > #CONTAINER > section > .inline-row .groups > span:not(.ignore).add-member,
#WRAPPER > #CONTAINER > section > .inline-row .groups > span:not(.ignore).add-extension,
#WRAPPER > #CONTAINER > section > .inline-row .groups > span.ignore > span.add-permission,
#WRAPPER > #CONTAINER > section > .inline-row .groups > span.ignore > span.add-group,
#WRAPPER > #CONTAINER > section > .inline-row .groups > span.ignore > span.add-member {
#WRAPPER > #CONTAINER > section > .inline-row .groups > span.ignore > span.add-member,
#WRAPPER > #CONTAINER > section > .inline-row .groups > span.ignore > span.add-extension {
border-radius: 3px;
cursor: pointer;
}
#WRAPPER > #CONTAINER > section > .inline-box .groups > span:not(.ignore).add-permission > div.dropdown, #WRAPPER > #CONTAINER > section > .inline-box .groups > span:not(.ignore).add-group > div.dropdown, #WRAPPER > #CONTAINER > section > .inline-box .groups > span:not(.ignore).add-member > div.dropdown,
#WRAPPER > #CONTAINER > section > .inline-box .groups > span:not(.ignore).add-permission > div.dropdown, #WRAPPER > #CONTAINER > section > .inline-box .groups > span:not(.ignore).add-group > div.dropdown, #WRAPPER > #CONTAINER > section > .inline-box .groups > span:not(.ignore).add-member > div.dropdown, #WRAPPER > #CONTAINER > section > .inline-box .groups > span:not(.ignore).add-extension > div.dropdown,
#WRAPPER > #CONTAINER > section > .inline-box .groups > span.ignore > span.add-permission > div.dropdown,
#WRAPPER > #CONTAINER > section > .inline-box .groups > span.ignore > span.add-group > div.dropdown,
#WRAPPER > #CONTAINER > section > .inline-box .groups > span.ignore > span.add-member > div.dropdown,
#WRAPPER > #CONTAINER > section > .inline-box .groups > span.ignore > span.add-extension > div.dropdown,
#WRAPPER > #CONTAINER > section > .inline-row .groups > span:not(.ignore).add-permission > div.dropdown,
#WRAPPER > #CONTAINER > section > .inline-row .groups > span:not(.ignore).add-group > div.dropdown,
#WRAPPER > #CONTAINER > section > .inline-row .groups > span:not(.ignore).add-member > div.dropdown,
#WRAPPER > #CONTAINER > section > .inline-row .groups > span:not(.ignore).add-extension > div.dropdown,
#WRAPPER > #CONTAINER > section > .inline-row .groups > span.ignore > span.add-permission > div.dropdown,
#WRAPPER > #CONTAINER > section > .inline-row .groups > span.ignore > span.add-group > div.dropdown,
#WRAPPER > #CONTAINER > section > .inline-row .groups > span.ignore > span.add-member > div.dropdown {
#WRAPPER > #CONTAINER > section > .inline-row .groups > span.ignore > span.add-member > div.dropdown,
#WRAPPER > #CONTAINER > section > .inline-row .groups > span.ignore > span.add-extension > div.dropdown {
display: flex;
flex-direction: column;
flex-wrap: nowrap;
@ -290,32 +296,38 @@
z-index: 100;
}
#WRAPPER > #CONTAINER > section > .inline-box .groups > span:not(.ignore).add-permission > div.dropdown > span, #WRAPPER > #CONTAINER > section > .inline-box .groups > span:not(.ignore).add-group > div.dropdown > span, #WRAPPER > #CONTAINER > section > .inline-box .groups > span:not(.ignore).add-member > div.dropdown > span,
#WRAPPER > #CONTAINER > section > .inline-box .groups > span:not(.ignore).add-permission > div.dropdown > span, #WRAPPER > #CONTAINER > section > .inline-box .groups > span:not(.ignore).add-group > div.dropdown > span, #WRAPPER > #CONTAINER > section > .inline-box .groups > span:not(.ignore).add-member > div.dropdown > span, #WRAPPER > #CONTAINER > section > .inline-box .groups > span:not(.ignore).add-extension > div.dropdown > span,
#WRAPPER > #CONTAINER > section > .inline-box .groups > span.ignore > span.add-permission > div.dropdown > span,
#WRAPPER > #CONTAINER > section > .inline-box .groups > span.ignore > span.add-group > div.dropdown > span,
#WRAPPER > #CONTAINER > section > .inline-box .groups > span.ignore > span.add-member > div.dropdown > span,
#WRAPPER > #CONTAINER > section > .inline-box .groups > span.ignore > span.add-extension > div.dropdown > span,
#WRAPPER > #CONTAINER > section > .inline-row .groups > span:not(.ignore).add-permission > div.dropdown > span,
#WRAPPER > #CONTAINER > section > .inline-row .groups > span:not(.ignore).add-group > div.dropdown > span,
#WRAPPER > #CONTAINER > section > .inline-row .groups > span:not(.ignore).add-member > div.dropdown > span,
#WRAPPER > #CONTAINER > section > .inline-row .groups > span:not(.ignore).add-extension > div.dropdown > span,
#WRAPPER > #CONTAINER > section > .inline-row .groups > span.ignore > span.add-permission > div.dropdown > span,
#WRAPPER > #CONTAINER > section > .inline-row .groups > span.ignore > span.add-group > div.dropdown > span,
#WRAPPER > #CONTAINER > section > .inline-row .groups > span.ignore > span.add-member > div.dropdown > span {
#WRAPPER > #CONTAINER > section > .inline-row .groups > span.ignore > span.add-member > div.dropdown > span,
#WRAPPER > #CONTAINER > section > .inline-row .groups > span.ignore > span.add-extension > div.dropdown > span {
padding: .5em;
padding-left: 1em;
flex: 2em 1 1;
cursor: pointer;
}
#WRAPPER > #CONTAINER > section > .inline-box .groups > span:not(.ignore).add-permission > div.dropdown > span:hover, #WRAPPER > #CONTAINER > section > .inline-box .groups > span:not(.ignore).add-group > div.dropdown > span:hover, #WRAPPER > #CONTAINER > section > .inline-box .groups > span:not(.ignore).add-member > div.dropdown > span:hover,
#WRAPPER > #CONTAINER > section > .inline-box .groups > span:not(.ignore).add-permission > div.dropdown > span:hover, #WRAPPER > #CONTAINER > section > .inline-box .groups > span:not(.ignore).add-group > div.dropdown > span:hover, #WRAPPER > #CONTAINER > section > .inline-box .groups > span:not(.ignore).add-member > div.dropdown > span:hover, #WRAPPER > #CONTAINER > section > .inline-box .groups > span:not(.ignore).add-extension > div.dropdown > span:hover,
#WRAPPER > #CONTAINER > section > .inline-box .groups > span.ignore > span.add-permission > div.dropdown > span:hover,
#WRAPPER > #CONTAINER > section > .inline-box .groups > span.ignore > span.add-group > div.dropdown > span:hover,
#WRAPPER > #CONTAINER > section > .inline-box .groups > span.ignore > span.add-member > div.dropdown > span:hover,
#WRAPPER > #CONTAINER > section > .inline-box .groups > span.ignore > span.add-extension > div.dropdown > span:hover,
#WRAPPER > #CONTAINER > section > .inline-row .groups > span:not(.ignore).add-permission > div.dropdown > span:hover,
#WRAPPER > #CONTAINER > section > .inline-row .groups > span:not(.ignore).add-group > div.dropdown > span:hover,
#WRAPPER > #CONTAINER > section > .inline-row .groups > span:not(.ignore).add-member > div.dropdown > span:hover,
#WRAPPER > #CONTAINER > section > .inline-row .groups > span:not(.ignore).add-extension > div.dropdown > span:hover,
#WRAPPER > #CONTAINER > section > .inline-row .groups > span.ignore > span.add-permission > div.dropdown > span:hover,
#WRAPPER > #CONTAINER > section > .inline-row .groups > span.ignore > span.add-group > div.dropdown > span:hover,
#WRAPPER > #CONTAINER > section > .inline-row .groups > span.ignore > span.add-member > div.dropdown > span:hover {
#WRAPPER > #CONTAINER > section > .inline-row .groups > span.ignore > span.add-member > div.dropdown > span:hover,
#WRAPPER > #CONTAINER > section > .inline-row .groups > span.ignore > span.add-extension > div.dropdown > span:hover {
background-color: #F8F8F8;
}
@ -323,18 +335,22 @@
#WRAPPER > #CONTAINER > section > .inline-box .groups > span:not(.ignore) > span.icon-permission,
#WRAPPER > #CONTAINER > section > .inline-box .groups > span:not(.ignore) > span.rem-permission,
#WRAPPER > #CONTAINER > section > .inline-box .groups > span:not(.ignore) > span.rem-member,
#WRAPPER > #CONTAINER > section > .inline-box .groups > span:not(.ignore) > span.rem-extension,
#WRAPPER > #CONTAINER > section > .inline-box .groups > span.ignore > span > span.rem-group,
#WRAPPER > #CONTAINER > section > .inline-box .groups > span.ignore > span > span.icon-permission,
#WRAPPER > #CONTAINER > section > .inline-box .groups > span.ignore > span > span.rem-permission,
#WRAPPER > #CONTAINER > section > .inline-box .groups > span.ignore > span > span.rem-member,
#WRAPPER > #CONTAINER > section > .inline-box .groups > span.ignore > span > span.rem-extension,
#WRAPPER > #CONTAINER > section > .inline-row .groups > span:not(.ignore) > span.rem-group,
#WRAPPER > #CONTAINER > section > .inline-row .groups > span:not(.ignore) > span.icon-permission,
#WRAPPER > #CONTAINER > section > .inline-row .groups > span:not(.ignore) > span.rem-permission,
#WRAPPER > #CONTAINER > section > .inline-row .groups > span:not(.ignore) > span.rem-member,
#WRAPPER > #CONTAINER > section > .inline-row .groups > span:not(.ignore) > span.rem-extension,
#WRAPPER > #CONTAINER > section > .inline-row .groups > span.ignore > span > span.rem-group,
#WRAPPER > #CONTAINER > section > .inline-row .groups > span.ignore > span > span.icon-permission,
#WRAPPER > #CONTAINER > section > .inline-row .groups > span.ignore > span > span.rem-permission,
#WRAPPER > #CONTAINER > section > .inline-row .groups > span.ignore > span > span.rem-member {
#WRAPPER > #CONTAINER > section > .inline-row .groups > span.ignore > span > span.rem-member,
#WRAPPER > #CONTAINER > section > .inline-row .groups > span.ignore > span > span.rem-extension {
display: block;
position: absolute;
top: -1px;
@ -356,18 +372,22 @@
#WRAPPER > #CONTAINER > section > .inline-box .groups > span:not(.ignore) > span.icon-permission:hover,
#WRAPPER > #CONTAINER > section > .inline-box .groups > span:not(.ignore) > span.rem-permission:hover,
#WRAPPER > #CONTAINER > section > .inline-box .groups > span:not(.ignore) > span.rem-member:hover,
#WRAPPER > #CONTAINER > section > .inline-box .groups > span:not(.ignore) > span.rem-extension:hover,
#WRAPPER > #CONTAINER > section > .inline-box .groups > span.ignore > span > span.rem-group:hover,
#WRAPPER > #CONTAINER > section > .inline-box .groups > span.ignore > span > span.icon-permission:hover,
#WRAPPER > #CONTAINER > section > .inline-box .groups > span.ignore > span > span.rem-permission:hover,
#WRAPPER > #CONTAINER > section > .inline-box .groups > span.ignore > span > span.rem-member:hover,
#WRAPPER > #CONTAINER > section > .inline-box .groups > span.ignore > span > span.rem-extension:hover,
#WRAPPER > #CONTAINER > section > .inline-row .groups > span:not(.ignore) > span.rem-group:hover,
#WRAPPER > #CONTAINER > section > .inline-row .groups > span:not(.ignore) > span.icon-permission:hover,
#WRAPPER > #CONTAINER > section > .inline-row .groups > span:not(.ignore) > span.rem-permission:hover,
#WRAPPER > #CONTAINER > section > .inline-row .groups > span:not(.ignore) > span.rem-member:hover,
#WRAPPER > #CONTAINER > section > .inline-row .groups > span:not(.ignore) > span.rem-extension:hover,
#WRAPPER > #CONTAINER > section > .inline-row .groups > span.ignore > span > span.rem-group:hover,
#WRAPPER > #CONTAINER > section > .inline-row .groups > span.ignore > span > span.icon-permission:hover,
#WRAPPER > #CONTAINER > section > .inline-row .groups > span.ignore > span > span.rem-permission:hover,
#WRAPPER > #CONTAINER > section > .inline-row .groups > span.ignore > span > span.rem-member:hover {
#WRAPPER > #CONTAINER > section > .inline-row .groups > span.ignore > span > span.rem-member:hover,
#WRAPPER > #CONTAINER > section > .inline-row .groups > span.ignore > span > span.rem-extension:hover {
background-image: url("/src/static/sub-menu-side/remove@d52918.svg");
}

View File

@ -0,0 +1 @@
<?xml version="1.0" ?><svg height="23px" version="1.1" viewBox="0 0 23 23" width="23px" xmlns="http://www.w3.org/2000/svg" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns" xmlns:xlink="http://www.w3.org/1999/xlink"><title/><desc/><defs/><g fill="none" fill-rule="evenodd" id="Page-1" stroke="none" stroke-width="1"><g fill="#000000" id="Core" transform="translate(-253.000000, -211.000000)"><g id="extension" transform="translate(253.500000, 211.500000)"><path d="M18.5,10 L17,10 L17,6 C17,4.9 16.1,4 15,4 L11,4 L11,2.5 C11,1.1 9.9,0 8.5,0 C7.1,0 6,1.1 6,2.5 L6,4 L2,4 C0.9,4 0,4.9 0,6 L0,9.8 L1.5,9.8 C3,9.8 4.2,11 4.2,12.5 C4.2,14 3,15.2 1.5,15.2 L0,15.2 L0,19 C0,20.1 0.9,21 2,21 L5.8,21 L5.8,19.5 C5.8,18 7,16.8 8.5,16.8 C10,16.8 11.2,18 11.2,19.5 L11.2,21 L15,21 C16.1,21 17,20.1 17,19 L17,15 L18.5,15 C19.9,15 21,13.9 21,12.5 C21,11.1 19.9,10 18.5,10 L18.5,10 Z" id="Shape"/></g></g></g></svg>

After

Width:  |  Height:  |  Size: 905 B

View File

@ -1,19 +1,20 @@
<?php define('__ROOT__', dirname(dirname(dirname(__FILE__))) );
require_once __ROOT__.'/vendor/autoload.php';
use \api\core\Request;
use \orm\core\Table;
use \database\core\Repo;
use \viewer\core\Viewer;
?>
<!-- [1] Gestion du sous-menu de gauche -->
<nav class='sub-menu-side'>
<span data-sublink='analytics'>
<span class='svg'><?php echo file_get_contents( __PUBLIC__.'/src/static/sub-menu-side/analytics.svg' ); ?></span>
<span data-sublink='view'>
<span class='svg'><?php echo file_get_contents( __PUBLIC__.'/src/static/sub-menu-side/permission.svg' ); ?></span>
<span>Général</span>
</span>
<span data-sublink='view' >
<span data-sublink='manage' >
<span class='svg'><?php echo file_get_contents( __PUBLIC__.'/src/static/sub-menu-side/view.svg' ); ?></span>
<span>Consulter le suivi</span>
</span>
@ -42,14 +43,87 @@
$sublink = $post[0];
/* [1] Affichage des groupes de machines
=========================================================*/
debug();
echo "<section data-sublink='view' class='list'>";
$extensionView = new Viewer('extension.view', []);
$extensionView->view();
echo '</section>';
/* PAGE DES STATISTIQUES
*
*/
// if( $sublink == 'analytics' ){
echo "<section data-sublink='analytics'>";
echo 'Statistiques';
var_dump( Table::get('user')->select('*')->fetch() );
echo "<section data-sublink='manage'>";
/* (1) Modules de l'entrepot
---------------------------------------------------------*/
echo "<pre><u>Modules entrepot:</u>\n";
/* (1) Requete de récupération */
$req_mods = new Repo('warehouse/getModules', [$_SESSION['WAREHOUSE']['id']]);
/* (2) Gestion erreur */
if( $req_mods->answer() === false )
die('fetch error: '.$req_mods->error->get());
/* (3) Affichage de la liste */
foreach($req_mods->answer() as $module)
echo " * ".$module['name']."\n";
echo "\n\n\n";
/* (2) Modules par groupes de machines
---------------------------------------------------------*/
echo "<u>Modules par groupes de machines:</u> \n";
/* (1) Requête de récupération des groupes */
$req_mc = new Repo('machine_cluster/getAll', [$_SESSION['WAREHOUSE']['id']]);
/* (2) Gestion erreur */
if( !$req_mc->answer() )
die('fetch error: '.$req_mc->error->get());
/* (3) Parcours des groupes */
foreach($req_mc->answer() as $mc){
echo " ".$mc['name']."\n";
/* (4) Requête récupération des modules */
$req_mc_mods = new Request('clusterDefault/getModules', [
'id_cluster' => $mc['id_machine_cluster']
]);
$res = $req_mc_mods->dispatch();
/* (5) Gestion erreur */
if( $res->error->get() !== 0 )
die('fetch error: '.$res->error->get());
/* (6) Pour chaque module : affichage */
foreach($res->get('modules') as $mod){
$id = $mod['id_module'];
$name = $mod['name'];
echo " * $name ($id)\n";
}
}
echo "</pre>";
echo '</section>';
// }