Compare commits
No commits in common. "master" and "session-guard" have entirely different histories.
master
...
session-gu
|
@ -10,5 +10,3 @@
|
|||
.vscode
|
||||
TODO
|
||||
*.log
|
||||
/tmp
|
||||
/public_html/tmp
|
||||
|
|
|
@ -8,6 +8,32 @@
|
|||
if( !defined('__PUBLIC__') ) define('__PUBLIC__', __ROOT__.'/public_html' );
|
||||
|
||||
|
||||
|
||||
/* [1] On définit __SERVER_HOST__ et __SERVER_ROOT__ si c'est pas déja fait
|
||||
=========================================================*/
|
||||
if( !defined('__SERVER_HOST__') || !defined('__SERVER_ROOT__') ){
|
||||
/* (1) On charge le fichier de configuration */
|
||||
$json = json_decode( file_get_contents(__ROOT__.'/config/server.json'), true );
|
||||
|
||||
// Si pas d'erreur, on définit
|
||||
if( !is_null($json) ){
|
||||
|
||||
/* (2) Gestion de la config si server local ou remote */
|
||||
if( !isset($_SERVER['SERVER_NAME']) || !checkdnsrr($_SERVER['SERVER_NAME'], 'NS') )
|
||||
$config = $json['local'];
|
||||
else
|
||||
$config = $json['remote'];
|
||||
|
||||
/* (3) Création des constantes */
|
||||
define('__SERVER_HOST__', $config['host']);
|
||||
define('__SERVER_ROOT__', $config['root']);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* ACTIVE LE DEBUGGAGE (WARNING + EXCEPTION)
|
||||
*
|
||||
*/
|
||||
|
@ -22,23 +48,69 @@
|
|||
/* SECURE SHA1 ALGORITHM */
|
||||
/*************************/
|
||||
function secure_hash($data, $salt='">\[..|{@#))', $depth=1){
|
||||
/* (1) On hash @depth fois
|
||||
---------------------------------------------------------*/
|
||||
$hash = $data;
|
||||
$c = 0;
|
||||
/* (1) On hash @depth fois
|
||||
---------------------------------------------------------*/
|
||||
$hash = $data;
|
||||
$c = 0;
|
||||
|
||||
for( $h = 0 ; $h < $depth ; $h++ ){
|
||||
$hash = hash('sha512', $salt.hash('sha512', $hash.'_)Q@#((%*_$%(@#') );
|
||||
$c++;
|
||||
for( $h = 0 ; $h < $depth ; $h++ ){
|
||||
$hash = hash('sha512', $salt.hash('sha512', $hash.'_)Q@#((%*_$%(@#') );
|
||||
$c++;
|
||||
}
|
||||
|
||||
|
||||
/* (2) On renvoie le résultat
|
||||
---------------------------------------------------------*/
|
||||
return $hash;
|
||||
}
|
||||
|
||||
|
||||
/* (2) On renvoie le résultat
|
||||
---------------------------------------------------------*/
|
||||
return $hash;
|
||||
|
||||
|
||||
|
||||
/* AUTOLOADER
|
||||
*
|
||||
* @className<String> Nom de la classe appelee
|
||||
*
|
||||
*/
|
||||
function autoloader($className){
|
||||
/* [1] Basic processing
|
||||
=========================================================*/
|
||||
/* (1) Explode classname by namespaces */
|
||||
$path = explode('\\', $className);
|
||||
|
||||
/* (2) Check if at least a filename */
|
||||
if( count($path) < 1 )
|
||||
throw new \Exception('Missing classname for autoloader.');
|
||||
|
||||
/* (3) Detect if build class or lib class */
|
||||
$type = $path[0] === 'lib' ? 'lib' : 'build';
|
||||
|
||||
|
||||
/* [2] Manage type and check file
|
||||
=========================================================*/
|
||||
/* (1) Build path according to type */
|
||||
if( $type === 'lib' )
|
||||
$file = __ROOT__.'/'.implode('/', $path).'.php';
|
||||
else
|
||||
$file = __BUILD__.'/'.implode('/', $path).'.php';
|
||||
|
||||
|
||||
/* (2) Check file */
|
||||
if( file_exists($file) )
|
||||
require_once $file;
|
||||
|
||||
}
|
||||
|
||||
// // On definit l'autoloader comme autoloader (obvious)
|
||||
// spl_autoload_register('autoloader', false, true);
|
||||
|
||||
\session_start();
|
||||
|
||||
|
||||
|
||||
/* On demarre la session securisee PHP
|
||||
=========================================================*/
|
||||
session_start();
|
||||
// \manager\sessionManager::session_start();
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,96 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace api\core;
|
||||
|
||||
use \error\core\Error;
|
||||
use \error\core\Err;
|
||||
use \http\core\HttpRequest;
|
||||
use \api\core\Request;
|
||||
|
||||
|
||||
class Loader{
|
||||
|
||||
|
||||
/* (1) Build an API Request from the HTTP Request
|
||||
*
|
||||
* @uri<String> URI
|
||||
*
|
||||
* @return outName<outType> outDesc
|
||||
*
|
||||
---------------------------------------------------------*/
|
||||
public static function remote($uri){
|
||||
|
||||
/* (1) Fetch HttpRequest correct data
|
||||
---------------------------------------------------------*/
|
||||
/* (1) Parse HttpRequest data because php doesn't parse it for non-POST HTTP method */
|
||||
$httprequest = new HttpRequest();
|
||||
|
||||
/* (2) For later use -> replace default @_POST global */
|
||||
$_POST = $httprequest->POST();
|
||||
|
||||
/* (3) Get @data from @_POST values */
|
||||
$data = $_POST;
|
||||
|
||||
|
||||
/* (2) Check if @path var is set
|
||||
---------------------------------------------------------*/
|
||||
/* (1) If is in @uri */
|
||||
$pathInUrl = is_string($uri) && preg_match('#^/?([\w_-]+/[\w_-]+)(?:/?|/((?:\w+/)*(?:\w+/?)))$#', $uri, $uriMatches);
|
||||
|
||||
/* (2) Get @path from @uri + @uri arguments if there is */
|
||||
if( $pathInUrl ){
|
||||
|
||||
// {1} Add @path as data //
|
||||
$data['path'] = $uriMatches[1];
|
||||
|
||||
// {2} Add $uri arguments as data 'URL_@i' (@i is the order beginnint at 0) //
|
||||
if( count($uriMatches) > 2 ){
|
||||
|
||||
$uriParams = explode('/', trim($uriMatches[2], '/'));
|
||||
|
||||
foreach($uriParams as $k=>$v)
|
||||
$data["URL_$k"] = $v;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* (3) If @path haven't been found -> error */
|
||||
if( !isset($data['path']) )
|
||||
return new Request();
|
||||
|
||||
|
||||
|
||||
/* (3) Parse arguments from JSON
|
||||
---------------------------------------------------------*/
|
||||
/* (1) Init. arguments */
|
||||
$params = [];
|
||||
|
||||
/* (2) Parse each arg (except @path) */
|
||||
foreach($data as $name=>$value){
|
||||
|
||||
if( $name === 'path' )
|
||||
continue;
|
||||
|
||||
// {1} Json parse //
|
||||
$json = json_decode( $value, true );
|
||||
|
||||
// {2} if valid -> set the parsed value //
|
||||
if( !is_null($json) )
|
||||
$params[$name] = $json;
|
||||
|
||||
// {3} else -> leave it like it was //
|
||||
else
|
||||
$params[$name] = $value;
|
||||
}
|
||||
|
||||
|
||||
/* (4) Build an API Request object
|
||||
---------------------------------------------------------*/
|
||||
return new Request($data['path'], $params);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -6,6 +6,7 @@
|
|||
use \api\core\ModuleFactory;
|
||||
use \error\core\Error;
|
||||
use \error\core\Err;
|
||||
use \http\core\HttpRequest;
|
||||
|
||||
|
||||
class Request{
|
||||
|
@ -334,6 +335,88 @@
|
|||
}
|
||||
|
||||
|
||||
/* DESERIALISATION A PARTIR DE L'URL ET DES DONNEES POST (OPT)
|
||||
*
|
||||
* @url<String> Contenu de l'url formatté (commence à "/module/methode")
|
||||
*
|
||||
* @return instance<Request> Retourne un objet de type <Request>
|
||||
*
|
||||
* @note
|
||||
* 1. `path` peut être dans l'url : /method/module
|
||||
* `path` peut être dans les données $_POST
|
||||
* 2. les données peuvent être dans l'url : /module/method/data1/data2/...
|
||||
* les données peuvent être dans les données $_POST
|
||||
*
|
||||
*/
|
||||
public static function remote($url){
|
||||
|
||||
/* [1] Fetch HttpRequest correct data
|
||||
=========================================================*/
|
||||
/* (1) Parse HttpRequest data because php doesn't parse it for non-POST HTTP method */
|
||||
$httprequest = new HttpRequest();
|
||||
$_POST = $httprequest->POST();
|
||||
|
||||
$data = $_POST;
|
||||
|
||||
/* [2] On verifie que le @path est renseigne
|
||||
=========================================================*/
|
||||
/* (1) Si le path est dans @url */
|
||||
$pathInUrl = is_string($url) && preg_match('#^/?([\w_-]+/[\w_-]+)(?:/?|/((?:\w+/)*(?:\w+/?)))$#', $url, $urlMatches);
|
||||
|
||||
/* (2) On récupère le @path + les arguments dans l'URL */
|
||||
if( $pathInUrl ){
|
||||
// {1} On ajoute le @path aux données //
|
||||
$data['path'] = $urlMatches[1];
|
||||
|
||||
// {2} On ajoute les arguments d'URL aux données //
|
||||
if( count($urlMatches) > 2 ){
|
||||
|
||||
$urlParams = explode('/', trim($urlMatches[2], '/'));
|
||||
foreach($urlParams as $k=>$v)
|
||||
$data["URL_$k"] = $v;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* (2) On vérifie dans tous les cas si le path existe */
|
||||
if( !isset($data['path']) )
|
||||
return new Request();
|
||||
|
||||
|
||||
|
||||
/* [3] On met les paramètres en JSON
|
||||
=========================================================*/
|
||||
/* (1) On initialise les paramètres*/
|
||||
$params = [];
|
||||
|
||||
/* (2) On met tous les paramètres en json (sauf @path) */
|
||||
foreach($data as $name=>$value){
|
||||
if( $name === 'path' )
|
||||
continue;
|
||||
|
||||
// {1} On met en JSON //
|
||||
$json = json_decode( $value, true );
|
||||
|
||||
// {2} Si ok -> on remplace //
|
||||
if( !is_null($json) )
|
||||
$params[$name] = $json;
|
||||
|
||||
// {3} Sinon, on laisse tel quel //
|
||||
else
|
||||
$params[$name] = $value;
|
||||
}
|
||||
|
||||
/* [4] On retourne une instance de <Request>
|
||||
=========================================================*/
|
||||
return new Request($data['path'], $params);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* VERIFICATION DU FORMAT ET DE LA COHERENCE DU CHEMIN SPECIFIE
|
||||
*
|
||||
* @path<String> String correspondant au chemin de delegation ("module/methode")
|
||||
|
@ -349,7 +432,7 @@
|
|||
|
||||
// On recupere les données de la regex
|
||||
$module = $matches[1];
|
||||
$method = $matches[2];
|
||||
$method = $this->http_method.'::'.$matches[2];
|
||||
|
||||
|
||||
/* [2] Verification de l'existence du module (conf)
|
||||
|
|
|
@ -1,211 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace api\module;
|
||||
use \database\core\Repo;
|
||||
use \error\core\Error;
|
||||
use \error\core\Err;
|
||||
|
||||
class adminDefault{
|
||||
|
||||
public function __construct(){
|
||||
// Routine to execute before each call to authenticationDefault's method
|
||||
}
|
||||
|
||||
public function __destruct(){
|
||||
// Routine to execute after each call to authenticationDefault's method
|
||||
}
|
||||
|
||||
|
||||
/* RETOURNE LA LISTE DSE ADMINISTRATEURS DE L'ENTREPOT
|
||||
*
|
||||
* @return admins<array> Liste des administrateurs de l'entrepôt
|
||||
*
|
||||
*/
|
||||
public function getAll($params){
|
||||
/* (1) Fetch admin list
|
||||
---------------------------------------------------------*/
|
||||
/* (1) Prepare request */
|
||||
$listRq = new Repo('admin/getByIdWarehouse', [ $_SESSION['WAREHOUSE']['id'] ]);
|
||||
|
||||
/* (2) Get response */
|
||||
$listRs = $listRq->answer();
|
||||
|
||||
/* (3) Manage error */
|
||||
if( !is_array($listRs) )
|
||||
return ['error' => new Error(Err::RepoError)];
|
||||
|
||||
|
||||
/* (2) Setup data (remove self)
|
||||
---------------------------------------------------------*/
|
||||
return ['admins' => $listRs];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* MODIFICATION MOT DE PASSE ADMINISTRATEUR
|
||||
*
|
||||
* @old<String> Ancien mot de passe (actuel)
|
||||
* @new<String> Nouveau mot de passe
|
||||
* @confirm<String> Confirmation mot de passe
|
||||
*
|
||||
* @return status<Boolean> TRUE si les crédits sont bons, sinon FALSE
|
||||
*
|
||||
*/
|
||||
public function update($params){
|
||||
extract($params);
|
||||
|
||||
|
||||
|
||||
/* [1] On vérifie la confirmation de mot de passe
|
||||
=========================================================*/
|
||||
if( $new !== $confirm )
|
||||
return [ 'error' => new Error(Err::WrongParam, 'confirm') ];
|
||||
|
||||
|
||||
/* [2] On vérifie le mot de passe actuel
|
||||
=========================================================*/
|
||||
/* (1) On hash le mot de passe actuel */
|
||||
$hash_old = secure_hash($old, $_SESSION['ADMIN']['username']);
|
||||
|
||||
/* (2) On vérifie que le mot de passe est correct */
|
||||
$checkPassword = new Repo('admin/getById', [
|
||||
$_SESSION['WAREHOUSE']['id'],
|
||||
$_SESSION['ADMIN']['id']
|
||||
]);
|
||||
|
||||
$adminFetched = $checkPassword->answer();
|
||||
|
||||
// Si aucun résultat -> erreur
|
||||
if( $adminFetched === false )
|
||||
return [ 'error' => new Error(Err::NoMatchFound) ];
|
||||
|
||||
|
||||
/* [3] On vérifie le mot de passe actuel
|
||||
=========================================================*/
|
||||
// Si mot de passe faux, on retourne une erreur
|
||||
if( $adminFetched['password'] != $hash_old )
|
||||
return [ 'error' => new Error(Err::WrongParam, 'old') ];
|
||||
|
||||
|
||||
/* [3] On met à jour le mot de passe
|
||||
=========================================================*/
|
||||
/* (1) On hash le nouveau mot de passe */
|
||||
$hash_new = secure_hash($new, $adminFetched['username']);
|
||||
|
||||
/* (w) Requête */
|
||||
$update = new Repo('admin/edit', [
|
||||
$adminFetched['id_admin'],
|
||||
$adminFetched['username'],
|
||||
$adminFetched['mail'],
|
||||
$hash_new
|
||||
]);
|
||||
|
||||
/* (3) Gestion erreur */
|
||||
if( !$update->answer() )
|
||||
return [ 'error' => new Error(Err::RepoError) ];
|
||||
|
||||
/* (4) Succès si tout ok */
|
||||
return [ 'error' => new Error(Err::Success) ];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* CREATION D'UN NOUVEAL ADMINISTRATEUR
|
||||
*
|
||||
* @username<String> Identifiant du nouvel administrateur
|
||||
*
|
||||
* @return password<String> Mot de passe généré
|
||||
*
|
||||
*/
|
||||
public function create($params){
|
||||
extract($params);
|
||||
|
||||
|
||||
|
||||
/* [1] On génère un mot de passe
|
||||
=========================================================*/
|
||||
$password = secure_hash(uniqid(), uniqid());
|
||||
|
||||
|
||||
/* [2] On vérifie l'unicité de l'identifiant
|
||||
=========================================================*/
|
||||
/* (1) On vérifie que l'identifiant n'existe pas */
|
||||
$checkPassword = new Repo('admin/getByUsername', [
|
||||
$_SESSION['WAREHOUSE']['id'],
|
||||
$username
|
||||
]);
|
||||
|
||||
$adminFetched = $checkPassword->answer();
|
||||
|
||||
// Si un résultat -> erreur
|
||||
if( $adminFetched !== false )
|
||||
return [ 'error' => new Error(Err::AlreadyExists, 'username') ];
|
||||
|
||||
|
||||
/* [3] On crée l'administrateur
|
||||
=========================================================*/
|
||||
/* (1) Requête */
|
||||
$create = new Repo('admin/create', [
|
||||
$_SESSION['WAREHOUSE']['id'],
|
||||
$username,
|
||||
$mail,
|
||||
$password
|
||||
]);
|
||||
|
||||
|
||||
|
||||
/* (3) Gestion erreur */
|
||||
if( !$create->answer() )
|
||||
return [ 'error' => new Error(Err::RepoError) ];
|
||||
|
||||
/* (4) Succès si tout ok */
|
||||
return [ 'password' => $password ];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* SUPPRESSION D'UN ADMINISTRATEUR DU MEME ENTREPOT
|
||||
*
|
||||
* @id_admin<int> UID de l'administrateur
|
||||
*
|
||||
*/
|
||||
public function delete($params){
|
||||
extract($params);
|
||||
|
||||
/* [1] On vérifie que ce n'est pas nous-même
|
||||
=========================================================*/
|
||||
if( $id_admin == $_SESSION['ADMIN']['id'] )
|
||||
return ['error' => new Error(Err::NoMatchFound) ];
|
||||
|
||||
|
||||
/* [2] On essaie de supprimer
|
||||
=========================================================*/
|
||||
/* (1) On vérifie que l'identifiant n'existe pas */
|
||||
$del_req = new Repo('admin/delete', [
|
||||
$_SESSION['WAREHOUSE']['id'],
|
||||
$id_admin
|
||||
]);
|
||||
|
||||
/* (2) Gestion erreur */
|
||||
if( !$del_req->answer() )
|
||||
return [ 'error' => new Error(Err::RepoError) ];
|
||||
|
||||
/* (4) Succès si tout ok */
|
||||
return [];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
|
@ -121,6 +121,93 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* MODIFICATION MOT DE PASSE ADMINISTRATEUR
|
||||
*
|
||||
* @old<String> Ancien mot de passe (actuel)
|
||||
* @new<String> Nouveau mot de passe
|
||||
* @confirm<String> Confirmation mot de passe
|
||||
*
|
||||
* @return status<Boolean> TRUE si les crédits sont bons, sinon FALSE
|
||||
*
|
||||
*/
|
||||
public function update_admin($params){
|
||||
extract($params);
|
||||
|
||||
|
||||
|
||||
/* [1] On vérifie la confirmation de mot de passe
|
||||
=========================================================*/
|
||||
if( $new !== $confirm )
|
||||
return [ 'error' => new Error(Err::WrongParam, 'confirm') ];
|
||||
|
||||
|
||||
/* [2] On vérifie le mot de passe actuel
|
||||
=========================================================*/
|
||||
/* (1) On hash le mot de passe actuel */
|
||||
$hash_old = secure_hash($old, $_SESSION['ADMIN']['username']);
|
||||
|
||||
/* (2) On vérifie que le mot de passe est correct */
|
||||
$checkPassword = new Repo('admin/getById', [
|
||||
$_SESSION['WAREHOUSE']['id'],
|
||||
$_SESSION['ADMIN']['id']
|
||||
]);
|
||||
|
||||
$adminFetched = $checkPassword->answer();
|
||||
|
||||
// Si aucun résultat -> erreur
|
||||
if( $adminFetched === false )
|
||||
return [ 'error' => new Error(Err::NoMatchFound) ];
|
||||
|
||||
|
||||
/* [3] On vérifie le mot de passe actuel
|
||||
=========================================================*/
|
||||
// Si mot de passe faux, on retourne une erreur
|
||||
if( $adminFetched['password'] != $hash_old )
|
||||
return [ 'error' => new Error(Err::WrongParam, 'old') ];
|
||||
|
||||
|
||||
/* [3] On met à jour le mot de passe
|
||||
=========================================================*/
|
||||
/* (1) On hash le nouveau mot de passe */
|
||||
$hash_new = secure_hash($new, $adminFetched['username']);
|
||||
|
||||
/* (w) Requête */
|
||||
$update = new Repo('admin/edit', [
|
||||
$adminFetched['id_admin'],
|
||||
$adminFetched['username'],
|
||||
$adminFetched['mail'],
|
||||
$hash_new
|
||||
]);
|
||||
|
||||
/* (3) Gestion erreur */
|
||||
if( !$update->answer() )
|
||||
return [ 'error' => new Error(Err::RepoError) ];
|
||||
|
||||
/* (4) Succès si tout ok */
|
||||
return [ 'error' => new Error(Err::Success) ];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* MODIFICATION CODE D'ACCES ENTREPOT
|
||||
*
|
||||
* @old<String> Ancien code d'accès (actuel)
|
||||
|
@ -186,6 +273,69 @@
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* CREATION D'UN NOUVEAL ADMINISTRATEUR
|
||||
*
|
||||
* @username<String> Identifiant du nouvel administrateur
|
||||
*
|
||||
* @return password<String> Mot de passe généré
|
||||
*
|
||||
*/
|
||||
public function create_admin($params){
|
||||
extract($params);
|
||||
|
||||
|
||||
|
||||
/* [1] On génère un mot de passe
|
||||
=========================================================*/
|
||||
$password = secure_hash(uniqid(), uniqid());
|
||||
|
||||
|
||||
/* [2] On vérifie l'unicité de l'identifiant
|
||||
=========================================================*/
|
||||
/* (1) On vérifie que l'identifiant n'existe pas */
|
||||
$checkPassword = new Repo('admin/getByUsername', [
|
||||
$_SESSION['WAREHOUSE']['id'],
|
||||
$username
|
||||
]);
|
||||
|
||||
$adminFetched = $checkPassword->answer();
|
||||
|
||||
// Si un résultat -> erreur
|
||||
if( $adminFetched !== false )
|
||||
return [ 'error' => new Error(Err::AlreadyExists, 'username') ];
|
||||
|
||||
|
||||
/* [3] On crée l'administrateur
|
||||
=========================================================*/
|
||||
/* (1) Requête */
|
||||
$create = new Repo('admin/create', [
|
||||
$_SESSION['WAREHOUSE']['id'],
|
||||
$username,
|
||||
$mail,
|
||||
$password
|
||||
]);
|
||||
|
||||
|
||||
|
||||
/* (3) Gestion erreur */
|
||||
if( !$create->answer() )
|
||||
return [ 'error' => new Error(Err::RepoError) ];
|
||||
|
||||
/* (4) Succès si tout ok */
|
||||
return [ 'password' => $password ];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
use \database\core\DatabaseDriver;
|
||||
use \manager\sessionManager;
|
||||
use \error\core\Error;
|
||||
use \error\core\Err;
|
||||
use \database\core\Repo;
|
||||
use \manager\repo\cluster as clusterRepo;
|
||||
|
||||
|
|
|
@ -150,88 +150,6 @@
|
|||
];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* (x) Return the machine history for an history entry
|
||||
*
|
||||
* @id_entry<id> UID of the history entry
|
||||
*
|
||||
* @return timeline<array> Machine timeline data
|
||||
*
|
||||
---------------------------------------------------------*/
|
||||
|
||||
public function get_timeline($params){
|
||||
extract($params);
|
||||
|
||||
/* (1) Get history entry data
|
||||
---------------------------------------------------------*/
|
||||
/* (1) Request */
|
||||
$entry = new Repo('history/getById', [$id_entry]);
|
||||
|
||||
/* (2) Get response */
|
||||
$entry = $entry->answer();
|
||||
|
||||
/* (3) Manage error */
|
||||
if( !is_array($entry) )
|
||||
return ['error' => new Error(Err::RepoError)];
|
||||
|
||||
|
||||
/* (2) Get history for machine
|
||||
---------------------------------------------------------*/
|
||||
/* (1) Request */
|
||||
$timeline = new Repo('history/getByIdMachine', [
|
||||
$_SESSION['WAREHOUSE']['id'],
|
||||
$entry['id_machine']
|
||||
]);
|
||||
|
||||
/* (2) Get response */
|
||||
$timeline = $timeline->answer();
|
||||
|
||||
/* (3) Manage error */
|
||||
if( $timeline === false )
|
||||
return ['error' => new Error(Err::RepoError)];
|
||||
|
||||
|
||||
/* (3) Return data
|
||||
---------------------------------------------------------*/
|
||||
return [ 'timeline' => $timeline ];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* (x) Return the entry data for an history id
|
||||
*
|
||||
* @id_entry<id> UID of the history entry
|
||||
*
|
||||
* @return data<array> Entry data
|
||||
*
|
||||
---------------------------------------------------------*/
|
||||
|
||||
public function getById($params){
|
||||
extract($params);
|
||||
|
||||
/* (1) Get history entry data
|
||||
---------------------------------------------------------*/
|
||||
/* (1) Request */
|
||||
$entry = new Repo('history/getById', [$id_entry]);
|
||||
|
||||
/* (2) Get response */
|
||||
$entry = $entry->answer();
|
||||
|
||||
/* (3) Manage error */
|
||||
if( !is_array($entry) )
|
||||
return ['error' => new Error(Err::RepoError)];
|
||||
|
||||
|
||||
/* (2) Return data
|
||||
---------------------------------------------------------*/
|
||||
return [ 'entry' => $entry ];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -383,7 +383,7 @@
|
|||
/* [3] Get history for the machine
|
||||
=========================================================*/
|
||||
/* (1) Write request */
|
||||
$history_req = new Repo('history/getByIdMachine', [$_SESSION['WAREHOUSE']['id'], $id_machine]);
|
||||
$history_req = new Repo('history/getByIdMachine', [$id_machine]);
|
||||
|
||||
/* (2) Manage error */
|
||||
if( $history_req->error->get() != Err::Success )
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
use \error\core\Err;
|
||||
use \manager\ResourceDispatcher;
|
||||
|
||||
class documentationDefault{
|
||||
class module{
|
||||
|
||||
public function __construct(){}
|
||||
public function __destruct(){}
|
||||
|
@ -87,7 +87,7 @@
|
|||
/* [0] Récupération de la configuration
|
||||
=========================================================*/
|
||||
// On récupère le fichier et on le parse
|
||||
$modules = json_decode( file_get_contents(__CONFIG__.'/modules.json'), true );
|
||||
$modules = json_decode( file_get_contents(__ROOT__/'/config/modules.json'), true );
|
||||
|
||||
// Gestion de l'erreur de parsage
|
||||
if( $modules == null )
|
||||
|
@ -185,9 +185,8 @@
|
|||
/* (1) Description */
|
||||
$content .= "### $methName [POST /$module/$methName]\n\n";
|
||||
$content .= $method['description']."\n";
|
||||
if( count($method['permissions']) > 0 )
|
||||
foreach($method['permissions'] as $perm_set)
|
||||
$content .= '> Permissions `'.implode('``', $perm_set)."`\n\n";
|
||||
if( count($method['permissions']) > 0)
|
||||
$content .= '> Permissions `'.implode('``', $method['permissions'])."`\n\n";
|
||||
|
||||
// Liste des paramètres
|
||||
if( isset($method['parameters']) && count($method['parameters']) > 0 ){
|
||||
|
@ -195,7 +194,7 @@
|
|||
$content .= "+ Parameters\n\n";
|
||||
foreach($method['parameters'] as $argName=>$argument){
|
||||
$optional = isset($argument['optional']) && $argument['optional'] === true;
|
||||
$content .= " + $argName (".$argument['type'].", ".( $optional ? 'optional' : 'required' ).") - ".(isset($argument['description']) ? $argument['description'] : 'none')."\n";
|
||||
$content .= " + $argName (${argument['type']}, ".( $optional ? 'optional' : 'required' ).") - ${argument['description']}\n";
|
||||
}
|
||||
$content .= "\n";
|
||||
}
|
||||
|
@ -253,7 +252,7 @@
|
|||
// On explicite tous les paramètres
|
||||
$content .= " + Attributes (object)\n\n";
|
||||
foreach($method['output'] as $outName=>$outData)
|
||||
$content .= " + $outName (".$outData['type'].") - ".(isset($outData['description']) ? $outData['description'] : 'none')."\n";
|
||||
$content .= " + $outName (${outData['type']}) - ${outData['description']}\n";
|
||||
}
|
||||
|
||||
$content .= "\n\n";
|
|
@ -131,17 +131,15 @@
|
|||
|
||||
/* SUPPRIME UN ENTREPOT DONNE
|
||||
*
|
||||
* @id_warehouse<int> UID de l'entrepôt en question
|
||||
* @id_admin<int> UID de l'administrateur en question
|
||||
* @id_admin<int> UID de l'administrateur en question
|
||||
*
|
||||
* @return status<Boolean> Retourne si oui ou non l'administrateur a bien ete supprime
|
||||
*
|
||||
*/
|
||||
public static function delete($id_warehouse, $id_admin){
|
||||
public static function delete($id_admin){
|
||||
/* [1] On redige/execute la requete
|
||||
=========================================================*/
|
||||
$deleted = Table::get('admin')
|
||||
->whereIdWarehouse($id_warehouse)
|
||||
->whereId($id_admin)
|
||||
->delete();
|
||||
|
||||
|
|
|
@ -88,37 +88,15 @@
|
|||
* FALSE si aucun résultat
|
||||
*
|
||||
*/
|
||||
public static function getByIdMachine($id_warehouse, $id_machine){
|
||||
|
||||
public static function getByIdMachine($id_machine){
|
||||
/* [1] On rédige/execute la requête
|
||||
=========================================================*/
|
||||
$users = Table::get('user')
|
||||
->whereIdWarehouse($id_warehouse)
|
||||
->select('id_user')
|
||||
->select('username', null, null, 'user_name')
|
||||
->select('firstname', null, null, 'user_firstname')
|
||||
->select('lastname', null, null, 'user_lastname');
|
||||
$machine = Table::get('history')
|
||||
->whereIdMachine($id_machine)
|
||||
->orderby('timestamp', Rows::ORDER_DESC)
|
||||
->select('*');
|
||||
|
||||
$machines = Table::get('machine')
|
||||
->whereIdWarehouse($id_warehouse)
|
||||
->whereId($id_machine)
|
||||
->select('id_machine')
|
||||
->select('name', null, null, 'machine_name');
|
||||
|
||||
$actions = Table::get('action')
|
||||
->select('id_action')
|
||||
->select('name', null, null, 'action_name');
|
||||
|
||||
|
||||
$history = Table::get('history')
|
||||
->join('id_user', $users)
|
||||
->join('id_machine', $machines)
|
||||
->join('id_action', $actions)
|
||||
->select('id_history')
|
||||
->select('timestamp')
|
||||
->orderby('timestamp', Rows::ORDER_DESC);
|
||||
|
||||
return $history->fetch();
|
||||
return $machine->fetch();
|
||||
}
|
||||
|
||||
|
||||
|
@ -156,23 +134,21 @@
|
|||
|
||||
/* RETOURNE UNE ENTREE SPECIFIQUE
|
||||
*
|
||||
* @id_entry<int> UID de l'entrée historique
|
||||
* @id_history<int> UID de l'entree
|
||||
*
|
||||
* @return entry<Array> Données de l'entree
|
||||
* FALSE si erreur | aucun résultat
|
||||
* FALSE si aucun résultat
|
||||
*
|
||||
*/
|
||||
public static function getById($id_entry){
|
||||
public static function getById($id_history){
|
||||
/* [1] On rédige/execute la requête
|
||||
=========================================================*/
|
||||
$entry = Table::get('history')
|
||||
->whereId($id_entry)
|
||||
$user = Table::get('user')
|
||||
->whereId($id_history)
|
||||
->orderby('timestamp', Rows::ORDER_DESC)
|
||||
->select('*')
|
||||
->unique();
|
||||
|
||||
return $entry->fetch();
|
||||
->select('*');
|
||||
|
||||
return $user->fetch();
|
||||
}
|
||||
|
||||
|
||||
|
@ -235,60 +211,34 @@
|
|||
/* [1] Recherche dans les relations 'machines'
|
||||
=========================================================*/
|
||||
/* (1) On exécute la requête */
|
||||
$machines_rq = new Repo('machine/search', [$id_warehouse, $keyword]);
|
||||
|
||||
$machines_rs = $machines_rq->answer();
|
||||
$machines_r = new Repo('machine/search', [$id_warehouse, $keyword]);
|
||||
|
||||
/* (2) Gestion succès */
|
||||
if( is_array($machines_rs) )
|
||||
foreach($machines_rs as $row)
|
||||
if( $machines_r->error->get() == Err::Success )
|
||||
foreach($machines_r->answer() as $row)
|
||||
$machine_ids[] = $row['id_machine'];
|
||||
|
||||
/* [2] Recherche dans les relations 'users'
|
||||
=========================================================*/
|
||||
/* (1) On cherche dans les utilisateurs */
|
||||
$users_rq = new Repo('user/search', [$id_warehouse, $keyword]);
|
||||
|
||||
$users_rs = $users_rq->answer();
|
||||
$users_r = new Repo('user/search', [$id_warehouse, $keyword]);
|
||||
|
||||
/* (2) Gestion succès */
|
||||
if( is_array($users_rs) )
|
||||
foreach($users_rs as $row)
|
||||
if( $users_r->error->get() == Err::Success )
|
||||
foreach($users_r->answer() as $row)
|
||||
$user_ids[] = $row['id_user'];
|
||||
|
||||
|
||||
/* [3] On rédige/execute la requête
|
||||
=========================================================*/
|
||||
/* (1) Recherche par utilisateur */
|
||||
$history_r_user = Table::get('history')
|
||||
->select('id_history')
|
||||
->whereIdUser([ $user_ids, Rows::COND_IN ]);
|
||||
$history_r = DatabaseDriver::getPDO()->prepare("SELECT id_history FROM history
|
||||
WHERE id_user IN (SELECT id_user FROM user WHERE username LIKE '%$keyword%')
|
||||
or id_machine IN (SELECT id_machine FROM machine WHERE name LIKE '%$keyword%')
|
||||
ORDER BY timestamp DESC;");
|
||||
|
||||
/* (2) Recherche par utilisateur */
|
||||
$history_r_machine = Table::get('history')
|
||||
->select('id_history')
|
||||
->whereIdMachine([ $machine_ids, Rows::COND_IN ]);
|
||||
$history_r->execute();
|
||||
|
||||
/* (3) On enregistre les entrées par utilisateur */
|
||||
$already_id = [];
|
||||
$ids = $history_r_user->fetch();
|
||||
|
||||
foreach($ids as $user_result)
|
||||
$already_id[ $user_result['id_history'] ] = null;
|
||||
|
||||
/* (4) On ajoute les entrées par machines (si pas déja) */
|
||||
foreach($history_r_machine->fetch() as $machine_result)
|
||||
|
||||
if( !isset($already_id[$machine_result['id_history']]) ){
|
||||
|
||||
$ids[] = $machine_result;
|
||||
$already_id[ $machine_result['id_history'] ] = null;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* (5) On retourne le total */
|
||||
return $ids;
|
||||
return DatabaseDriver::delNumeric( $history_r->fetchAll() );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -65,75 +65,15 @@
|
|||
*
|
||||
*/
|
||||
public static function search($id_warehouse, $keyword){
|
||||
|
||||
/* (1) Format keyword
|
||||
---------------------------------------------------------*/ {
|
||||
|
||||
/* (1) Make all lowercase */
|
||||
$keyword = strtolower($keyword);
|
||||
|
||||
/* (2) Create a keyword set (separator: space) */
|
||||
$keywords = [];
|
||||
$keywords_tmp = explode(' ', $keyword);
|
||||
|
||||
/* (4) Trim each keyword + ignore empty ones (2 consecutive spaces) */
|
||||
foreach($keywords_tmp as $kw){
|
||||
|
||||
// ignore empty keywords
|
||||
if( strlen(trim($kw)) == 0 )
|
||||
continue;
|
||||
|
||||
// store others
|
||||
$keywords[] = trim($kw);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* (2) Search for each keyword
|
||||
---------------------------------------------------------*/ {
|
||||
|
||||
/* (1) Initialise id list that will contain each matching user ids */
|
||||
$mac_id_list = [];
|
||||
|
||||
/* (2) Request for each keyword */
|
||||
foreach($keywords as $kw){
|
||||
|
||||
// {2.1} Request //
|
||||
$searchmac = Table::get('machine')
|
||||
->select('id_machine')
|
||||
->whereIdWarehouse($id_warehouse)
|
||||
->whereName(["%$kw%", Rows::COND_LIKE] );
|
||||
|
||||
// {2.2} Fetch result //
|
||||
$matches = $searchmac->fetch();
|
||||
|
||||
// {2.3} Only add non-already added ids //
|
||||
foreach($matches as $match){
|
||||
|
||||
// {2.4.1} If not already -> add it //
|
||||
if( !isset($mac_id_list[ $match['id_machine'] ]) )
|
||||
$mac_id_list[ $match['id_machine'] ] = null;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* (3) Join results
|
||||
---------------------------------------------------------*/
|
||||
/* (1) Join request */
|
||||
$join_rq = Table::get('machine')
|
||||
// On recupere les donnees
|
||||
$search = Table::get('machine')
|
||||
->whereIdWarehouse($id_warehouse)
|
||||
->whereName(["%$keyword%", Rows::COND_LIKE])
|
||||
->select('id_machine')
|
||||
->select('name')
|
||||
->whereId([array_keys($mac_id_list), Rows::COND_IN]);
|
||||
|
||||
/* (2) Return result */
|
||||
return $join_rq->fetch();
|
||||
->orderby('name', Rows::ORDER_ASC);
|
||||
|
||||
return $search->fetch();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -66,82 +66,22 @@
|
|||
*
|
||||
*/
|
||||
public static function search($id_warehouse, $keyword){
|
||||
// On recupere les donnees
|
||||
$searchusers = DatabaseDriver::getPDO()->prepare("SELECT * FROM user
|
||||
WHERE id_warehouse = :id_warehouse
|
||||
AND ( code LIKE '%".$keyword."%'
|
||||
OR username LIKE '%".$keyword."%'
|
||||
OR firstname LIKE '%".$keyword."%'
|
||||
OR lastname LIKE '%".$keyword."%'
|
||||
OR mail LIKE '%".$keyword."%'
|
||||
)
|
||||
");
|
||||
|
||||
/* (1) Format keyword
|
||||
---------------------------------------------------------*/ {
|
||||
$searchusers->execute([
|
||||
':id_warehouse' => $id_warehouse
|
||||
]);
|
||||
|
||||
/* (1) Make all lowercase */
|
||||
$keyword = strtolower($keyword);
|
||||
|
||||
/* (2) Create a keyword set (separator: space) */
|
||||
$keywords = [];
|
||||
$keywords_tmp = explode(' ', $keyword);
|
||||
|
||||
/* (4) Trim each keyword + ignore empty ones (2 consecutive spaces) */
|
||||
foreach($keywords_tmp as $kw){
|
||||
|
||||
// ignore empty keywords
|
||||
if( strlen(trim($kw)) == 0 )
|
||||
continue;
|
||||
|
||||
// store others
|
||||
$keywords[] = trim($kw);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* (2) Search for each keyword
|
||||
---------------------------------------------------------*/ {
|
||||
|
||||
/* (1) Initialise id list that will contain each matching user ids */
|
||||
$user_id_list = [];
|
||||
|
||||
/* (2) Request for each keyword */
|
||||
foreach($keywords as $kw){
|
||||
|
||||
// {2.1} Request //
|
||||
$searchusers = DatabaseDriver::getPDO()->prepare("SELECT id_user FROM user
|
||||
WHERE id_warehouse = :id_warehouse
|
||||
AND ( LOWER(code) LIKE '%".$kw."%'
|
||||
OR LOWER(username) LIKE '%".$kw."%'
|
||||
OR LOWER(firstname) LIKE '%".$kw."%'
|
||||
OR LOWER(lastname) LIKE '%".$kw."%'
|
||||
OR LOWER(mail) LIKE '%".$kw."%'
|
||||
)
|
||||
");
|
||||
|
||||
// {2.2} Inject params //
|
||||
$searchusers->execute([ ':id_warehouse' => $id_warehouse ]);
|
||||
|
||||
// {2.3} Fetch result //
|
||||
$matches = DatabaseDriver::delNumeric( $searchusers->fetchAll() );
|
||||
|
||||
// {2.4} Only add non-already added ids //
|
||||
foreach($matches as $match){
|
||||
|
||||
// {2.4.1} If not already -> add it //
|
||||
if( !isset($user_id_list[ $match['id_user'] ]) )
|
||||
$user_id_list[ $match['id_user'] ] = null;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* (3) Join results
|
||||
---------------------------------------------------------*/
|
||||
/* (1) Join request */
|
||||
$join_rq = Table::get('user')
|
||||
->select('*')
|
||||
->whereId([array_keys($user_id_list), Rows::COND_IN]);
|
||||
|
||||
/* (2) Return result */
|
||||
return $join_rq->fetch();
|
||||
return DatabaseDriver::delNumeric( $searchusers->fetchAll() );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,117 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace generic\core;
|
||||
|
||||
|
||||
class View{
|
||||
|
||||
/* (1) Attributes
|
||||
---------------------------------------------------------*/
|
||||
private $core_class;
|
||||
private $patch_class = [];
|
||||
private $arguments;
|
||||
|
||||
public static $html_error = "<span class='error'>Une erreur est survenue, veuilez contacter le webmaster si cette erreur persiste.</span>";
|
||||
|
||||
|
||||
/* (2) Instance constructor (add patches)
|
||||
*
|
||||
* @core_class<String> The target view class
|
||||
*
|
||||
---------------------------------------------------------*/
|
||||
private function __construct(String $core_class){
|
||||
|
||||
/* (1) Get class directory & namespace */
|
||||
$root_ns = str_replace('/', '\\', dirname( str_replace('\\', '/', $core_class) ) ).'\\';
|
||||
$root_dir = __BUILD__.'/generic/'.dirname( str_replace('\\', '/', $core_class) );
|
||||
|
||||
/* (2) Get patches */
|
||||
foreach( glob($root_dir.'/*.php') as $class ){
|
||||
|
||||
// {1} Extract basename (without '.php') //
|
||||
$basename = basename($class);
|
||||
$basename = substr($basename, 0, strlen($basename)-strlen('.php'));
|
||||
$class_ns = $root_ns.$basename;
|
||||
|
||||
// {2} Ignore main (core class) //
|
||||
if( $basename == 'main' )
|
||||
continue;
|
||||
|
||||
// {3} Check if class exists //
|
||||
if( !class_exists($class_ns) )
|
||||
continue;
|
||||
|
||||
// {4} Check if instance of 'i_patch' //
|
||||
if( !(new $class_ns() instanceof i_patch) )
|
||||
continue;
|
||||
|
||||
// {5} Check if it corresponds to a warehouse's module //
|
||||
if( !in_array($basename, $_SESSION['WAREHOUSE']['modules']) )
|
||||
continue;
|
||||
|
||||
// {6} Store each patch instance //
|
||||
$this->patch_class[$basename] = new $class_ns();
|
||||
|
||||
}
|
||||
|
||||
/* (3) Store core class */
|
||||
$this->core_class = $core_class;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* (3) Renders a view with injected data
|
||||
*
|
||||
* @injected_data<Array> Data to inject
|
||||
*
|
||||
* @return render<String> Rendered view
|
||||
*
|
||||
---------------------------------------------------------*/
|
||||
public function render(array $injected_data=[]){
|
||||
/* (1) Create core instance with data */
|
||||
$view = new $this->core_class(...$injected_data);
|
||||
|
||||
/* (2) Patch it every @patch_class */
|
||||
foreach($this->patch_class as $patch_name=>$patch_inst)
|
||||
$view->patch($patch_name, $patch_inst);
|
||||
|
||||
/* (3) Dispatch rendering */
|
||||
return $view->render();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* (4) Loads a view from its path (builder)
|
||||
*
|
||||
* @view_path<String> View path
|
||||
*
|
||||
* @return view<View> View instance
|
||||
* NULL on error
|
||||
*
|
||||
---------------------------------------------------------*/
|
||||
public static function load(String $view_path){
|
||||
|
||||
/* (1) Check arguments
|
||||
---------------------------------------------------------*/
|
||||
/* (1) Check path format */
|
||||
if( !preg_match('@^[\w+\.]+$@', $view_path) )
|
||||
return null;
|
||||
|
||||
/* (2) Extract class */
|
||||
$core_class = '\\view\\'.str_replace('.', '\\', $view_path).'\\main';
|
||||
|
||||
/* (3) Check if class exists */
|
||||
if( !class_exists($core_class) )
|
||||
return null;
|
||||
|
||||
|
||||
/* (2) Return View instance
|
||||
---------------------------------------------------------*/
|
||||
return new self($core_class);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace generic\core;
|
||||
|
||||
|
||||
abstract class i_patch{
|
||||
|
||||
/* (1) Attributes
|
||||
---------------------------------------------------------*/
|
||||
/* (1) Patch index */
|
||||
public $patch = [];
|
||||
|
||||
}
|
|
@ -1,90 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace generic\core;
|
||||
|
||||
|
||||
abstract class i_view{
|
||||
|
||||
/* (1) Attributes
|
||||
---------------------------------------------------------*/
|
||||
/* (1) Will contain patches according to warehouse's modules */
|
||||
public $patch = [];
|
||||
|
||||
|
||||
/* (2) Add a patch to the core view
|
||||
*
|
||||
* @patch_name<String> Patch name
|
||||
* @patch_inst<i_patch> Patch instance
|
||||
*
|
||||
---------------------------------------------------------*/
|
||||
public function patch(String $patch_name, i_patch $patch_inst){
|
||||
$this->patch[$patch_name] = $patch_inst;
|
||||
}
|
||||
|
||||
/* (3) Returns the auto patch code
|
||||
*
|
||||
*
|
||||
---------------------------------------------------------*/
|
||||
private function autopatch(){
|
||||
/* (1) Pre-code */
|
||||
$code = "{% extends 'main.twig' %}\n\n";
|
||||
|
||||
/* (2) For each module patch */
|
||||
foreach($this->patch as $name=>$inst)
|
||||
|
||||
/* (3) For each block patch */
|
||||
foreach($inst->patch as $block=>$temp)
|
||||
$code .= "{% block $block %}{% include '$temp' %}{% endblock %}\n";
|
||||
|
||||
|
||||
/* (4) Return code */
|
||||
return $code;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* (4) Renders the view
|
||||
*
|
||||
---------------------------------------------------------*/
|
||||
public function render(){
|
||||
|
||||
/* (1) Get path information (core class)
|
||||
---------------------------------------------------------*/
|
||||
/* (1) Get core class */
|
||||
$core_class = str_replace('\\', '/', get_class($this));
|
||||
|
||||
/* (2) Extract root DIR */
|
||||
$root_path = __BUILD__.'/generic/'.dirname($core_class);
|
||||
|
||||
/* (3) Extract file name */
|
||||
$model_path = basename($core_class).'.twig';
|
||||
|
||||
|
||||
/* (2) Get patches
|
||||
---------------------------------------------------------*/
|
||||
$auto_patch = [ 'render.twig' => $this->autopatch() ];
|
||||
|
||||
|
||||
/* (2) Setup
|
||||
---------------------------------------------------------*/
|
||||
/* (1) Initialize twig */
|
||||
$loader = new \Twig_Loader_Chain([
|
||||
new \Twig_Loader_Filesystem($root_path), // default directory templates
|
||||
new \Twig_Loader_Array($auto_patch) // custom auto-patch system
|
||||
]);
|
||||
|
||||
$twig = new \Twig_Environment($loader, [
|
||||
'debug' => true,
|
||||
'cache' => false,
|
||||
'auto_reload' => true
|
||||
]);
|
||||
|
||||
|
||||
/* (3) Build the view and return it back
|
||||
---------------------------------------------------------*/
|
||||
/* (1) Render and return the view */
|
||||
return $twig->render('render.twig', [ 'core' => $this, 'patch' => $this->patch ]);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace view\group\form\create;
|
||||
|
||||
use \generic\core\i_view;
|
||||
|
||||
|
||||
class main extends i_view{
|
||||
|
||||
public function __construct(){}
|
||||
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
{% block form_tag %} <form class='valid'> {% endblock %}
|
||||
|
||||
{% block input %}
|
||||
|
||||
<input id='create_name' type='text' placeholder='Nom'><br>
|
||||
<span class='error-msg create_name'></span><br>
|
||||
|
||||
<select id='create_class'>
|
||||
<option value='-' selected disabled>Type de groupe</option>
|
||||
<option value='0'>utilisateurs</option>
|
||||
<option value='1'>machines</option>
|
||||
</select>
|
||||
|
||||
<span class='error-msg create_class'></span><br>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block submit %}
|
||||
|
||||
<button id='create_submit'>Créer</button>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
</form>
|
|
@ -1,12 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace view\group\form\edit;
|
||||
|
||||
use \generic\core\i_view;
|
||||
|
||||
|
||||
class main extends i_view{
|
||||
|
||||
public function __construct(){}
|
||||
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
{% block form_tag %} <form class='neutral'> {% endblock %}
|
||||
|
||||
<!-- Recherche de groupe -->
|
||||
{% block search %}
|
||||
|
||||
{% block search_input %}
|
||||
|
||||
<input id='edit_search_keyword' type='text' class='search' placeholder='Recherche...'><br>
|
||||
<input id='edit_search_id' type='hidden' value=''>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
<!-- Indice du resultat -->
|
||||
{% block search_submit %}
|
||||
|
||||
<span class='edit_search_view'>groupe <span class='edit_search_num'>0</span> sur <span class='edit_search_sum'>0</span></span><br><br>
|
||||
<button id='edit_search_submit' class='search'>Trouver/Suivant</button><br>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
<br><br><hr class='OR' data-label='PUIS' /><br><br>
|
||||
|
||||
<!-- Modification de groupe -->
|
||||
{% block edit %}
|
||||
|
||||
{% block edit_input %}
|
||||
|
||||
<input id='edit_name' type='text' placeholder='Nom'><br>
|
||||
<span class='error-msg edit_name'></span><br>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block edit_submit %}
|
||||
|
||||
<input id='edit_class' type='text' placeholder='Type de groupe' disabled><br>
|
||||
<button id='edit_submit' disabled>Modifier</button>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
</form>
|
|
@ -1,12 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace view\group\form\remove;
|
||||
|
||||
use \generic\core\i_view;
|
||||
|
||||
|
||||
class main extends i_view{
|
||||
|
||||
public function __construct(){}
|
||||
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
{% block form_tag %} <form class='invalid'> {% endblock %}
|
||||
|
||||
<!-- Recherche de groupe -->
|
||||
{% block search %}
|
||||
|
||||
{% block search_input %}
|
||||
|
||||
<input id='remove_search_keyword' type='text' class='search' placeholder='Recherche...'><br>
|
||||
<input id='remove_search_id' type='hidden' value=''>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
<!-- Indice du resultat -->
|
||||
{% block search_submit %}
|
||||
|
||||
<span class='remove_search_view'>groupe <span class='remove_search_num'>0</span> sur <span class='remove_search_sum'>0</span></span><br><br>
|
||||
<button id='remove_search_submit' class='search'>Trouver/Suivant</button><br>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
<br><br><hr class='OR' data-label='PUIS' /><br><br>
|
||||
|
||||
<!-- Suppression de groupe -->
|
||||
{% block remove %}
|
||||
|
||||
{% block remove_input %}
|
||||
|
||||
<input id='remove_name' type='text' placeholder='Nom' disabled><br>
|
||||
<input id='remove_class' type='text' placeholder='Type de groupe' disabled><br>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block remove_submit %}
|
||||
|
||||
<button id='remove_submit' disabled>Supprimer</button>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
</form>
|
|
@ -1,127 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace view\group\member\choice;
|
||||
|
||||
use \generic\core\i_view;
|
||||
use \api\core\Request;
|
||||
use \error\core\Err;
|
||||
use \generic\core\View;
|
||||
|
||||
|
||||
class main extends i_view{
|
||||
|
||||
public $class;
|
||||
public $name;
|
||||
public $id_cluster;
|
||||
|
||||
public function __construct(String $id_cluster, int $class){
|
||||
|
||||
/* (1) On vérifie le type de groupe (user/machine)
|
||||
---------------------------------------------------------*/ {
|
||||
|
||||
/* (1) On vérifie les paramètres */
|
||||
if( !isset($id_cluster) || !is_numeric($id_cluster) || !isset($class) || !is_numeric($class) )
|
||||
return View::$html_error;
|
||||
|
||||
/* (2) On récupère le groupe */
|
||||
$checktypeRequest = new Request('clusterDefault/getById', [
|
||||
'id_cluster' => $id_cluster,
|
||||
'class' => $class
|
||||
]);
|
||||
$checktypeResponse = $checktypeRequest->dispatch();
|
||||
|
||||
/* (3) Si on ne le trouve pas, on retourne une erreur */
|
||||
if( $checktypeResponse->error->get() != Err::Success )
|
||||
return View::$html_error;
|
||||
|
||||
/* (4) On récupère les données du groupe */
|
||||
$currentCluster = $checktypeResponse->get('cluster');
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* (2) Fill attributes
|
||||
---------------------------------------------------------*/
|
||||
$this->id_cluster = $id_cluster;
|
||||
$this->class = $class;
|
||||
$this->name = $currentCluster['name'];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function get_members($id_cluster, $class){
|
||||
|
||||
/* (1) On récupère les membres
|
||||
---------------------------------------------------------*/ {
|
||||
|
||||
/* (1) On exécute la requête */
|
||||
$getmembersRequest = new Request('clusterDefault/getMembers', [
|
||||
'id_cluster' => $id_cluster,
|
||||
'class' => $class
|
||||
]);
|
||||
$getmembersResponse = $getmembersRequest->dispatch();
|
||||
|
||||
/* (2) Si erreur, on retourne rien par défaut */
|
||||
if( $getmembersResponse->error->get() != Err::Success )
|
||||
return [];
|
||||
|
||||
/* (3) On récupère la liste des UID uniquement */
|
||||
$members_ids = [];
|
||||
foreach($getmembersResponse->get('members') as $member)
|
||||
$members_ids[] = ($class==0) ? $member['id_user'] : $member['id_machine'];
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* (2) On récupère les utilisateurs non membres
|
||||
---------------------------------------------------------*/
|
||||
/* (1) On récupère les utilisateurs */
|
||||
if( $class == 0 ){
|
||||
|
||||
/* (2) On exécute la requête */
|
||||
$getusersRequest = new Request('userDefault/getAll');
|
||||
// On recupere la reponse
|
||||
$getusersResponse = $getusersRequest->dispatch();
|
||||
|
||||
/* (3) si erreur, on affiche l'explicitation */
|
||||
if( $getusersResponse->error->get() != Err::Success )
|
||||
return [];
|
||||
|
||||
/* (4) On récupère la liste des utilisateurs */
|
||||
$users = $getusersResponse->get('users');
|
||||
|
||||
/* (5) On ajoute s'ils sont dans le groupe ou non */
|
||||
foreach($users as $u=>$user)
|
||||
$users[$u]['already'] = in_array($user['id_user'], $members_ids);
|
||||
return $users;
|
||||
|
||||
|
||||
/* (3) On récupère les machines non membres
|
||||
---------------------------------------------------------*/
|
||||
/* (1) On récupère les machines */
|
||||
}else{
|
||||
|
||||
/* (2) On exécute la requête */
|
||||
$getmachinesRequest = new Request('machineDefault/getAll');
|
||||
// On recupere la reponse
|
||||
$getmachinesResponse = $getmachinesRequest->dispatch();
|
||||
|
||||
/* (3) si erreur, on affiche l'explicitation */
|
||||
if( $getmachinesResponse->error->get() != Err::Success )
|
||||
return [];
|
||||
|
||||
/* (4) On récupère la liste des machines */
|
||||
$machines = $getmachinesResponse->get('machines');
|
||||
|
||||
/* (5) On ajoute s'ils sont dans le groupe ou non */
|
||||
foreach($machines as $u=>$machine)
|
||||
$machines[$u]['already'] = in_array($machine['id_machine'], $members_ids);
|
||||
|
||||
return $machines;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,87 +0,0 @@
|
|||
{% block back %}
|
||||
|
||||
<span style='text-align:center; color: #666; text-decoration: underline; cursor: pointer;' id='members-change-group'>Modifier un autre groupe</span>
|
||||
<p></p>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block container %}
|
||||
|
||||
<article class='check-table'>
|
||||
|
||||
{% block hidden %}
|
||||
|
||||
<input type='hidden' id='members-member-idcluster' value='{{ core.id_cluster }}'>
|
||||
<input type='hidden' id='members-member-class' value='{{ core.class }}'>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block header %}
|
||||
|
||||
<div>
|
||||
|
||||
{# USER HEADER #}
|
||||
{% if core.class == 0 %}
|
||||
<span><strong>Identifiant</strong></span>
|
||||
<span><strong>Nom</strong></span>
|
||||
<span><strong>Code RFID</strong></span>
|
||||
{# MACHINE HEADER #}
|
||||
{% else %}
|
||||
<span><strong>Nom</strong></span>
|
||||
{% endif %}
|
||||
<span><strong>Membre de <u>{{ core.name }}</u></strong></span>
|
||||
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block member_list %}
|
||||
|
||||
{% for member in core.get_members(core.id_cluster, core.class) %}
|
||||
|
||||
{% block member_entry %}
|
||||
|
||||
{# USER ENTRIES #}
|
||||
{% if core.class == 0 %}
|
||||
{% block user_entry %}
|
||||
|
||||
<div>
|
||||
<span>{{ member.username }}</span>
|
||||
<span>{{ member.firstname }} {{ member.lastname }}</span>
|
||||
<span>{{ member.code }}</span>
|
||||
<span>
|
||||
<input type='checkbox' value='{{ member.id_user }}' data-name='members' id='checkbox_{{ member.id_user }}' {% if member.already %}checked{% endif %}>
|
||||
<label for='checkbox_{{ member.id_user }}'></label>
|
||||
</span>
|
||||
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{# MACHINE ENTRIES #}
|
||||
{% else %}
|
||||
|
||||
{% block machine_entry %}
|
||||
|
||||
<div>
|
||||
<span>{{ member.name }}</span>
|
||||
<span>
|
||||
<input type='checkbox' value='{{ member.id_machine }}' data-name='members' id='checkbox_{{ member.id_machine }}' {% if member.already %}checked{% endif %}>
|
||||
<label for='checkbox_{{ member.id_machine }}'></label>
|
||||
</span>
|
||||
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% endfor %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
</article>
|
||||
|
||||
{% endblock %}
|
|
@ -1,32 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace view\group\member\group;
|
||||
|
||||
use \generic\core\i_view;
|
||||
use \api\core\Request;
|
||||
use \error\core\Err;
|
||||
|
||||
|
||||
class main extends i_view{
|
||||
|
||||
public function __construct(){
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
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');
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
{% block form_tag %} <form class='neutral' action='' method='POST' id='choose-cluster'> {% endblock %}
|
||||
|
||||
{% block input %}
|
||||
|
||||
<select data-name='cluster'>
|
||||
<option value='.' selected disabled>Groupe à modifier</option>
|
||||
|
||||
{% for user_cluster in core.get_clusters(0) %}
|
||||
<option value='u{{ user_cluster.id_user_cluster }}'>{{ user_cluster.name }} (utilisateur)</option>
|
||||
{% endfor %}
|
||||
|
||||
{% for machine_cluster in core.get_clusters(1) %}
|
||||
<option value='m{{ machine_cluster.id_machine_cluster }}'>{{ machine_cluster.name }} (machine)</option>
|
||||
{% endfor %}
|
||||
|
||||
</select>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block submit %}
|
||||
|
||||
<button id='choose-cluster'>Modifier la composition</button>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
</form>
|
|
@ -1,113 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace view\group\permission;
|
||||
|
||||
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' ),
|
||||
'permission' => file_get_contents( __PUBLIC__.'/src/static/sub-menu-side/permission.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_nb_machines($id_cluster){
|
||||
$machineReq = new Request('clusterDefault/getMembers', [
|
||||
'id_cluster' => (int) $id_cluster,
|
||||
'class' => 1
|
||||
]);
|
||||
|
||||
$machineRes = $machineReq->dispatch();
|
||||
|
||||
// si erreur, on affiche rien par défaut
|
||||
if( $machineRes->error->get() != Err::Success )
|
||||
return [];
|
||||
|
||||
return count($machineRes->get('members'));
|
||||
}
|
||||
|
||||
|
||||
public function get_permissions(){
|
||||
$permReq = new Request('clusterDefault/getPermissions', []);
|
||||
|
||||
$permRes = $permReq->dispatch();
|
||||
|
||||
// si erreur, on affiche rien par défaut
|
||||
if( $permRes->error->get() != Err::Success )
|
||||
return [];
|
||||
|
||||
return $permRes->get('permissions');
|
||||
}
|
||||
|
||||
|
||||
public function get_authed_user_clusters($id_cluster, $id_permission){
|
||||
$ucReq = new Request('clusterDefault/getAuthenticatedClusters', [
|
||||
'id_target' => $id_cluster,
|
||||
'id_action' => $id_permission
|
||||
]);
|
||||
|
||||
$ucRes = $ucReq->dispatch();
|
||||
|
||||
// si erreur, on affiche rien par défaut
|
||||
if( $ucRes->error->get() != Err::Success )
|
||||
return [];
|
||||
|
||||
return $ucRes->get('clusters');
|
||||
}
|
||||
|
||||
|
||||
public function permission_translate($word, $lang){
|
||||
$word = strtolower($word);
|
||||
|
||||
if( $lang === 'fr' ){
|
||||
|
||||
switch($word){
|
||||
case 'start': return 'démarrer'; break;
|
||||
case 'stop': return 'arrêter'; break;
|
||||
case 'signal': return 'signaler'; break;
|
||||
case 'lock': return 'bloquer'; break;
|
||||
case 'unlock': return 'débloquer'; break;
|
||||
case 'unsignal': return 'désignaler'; break;
|
||||
|
||||
default: return 'inconnu'; break;
|
||||
}
|
||||
}else
|
||||
return $word;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,86 +0,0 @@
|
|||
{% block search_bar %} <input type='text' class='searchbar' placeholder='Recherche'> {% endblock %}
|
||||
|
||||
{% for machine_cluster in core.get_clusters() %}
|
||||
|
||||
{% block machine_cluster_card %}
|
||||
|
||||
{% block card_tag %} <article class='inline-box' id='{{ machine_cluster.id_machine_cluster }}'> {% endblock %}
|
||||
|
||||
{% set nb_machines = core.get_nb_machines(machine_cluster.id_machine_cluster) %}
|
||||
|
||||
{% block card_title %} <span class='title' style='color: {{ core.theme }}'>{{ machine_cluster.name }}</span> {% endblock %}
|
||||
|
||||
{% block card_remove %} <span class='link_remove' data-cluster='{{ machine_cluster.id_machine_cluster }}'>{{ core.icon.remove | raw }}</span> {% endblock %}
|
||||
{% block card_edit %} <span class='link_edit' data-cluster='{{ machine_cluster.id_machine_cluster }}'>{{ core.icon.edit | raw }}</span> {% endblock %}
|
||||
|
||||
{% block card_count %}
|
||||
|
||||
<span class='code'>
|
||||
{{ core.icon.device | raw }}
|
||||
<span>{{ nb_machines }} machines</span>
|
||||
</span>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% block card_permission_list %}
|
||||
|
||||
{% for permission in core.get_permissions() %}
|
||||
|
||||
{% block card_permission %}
|
||||
|
||||
<span class='groups'>
|
||||
|
||||
{% block card_permission_name %}
|
||||
|
||||
<span style='border-color: #ddd; background-color: #eee;'>
|
||||
{{ core.permission_translate(permission.name, 'fr') }}
|
||||
<span class='icon-permission'></span>
|
||||
</span>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block auth_user_cluster_list %}
|
||||
|
||||
<span class='ignore'>
|
||||
{% for user_cluster in core.get_authed_user_clusters(machine_cluster.id_machine_cluster, permission.id_permission) %}
|
||||
|
||||
{% block auth_user_cluster %}
|
||||
|
||||
<span>
|
||||
{% block auth_user_cluster_name %} {{ user_cluster.name }} {% endblock %}
|
||||
<span class='rem-permission' data-permission='{{ permission.id_permission }}' data-source='{{ user_cluster.id_user_cluster }}' data-target='{{ machine_cluster.id_machine_cluster }}'></span>
|
||||
</span>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% endfor %}
|
||||
</span>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
<span class='add-permission' data-target='{{ machine_cluster.id_machine_cluster }}' data-permission='{{ permission.id_permission }}'>+</span>
|
||||
</span>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% endfor %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
</article>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{# if no result #}
|
||||
{% else %}
|
||||
|
||||
{% block no_result %}
|
||||
|
||||
<article class='inline-box'>
|
||||
<span>Aucun groupe trouvé.</span>
|
||||
</article>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% endfor %}
|
|
@ -1,79 +0,0 @@
|
|||
<?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');
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,150 +0,0 @@
|
|||
{% block search_bar %} <input type='text' class='searchbar' placeholder='Recherche'> {% endblock %}
|
||||
|
||||
{% set count = 0 %}
|
||||
|
||||
{# {% block user_cluster_list %} #}
|
||||
|
||||
{% for user_cluster in core.get_clusters(0) %}
|
||||
|
||||
{% set count = count + 1 %}
|
||||
|
||||
{% set id_user_cluster = 'u' ~ user_cluster.id_user_cluster %}
|
||||
{% set memlen = core.get_members(user_cluster.id_user_cluster,0) | length %}
|
||||
|
||||
{% block uc_card %}
|
||||
|
||||
{% block uc_card_tag %} <article class='inline-box' id='{{ id_user_cluster }}'> {% endblock %}
|
||||
|
||||
{% block uc_card_title %} <span class='title' style='color: {{ core.theme }}'>{{ user_cluster.name }}</span> {% endblock %}
|
||||
|
||||
{% block uc_card_remove %} <span class='link_remove' data-cluster='{{ id_user_cluster }}'>{{ core.icon.remove | raw }}</span> {% endblock %}
|
||||
{% block uc_card_edit %} <span class='link_edit' data-cluster='{{ id_user_cluster }}'>{{ core.icon.edit | raw }}</span> {% endblock %}
|
||||
|
||||
{% block uc_card_count %}
|
||||
|
||||
<span class='code'>
|
||||
{{ core.icon.user | raw }}
|
||||
<span>{{ memlen }} utilisateur{% if memlen > 1 %}s{% endif %}</span>
|
||||
</span>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block uc_card_member_list %}
|
||||
|
||||
<span class='groups'>
|
||||
{{ core.icon.group | raw }}
|
||||
|
||||
{% block uc_card_member %}
|
||||
|
||||
<span class='ignore'>
|
||||
{% for user in core.get_members(user_cluster.id_user_cluster, 0) %}
|
||||
<span>
|
||||
{% block uc_card_member_name %} {{ user.username }} {% endblock %}
|
||||
<span class='rem-member' data-member='{{ user.id_user }}' data-cluster='{{ id_user_cluster }}'></span>
|
||||
</span>
|
||||
{% endfor %}
|
||||
</span>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
<span class='add-member' data-cluster='{{ id_user_cluster }}'>+</span>
|
||||
</span>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
</article>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% endfor %}
|
||||
|
||||
{# {% endblock %} #}
|
||||
|
||||
|
||||
|
||||
{# {% block machines_cluster_list %} #}
|
||||
|
||||
{% for machine_cluster in core.get_clusters(1) %}
|
||||
|
||||
{% set count = count + 1 %}
|
||||
|
||||
|
||||
{% set id_machine_cluster = 'm' ~ machine_cluster.id_machine_cluster %}
|
||||
{% set memlen = core.get_members(machine_cluster.id_machine_cluster,1) | length %}
|
||||
|
||||
{% block mc_card %}
|
||||
|
||||
{% block mc_card_tag %} <article class='inline-box' id='{{ id_machine_cluster }}'> {% endblock %}
|
||||
|
||||
{% block mc_card_title %} <span class='title' style='color: {{ core.theme }}'>{{ machine_cluster.name }}</span> {% endblock %}
|
||||
{% block mc_card_remove %} <span class='link_remove' data-cluster='{{ id_machine_cluster }}'>{{ core.icon.remove | raw }}</span> {% endblock %}
|
||||
{% block mc_card_edit %} <span class='link_edit' data-cluster='{{ id_machine_cluster }}'>{{ core.icon.edit | raw }}</span> {% endblock %}
|
||||
|
||||
{% block mc_card_count %}
|
||||
|
||||
<span class='code'>
|
||||
{{ core.icon.device | raw }}
|
||||
<span>{{ memlen }} machine{% if memlen > 1 %}s{% endif %}</span>
|
||||
</span>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block mc_card_options %}
|
||||
|
||||
<span class='option'>
|
||||
{{ core.icon.option | raw }}
|
||||
{% for option in core.get_options(machine_cluster.id_machine_cluster) %}
|
||||
<span class='ignore'>
|
||||
<span>{{ option.name }}:{{ option.daemon }}</span>
|
||||
</span>
|
||||
{% else %}
|
||||
<span class='ignore'>Aucune option</span>
|
||||
{% endfor %}
|
||||
</span>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block mc_card_member_list %}
|
||||
|
||||
<span class='groups'>
|
||||
{{ core.icon.group | raw }}
|
||||
|
||||
{% block mc_card_member %}
|
||||
|
||||
<span class='ignore'>
|
||||
{% for machine in core.get_members(machine_cluster.id_machine_cluster,1) %}
|
||||
<span>
|
||||
{% block mc_card_member_name %} {{ machine.name }} {% endblock %}
|
||||
<span class='rem-member' data-member='{{ machine.id_machine }}' data-cluster='{{ id_machine_cluster }}'></span>
|
||||
</span>
|
||||
{% endfor %}
|
||||
</span>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
<span class='add-member' data-cluster='{{ id_machine_cluster }}'>+</span>
|
||||
</span>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
</article>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% endfor %}
|
||||
|
||||
{# {% endblock %} #}
|
||||
|
||||
|
||||
{# if no result #}
|
||||
{% if count <= 0 %}
|
||||
|
||||
{% block no_result %}
|
||||
|
||||
<article class='inline-box'>
|
||||
<span>Aucun résultat {{ count }}</span>
|
||||
</article>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% endif %}
|
|
@ -1,13 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace view\history\archive;
|
||||
|
||||
use \generic\core\i_view;
|
||||
|
||||
|
||||
class main extends i_view{
|
||||
|
||||
public function __construct(){
|
||||
}
|
||||
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
<form class='search'>
|
||||
Le téléchargement de l'archive supprimera toutes les entrées de l'historique.
|
||||
<br>
|
||||
<center>Etes-vous sur de vouloir procéder ?</center>
|
||||
<br>
|
||||
<button id='archive_clean'>Archiver l'historique</button>
|
||||
</form>
|
|
@ -1,256 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace view\history\details;
|
||||
|
||||
use \generic\core\i_view;
|
||||
use \api\core\Request;
|
||||
use \error\core\Err;
|
||||
|
||||
|
||||
class main extends i_view{
|
||||
|
||||
public $id_history;
|
||||
public $timeline = [];
|
||||
public $entry = [];
|
||||
|
||||
|
||||
/* (1) Constructor
|
||||
*
|
||||
* @id_history<id> UID of the history entry
|
||||
*
|
||||
---------------------------------------------------------*/
|
||||
public function __construct($id_history){
|
||||
/* (1) Set attributes
|
||||
---------------------------------------------------------*/
|
||||
$this->id_history = $id_history;
|
||||
|
||||
|
||||
/* (3) Get entry data
|
||||
---------------------------------------------------------*/
|
||||
/* (1) Request */
|
||||
$entry_req = new Request('historyDefault/getById', [ 'id_entry' => $this->id_history ]);
|
||||
|
||||
/* (2) Get response */
|
||||
$entry_res = $entry_req->dispatch();
|
||||
|
||||
/* (3) On success, store entry data */
|
||||
if( $entry_res->error->get() == Err::Success )
|
||||
$this->entry = $entry_res->get('entry');
|
||||
|
||||
|
||||
/* (3) Get machine timeline
|
||||
---------------------------------------------------------*/
|
||||
/* (1) Request */
|
||||
$mac_req = new Request('historyDefault/get_timeline', [ 'id_entry' => $this->id_history ]);
|
||||
|
||||
/* (2) Get response */
|
||||
$mac_res = $mac_req->dispatch();
|
||||
|
||||
/* (3) On success, store timeline data */
|
||||
if( $mac_res->error->get() == Err::Success ){
|
||||
$this->timeline = $mac_res->get('timeline');
|
||||
|
||||
// add date nodes to the timeline
|
||||
$this->add_date_nodes();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* (2) Format timeline data to svg render
|
||||
*
|
||||
* @return svg<String> SVG raw render
|
||||
*
|
||||
---------------------------------------------------------*/
|
||||
public function svg(){
|
||||
|
||||
/* (1) Initialize variables
|
||||
---------------------------------------------------------*/
|
||||
/* (1) Set date() timezone */
|
||||
date_default_timezone_set('Europe/Paris');
|
||||
debug();
|
||||
|
||||
/* (2) Init. result raw svg */
|
||||
$RAW = '';
|
||||
|
||||
/* (3) Set global range */
|
||||
$c = 0;
|
||||
$cl = count($this->timeline);
|
||||
|
||||
// if no entry -> abort
|
||||
if( $cl == 0 )
|
||||
return '';
|
||||
|
||||
/* (4) Useful variables */
|
||||
$y_pad = 50; // padding between each node
|
||||
$line_pad = 50; // padding on each LINE end
|
||||
$line_height = ( $cl + 1 ) * $y_pad; // line height (each node * @y_pad + @y_pad)
|
||||
$height = $line_height + 2*$line_pad; // svg height
|
||||
$width = 200; // svg width
|
||||
$x = 50; // center width
|
||||
|
||||
/* (5) Svg tag */
|
||||
$RAW .= "<svg width='$width' height='$height' viewBox='0 0 $width $height' class='timeline'>";
|
||||
|
||||
/* (6) Start CIRCLE */ {
|
||||
|
||||
// {6.1} Date node //
|
||||
$y = $line_pad;
|
||||
$RAW .= "<circle cx='$x' cy='$y' r='7' fill='#edf0f5' class='tstart'/>";
|
||||
$RAW .= "<circle cx='$x' cy='$y' r='4' fill='#555' class='tstart'/>";
|
||||
|
||||
// {6.2} Date line to text //
|
||||
$line_end_x = $x + (30-8);
|
||||
$RAW .= "<path d='m".($x+8)." $y L$line_end_x $y' style='stroke-dasharray: 3px;' s stroke='#444'/>";
|
||||
|
||||
// {6.3} Date text //
|
||||
$x_decal = $x + 30;
|
||||
$y_decal = $y + 5;
|
||||
$RAW .= "<text x='$x_decal' y='$y_decal' class='bold'>".date('d / m / Y', $this->timeline[0]['timestamp'])."</text>";
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* (2) Build barebone
|
||||
---------------------------------------------------------*/
|
||||
/* (1) Default TIMELINE */
|
||||
$line_end_y = $line_height + $line_pad;
|
||||
$RAW .= "<path d='m$x $line_pad L$x $line_end_y' style='stroke-dasharray: 3px;' stroke='#444' class='timeline line'/>";
|
||||
|
||||
|
||||
/* (3) Build each action
|
||||
---------------------------------------------------------*/
|
||||
for( $c = 0 ; $c < $cl ; $c++ ){
|
||||
|
||||
/* (1) Calculate X */
|
||||
$y = $line_pad + $y_pad + $c*$y_pad;
|
||||
|
||||
/* (2) Get entry data */
|
||||
$entry = $this->timeline[$c];
|
||||
|
||||
/* (2.1) If DATE NODE -> add it */
|
||||
if( isset($entry['date_node']) ){
|
||||
|
||||
// {2.1.1} Date node //
|
||||
$RAW .= "<circle cx='$x' cy='$y' r='7' fill='#edf0f5' class='tstart'/>";
|
||||
$RAW .= "<circle cx='$x' cy='$y' r='4' fill='#555' class='tstart'/>";
|
||||
|
||||
// {2.1.2} Date line to text //
|
||||
$line_end_x = $x + (30-8);
|
||||
$RAW .= "<path d='m".($x+8)." $y L$line_end_x $y' style='stroke-dasharray: 3px;' stroke='#555'/>";
|
||||
|
||||
// {2.1.3} Date text //
|
||||
$x_decal = $x + 30;
|
||||
$y_decal = $y + 5;
|
||||
$RAW .= "<text x='$x_decal' y='$y_decal' class='bold'>".$entry['date_node']."</text>";
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* (3) Get useful data */
|
||||
$action_class = strtolower($entry['action_name']);
|
||||
$icon_uri = '/src/static/timeline/'.$action_class.'@ffffff.svg';
|
||||
$data_entry = "data-entry='".$entry['id_history']."'";
|
||||
$data_user = " data-user='".$entry['user_name']."'";
|
||||
$data_machine = " data-machine='".$entry['machine_name']."'";
|
||||
$data_action = " data-action='".$entry['action_name']."'";
|
||||
$data_time = " data-time='".date('H:i:s d/m/Y', $entry['timestamp'])."'";
|
||||
$data_tags = $data_entry.$data_user.$data_machine.$data_action.$data_time;
|
||||
|
||||
$y_img = $y - 5.5;
|
||||
|
||||
/* (4) Draw entry circles */
|
||||
$RAW .= "<circle cx='$x' cy='$y' r='15' class='timeline around $action_class' $data_tags id='e".$entry['id_history']."' data-y='$y' />";
|
||||
$RAW .= "<circle cx='$x' cy='$y' r='12' class='timeline center $action_class' />";
|
||||
|
||||
/* (5) Draw entry icon (action) */
|
||||
$x_decal = $x - 5.5;
|
||||
$RAW .= "\t<image x='$x_decal' y='$y_img' width='12' height='12' xlink:href='$icon_uri' class='icon' />";
|
||||
|
||||
/* (6) Draw circle below if current user */
|
||||
if( $this->entry['id_user'] == $entry['id_user'] ){
|
||||
|
||||
$x_decal = $x - 25;
|
||||
|
||||
// {6.1} If current ENTRY -> draw big circle //
|
||||
if( $this->entry['id_history'] == $entry['id_history'] )
|
||||
$RAW .= "<circle cx='$x_decal' cy='$y' r='4' class='timeline below $action_class' />";
|
||||
|
||||
// {6.2} Else -> draw little circle //
|
||||
else
|
||||
$RAW .= "<circle cx='$x_decal' cy='$y' r='2' class='timeline below $action_class' />";
|
||||
}
|
||||
|
||||
/* (6) Hour */
|
||||
$x_decal = $x + 25;
|
||||
$y_decal = $y + 5;
|
||||
$RAW .= "<text x='$x_decal' y='$y_decal' class='$action_class'>".date('H:i:s', $entry['timestamp'])." - ".$entry['user_name']."</text>";
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* (4) Close SVG
|
||||
---------------------------------------------------------*/
|
||||
/* (1) Stop CIRCLE */
|
||||
$y = $line_height + $line_pad;
|
||||
$RAW .= "<circle cx='$x' cy='$y' r='6' fill='#edf0f5' class='tstop' />";
|
||||
$RAW .= "<circle cx='$x' cy='$y' r='4' fill='#555' class='tstop' />";
|
||||
|
||||
/* (2) Close SVG tag */
|
||||
$RAW .= "</svg>";
|
||||
|
||||
|
||||
/* (5) Create invisible infobox (for now)
|
||||
---------------------------------------------------------*/
|
||||
$RAW .= "<div class='timeline infobox'></div>";
|
||||
|
||||
|
||||
|
||||
return $RAW;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* (3) Add events for new day in @this->timeline
|
||||
*
|
||||
---------------------------------------------------------*/
|
||||
private function add_date_nodes(){
|
||||
|
||||
/* (1) Initialization
|
||||
---------------------------------------------------------*/
|
||||
/* (1) Initialize variables */
|
||||
$last_day = null;
|
||||
$new_timeline = []; // will contain the new @timeline data
|
||||
|
||||
|
||||
/* (2) Browse each entry
|
||||
---------------------------------------------------------*/
|
||||
foreach($this->timeline as $entry){
|
||||
|
||||
/* (1) If different day (not null) -> add a node + update last_day */
|
||||
if( !is_null($last_day) && $last_day != date('d / m / Y', $entry['timestamp']) )
|
||||
$new_timeline[] = [ 'date_node' => $last_day ];
|
||||
|
||||
/* (2) In all cases -> copy the event */
|
||||
$new_timeline[] = $entry;
|
||||
|
||||
/* (3) Update the day */
|
||||
$last_day = date('d / m / Y', $entry['timestamp']);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* (3) Update the result
|
||||
---------------------------------------------------------*/
|
||||
$this->timeline = $new_timeline;
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
<!-- <span class='in-dev'>In development.. This feature will soon be available.</span> -->
|
||||
|
||||
<article class='timeline container' data-length='{{ core.timeline | length }}'>
|
||||
{{ core.svg() | raw }}
|
||||
</article>
|
||||
|
|
@ -1,110 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace view\history\view;
|
||||
|
||||
use \generic\core\i_view;
|
||||
use \api\core\Request;
|
||||
use \error\core\Err;
|
||||
|
||||
|
||||
class main extends i_view{
|
||||
|
||||
|
||||
|
||||
public function __construct(){}
|
||||
|
||||
|
||||
|
||||
|
||||
public function get_history(){
|
||||
$req = new Request('historyDefault/getAll', []);
|
||||
|
||||
$res = $req->dispatch();
|
||||
|
||||
// si erreur, on retourne rien par défaut
|
||||
if( $res->error->get() != Err::Success )
|
||||
return [];
|
||||
|
||||
return $res->get('history');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function ts_format($ts){
|
||||
date_default_timezone_set('Europe/Paris');
|
||||
return date('d/m/Y H:i:s', $ts);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function ts_relative($ts){
|
||||
$r = self::relativetime($ts);
|
||||
|
||||
// if only one
|
||||
$o = $r[0] <= 1;
|
||||
|
||||
switch($r[1]){
|
||||
|
||||
case 'Y': return $r[0].' an'.($o?'':'s'); break;
|
||||
case 'm': return $r[0].' mois'; break;
|
||||
case 'd': return $r[0].' jour'.($o?'':'s'); break;
|
||||
|
||||
case 'H': return $r[0].' heure'.($o?'':'s'); break;
|
||||
case 'i': return $r[0].' minute'.($o?'':'s'); break;
|
||||
case 's': return $r[0].' seconde'.($o?'':'s'); break;
|
||||
|
||||
default: return 'peu de temps'; break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static function relativetime($ts){
|
||||
|
||||
/* [1] Explode time into human-readable time units
|
||||
=========================================================*/
|
||||
$units = [];
|
||||
|
||||
/* (1) Date units */
|
||||
$units['year'] = (int) date('Y', $ts);
|
||||
$units['month'] = (int) date('m', $ts);
|
||||
$units['day'] = (int) date('d', $ts);
|
||||
|
||||
/* (2) Time units */
|
||||
$units['hour'] = (int) date('H', $ts);
|
||||
$units['minute'] = (int) date('i', $ts);
|
||||
$units['second'] = (int) date('s', $ts);
|
||||
|
||||
|
||||
/* [2] Calculate relative time for each unit
|
||||
=========================================================*/
|
||||
/* (1) Date units */
|
||||
$units['year'] = intval(date('Y')) - $units['year'];
|
||||
$units['month'] = intval(date('m')) - $units['month'];
|
||||
$units['day'] = intval(date('d')) - $units['day'];
|
||||
|
||||
/* (2) Time units */
|
||||
$units['hour'] = intval(date('H')) - $units['hour'];
|
||||
$units['minute'] = intval(date('i')) - $units['minute'];
|
||||
$units['second'] = intval(date('s')) - $units['second'];
|
||||
|
||||
|
||||
/* [3] Return significative relative time
|
||||
=========================================================*/
|
||||
/* (1) Date units */
|
||||
if( $units['year'] > 0 ) return [ $units['year'], 'Y' ];
|
||||
if( $units['month'] > 0 ) return [ $units['month'], 'm' ];
|
||||
if( $units['day'] > 0 ) return [ $units['day'], 'd' ];
|
||||
|
||||
/* (2) Time units */
|
||||
if( $units['hour'] > 0 ) return [ $units['hour'], 'H' ];
|
||||
if( $units['minute'] > 0 ) return [ $units['minute'], 'i' ];
|
||||
if( $units['second'] > 0 ) return [ $units['second'], 's' ];
|
||||
|
||||
/* (3) Default value */
|
||||
return [0, '.'];
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,70 +0,0 @@
|
|||
{% block search_bar %} <input type='text' class='searchbar' placeholder='Recherche'> {% endblock %}
|
||||
|
||||
|
||||
{% block history_list %}
|
||||
|
||||
{% for entry in core.get_history() %}
|
||||
|
||||
|
||||
{% block header %}
|
||||
|
||||
{% if loop.index == 1 %}
|
||||
|
||||
<article class='inline-row' style='border: 0; box-shadow: none;background: transparent;'>
|
||||
<span>Machine</span>
|
||||
<span>Dernière utilisation</span>
|
||||
<span>Utilisateur</span>
|
||||
<span>Action</span>
|
||||
<span>Historique détaillé</span>
|
||||
</article>
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block entry %}
|
||||
{% block entry_tag %} <article class='inline-row' id='{{ entry.id_history }}'> {% endblock %}
|
||||
|
||||
{% block entry_machine %} <span data-machine='{{ entry.id_machine }}' class='title'><span>#{{ entry.machine_name }}</span></span> {% endblock %}
|
||||
|
||||
{% block entry_time %}
|
||||
|
||||
<span>
|
||||
<span>{{ core.ts_format(entry.timestamp) }}</span>
|
||||
<span style='color:#aaa;'>Il y a {{ core.ts_relative(entry.timestamp) }}</span>
|
||||
</span>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block entry_user %}
|
||||
|
||||
<span data-user='{{ entry.id_user }}'>
|
||||
<span>{{ entry.user_name }}</span>
|
||||
<span style='color:#aaa;'>{{ entry.user_firstname }} {{ entry.user_lastname }}</span>
|
||||
</span>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block entry_action %}
|
||||
|
||||
<span>
|
||||
<span>{{ entry.action_name }}</span>
|
||||
</span>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block entry_details %}
|
||||
|
||||
<span>
|
||||
<button class='search' data-details='{{ entry.id_history }}'>Détails</button>
|
||||
</span>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
</article>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% endfor %}
|
||||
|
||||
{% endblock %}
|
|
@ -1,12 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace view\machine\form\create;
|
||||
|
||||
use \generic\core\i_view;
|
||||
|
||||
|
||||
class main extends i_view{
|
||||
|
||||
public function __construct(){}
|
||||
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
{% block form_tag %} <form class='valid'> {% endblock %}
|
||||
|
||||
{% block input %}
|
||||
|
||||
<input id='create_name' type='text' placeholder='Name'><br>
|
||||
<span class='error-msg create_name'></span><br>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% block submit %}
|
||||
|
||||
<button id='create_submit'>Créer</button>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
</form>
|
|
@ -1,12 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace view\machine\form\edit;
|
||||
|
||||
use \generic\core\i_view;
|
||||
|
||||
|
||||
class main extends i_view{
|
||||
|
||||
public function __construct(){}
|
||||
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
{% block form_tag %} <form class='neutral'> {% endblock %}
|
||||
|
||||
<!-- Recherche de machine -->
|
||||
{% block search %}
|
||||
|
||||
{% block search_input %}
|
||||
|
||||
<input id='edit_search_keyword' type='text' class='search' placeholder='Recherche...'><br>
|
||||
<input id='edit_search_id' type='hidden' value=''>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
<!-- Indice du resultat -->
|
||||
{% block search_submit %}
|
||||
|
||||
<span class='edit_search_view'>machine <span class='edit_search_num'>0</span> sur <span class='edit_search_sum'>0</span></span><br><br>
|
||||
<button id='edit_search_submit' class='search'>Trouver/Suivant</button><br>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
<br><br><hr class='OR' data-label='PUIS' /><br><br>
|
||||
|
||||
<!-- Modification de machine -->
|
||||
{% block edit %}
|
||||
|
||||
{% block edit_input %}
|
||||
|
||||
<input id='edit_name' type='text' placeholder='Name'><br>
|
||||
<span class='error-msg edit_name'></span><br>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block edit_submit %}
|
||||
|
||||
<button id='edit_submit' disabled>Modifier</button>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
</form>
|
|
@ -1,12 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace view\machine\form\remove;
|
||||
|
||||
use \generic\core\i_view;
|
||||
|
||||
|
||||
class main extends i_view{
|
||||
|
||||
public function __construct(){}
|
||||
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
{% block form_tag %} <form class='invalid'> {% endblock %}
|
||||
|
||||
<!-- Recherche de machine -->
|
||||
{% block search %}
|
||||
|
||||
{% block search_input %}
|
||||
|
||||
<input id='remove_search_keyword' type='text' class='search' placeholder='Recherche...'><br>
|
||||
<input id='remove_search_id' type='hidden' value=''>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
<!-- Indice du resultat -->
|
||||
{% block search_submit %}
|
||||
|
||||
<span class='remove_search_view'>machine <span class='remove_search_num'>0</span> sur <span class='remove_search_sum'>0</span></span><br><br>
|
||||
<button id='remove_search_submit' class='search'>Trouver/Suivant</button><br>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
<br><br><hr class='OR' data-label='PUIS' /><br><br>
|
||||
|
||||
<!-- Suppression de machine -->
|
||||
{% block edit %}
|
||||
|
||||
{% block edit_input %}
|
||||
<input id='remove_name' type='text' placeholder='Name'><br>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block edit_submit %}
|
||||
|
||||
<button id='remove_submit' disabled>Supprimer</button>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
</form>
|
|
@ -1,87 +0,0 @@
|
|||
<?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');
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,82 +0,0 @@
|
|||
{% block search_bar %} <input type='text' class='searchbar' placeholder='Recherche'> {% endblock %}
|
||||
|
||||
|
||||
{% block group_list %}
|
||||
|
||||
{% for cluster in core.get_clusters() %}
|
||||
|
||||
{% block group_card %}
|
||||
|
||||
{% block card_tag %} <article class='inline-box' id='{{ cluster.id_machine_cluster }}'> {% endblock %}
|
||||
|
||||
{% set machinelist = core.get_members(cluster.id_machine_cluster) %}
|
||||
|
||||
{% block card_title %} <span class='title' style='color: {{ core.theme }}'>{{ cluster.name }}</span> {% endblock %}
|
||||
|
||||
{% block card_remove %} <span class='link_remove' data-cluster='{{ cluster.id_machine_cluster }}'>{{ core.icon.remove | raw }}</span> {% endblock %}
|
||||
{% block card_edit %} <span class='link_edit' data-cluster='{{ cluster.id_machine_cluster }}'>{{ core.icon.edit | raw }}</span> {% endblock %}
|
||||
|
||||
{# To be patched #}
|
||||
{% block card_patch %}{% endblock %}
|
||||
|
||||
{% block card_count %}
|
||||
|
||||
<span class='code'>
|
||||
{{ core.icon.device | raw }}
|
||||
<span>{{ machinelist | length }} machines</span>
|
||||
</span>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block card_option %}
|
||||
|
||||
<span class='option'>
|
||||
{{ core.icon.option | raw }}
|
||||
{% for option in core.get_options(cluster.id_machine_cluster) %}
|
||||
<span class='ignore'>
|
||||
<span>{{ option.name }}:{{ option.daemon }}</span>
|
||||
</span>
|
||||
{% else %}
|
||||
<span class='ignore'>Aucune option</span>
|
||||
{% endfor %}
|
||||
</span>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block card_members %}
|
||||
|
||||
<span class='groups'>
|
||||
{{ core.icon.group | raw }}
|
||||
|
||||
<span class='ignore'>
|
||||
{% for machine in machinelist %}
|
||||
<span>
|
||||
{{ machine.name }}
|
||||
<span class='rem-member' data-member='{{ machine.id_machine }}' data-cluster='{{ cluster.id_machine_cluster }}'></span>
|
||||
</span>
|
||||
{% endfor %}
|
||||
</span>
|
||||
|
||||
<span class='add-member' data-cluster='{{ cluster.id_machine_cluster }}'>+</span>
|
||||
</span>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
</article>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{# if no result #}
|
||||
{% else %}
|
||||
|
||||
{% block no_result %}
|
||||
|
||||
<article class='inline-box'>
|
||||
<span>Aucun groupe machine trouvé.</span>
|
||||
</article>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% endfor %}
|
||||
|
||||
{% endblock %}
|
|
@ -1,82 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace view\machine\view;
|
||||
|
||||
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' ),
|
||||
'group' => file_get_contents( __PUBLIC__.'/src/static/container/group.svg' ),
|
||||
'motor' => file_get_contents( __PUBLIC__.'/src/static/container/motor.svg' )
|
||||
];
|
||||
|
||||
$this->theme = $_SESSION['WAREHOUSE']['theme'];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function get_machines(){
|
||||
$request = new Request('machineDefault/getAll'); // On utilise la methode 'getAll' du module 'machineDefault'
|
||||
$answer = $request->dispatch(); // On recupere la reponse
|
||||
|
||||
// si erreur, on affiche rien par défaut
|
||||
if( $answer->error->get() != Err::Success )
|
||||
return [];
|
||||
|
||||
return $answer->get('machines');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function get_state($id_machine){
|
||||
/* (1) Write / Execute request */
|
||||
$req = new Request('machineDefault/getState', [
|
||||
'id_machine' => $id_machine
|
||||
]);
|
||||
$res = $req->dispatch();
|
||||
|
||||
/* (2) Manage error */
|
||||
if( $res->error->get() != Err::Success )
|
||||
return 'detached';
|
||||
|
||||
return $res->get('state');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function get_clusters($id_machine){
|
||||
$request = new Request('machineDefault/getClusters', [
|
||||
'id_machine' => (int) $id_machine
|
||||
]);
|
||||
|
||||
$answer = $request->dispatch();
|
||||
|
||||
// si erreur, on affiche rien par défaut
|
||||
if( $answer->error->get() != Err::Success )
|
||||
return [];
|
||||
|
||||
return $answer->get('clusters');
|
||||
}
|
||||
|
||||
}
|
|
@ -1,60 +0,0 @@
|
|||
{% block search_bar %} <input type='text' class='searchbar' placeholder='Recherche'> {% endblock %}
|
||||
|
||||
{% block machine_list %}
|
||||
|
||||
{% for machine in core.get_machines() %}
|
||||
|
||||
{% block machine_card %}
|
||||
|
||||
{% block card_tag %} <article class='inline-box' id='{{ machine.id_machine }}'> {% endblock %}
|
||||
|
||||
{% block card_state %} <span class='state' data-state='{{ core.get_state(machine.id_machine) }}'></span> {% endblock %}
|
||||
{% block card_title %} <span class='title' style='color: {{ core.theme }}' title='{{ machine.ap | default('?') }} ({{ machine.ip | default('?') }})'>{{ machine.name }} <span>#{{ machine.name }}</span></span> {% endblock %}
|
||||
|
||||
{% block card_remove %} <span class='link_remove' data-machine='{{ machine.id_machine }}'>{{ core.icon.remove | raw }}</span> {% endblock %}
|
||||
{% block card_edit %} <span class='link_edit' data-machine='{{ machine.id_machine }}'>{{ core.icon.edit | raw }}</span> {% endblock %}
|
||||
|
||||
{# To be patched #}
|
||||
{% block card_motheure_patch %}{% endblock %}
|
||||
|
||||
{% block card_group %}
|
||||
|
||||
<span class='groups'>
|
||||
{{ core.icon.group | raw }}
|
||||
|
||||
{% block group_list %}
|
||||
|
||||
<span class='ignore'>
|
||||
{% for cluster in core.get_clusters(machine.id_machine) %}
|
||||
<span>
|
||||
{% block group_name %} {{ cluster.name }} {% endblock %}
|
||||
<span class='rem-group' data-group='{{ cluster.id_machine_cluster }}' data-machine='{{ machine.id_machine }}'></span>
|
||||
</span>
|
||||
{% endfor %}
|
||||
</span>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
<span class='add-group' data-machine='{{ machine.id_machine }}'>+</span>
|
||||
</span>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
</article>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{# if no result #}
|
||||
{% else %}
|
||||
|
||||
{% block no_result %}
|
||||
|
||||
<article class='inline-box'>
|
||||
<span>Aucune machine trouvée</span>
|
||||
</article>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% endfor %}
|
||||
|
||||
{% endblock %}
|
|
@ -1,36 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace view\machine\view;
|
||||
|
||||
use \generic\core\i_patch;
|
||||
use \api\core\Request;
|
||||
use \error\core\Err;
|
||||
|
||||
|
||||
class motheure extends i_patch{
|
||||
|
||||
/* (1) Attributes
|
||||
---------------------------------------------------------*/
|
||||
public $patch = [
|
||||
'card_motheure_patch' => 'motheure_count.twig'
|
||||
];
|
||||
|
||||
|
||||
public function get_motheure($id_machine){
|
||||
/* (1) Get its machine_clusters
|
||||
---------------------------------------------------------*/
|
||||
/* (1) Create request */
|
||||
$motheureReq = new Request('motheure/getCount', ['id_machine' => $id_machine]);
|
||||
|
||||
/* (2) Execute */
|
||||
$motheureRes = $motheureReq->dispatch();
|
||||
|
||||
/* (3) Manage error */
|
||||
if( $motheureRes->error->get() != Err::Success )
|
||||
return null;
|
||||
|
||||
return $motheureRes->get('count');
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
{% set motheure = patch.motheure.get_motheure(machine.id_machine) %}
|
||||
|
||||
{% if motheure %}
|
||||
|
||||
<span class='motheure'>
|
||||
{{ core.icon.motor | raw }}
|
||||
<span>{{ motheure }}</span>ms
|
||||
</span>
|
||||
|
||||
{% endif %}
|
|
@ -1,12 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace view\profile\password;
|
||||
|
||||
use \generic\core\i_view;
|
||||
|
||||
|
||||
class main extends i_view{
|
||||
|
||||
public function __construct(){}
|
||||
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
{% block form_tag %} <form class='search'> {% endblock %}
|
||||
|
||||
{% block input %}
|
||||
|
||||
<input id='old_pwd' type='password' placeholder='Mot de passe actuel'><br>
|
||||
<span class='error-msg old_pwd'></span><br>
|
||||
|
||||
<input id='new_pwd' type='password' placeholder='Nouveau mot de passe'><br>
|
||||
<span class='error-msg new_pwd'></span><br>
|
||||
|
||||
<input id='confirm_pwd' type='password' placeholder='Confirmation'><br>
|
||||
<span class='error-msg confirm_pwd'></span><br>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block submit %}
|
||||
|
||||
<button id='update_pwd'>Mettre à jour</button>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
</form>
|
|
@ -1,12 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace view\profile\view;
|
||||
|
||||
use \generic\core\i_view;
|
||||
|
||||
|
||||
class main extends i_view{
|
||||
|
||||
public function __construct(){}
|
||||
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
<span class='in-dev'>In development.. This feature will soon be available.</span>
|
|
@ -1,12 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace view\settings\admin\create;
|
||||
|
||||
use \generic\core\i_view;
|
||||
|
||||
|
||||
class main extends i_view{
|
||||
|
||||
public function __construct(){}
|
||||
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
{% block form_tag %} <form class='valid'> {% endblock %}
|
||||
|
||||
{% block input %}
|
||||
|
||||
<input id='admin_username' type='text' placeholder='Identifiant'><br>
|
||||
<span class='error-msg admin_username'></span><br>
|
||||
|
||||
<input id='admin_mail' type='text' placeholder='Adresse mail'><br>
|
||||
<span class='error-msg admin_mail'></span><br>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block generated %}
|
||||
|
||||
<input id='admin_password' type='text' placeholder='Mot de passe généré...'><br>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block submit %}
|
||||
|
||||
<button id='admin_submit'>Créer l'administrateur</button>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
</form>
|
|
@ -1,49 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace view\settings\admin\view;
|
||||
|
||||
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 $self_id;
|
||||
|
||||
public function __construct(){
|
||||
|
||||
/* (1) Setup attributes
|
||||
---------------------------------------------------------*/
|
||||
/* (1) Fill attributes */
|
||||
$this->icon = [
|
||||
'remove' => file_get_contents( __PUBLIC__.'/src/static/sub-menu-side/remove.svg' )
|
||||
];
|
||||
|
||||
$this->theme = $_SESSION['WAREHOUSE']['theme'];
|
||||
|
||||
$this->self_id = $_SESSION['ADMIN']['id'];
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function get_admins(){
|
||||
/* (1) On exécute la requête */
|
||||
$adminListRq = new Request('adminDefault/getAll');
|
||||
|
||||
/* (2) On recupere la reponse */
|
||||
$adminListRs = $adminListRq->dispatch();
|
||||
|
||||
/* (3) si erreur vide */
|
||||
if( $adminListRs->error->get() != Err::Success )
|
||||
return [];
|
||||
|
||||
/* (4) On récupère la liste des utilisateurs */
|
||||
return $adminListRs->get('admins');
|
||||
}
|
||||
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
{% for admin in core.get_admins() %}
|
||||
|
||||
{% block entry %}
|
||||
|
||||
{% block entry_tag %} <article class='inline-row' id='{{ admin.id_admin }}'> {% endblock %}
|
||||
|
||||
{% block entry_name %} <span data-admin='{{ admin.id_admin }}' class='title'><span style='color: {{ core.theme }};'>{{ admin.username }}</span></span> {% endblock %}
|
||||
|
||||
{% block entry_mail %}
|
||||
|
||||
<span>
|
||||
<span>{{ admin.mail }}</span>
|
||||
</span>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block link_remove %}
|
||||
|
||||
<span>
|
||||
<span class='link_remove list' data-admin='{{ admin.id_admin }}'>{{ core.icon.remove | raw }}</span>
|
||||
</span>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
</article>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% endfor %}
|
|
@ -1,12 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace view\settings\password;
|
||||
|
||||
use \generic\core\i_view;
|
||||
|
||||
|
||||
class main extends i_view{
|
||||
|
||||
public function __construct(){}
|
||||
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
{% block form_tag %} <form class='search'> {% endblock %}
|
||||
|
||||
{% block input %}
|
||||
|
||||
<input id='old_pwd' type='password' placeholder="Code d'accès actuel"><br>
|
||||
<span class='error-msg old_pwd'></span><br>
|
||||
|
||||
<input id='new_pwd' type='password' placeholder="Nouveau code d'accès"><br>
|
||||
<span class='error-msg new_pwd'></span><br>
|
||||
|
||||
<input id='confirm_pwd' type='password' placeholder='Confirmation'><br>
|
||||
<span class='error-msg confirm_pwd'></span><br>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block submit %}
|
||||
|
||||
<button id='update_pwd'>Mettre à jour</button>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
</form>
|
|
@ -1,12 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace view\settings\view;
|
||||
|
||||
use \generic\core\i_view;
|
||||
|
||||
|
||||
class main extends i_view{
|
||||
|
||||
public function __construct(){}
|
||||
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
<span class='in-dev'>In development.. This feature will soon be available.</span>
|
|
@ -1,12 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace view\user\form\create;
|
||||
|
||||
use \generic\core\i_view;
|
||||
|
||||
|
||||
class main extends i_view{
|
||||
|
||||
public function __construct(){}
|
||||
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
{% block form_tag %} <form class='valid'> {% endblock %}
|
||||
|
||||
{% block input %}
|
||||
|
||||
<input id='create_code' type='text' placeholder='CO-DE-RF-ID'><br>
|
||||
<span class='error-msg create_code'></span><br>
|
||||
|
||||
<input id='create_username' type='text' placeholder='Username'><br>
|
||||
<span class='error-msg create_username'></span><br>
|
||||
|
||||
<input id='create_firstname' type='text' placeholder='Firstname'><br>
|
||||
<span class='error-msg create_firstname'></span><br>
|
||||
|
||||
<input id='create_lastname' type='text' placeholder='Lastname'><br>
|
||||
<span class='error-msg create_lastname'></span><br>
|
||||
|
||||
<input id='create_mail' type='text' placeholder='Mail'><br>
|
||||
<span class='error-msg create_mail'></span><br>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block submit %}
|
||||
|
||||
<button id='create_submit'>Créer</button>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
</form>
|
|
@ -1,12 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace view\user\form\edit;
|
||||
|
||||
use \generic\core\i_view;
|
||||
|
||||
|
||||
class main extends i_view{
|
||||
|
||||
public function __construct(){}
|
||||
|
||||
}
|
|
@ -1,55 +0,0 @@
|
|||
{% block form_tag %} <form class='neutral'> {% endblock %}
|
||||
|
||||
<!-- Recherche d'utilisateur -->
|
||||
{% block search %}
|
||||
|
||||
{% block search_input %}
|
||||
|
||||
<input id='edit_search_keyword' type='text' class='search' placeholder='Recherche...'><br>
|
||||
<input id='edit_search_id' type='hidden' value=''>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
<!-- Indice du resultat -->
|
||||
{% block search_submit %}
|
||||
|
||||
<span class='edit_search_view'>utilisateur <span class='edit_search_num'>0</span> sur <span class='edit_search_sum'>0</span></span><br><br>
|
||||
<button id='edit_search_submit' class='search'>Trouver/Suivant</button><br>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
<br><br><hr class='OR' data-label='PUIS' /><br><br>
|
||||
|
||||
<!-- Modification d'utilisateur -->
|
||||
{% block edit %}
|
||||
|
||||
{% block edit_input %}
|
||||
|
||||
<input id='edit_code' type='text' placeholder='CO-DE-RF-ID'><br>
|
||||
<span class='error-msg edit_code'></span><br>
|
||||
|
||||
<input id='edit_username' type='text' placeholder='Username'><br>
|
||||
<span class='error-msg edit_username'></span><br>
|
||||
|
||||
<input id='edit_firstname' type='text' placeholder='Firstname'><br>
|
||||
<span class='error-msg edit_firstname'></span><br>
|
||||
|
||||
<input id='edit_lastname' type='text' placeholder='Lastname'><br>
|
||||
<span class='error-msg edit_lastname'></span><br>
|
||||
|
||||
<input id='edit_mail' type='text' placeholder='Mail'><br>
|
||||
<span class='error-msg edit_mail'></span><br>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block edit_submit %}
|
||||
|
||||
<button id='edit_submit' disabled>Modifier</button>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
</form>
|
|
@ -1,12 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace view\user\form\remove;
|
||||
|
||||
use \generic\core\i_view;
|
||||
|
||||
|
||||
class main extends i_view{
|
||||
|
||||
public function __construct(){}
|
||||
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
{% block form_tag %} <form class='invalid'> {% endblock %}
|
||||
|
||||
<!-- Recherche d'utilisateur -->
|
||||
{% block search %}
|
||||
|
||||
{% block search_input %}
|
||||
|
||||
<input id='remove_search_keyword' type='text' class='search' placeholder='Recherche...'><br>
|
||||
<input id='remove_search_id' type='hidden' value=''>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
<!-- Indice du resultat -->
|
||||
{% block search_submit %}
|
||||
|
||||
<span class='remove_search_view'>utilisateur <span class='remove_search_num'>0</span> sur <span class='remove_search_sum'>0</span></span><br><br>
|
||||
<button id='remove_search_submit' class='search'>Trouver/Suivant</button><br>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
<br><br><hr class='OR' data-label='PUIS' /><br><br>
|
||||
|
||||
<!-- Suppression d'utilisateur -->
|
||||
{% block remove %}
|
||||
|
||||
{% block remove_input %}
|
||||
|
||||
<input id='remove_code' type='text' placeholder='Code'><br>
|
||||
<span class='error-msg remove_code'></span><br>
|
||||
|
||||
<input id='remove_username' type='text' placeholder='Username'><br>
|
||||
<span class='error-msg remove_username'></span><br>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block remove_submit %}
|
||||
|
||||
<button id='remove_submit' disabled>Supprimer</button>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
</form>
|
|
@ -1,68 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace view\user\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' ),
|
||||
'type' => file_get_contents( __PUBLIC__.'/src/static/container/type.svg' ),
|
||||
'group' => file_get_contents( __PUBLIC__.'/src/static/container/group.svg' )
|
||||
];
|
||||
|
||||
$this->theme = $_SESSION['WAREHOUSE']['theme'];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function get_clusters(){
|
||||
$request = new Request('clusterDefault/getAll', [
|
||||
'class' => 0
|
||||
]);
|
||||
|
||||
$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' => 0
|
||||
]);
|
||||
|
||||
$usersRes = $usersReq->dispatch();
|
||||
// si erreur, on affiche rien par défaut
|
||||
if( $usersRes->error->get() != Err::Success )
|
||||
return [];
|
||||
|
||||
return $usersRes->get('members');
|
||||
}
|
||||
|
||||
}
|
|
@ -1,65 +0,0 @@
|
|||
{% block search_bar %} <input type='text' class='searchbar' placeholder='Recherche'> {% endblock %}
|
||||
|
||||
{% block group_list %}
|
||||
|
||||
{% for cluster in core.get_clusters() %}
|
||||
|
||||
{% block group_card %}
|
||||
|
||||
{% block card_tag %} <article class='inline-box' id='{{ cluster.id_user_cluster }}'> {% endblock %}
|
||||
|
||||
{% set userlist = core.get_members(cluster.id_user_cluster) %}
|
||||
|
||||
{% block card_title %} <span class='title' style='color: {{ core.theme }}'>{{ cluster.name }}</span> {% endblock %}
|
||||
|
||||
{% block card_remove %} <span class='link_remove' data-cluster='{{ cluster.id_user_cluster }}'>{{ core.icon.remove | raw }}</span> {% endblock %}
|
||||
{% block card_edit %} <span class='link_edit' data-cluster='{{ cluster.id_user_cluster }}'>{{ core.icon.edit | raw }}</span> {% endblock %}
|
||||
|
||||
{% block card_count %}
|
||||
|
||||
<span class='code'>
|
||||
{{ core.icon.type | raw }}
|
||||
<span>{{ userlist | length }} utilisateurs</span>
|
||||
</span>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block card_members %}
|
||||
|
||||
<span class='groups'>
|
||||
{{ core.icon.group | raw }}
|
||||
|
||||
<span class='ignore'>
|
||||
{% for user in userlist %}
|
||||
|
||||
<span>
|
||||
{{ user.username }}
|
||||
<span class='rem-member' data-member='{{ user.id_user }}' data-cluster='{{ cluster.id_user_cluster }}'></span>
|
||||
</span>
|
||||
|
||||
{% endfor %}
|
||||
</span>
|
||||
|
||||
<span class='add-member' data-cluster='{{ cluster.id_user_cluster }}'>+</span>
|
||||
</span>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
</article>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{# if no result #}
|
||||
{% else %}
|
||||
|
||||
{% block no_result %}
|
||||
|
||||
<article class='inline-box'>
|
||||
<span>Aucun groupe utilisateur trouvé.</span>
|
||||
</article>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% endfor %}
|
||||
|
||||
{% endblock %}
|
|
@ -1,63 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace view\user\view;
|
||||
|
||||
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' ),
|
||||
'card' => file_get_contents( __PUBLIC__.'/src/static/container/card.svg' ),
|
||||
'mail' => file_get_contents( __PUBLIC__.'/src/static/container/mail.svg' ),
|
||||
'group' => file_get_contents( __PUBLIC__.'/src/static/container/group.svg' )
|
||||
];
|
||||
|
||||
$this->theme = $_SESSION['WAREHOUSE']['theme'];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function get_users(){
|
||||
$request = new Request('userDefault/getAll'); // On utilise la methode 'getAll' du module 'userDefault'
|
||||
$answer = $request->dispatch(); // On recupere la reponse
|
||||
|
||||
// si erreur, on affiche rien
|
||||
if( $answer->error->get() != Err::Success )
|
||||
return [];
|
||||
|
||||
return $answer->get('users');
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function get_clusters($id_user){
|
||||
$clustersReq = new Request('userDefault/getClusters', [ 'id_user' => $id_user ]);
|
||||
$clustersRes = $clustersReq->dispatch();
|
||||
|
||||
/* (2) Gestion si erreur */
|
||||
if( $clustersRes->error->get() != Err::Success )
|
||||
return [];
|
||||
|
||||
return $clustersRes->get('clusters');
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,80 +0,0 @@
|
|||
{% block search_bar %} <input type='text' class='searchbar' placeholder='Recherche'> {% endblock %}
|
||||
|
||||
{% block user_list %}
|
||||
|
||||
{% for user in core.get_users() %}
|
||||
|
||||
{% block user_card %}
|
||||
|
||||
{% block card_tag %} <article class='inline-box' id='{{ user.id_user }}'> {% endblock %}
|
||||
|
||||
{% block card_title %} <span class='title' style='color: {{ core.theme }}'>{{ user.firstname }} {{ user.lastname }} <span>#{{ user.username }}</span></span> {% endblock %}
|
||||
|
||||
{% block card_remove %} <span class='link_remove' data-user='{{ user.id_user }}'>{{ core.icon.remove | raw }}</span> {% endblock %}
|
||||
{% block card_edit %} <span class='link_edit' data-user='{{ user.id_user }}'>{{ core.icon.edit | raw }}</span> {% endblock %}
|
||||
|
||||
{% block card_code %}
|
||||
|
||||
<span class='code'>
|
||||
{{ core.icon.card | raw }}
|
||||
<span>{{ user.code }}</span>
|
||||
</span>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block card_mail %}
|
||||
|
||||
<span class='mail'>
|
||||
{{ core.icon.mail | raw }}
|
||||
|
||||
<a href='mailto:{{ user.mail }}'>
|
||||
<span>{{ user.mail }}</span>
|
||||
</a>
|
||||
</span>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block card_groups %}
|
||||
|
||||
<span class='groups'>
|
||||
{{ core.icon.group | raw }}
|
||||
|
||||
{% block group_list %}
|
||||
|
||||
<span class='ignore'>
|
||||
{% for cluster in core.get_clusters(user.id_user) %}
|
||||
|
||||
<span>
|
||||
{% block group_name %} {{ cluster.name }} {% endblock %}
|
||||
<span class='rem-group' data-group='{{ cluster.id_user_cluster }}' data-user='{{ user.id_user }}'></span>
|
||||
</span>
|
||||
|
||||
{% endfor %}
|
||||
</span>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
<span class='add-group' data-user='{{ user.id_user }}'>+</span>
|
||||
|
||||
</span>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
</article>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{# if no result #}
|
||||
{% else %}
|
||||
|
||||
{% block no_result %}
|
||||
|
||||
<article class='inline-box'>
|
||||
<span>Aucun utilisateur trouvé</span>
|
||||
</article>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% endfor %}
|
||||
|
||||
{% endblock %}
|
|
@ -42,7 +42,7 @@
|
|||
|
||||
/* [2] Define headers
|
||||
=========================================================*/
|
||||
$this->headers = self::getallheaders_adapter();
|
||||
$this->headers = \getallheaders();
|
||||
|
||||
|
||||
/* [3] Define default datasets (GET, POST)
|
||||
|
@ -201,30 +201,4 @@
|
|||
public function HEADERS(){ return $this->headers; }
|
||||
public function METHOD(){ return $this->method; }
|
||||
public function URI(){ return $this->uri; }
|
||||
|
||||
|
||||
private static function getallheaders_adapter(){
|
||||
/* (1) If exists -> use it
|
||||
---------------------------------------------------------*/
|
||||
if( function_exists('getallheaders') )
|
||||
return getallheaders();
|
||||
|
||||
/* (2) If does not (php-fpm)
|
||||
---------------------------------------------------------*/
|
||||
/* (1) init. variables */
|
||||
$fetched_headers = [];
|
||||
|
||||
/* (2) Get all headers from $_SERVER */
|
||||
foreach($_SERVER as $hname=>$hvalue ){
|
||||
|
||||
// {1} Store only if begins with 'HTTP_' //
|
||||
if( substr($hname,0,5) == 'HTTP_' )
|
||||
$fetched_headers[ str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($hname,5)))))] = $hvalue;
|
||||
|
||||
}
|
||||
|
||||
/* (3) Return created headers */
|
||||
return $fetched_headers;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -237,7 +237,7 @@
|
|||
/* [3] If `IN` condition
|
||||
=========================================================*/
|
||||
$defaultWhere = $this->where;
|
||||
$inCond = is_array($args[0]) && count($args[0]) > 1 && is_array($args[0][0]) && $args[0][1] == self::COND_IN;
|
||||
$inCond = count($args[0]) > 1 && is_array($args[0][0]) && $args[0][1] == self::COND_IN;
|
||||
|
||||
// erreur
|
||||
if( is_array($args[0][0]) && !$inCond )
|
||||
|
|
|
@ -132,10 +132,7 @@
|
|||
/* [1] On construit la requête
|
||||
=========================================================*/
|
||||
/* (1) Chamo */
|
||||
if( $value[1] == Rows::COND_LIKE ) // make LIKE lowercase
|
||||
$sql .= 'LOWER('.$field[0].'.'.$field[1].') ';
|
||||
else
|
||||
$sql .= $field[0].'.'.$field[1].' ';
|
||||
$sql .= $field[0].'.'.$field[1].' ';
|
||||
|
||||
/* (2) Opérateur */
|
||||
$sql .= substr($value[1], 2, -2).' ';
|
||||
|
|
|
@ -18,10 +18,6 @@ class Router{
|
|||
*
|
||||
*/
|
||||
public function __construct($url){
|
||||
// Format URI (ne doit pas avoir le premier '/')
|
||||
if( preg_match("@^/@", $url) )
|
||||
$url = substr($url, 1);
|
||||
|
||||
$this->url = $url;
|
||||
|
||||
// On initialise les routes
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace token\core;
|
||||
|
||||
class TreeTokenNull{
|
||||
|
||||
public function __construct(){}
|
||||
|
||||
public function init_parent(){ return true; }
|
||||
|
||||
public function init_child(){ return true; }
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,146 @@
|
|||
<?php
|
||||
|
||||
namespace viewer\core;
|
||||
|
||||
use \error\core\Error;
|
||||
use \error\core\Err;
|
||||
|
||||
class Viewer{
|
||||
|
||||
public $error;
|
||||
|
||||
|
||||
private $template;
|
||||
private $args;
|
||||
|
||||
private $view;
|
||||
|
||||
public static $htmlError = "<span class='error'>Une erreur est survenue, veuilez contacter le webmaster si cette erreur persiste.</span>";
|
||||
|
||||
|
||||
|
||||
/* INITIALISATION DE LA VUE VUE
|
||||
*
|
||||
* @template<String> Nom du modèle de la vue à utiliser
|
||||
* @args<Array> Données pour construire la vue à partir du modèle
|
||||
*
|
||||
*/
|
||||
public function __construct($template, $args){
|
||||
$this->error = new Error(Err::Success);
|
||||
|
||||
|
||||
// Si pas parametre manquant, on quitte
|
||||
if( $template == null ){
|
||||
$this->error = new Error(Err::MissingPath);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/* [1] On vérifie que le template existe
|
||||
=========================================================*/
|
||||
$templatePath = $this->checkPath($template);
|
||||
|
||||
if( $templatePath === false )
|
||||
return false;
|
||||
|
||||
|
||||
/* [2] On récupère le chemin du template et on l'enregistre
|
||||
=========================================================*/
|
||||
$this->template = $templatePath;
|
||||
|
||||
/* [3] On enregistre les paramètres
|
||||
=========================================================*/
|
||||
$this->args = $args;
|
||||
|
||||
|
||||
/* [4] On process la vue
|
||||
=========================================================*/
|
||||
$this->view = call_user_func(
|
||||
$this->template,
|
||||
$this->args
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* AFFICHE LA VUE CALCULEE
|
||||
*
|
||||
*/
|
||||
public function view(){
|
||||
echo $this->view;
|
||||
}
|
||||
|
||||
/* RETOURNE LA VUE CALCULEE
|
||||
*
|
||||
*/
|
||||
public function getView(){
|
||||
return $this->view;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* VERIFICATION DE L'EXISTENCE D'UN MODELE
|
||||
*
|
||||
* @template<String> Chemin du modèle
|
||||
*
|
||||
* @return status<Boolean> TRUE si le modèle existe, sinon FALSE
|
||||
*
|
||||
*/
|
||||
private function checkPath($template){
|
||||
/* [1] On vérifie le format
|
||||
=========================================================*/
|
||||
if( !preg_match('/^(\w+)\.(\w+)$/i', $template, $match) ){
|
||||
$this->error = new Error(Err::ParamError);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/* [2] On vérifie que le template existe
|
||||
=========================================================*/
|
||||
$class = '\\viewer\\view\\'.$match[1].'\\'.$match[2];
|
||||
$method = 'render';
|
||||
|
||||
/* (1) On vérifie que la classe existe */
|
||||
if( !class_exists($class) ){
|
||||
$this->error = new Error(Err::UnknownTemplate);
|
||||
return false;
|
||||
}
|
||||
|
||||
/* (2) On vérifie que la méthode existe */
|
||||
if( !method_exists($class, $method) ){
|
||||
$this->error = new Error(Err::UnknownTemplate);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/* [3] Si tout est bon, on renvoie les données
|
||||
=========================================================*/
|
||||
return [ $class, $method ];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// USE case
|
||||
//
|
||||
// $myView = new Viewer('templateParent.templateModel', [
|
||||
// 'myVar' => 1,
|
||||
// 'helloMsg' => 'Hello',
|
||||
// ]);
|
||||
//
|
||||
// $myView->view();
|
||||
//
|
||||
|
||||
|
||||
?>
|
|
@ -0,0 +1,52 @@
|
|||
<?php
|
||||
|
||||
namespace viewer\view\group;
|
||||
use \api\core\Request;
|
||||
use \error\core\Error;
|
||||
use \error\core\Err;
|
||||
use \api\core\Authentification;
|
||||
|
||||
class group_choice{
|
||||
|
||||
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_theme' => $_SESSION['WAREHOUSE']['theme']
|
||||
];
|
||||
|
||||
/* [3] Store functions
|
||||
=========================================================*/
|
||||
$twig->addFunction(new \Twig_Function('f_clusters', function($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');
|
||||
}));
|
||||
|
||||
|
||||
/* [4] Build the whole stuff
|
||||
=========================================================*/
|
||||
return $twig->render('group/group_choice.twig', [
|
||||
'p_icon' => $variables['p_icon'],
|
||||
'p_theme' => $variables['p_theme']
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
|
@ -0,0 +1,16 @@
|
|||
<form class='neutral' action='' method='POST' id='choose-cluster'>
|
||||
<select data-name='cluster'>
|
||||
<option value='.' selected disabled>Groupe à modifier</option>
|
||||
|
||||
{% for user_cluster in f_clusters(0) %}
|
||||
<option value='u{{ user_cluster.id_user_cluster }}'>{{ user_cluster.name }} (utilisateur)</option>
|
||||
{% endfor %}
|
||||
|
||||
{% for machine_cluster in f_clusters(1) %}
|
||||
<option value='m{{ machine_cluster.id_machine_cluster }}'>{{ machine_cluster.name }} (machine)</option>
|
||||
{% endfor %}
|
||||
|
||||
</select>
|
||||
|
||||
<button id='choose-cluster'>Modifier la composition</button>
|
||||
</form>
|
|
@ -0,0 +1,138 @@
|
|||
<?php
|
||||
|
||||
namespace viewer\view\group;
|
||||
use \viewer\core\Viewer;
|
||||
use \api\core\Request;
|
||||
use \error\core\Err;
|
||||
use \error\core\Error;
|
||||
use \api\core\Authentification;
|
||||
|
||||
class members_choice{
|
||||
|
||||
public static function render($params){
|
||||
/* [1] On vérifie le type de groupe (user/machine)
|
||||
=========================================================*/
|
||||
/* (1) On vérifie les paramètres */
|
||||
if( !isset($params['id_cluster']) || !is_numeric($params['id_cluster']) || !isset($params['class']) || !is_numeric($params['class']) )
|
||||
return Viewer::$htmlError;
|
||||
|
||||
/* (2) On récupère le groupe */
|
||||
$checktypeRequest = new Request('clusterDefault/getById', [
|
||||
'id_cluster' => $params['id_cluster'],
|
||||
'class' => $params['class']
|
||||
]);
|
||||
$checktypeResponse = $checktypeRequest->dispatch();
|
||||
|
||||
/* (3) Si on ne le trouve pas, on retourne une erreur */
|
||||
if( $checktypeResponse->error->get() != Err::Success )
|
||||
return Viewer::$htmlError;
|
||||
|
||||
/* (4) On récupère les données du groupe */
|
||||
$currentCluster = $checktypeResponse->get('cluster');
|
||||
|
||||
|
||||
/* [2] Init Twig
|
||||
=========================================================*/
|
||||
$loader = new \Twig_Loader_Filesystem(__BUILD__.'/viewer/view');
|
||||
$twig = new \Twig_Environment($loader, []);
|
||||
|
||||
|
||||
/* [3] Store variables
|
||||
=========================================================*/
|
||||
$variables = [
|
||||
'p_id_cluster' => $params['id_cluster'],
|
||||
'p_class' => $params['class'],
|
||||
'p_name' => $currentCluster['name'],
|
||||
'p_theme' => $_SESSION['WAREHOUSE']['theme']
|
||||
];
|
||||
|
||||
/* [4] Store functions
|
||||
=========================================================*/
|
||||
$twig->addFunction(new \Twig_Function('f_members', function($id_cluster, $class){
|
||||
/* [1] On récupère les membres
|
||||
=========================================================*/
|
||||
|
||||
/* (1) On exécute la requête */
|
||||
$getmembersRequest = new Request('clusterDefault/getMembers', [
|
||||
'id_cluster' => $id_cluster,
|
||||
'class' => $class
|
||||
]);
|
||||
$getmembersResponse = $getmembersRequest->dispatch();
|
||||
|
||||
/* (2) Si erreur, on retourne rien par défaut */
|
||||
if( $getmembersResponse->error->get() != Err::Success )
|
||||
return [];
|
||||
|
||||
/* (3) On récupère la liste des UID uniquement */
|
||||
$members_ids = [];
|
||||
foreach($getmembersResponse->get('members') as $member)
|
||||
$members_ids[] = ($class==0) ? $member['id_user'] : $member['id_machine'];
|
||||
|
||||
|
||||
/* [2] On récupère les utilisateurs non membres
|
||||
=========================================================*/
|
||||
/* (1) On récupère les utilisateurs */
|
||||
if( $class == 0 ){
|
||||
|
||||
/* (2) On exécute la requête */
|
||||
$getusersRequest = new Request('userDefault/getAll');
|
||||
// On recupere la reponse
|
||||
$getusersResponse = $getusersRequest->dispatch();
|
||||
|
||||
/* (3) si erreur, on affiche l'explicitation */
|
||||
if( $getusersResponse->error->get() != Err::Success )
|
||||
return [];
|
||||
|
||||
/* (4) On récupère la liste des utilisateurs */
|
||||
$users = $getusersResponse->get('users');
|
||||
|
||||
/* (5) On ajoute s'ils sont dans le groupe ou non */
|
||||
foreach($users as $u=>$user)
|
||||
$users[$u]['already'] = in_array($user['id_user'], $members_ids);
|
||||
return $users;
|
||||
|
||||
|
||||
/* [3] On récupère les machines non membres
|
||||
=========================================================*/
|
||||
/* (1) On récupère les machines */
|
||||
}else{
|
||||
|
||||
/* (2) On exécute la requête */
|
||||
$getmachinesRequest = new Request('machineDefault/getAll');
|
||||
// On recupere la reponse
|
||||
$getmachinesResponse = $getmachinesRequest->dispatch();
|
||||
|
||||
/* (3) si erreur, on affiche l'explicitation */
|
||||
if( $getmachinesResponse->error->get() != Err::Success )
|
||||
return [];
|
||||
|
||||
/* (4) On récupère la liste des machines */
|
||||
$machines = $getmachinesResponse->get('machines');
|
||||
|
||||
/* (5) On ajoute s'ils sont dans le groupe ou non */
|
||||
foreach($machines as $u=>$machine)
|
||||
$machines[$u]['already'] = in_array($machine['id_machine'], $members_ids);
|
||||
|
||||
return $machines;
|
||||
}
|
||||
|
||||
|
||||
}));
|
||||
|
||||
|
||||
|
||||
/* [5] Build the whole stuff
|
||||
=========================================================*/
|
||||
return $twig->render('group/members_choice.twig', [
|
||||
'p_class' => $variables['p_class'],
|
||||
'p_name' => $variables['p_name'],
|
||||
'p_id_cluster' => $variables['p_id_cluster'],
|
||||
'p_theme' => $variables['p_theme']
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
|
@ -0,0 +1,50 @@
|
|||
<span style='text-align:center; color: #666; text-decoration: underline; cursor: pointer;' id='members-change-group'>Modifier un autre groupe</span>
|
||||
<p></p>
|
||||
|
||||
<article class='check-table'>
|
||||
<input type='hidden' id='members-member-idcluster' value='{{ p_id_cluster }}'>
|
||||
<input type='hidden' id='members-member-class' value='{{ p_class }}'>
|
||||
|
||||
<div>
|
||||
|
||||
{# USER HEADER #}
|
||||
{% if p_class == 0 %}
|
||||
<span><strong>Identifiant</strong></span>
|
||||
<span><strong>Nom</strong></span>
|
||||
<span><strong>Code RFID</strong></span>
|
||||
{# MACHINE HEADER #}
|
||||
{% else %}
|
||||
<span><strong>Nom</strong></span>
|
||||
{% endif %}
|
||||
<span><strong>Membre de <u>{{ p_name }}</u></strong></span>
|
||||
</div>
|
||||
|
||||
|
||||
{% for member in f_members(p_id_cluster, p_class) %}
|
||||
|
||||
{# USER ENTRIES #}
|
||||
{% if p_class == 0 %}
|
||||
<div>
|
||||
<span>{{ member.username }}</span>
|
||||
<span>{{ member.firstname }} {{ member.lastname }}</span>
|
||||
<span>{{ member.code }}</span>
|
||||
<span>
|
||||
<input type='checkbox' value='{{ member.id_user }}' data-name='members' id='checkbox_{{ member.id_user }}' {% if member.already %}checked{% endif %}>
|
||||
<label for='checkbox_{{ member.id_user }}'></label>
|
||||
</span>
|
||||
|
||||
</div>
|
||||
{# MACHINE ENTRIES #}
|
||||
{% else %}
|
||||
<div>
|
||||
<span>{{ member.name }}</span>
|
||||
<span>
|
||||
<input type='checkbox' value='{{ member.id_machine }}' data-name='members' id='checkbox_{{ member.id_machine }}' {% if member.already %}checked{% endif %}>
|
||||
<label for='checkbox_{{ member.id_machine }}'></label>
|
||||
</span>
|
||||
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% endfor %}
|
||||
</article>
|
|
@ -0,0 +1,126 @@
|
|||
<?php
|
||||
|
||||
namespace viewer\view\group;
|
||||
use \viewer\core\Viewer;
|
||||
use \api\core\Request;
|
||||
use \api\core\Authentification;
|
||||
use \error\core\Err;
|
||||
use \error\core\Error;
|
||||
|
||||
class permission{
|
||||
|
||||
public static function render(){
|
||||
debug();
|
||||
/* [1] Init Twig
|
||||
=========================================================*/
|
||||
$loader = new \Twig_Loader_Filesystem(__BUILD__.'/viewer/view');
|
||||
$twig = new \Twig_Environment($loader, []);
|
||||
|
||||
|
||||
/* [2] Store variables
|
||||
=========================================================*/
|
||||
$variables = [
|
||||
'p_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' ),
|
||||
'permission' => file_get_contents( __PUBLIC__.'/src/static/sub-menu-side/permission.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_nbmachines', function($id_cluster){
|
||||
$machineReq = new Request('clusterDefault/getMembers', [
|
||||
'id_cluster' => (int) $id_cluster,
|
||||
'class' => 1
|
||||
]);
|
||||
|
||||
$machineRes = $machineReq->dispatch();
|
||||
|
||||
// si erreur, on affiche rien par défaut
|
||||
if( $machineRes->error->get() != Err::Success )
|
||||
return [];
|
||||
|
||||
return count($machineRes->get('members'));
|
||||
}));
|
||||
|
||||
$twig->addFunction(new \Twig_Function('f_permissions', function(){
|
||||
$permReq = new Request('clusterDefault/getPermissions', []);
|
||||
|
||||
$permRes = $permReq->dispatch();
|
||||
|
||||
// si erreur, on affiche rien par défaut
|
||||
if( $permRes->error->get() != Err::Success )
|
||||
return [];
|
||||
|
||||
return $permRes->get('permissions');
|
||||
}));
|
||||
|
||||
$twig->addFunction(new \Twig_Function('f_userclusters', function($id_cluster, $id_permission){
|
||||
$ucReq = new Request('clusterDefault/getAuthenticatedClusters', [
|
||||
'id_target' => $id_cluster,
|
||||
'id_action' => $id_permission
|
||||
]);
|
||||
|
||||
$ucRes = $ucReq->dispatch();
|
||||
|
||||
// si erreur, on affiche rien par défaut
|
||||
if( $ucRes->error->get() != Err::Success )
|
||||
return [];
|
||||
|
||||
return $ucRes->get('clusters');
|
||||
}));
|
||||
|
||||
$twig->addFilter(new \Twig_Filter('translate', function($word, $lang){
|
||||
$word = strtolower($word);
|
||||
|
||||
|
||||
if( $lang === 'fr' ){
|
||||
|
||||
switch($word){
|
||||
case 'start': return 'démarrer'; break;
|
||||
case 'stop': return 'arrêter'; break;
|
||||
case 'signal': return 'signaler'; break;
|
||||
case 'lock': return 'bloquer'; break;
|
||||
case 'unlock': return 'débloquer'; break;
|
||||
case 'unsignal': return 'désignaler'; break;
|
||||
|
||||
default: return 'inconnu'; break;
|
||||
}
|
||||
}else
|
||||
return $word;
|
||||
|
||||
}));
|
||||
|
||||
|
||||
/* [4] Build the whole stuff
|
||||
=========================================================*/
|
||||
return $twig->render('group/permission.twig', [
|
||||
'p_icon' => $variables['p_icon'],
|
||||
'p_theme' => $variables['p_theme']
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
|
@ -0,0 +1,50 @@
|
|||
<input type='text' class='searchbar' placeholder='Recherche'>
|
||||
|
||||
{% for machine_cluster in f_clusters() %}
|
||||
<article class='inline-box' id='{{ machine_cluster.id_machine_cluster }}'>
|
||||
|
||||
{% set nbmachines = f_nbmachines(machine_cluster.id_machine_cluster) %}
|
||||
|
||||
<span class='title' style='color: {{ p_theme }}'>{{ machine_cluster.name }}</span>
|
||||
{# <span class='link_remove' data-cluster='{{ machine_cluster.id_machine_cluster }}'>{{ p_icon.remove | raw }}</span>
|
||||
|
||||
<span class='link_edit' data-cluster='{{ machine_cluster.id_machine_cluster }}'>{{ p_icon.edit | raw }}</span> #}
|
||||
|
||||
<span class='code'>
|
||||
{{ p_icon.device | raw }}
|
||||
<span>{{ nbmachines }} machines</span>
|
||||
</span>
|
||||
|
||||
|
||||
{% for permission in f_permissions() %}
|
||||
|
||||
<span class='groups'>
|
||||
<span style='border-color: #ddd; background-color: #eee;'>
|
||||
{{ permission.name | translate('fr') }}
|
||||
<span class='icon-permission'></span>
|
||||
</span>
|
||||
|
||||
<span class='ignore'>
|
||||
{% for user_cluster in f_userclusters(machine_cluster.id_machine_cluster,permission.id_permission) %}
|
||||
<span>
|
||||
{{ user_cluster.name }}
|
||||
<span class='rem-permission' data-permission='{{ permission.id_permission }}' data-source='{{ user_cluster.id_user_cluster }}' data-target='{{ machine_cluster.id_machine_cluster }}'></span>
|
||||
</span>
|
||||
{% endfor %}
|
||||
</span>
|
||||
|
||||
<span class='add-permission' data-target='{{ machine_cluster.id_machine_cluster }}' data-permission='{{ permission.id_permission }}'>+</span>
|
||||
</span>
|
||||
|
||||
{% endfor %}
|
||||
|
||||
</article>
|
||||
|
||||
{# if no result #}
|
||||
{% else %}
|
||||
|
||||
<article class='inline-box'>
|
||||
<span>Aucun groupe trouvé.</span>
|
||||
</article>
|
||||
|
||||
{% endfor %}
|
|
@ -0,0 +1,90 @@
|
|||
<?php
|
||||
|
||||
namespace viewer\view\group;
|
||||
use \api\core\Request;
|
||||
use \api\core\Authentification;
|
||||
use \error\core\Err;
|
||||
use \error\core\Error;
|
||||
|
||||
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' => [
|
||||
'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' )
|
||||
],
|
||||
|
||||
'p_theme' => $_SESSION['WAREHOUSE']['theme']
|
||||
];
|
||||
|
||||
/* [3] Store functions
|
||||
=========================================================*/
|
||||
$twig->addFunction(new \Twig_Function('f_clusters', function($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');
|
||||
}));
|
||||
|
||||
$twig->addFunction(new \Twig_Function('f_members', function($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');
|
||||
}));
|
||||
|
||||
$twig->addFunction(new \Twig_Function('f_options', function($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');
|
||||
}));
|
||||
|
||||
|
||||
/* [4] Build the whole stuff
|
||||
=========================================================*/
|
||||
return $twig->render('group/view.twig', [
|
||||
'p_icon' => $variables['p_icon'],
|
||||
'p_theme' => $variables['p_theme']
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
|
@ -0,0 +1,101 @@
|
|||
<input type='text' class='searchbar' placeholder='Recherche'>
|
||||
|
||||
{% set noresult = true %}
|
||||
|
||||
{% for user_cluster in f_clusters(0) %}
|
||||
|
||||
{% set noresult = false %}
|
||||
|
||||
{% set id_user_cluster = 'u' ~ user_cluster.id_user_cluster %}
|
||||
{% set memlen = f_members(user_cluster.id_user_cluster,0) | length %}
|
||||
|
||||
<article class='inline-box' id='{{ id_user_cluster }}'>
|
||||
|
||||
<span class='title' style='color: {{ p_theme }}'>{{ user_cluster.name }}</span>
|
||||
<span class='link_remove' data-cluster='{{ id_user_cluster }}'>{{ p_icon.remove | raw }}</span>
|
||||
|
||||
<span class='link_edit' data-cluster='{{ id_user_cluster }}'>{{ p_icon.edit | raw }}</span>
|
||||
|
||||
<span class='code'>
|
||||
{{ p_icon.user | raw }}
|
||||
<span>{{ memlen }} utilisateur{% if memlen > 1 %}s{% endif %}</span>
|
||||
</span>
|
||||
|
||||
|
||||
<span class='groups'>
|
||||
{{ p_icon.group | raw }}
|
||||
|
||||
<span class='ignore'>
|
||||
{% for user in f_members(user_cluster.id_user_cluster, 0) %}
|
||||
<span>
|
||||
{{ user.username }}
|
||||
<span class='rem-member' data-member='{{ user.id_user }}' data-cluster='{{ id_user_cluster }}'></span>
|
||||
</span>
|
||||
{% endfor %}
|
||||
</span>
|
||||
|
||||
<span class='add-member' data-cluster='{{ id_user_cluster }}'>+</span>
|
||||
</span>
|
||||
|
||||
</article>
|
||||
{% endfor %}
|
||||
|
||||
|
||||
{% for machine_cluster in f_clusters(1) %}
|
||||
|
||||
{% set noresult = false %}
|
||||
|
||||
{% set id_machine_cluster = 'm' ~ machine_cluster.id_machine_cluster %}
|
||||
{% set memlen = f_members(machine_cluster.id_machine_cluster,1) | length %}
|
||||
|
||||
<article class='inline-box' id='{{ id_machine_cluster }}'>
|
||||
|
||||
<span class='title' style='color: {{ p_theme }}'>{{ machine_cluster.name }}</span>
|
||||
<span class='link_remove' data-cluster='{{ id_machine_cluster }}'>{{ p_icon.remove | raw }}</span>
|
||||
|
||||
<span class='link_edit' data-cluster='{{ id_machine_cluster }}'>{{ p_icon.edit | raw }}</span>
|
||||
|
||||
<span class='code'>
|
||||
{{ p_icon.device | raw }}
|
||||
<span>{{ memlen }} machine{% if memlen > 1 %}s{% endif %}</span>
|
||||
</span>
|
||||
|
||||
<span class='option'>
|
||||
{{ p_icon.option | raw }}
|
||||
{% for option in f_options(machine_cluster.id_machine_cluster) %}
|
||||
<span class='ignore'>
|
||||
<span>{{ option.name }}:{{ option.daemon }}</span>
|
||||
</span>
|
||||
{% else %}
|
||||
<span class='ignore'>Aucune option</span>
|
||||
{% endfor %}
|
||||
</span>
|
||||
|
||||
<span class='groups'>
|
||||
{{ p_icon.group | raw }}
|
||||
|
||||
<span class='ignore'>
|
||||
{% for machine in f_members(machine_cluster.id_machine_cluster,1) %}
|
||||
<span>
|
||||
{{ machine.name }}
|
||||
<span class='rem-member' data-member='{{ machine.id_machine }}' data-cluster='{{ id_machine_cluster }}'></span>
|
||||
</span>
|
||||
{% endfor %}
|
||||
</span>
|
||||
|
||||
<span class='add-member' data-cluster='{{ id_machine_cluster }}'>+</span>
|
||||
</span>
|
||||
|
||||
</article>
|
||||
|
||||
{% endfor %}
|
||||
|
||||
|
||||
{# if no result #}
|
||||
{% if noresult %}
|
||||
|
||||
<article class='inline-box'>
|
||||
<span>Aucun groupe trouvé</span>
|
||||
</article>
|
||||
|
||||
{% endif %}
|
|
@ -0,0 +1,129 @@
|
|||
<?php
|
||||
|
||||
namespace viewer\view\history;
|
||||
|
||||
use \api\core\Request;
|
||||
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_theme' => $_SESSION['WAREHOUSE']['theme']
|
||||
];
|
||||
|
||||
/* [3] Store functions
|
||||
=========================================================*/
|
||||
$twig->addFunction(new \Twig_Function('f_history', function(){
|
||||
$req = new Request('historyDefault/getAll', []);
|
||||
|
||||
$res = $req->dispatch();
|
||||
|
||||
// si erreur, on retourne rien par défaut
|
||||
if( $res->error->get() != Err::Success )
|
||||
return [];
|
||||
|
||||
return $res->get('history');
|
||||
}));
|
||||
|
||||
|
||||
$twig->addFilter(new \Twig_Filter('f_tsformat', function($ts){
|
||||
date_default_timezone_set('Europe/Paris');
|
||||
return date('d/m/Y H:i:s', $ts);
|
||||
}));
|
||||
|
||||
|
||||
$twig->addFilter(new \Twig_Filter('f_tsrelative', function($ts){
|
||||
$r = self::relativetime($ts);
|
||||
|
||||
// if only one
|
||||
$o = $r[0] <= 1;
|
||||
|
||||
switch($r[1]){
|
||||
|
||||
case 'Y': return $r[0].' an'.($o?'':'s'); break;
|
||||
case 'm': return $r[0].' mois'; break;
|
||||
case 'd': return $r[0].' jour'.($o?'':'s'); break;
|
||||
|
||||
case 'H': return $r[0].' heure'.($o?'':'s'); break;
|
||||
case 'i': return $r[0].' minute'.($o?'':'s'); break;
|
||||
case 's': return $r[0].' seconde'.($o?'':'s'); break;
|
||||
|
||||
default: return 'peu de temps'; break;
|
||||
}
|
||||
}));
|
||||
|
||||
/* [4] Build the whole stuff
|
||||
=========================================================*/
|
||||
return $twig->render('history/view.twig', [
|
||||
'p_theme' => $variables['p_theme']
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* RETURNS A RELATIVE HUMAN-READABLE TIME
|
||||
*
|
||||
* @ts<int> Timestamp to process
|
||||
*
|
||||
* @return relative<Array> human-readable relative time [value, unit]
|
||||
*
|
||||
*/
|
||||
private static function relativetime($ts){
|
||||
|
||||
/* [1] Explode time into human-readable time units
|
||||
=========================================================*/
|
||||
$units = [];
|
||||
|
||||
/* (1) Date units */
|
||||
$units['year'] = (int) date('Y', $ts);
|
||||
$units['month'] = (int) date('m', $ts);
|
||||
$units['day'] = (int) date('d', $ts);
|
||||
|
||||
/* (2) Time units */
|
||||
$units['hour'] = (int) date('H', $ts);
|
||||
$units['minute'] = (int) date('i', $ts);
|
||||
$units['second'] = (int) date('s', $ts);
|
||||
|
||||
|
||||
/* [2] Calculate relative time for each unit
|
||||
=========================================================*/
|
||||
/* (1) Date units */
|
||||
$units['year'] = intval(date('Y')) - $units['year'];
|
||||
$units['month'] = intval(date('m')) - $units['month'];
|
||||
$units['day'] = intval(date('d')) - $units['day'];
|
||||
|
||||
/* (2) Time units */
|
||||
$units['hour'] = intval(date('H')) - $units['hour'];
|
||||
$units['minute'] = intval(date('i')) - $units['minute'];
|
||||
$units['second'] = intval(date('s')) - $units['second'];
|
||||
|
||||
|
||||
/* [3] Return significative relative time
|
||||
=========================================================*/
|
||||
/* (1) Date units */
|
||||
if( $units['year'] > 0 ) return [ $units['year'], 'Y' ];
|
||||
if( $units['month'] > 0 ) return [ $units['month'], 'm' ];
|
||||
if( $units['day'] > 0 ) return [ $units['day'], 'd' ];
|
||||
|
||||
/* (2) Time units */
|
||||
if( $units['hour'] > 0 ) return [ $units['hour'], 'H' ];
|
||||
if( $units['minute'] > 0 ) return [ $units['minute'], 'i' ];
|
||||
if( $units['second'] > 0 ) return [ $units['second'], 's' ];
|
||||
|
||||
/* (3) Default value */
|
||||
return [0, '.'];
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
<input type='text' class='searchbar' placeholder='Recherche'>
|
||||
|
||||
|
||||
|
||||
{% for entry in f_history() %}
|
||||
|
||||
|
||||
{% if loop.index == 1 %}
|
||||
|
||||
<article class='inline-row' style='border: 0; box-shadow: none;background: transparent;'>
|
||||
<span>Machine</span>
|
||||
<span>Dernière utilisation</span>
|
||||
<span>Utilisateur</span>
|
||||
<span>Action</span>
|
||||
<span>Historique détaillé</span>
|
||||
</article>
|
||||
|
||||
{% endif %}
|
||||
|
||||
<article class='inline-row' id='{{ entry.id_history }}'>
|
||||
|
||||
<span data-machine='{{ entry.id_machine }}' class='title'><span>#{{ entry.machine_name }}</span></span>
|
||||
|
||||
<span>
|
||||
<span>{{ entry.timestamp | f_tsformat }}</span>
|
||||
<span style='color:#aaa;'>Il y a {{ entry.timestamp | f_tsrelative }}</span>
|
||||
</span>
|
||||
|
||||
|
||||
<span data-user='{{ entry.id_user }}'>
|
||||
<span>{{ entry.user_name }}</span>
|
||||
<span style='color:#aaa;'>{{ entry.user_firstname }} {{ entry.user_lastname }}</span>
|
||||
</span>
|
||||
|
||||
<span>
|
||||
<span>{{ entry.action_name }}</span>
|
||||
</span>
|
||||
|
||||
<span>
|
||||
<button class='search' data-details='{{ entry.id_history }}'>Détails</button>
|
||||
</span>
|
||||
|
||||
</article>
|
||||
{% endfor %}
|
|
@ -0,0 +1,91 @@
|
|||
<?php
|
||||
|
||||
namespace viewer\view\machine;
|
||||
use \viewer\core\Viewer;
|
||||
use \api\core\Request;
|
||||
use \api\core\Authentification;
|
||||
use \error\core\Error;
|
||||
use \error\core\Err;
|
||||
|
||||
class groups{
|
||||
|
||||
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' => [
|
||||
'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' )
|
||||
],
|
||||
|
||||
'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_machines', function($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');
|
||||
}));
|
||||
|
||||
$twig->addFunction(new \Twig_Function('f_options', function($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');
|
||||
}));
|
||||
|
||||
|
||||
/* [4] Build the whole stuff
|
||||
=========================================================*/
|
||||
return $twig->render('machine/groups.twig', [
|
||||
'p_icon' => $variables['p_icon'],
|
||||
'p_theme' => $variables['p_theme']
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
|
@ -0,0 +1,54 @@
|
|||
<input type='text' class='searchbar' placeholder='Recherche'>
|
||||
|
||||
{% for cluster in f_clusters() %}
|
||||
<article class='inline-box' id='{{ cluster.id_machine_cluster }}'>
|
||||
|
||||
{% set machinelist = f_machines(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>{{ machinelist | length }} machines</span>
|
||||
</span>
|
||||
|
||||
|
||||
<span class='option'>
|
||||
{{ p_icon.option | raw }}
|
||||
{% for option in f_options(cluster.id_machine_cluster) %}
|
||||
<span class='ignore'>
|
||||
<span>{{ option.name }}:{{ option.daemon }}</span>
|
||||
</span>
|
||||
{% else %}
|
||||
<span class='ignore'>Aucune option</span>
|
||||
{% endfor %}
|
||||
</span>
|
||||
|
||||
<span class='groups'>
|
||||
{{ p_icon.group | raw }}
|
||||
|
||||
<span class='ignore'>
|
||||
{% for machine in machinelist %}
|
||||
<span>
|
||||
{{ machine.name }}
|
||||
<span class='rem-member' data-member='{{ machine.id_machine }}' 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 %}
|
|
@ -0,0 +1,102 @@
|
|||
<?php
|
||||
|
||||
namespace viewer\view\machine;
|
||||
use \viewer\core\Viewer;
|
||||
use \api\core\Request;
|
||||
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' => [
|
||||
'remove' => file_get_contents( __PUBLIC__.'/src/static/sub-menu-side/remove.svg' ),
|
||||
'edit' => file_get_contents( __PUBLIC__.'/src/static/sub-menu-side/edit.svg' ),
|
||||
'group' => file_get_contents( __PUBLIC__.'/src/static/container/group.svg' ),
|
||||
'motor' => file_get_contents( __PUBLIC__.'/src/static/container/motor.svg' )
|
||||
],
|
||||
|
||||
'p_theme' => $_SESSION['WAREHOUSE']['theme']
|
||||
];
|
||||
|
||||
/* [3] Store functions
|
||||
=========================================================*/
|
||||
$twig->addFunction(new \Twig_Function('f_machines', function(){
|
||||
$request = new Request('machineDefault/getAll'); // On utilise la methode 'getAll' du module 'machineDefault'
|
||||
$answer = $request->dispatch(); // On recupere la reponse
|
||||
|
||||
// si erreur, on affiche rien par défaut
|
||||
if( $answer->error->get() != Err::Success )
|
||||
return [];
|
||||
|
||||
return $answer->get('machines');
|
||||
}));
|
||||
|
||||
$twig->addFunction(new \Twig_Function('f_getstate', function($id_machine){
|
||||
/* (1) Write / Execute request */
|
||||
$req = new Request('machineDefault/getState', ['id_machine' => $id_machine]);
|
||||
$res = $req->dispatch();
|
||||
|
||||
/* (2) Manage error */
|
||||
if( $res->error->get() != Err::Success )
|
||||
return 'detached';
|
||||
|
||||
return $res->get('state');
|
||||
}));
|
||||
|
||||
$twig->addFunction(new \Twig_Function('f_clusters', function($id_machine){
|
||||
$request = new Request('machineDefault/getClusters', [
|
||||
'id_machine' => (int) $id_machine
|
||||
]);
|
||||
|
||||
$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_motheure', function($id_machine){
|
||||
/* (1) Get its machine_clusters
|
||||
---------------------------------------------------------*/
|
||||
/* (1) Create request */
|
||||
$motheureReq = new Request('motheure/getCount', ['id_machine' => $id_machine]);
|
||||
|
||||
/* (2) Execute */
|
||||
$motheureRes = $motheureReq->dispatch();
|
||||
|
||||
/* (3) Manage error */
|
||||
if( $motheureRes->error->get() != Err::Success )
|
||||
return null;
|
||||
|
||||
|
||||
return $motheureRes->get('count');
|
||||
|
||||
}));
|
||||
|
||||
|
||||
/* [4] Build the whole stuff
|
||||
=========================================================*/
|
||||
return $twig->render('machine/view.twig', [
|
||||
'p_icon' => $variables['p_icon'],
|
||||
'p_theme' => $variables['p_theme']
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
|
@ -0,0 +1,45 @@
|
|||
<input type='text' class='searchbar' placeholder='Recherche'>
|
||||
|
||||
{% for machine in f_machines() %}
|
||||
<article class='inline-box' id='{{ machine.id_machine }}'>
|
||||
|
||||
<span class='state' data-state='{{ f_getstate(machine.id_machine) }}'></span>
|
||||
<span class='title' style='color: {{ p_theme }}' title='{{ machine.ap | default('?') }} ({{ machine.ip | default('?') }})'>{{ machine.name }} <span>#{{ machine.name }}</span></span>
|
||||
<span class='link_remove' data-machine='{{ machine.id_machine }}'>{{ p_icon.remove | raw }}</span>
|
||||
|
||||
<span class='link_edit' data-machine='{{ machine.id_machine }}'>{{ p_icon.edit | raw }}</span>
|
||||
|
||||
{# List etrees #}
|
||||
{% set motheure = f_motheure(machine.id_machine) %}
|
||||
|
||||
{% if motheure %}
|
||||
<span class='motheure'>
|
||||
{{ p_icon.motor | raw }}
|
||||
<span>{{ motheure }}</span>ms
|
||||
</span>
|
||||
{% endif %}
|
||||
|
||||
<span class='groups'>
|
||||
{{ p_icon.group | raw }}
|
||||
|
||||
<span class='ignore'>
|
||||
{% for cluster in f_clusters(machine.id_machine) %}
|
||||
<span>
|
||||
{{ cluster.name }}
|
||||
<span class='rem-group' data-group='{{ cluster.id_machine_cluster }}' data-machine='{{ machine.id_machine }}'></span>
|
||||
</span>
|
||||
{% endfor %}
|
||||
</span>
|
||||
|
||||
<span class='add-group' data-machine='{{ machine.id_machine }}'>+</span>
|
||||
</span>
|
||||
|
||||
</article>
|
||||
|
||||
{# if no result #}
|
||||
{% else %}
|
||||
|
||||
<article class='inline-box'>
|
||||
<span>Aucune machine trouvée</span>
|
||||
</article>
|
||||
{% endfor %}
|
|
@ -0,0 +1,84 @@
|
|||
<?php
|
||||
|
||||
namespace viewer\view\user;
|
||||
use \viewer\core\Viewer;
|
||||
use \api\core\Request;
|
||||
use \api\core\Authentification;
|
||||
use \error\core\Error;
|
||||
use \error\core\Err;
|
||||
|
||||
class groups{
|
||||
|
||||
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' => [
|
||||
'remove' => file_get_contents( __PUBLIC__.'/src/static/sub-menu-side/remove.svg' ),
|
||||
'edit' => file_get_contents( __PUBLIC__.'/src/static/sub-menu-side/edit.svg' ),
|
||||
'type' => file_get_contents( __PUBLIC__.'/src/static/container/type.svg' ),
|
||||
'group' => file_get_contents( __PUBLIC__.'/src/static/container/group.svg' )
|
||||
],
|
||||
|
||||
'p_theme' => $_SESSION['WAREHOUSE']['theme']
|
||||
];
|
||||
|
||||
/* [3] Store functions
|
||||
=========================================================*/
|
||||
$twig->addFunction(new \Twig_Function('f_clusters', function(){
|
||||
$request = new Request('clusterDefault/getAll', [
|
||||
'class' => 0
|
||||
]);
|
||||
|
||||
$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_users', function($id_cluster){
|
||||
$usersReq = new Request('clusterDefault/getMembers', [
|
||||
'id_cluster' => (int) $id_cluster,
|
||||
'class' => 0
|
||||
]);
|
||||
|
||||
$usersRes = $usersReq->dispatch();
|
||||
// si erreur, on affiche rien par défaut
|
||||
if( $usersRes->error->get() != Err::Success )
|
||||
return [];
|
||||
|
||||
return $usersRes->get('members');
|
||||
}));
|
||||
|
||||
|
||||
/* [4] Build the whole stuff
|
||||
=========================================================*/
|
||||
return $twig->render('user/groups.twig', [
|
||||
'p_icon' => $variables['p_icon'],
|
||||
'p_theme' => $variables['p_theme']
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
|
@ -0,0 +1,44 @@
|
|||
<input type='text' class='searchbar' placeholder='Recherche'>
|
||||
|
||||
{% for cluster in f_clusters() %}
|
||||
<article class='inline-box' id='{{ cluster.id_user_cluster }}'>
|
||||
|
||||
{% set userlist = f_users(cluster.id_user_cluster) %}
|
||||
|
||||
|
||||
<span class='title' style='color: {{ p_theme }}'>{{ cluster.name }}</span>
|
||||
<span class='link_remove' data-cluster='{{ cluster.id_user_cluster }}'>{{ p_icon.remove | raw }}</span>
|
||||
|
||||
<span class='link_edit' data-cluster='{{ cluster.id_user_cluster }}'>{{ p_icon.edit | raw }}</span>
|
||||
|
||||
<span class='code'>
|
||||
{{ p_icon.type | raw }}
|
||||
<span>{{ userlist | length }} utilisateurs</span>
|
||||
</span>
|
||||
|
||||
<span class='groups'>
|
||||
{{ p_icon.group | raw }}
|
||||
|
||||
<span class='ignore'>
|
||||
{% for user in userlist %}
|
||||
|
||||
<span>
|
||||
{{ user.username }}
|
||||
<span class='rem-member' data-member='{{ user.id_user }}' data-cluster='{{ cluster.id_user_cluster }}'></span>
|
||||
</span>
|
||||
|
||||
{% endfor %}
|
||||
</span>
|
||||
|
||||
<span class='add-member' data-cluster='{{ cluster.id_user_cluster }}'>+</span>
|
||||
</span>
|
||||
|
||||
</article>
|
||||
|
||||
{# if no result #}
|
||||
{% else %}
|
||||
|
||||
<article class='inline-box'>
|
||||
<span>Aucun groupe trouvé.</span>
|
||||
</article>
|
||||
{% endfor %}
|
|
@ -0,0 +1,70 @@
|
|||
<?php
|
||||
|
||||
namespace viewer\view\user;
|
||||
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' => [
|
||||
'remove' => file_get_contents( __PUBLIC__.'/src/static/sub-menu-side/remove.svg' ),
|
||||
'edit' => file_get_contents( __PUBLIC__.'/src/static/sub-menu-side/edit.svg' ),
|
||||
'card' => file_get_contents( __PUBLIC__.'/src/static/container/card.svg' ),
|
||||
'mail' => file_get_contents( __PUBLIC__.'/src/static/container/mail.svg' ),
|
||||
'group' => file_get_contents( __PUBLIC__.'/src/static/container/group.svg' )
|
||||
],
|
||||
|
||||
'p_theme' => $_SESSION['WAREHOUSE']['theme']
|
||||
];
|
||||
|
||||
/* [3] Store functions
|
||||
=========================================================*/
|
||||
$twig->addFunction(new \Twig_Function('f_users', function(){
|
||||
|
||||
$request = new Request('userDefault/getAll'); // On utilise la methode 'getAll' du module 'userDefault'
|
||||
$answer = $request->dispatch(); // On recupere la reponse
|
||||
|
||||
// si erreur, on affiche rien
|
||||
if( $answer->error->get() != Err::Success )
|
||||
return [];
|
||||
|
||||
return $answer->get('users');
|
||||
}));
|
||||
|
||||
$twig->addFunction(new \Twig_Function('f_clusters', function($id_user){
|
||||
$clustersReq = new Request('userDefault/getClusters', [ 'id_user' => $id_user ]);
|
||||
$clustersRes = $clustersReq->dispatch();
|
||||
|
||||
/* (2) Gestion si erreur */
|
||||
if( $clustersRes->error->get() != Err::Success )
|
||||
return [];
|
||||
|
||||
return $clustersRes->get('clusters');
|
||||
}));
|
||||
|
||||
|
||||
/* [4] Build the whole stuff
|
||||
=========================================================*/
|
||||
return $twig->render('user/view.twig', [
|
||||
'p_icon' => $variables['p_icon'],
|
||||
'p_theme' => $variables['p_theme']
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
|
@ -0,0 +1,53 @@
|
|||
<input type='text' class='searchbar' placeholder='Recherche'>
|
||||
|
||||
{% for user in f_users() %}
|
||||
|
||||
<article class='inline-box' id='{{ user.id_user }}'>
|
||||
|
||||
<span class='title' style='color: {{ p_theme }}'>{{ user.firstname }} {{ user.lastname }} <span>#{{ user.username }}</span></span>
|
||||
<span class='link_remove' data-user='{{ user.id_user }}'>{{ p_icon.remove | raw }}</span>
|
||||
|
||||
<span class='link_edit' data-user='{{ user.id_user }}'>{{ p_icon.edit | raw }}</span>
|
||||
|
||||
<span class='code'>
|
||||
{{ p_icon.card | raw }}
|
||||
<span>{{ user.code }}</span>
|
||||
</span>
|
||||
|
||||
<span class='mail'>
|
||||
{{ p_icon.mail | raw }}
|
||||
|
||||
<a href='mailto:{{ user.mail }}'>
|
||||
<span>{{ user.mail }}</span>
|
||||
</a>
|
||||
</span>
|
||||
|
||||
<span class='groups'>
|
||||
{{ p_icon.group | raw }}
|
||||
|
||||
<span class='ignore'>
|
||||
{% for cluster in f_clusters(user.id_user) %}
|
||||
|
||||
|
||||
<span>
|
||||
{{ cluster.name }}
|
||||
<span class='rem-group' data-group='{{ cluster.id_user_cluster }}' data-user='{{ user.id_user }}'></span>
|
||||
</span>
|
||||
|
||||
{% endfor %}
|
||||
</span>
|
||||
|
||||
<span class='add-group' data-user='{{ user.id_user }}'>+</span>
|
||||
|
||||
</span>
|
||||
|
||||
</article>
|
||||
|
||||
{# if no result #}
|
||||
{% else %}
|
||||
|
||||
<article class='inline-box'>
|
||||
<span>Aucun utilisateur trouvé</span>
|
||||
</article>
|
||||
|
||||
{% endfor %}
|
|
@ -8,9 +8,7 @@
|
|||
"email": "doowap31@gmail.com"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"twig/twig": "dev-master"
|
||||
},
|
||||
"require": {},
|
||||
"require-dev": {
|
||||
"phpro/grumphp": "^0.11.5",
|
||||
"jakub-onderka/php-parallel-lint": "^0.9.2",
|
||||
|
@ -24,11 +22,10 @@
|
|||
"http\\": "build/http",
|
||||
"orm\\": "build/orm",
|
||||
"router\\": "build/router",
|
||||
"log\\": "build/log",
|
||||
"generic\\": "build/generic",
|
||||
"view\\": "build/generic/view",
|
||||
"token\\": "build/token"
|
||||
"viewer\\": "build/viewer",
|
||||
"loh\\": "build/loh",
|
||||
"token\\": "build/token"
|
||||
},
|
||||
"files": ["autoloader.php"]
|
||||
"files": ["autoloader.php", "lib/vendor/autoload.php"]
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,8 +1,8 @@
|
|||
{
|
||||
|
||||
"documentationDefault": {
|
||||
"module": {
|
||||
|
||||
"apiBlueprint": {
|
||||
"POST::apiBlueprint": {
|
||||
"description": "Retourne une documentation de l'API au format API Blueprint.",
|
||||
"permissions": [["admin"]],
|
||||
"options": { "download": true },
|
||||
|
@ -14,7 +14,7 @@
|
|||
|
||||
"motheure": {
|
||||
|
||||
"getCount": {
|
||||
"POST::getCount": {
|
||||
"description": "Retourne le compteur horaire du moteur d'une machine donnée",
|
||||
"permissions": [["admin"]],
|
||||
"parameters": {
|
||||
|
@ -24,8 +24,7 @@
|
|||
"count": { "description": "Compte horaire (en secondes)", "type": "int" }
|
||||
}
|
||||
},
|
||||
|
||||
"increment": {
|
||||
"POST::increment": {
|
||||
"description": "Incrémente le comptheure horaire d'une machine.",
|
||||
"permissions": [["sats"]],
|
||||
"parameters": {
|
||||
|
@ -38,7 +37,7 @@
|
|||
|
||||
|
||||
"authenticationDefault": {
|
||||
"warehouse": {
|
||||
"POST::warehouse": {
|
||||
"description": "Connexion de premier niveau : entrepot.",
|
||||
"permissions": [],
|
||||
"parameters": {
|
||||
|
@ -50,7 +49,7 @@
|
|||
}
|
||||
},
|
||||
|
||||
"admin": {
|
||||
"POST::admin": {
|
||||
"description": "Connexion de second niveau : administrateur.",
|
||||
"permissions": [["warehouse"]],
|
||||
"parameters": {
|
||||
|
@ -62,32 +61,7 @@
|
|||
}
|
||||
},
|
||||
|
||||
"update_warehouse": {
|
||||
"description": "Changement de code d'accés de l'entrepôt",
|
||||
"permissions": [["admin"]],
|
||||
"parameters": {
|
||||
"old": { "description": "Mot de passe actuel", "type": "text" },
|
||||
"new": { "description": "Nouveau mot de passe", "type": "text" },
|
||||
"confirm": { "description": "Confirmation du nouveau mot de passe", "type": "text" }
|
||||
},
|
||||
"output": {}
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
|
||||
"adminDefault": {
|
||||
|
||||
"getAll": {
|
||||
"description": "Retourne la liste des administrateurs de l'entrepôt.",
|
||||
"permissions": [["admin"]],
|
||||
"parameters": {},
|
||||
"output": {
|
||||
"admin": { "description": "Liste des administrateur.", "type": "array" }
|
||||
}
|
||||
},
|
||||
|
||||
"update": {
|
||||
"POST::update_admin": {
|
||||
"description": "Changement de mot de passe administrateur",
|
||||
"permissions": [["admin"]],
|
||||
"parameters": {
|
||||
|
@ -98,16 +72,18 @@
|
|||
"output": {}
|
||||
},
|
||||
|
||||
"delete": {
|
||||
"description": "Suppression d'un accès administrateur",
|
||||
"POST::update_warehouse": {
|
||||
"description": "Changement de code d'accés de l'entrepôt",
|
||||
"permissions": [["admin"]],
|
||||
"parameters": {
|
||||
"id_admin": { "description": "Identifiant de l'administrateur", "type": "id" }
|
||||
"old": { "description": "Mot de passe actuel", "type": "text" },
|
||||
"new": { "description": "Nouveau mot de passe", "type": "text" },
|
||||
"confirm": { "description": "Confirmation du nouveau mot de passe", "type": "text" }
|
||||
},
|
||||
"output": {}
|
||||
},
|
||||
|
||||
"create": {
|
||||
"POST::create_admin": {
|
||||
"description": "Création d'un administrateur",
|
||||
"permissions": [["admin"]],
|
||||
"parameters": {
|
||||
|
@ -124,7 +100,7 @@
|
|||
|
||||
"userDefault": {
|
||||
|
||||
"create": {
|
||||
"POST::create": {
|
||||
"description": "Création d'un nouvel utilisateur.",
|
||||
"permissions": [["admin"]],
|
||||
"parameters": {
|
||||
|
@ -139,7 +115,7 @@
|
|||
}
|
||||
},
|
||||
|
||||
"link": {
|
||||
"POST::link": {
|
||||
"description": "Ajout d'un utilisateur à un groupe.",
|
||||
"permissions": [["admin"]],
|
||||
"parameters": {
|
||||
|
@ -150,7 +126,7 @@
|
|||
},
|
||||
|
||||
|
||||
"unlink": {
|
||||
"POST::unlink": {
|
||||
"description": "Retrait d'un utilisateur d'un groupe",
|
||||
"permissions": [["admin"]],
|
||||
"parameters": {
|
||||
|
@ -160,7 +136,7 @@
|
|||
"output": {}
|
||||
},
|
||||
|
||||
"search": {
|
||||
"POST::search": {
|
||||
"description": "Recherche d'un utilisateur par mots-clés.",
|
||||
"permissions": [["admin"]],
|
||||
"parameters": {
|
||||
|
@ -171,7 +147,7 @@
|
|||
}
|
||||
},
|
||||
|
||||
"getAll": {
|
||||
"POST::getAll": {
|
||||
"description": "Liste de tous les utilisateurs",
|
||||
"permissions": [["admin"]],
|
||||
"parameters": {},
|
||||
|
@ -180,7 +156,7 @@
|
|||
}
|
||||
},
|
||||
|
||||
"getById": {
|
||||
"POST::getById": {
|
||||
"description": "Retourne un utilisateur spécifique.",
|
||||
"permissions": [["admin"]],
|
||||
"parameters": {
|
||||
|
@ -191,7 +167,7 @@
|
|||
}
|
||||
},
|
||||
|
||||
"getByCode": {
|
||||
"POST::getByCode": {
|
||||
"description": "Retourne un utilisateur de Code RFID donné.",
|
||||
"permissions": [["admin"]],
|
||||
"parameters": {
|
||||
|
@ -202,7 +178,7 @@
|
|||
}
|
||||
},
|
||||
|
||||
"getByUsername": {
|
||||
"POST::getByUsername": {
|
||||
"description": "Retourne un utilisateur d'identifiant donné.",
|
||||
"permissions": [["admin"]],
|
||||
"parameters": {
|
||||
|
@ -213,7 +189,7 @@
|
|||
}
|
||||
},
|
||||
|
||||
"getClusters": {
|
||||
"POST::getClusters": {
|
||||
"description": "Retourne les groupes d'un utilisateur.",
|
||||
"permissions": [["admin"]],
|
||||
"parameters": {
|
||||
|
@ -224,7 +200,7 @@
|
|||
}
|
||||
},
|
||||
|
||||
"edit": {
|
||||
"POST::edit": {
|
||||
"description": "Modifie les attributs d'un utilisateur.",
|
||||
"permissions": [["admin"]],
|
||||
"parameters": {
|
||||
|
@ -243,7 +219,7 @@
|
|||
}
|
||||
},
|
||||
|
||||
"delete": {
|
||||
"POST::delete": {
|
||||
"description": "Suppression d'un utilisateur.",
|
||||
"permissions": [["admin"]],
|
||||
"parameters": {
|
||||
|
@ -259,7 +235,7 @@
|
|||
|
||||
"machineDefault": {
|
||||
|
||||
"update": {
|
||||
"POST::update": {
|
||||
"description": "Mise à jour d'un SATS.",
|
||||
"permissions": [["sats"]],
|
||||
"parameters": {
|
||||
|
@ -270,7 +246,7 @@
|
|||
}
|
||||
},
|
||||
|
||||
"sync": {
|
||||
"POST::sync": {
|
||||
"description": "Synchronisation d'un SATS.",
|
||||
"permissions": [["warehouse"]],
|
||||
"parameters": {
|
||||
|
@ -283,7 +259,7 @@
|
|||
}
|
||||
},
|
||||
|
||||
"create": {
|
||||
"POST::create": {
|
||||
"description": "Création d'une nouvelle machine.",
|
||||
"permissions": [["admin"]],
|
||||
"parameters": {
|
||||
|
@ -294,7 +270,7 @@
|
|||
}
|
||||
},
|
||||
|
||||
"link": {
|
||||
"POST::link": {
|
||||
"description": "Ajout d'une machine à un groupe.",
|
||||
"permissions": [["admin"]],
|
||||
"parameters": {
|
||||
|
@ -304,7 +280,7 @@
|
|||
"output": {}
|
||||
},
|
||||
|
||||
"unlink": {
|
||||
"POST::unlink": {
|
||||
"description": "Retrait d'une machine d'un groupe.",
|
||||
"permissions": [["admin"]],
|
||||
"parameters": {
|
||||
|
@ -314,7 +290,7 @@
|
|||
"output": {}
|
||||
},
|
||||
|
||||
"search": {
|
||||
"POST::search": {
|
||||
"description": "Recherche une machine par mots-clés.",
|
||||
"permissions": [["admin"]],
|
||||
"parameters": {
|
||||
|
@ -325,7 +301,7 @@
|
|||
}
|
||||
},
|
||||
|
||||
"getAll": {
|
||||
"POST::getAll": {
|
||||
"description": "Retourne la liste de toutes les machines.",
|
||||
"permissions": [["admin"]],
|
||||
"parameters": {},
|
||||
|
@ -334,7 +310,7 @@
|
|||
}
|
||||
},
|
||||
|
||||
"getById": {
|
||||
"POST::getById": {
|
||||
"description": "Retourne les données d'une machine.",
|
||||
"permissions": [["admin"]],
|
||||
"parameters": {
|
||||
|
@ -345,7 +321,7 @@
|
|||
}
|
||||
},
|
||||
|
||||
"getByName": {
|
||||
"POST::getByName": {
|
||||
"description": "Retourne les données d'une machine de nom donné.",
|
||||
"permissions": [["admin"]],
|
||||
"parameters": {
|
||||
|
@ -356,7 +332,7 @@
|
|||
}
|
||||
},
|
||||
|
||||
"getClusters": {
|
||||
"POST::getClusters": {
|
||||
"description": "Retourne les groupes d'une machine.",
|
||||
"permissions": [["admin"], ["sats"]],
|
||||
"parameters": {
|
||||
|
@ -367,7 +343,7 @@
|
|||
}
|
||||
},
|
||||
|
||||
"edit": {
|
||||
"POST::edit": {
|
||||
"description": "Modifie les attributs d'une machine.",
|
||||
"permissions": [["admin"]],
|
||||
"parameters": {
|
||||
|
@ -377,7 +353,7 @@
|
|||
"output": {}
|
||||
},
|
||||
|
||||
"delete": {
|
||||
"POST::delete": {
|
||||
"description": "Supprime une machine.",
|
||||
"permissions": [["admin"]],
|
||||
"parameters": {
|
||||
|
@ -388,7 +364,7 @@
|
|||
}
|
||||
},
|
||||
|
||||
"getState": {
|
||||
"POST::getState": {
|
||||
"description": "Retourne l'état d'une machine.",
|
||||
"permissions": [["admin"]],
|
||||
"parameters": {
|
||||
|
@ -404,7 +380,7 @@
|
|||
|
||||
"clusterDefault": {
|
||||
|
||||
"create": {
|
||||
"POST::create": {
|
||||
"description": "Création d'un nouveau groupe.",
|
||||
"permissions": [["admin"]],
|
||||
"parameters": {
|
||||
|
@ -416,7 +392,7 @@
|
|||
}
|
||||
},
|
||||
|
||||
"search": {
|
||||
"POST::search": {
|
||||
"description": "Recherche d'un groupe par mots-clés.",
|
||||
"permissions": [["admin"]],
|
||||
"parameters": {
|
||||
|
@ -428,7 +404,7 @@
|
|||
}
|
||||
},
|
||||
|
||||
"getAll": {
|
||||
"POST::getAll": {
|
||||
"description": "Liste de tous les groupes",
|
||||
"permissions": [["admin"]],
|
||||
"parameters": {
|
||||
|
@ -439,7 +415,7 @@
|
|||
}
|
||||
},
|
||||
|
||||
"getById": {
|
||||
"POST::getById": {
|
||||
"description": "Retourne un groupe spécifique.",
|
||||
"permissions": [["admin"]],
|
||||
"parameters": {
|
||||
|
@ -451,7 +427,7 @@
|
|||
}
|
||||
},
|
||||
|
||||
"getByName": {
|
||||
"POST::getByName": {
|
||||
"description": "Retourne un groupe de nom donné.",
|
||||
"permissions": [["admin"]],
|
||||
"parameters": {
|
||||
|
@ -463,7 +439,7 @@
|
|||
}
|
||||
},
|
||||
|
||||
"getMembers": {
|
||||
"POST::getMembers": {
|
||||
"description": "Retourne les membres d'un groupe.",
|
||||
"permissions": [["admin"]],
|
||||
"parameters": {
|
||||
|
@ -475,7 +451,7 @@
|
|||
}
|
||||
},
|
||||
|
||||
"edit": {
|
||||
"POST::edit": {
|
||||
"description": "Modifie le nom d'un groupe.",
|
||||
"permissions": [["admin"]],
|
||||
"parameters": {
|
||||
|
@ -488,7 +464,7 @@
|
|||
}
|
||||
},
|
||||
|
||||
"delete": {
|
||||
"POST::delete": {
|
||||
"description": "Suppression d'un groupe.",
|
||||
"permissions": [["admin"]],
|
||||
"parameters": {
|
||||
|
@ -500,7 +476,7 @@
|
|||
}
|
||||
},
|
||||
|
||||
"addPermission": {
|
||||
"POST::addPermission": {
|
||||
"description": "Ajout d'une permission",
|
||||
"permissions": [["admin"]],
|
||||
"parameters": {
|
||||
|
@ -511,7 +487,7 @@
|
|||
"output": {}
|
||||
},
|
||||
|
||||
"remPermission": {
|
||||
"POST::remPermission": {
|
||||
"description": "Suppression d'une permission",
|
||||
"permissions": [["admin"]],
|
||||
"parameters": {
|
||||
|
@ -522,7 +498,7 @@
|
|||
"output": {}
|
||||
},
|
||||
|
||||
"getPermissions": {
|
||||
"POST::getPermissions": {
|
||||
"description": "Retourne la liste des permissions",
|
||||
"permissions": [["admin"]],
|
||||
"parameters": {},
|
||||
|
@ -531,7 +507,7 @@
|
|||
}
|
||||
},
|
||||
|
||||
"getAuthenticatedClusters": {
|
||||
"POST::getAuthenticatedClusters": {
|
||||
"description": "Retourne les groupes d'utilisateurs ayant une action sur un groupe de machine.",
|
||||
"permissions": [["admin"]],
|
||||
"parameters": {
|
||||
|
@ -543,7 +519,7 @@
|
|||
}
|
||||
},
|
||||
|
||||
"getModules": {
|
||||
"POST::getModules": {
|
||||
"description": "Retourne les modules d'un groupe de machines",
|
||||
"permissions": [["admin"], ["sats"]],
|
||||
"parameters": {
|
||||
|
@ -554,7 +530,7 @@
|
|||
}
|
||||
},
|
||||
|
||||
"getEtrees": {
|
||||
"POST::getEtrees": {
|
||||
"description": "Retourne les e-trees d'un groupe de machines",
|
||||
"permissions": [["admin"], ["sats"]],
|
||||
"parameters": {
|
||||
|
@ -568,7 +544,7 @@
|
|||
},
|
||||
|
||||
"historyDefault": {
|
||||
"create": {
|
||||
"POST::create": {
|
||||
"description": "Retourne l'historique complet",
|
||||
"permissions": [["admin"], ["sats"]],
|
||||
"parameters": {
|
||||
|
@ -579,7 +555,7 @@
|
|||
},
|
||||
"output": {}
|
||||
},
|
||||
"getAll": {
|
||||
"POST::getAll": {
|
||||
"description": "Retourne l'historique complet",
|
||||
"permissions": [["admin"]],
|
||||
"parameters": {},
|
||||
|
@ -588,7 +564,7 @@
|
|||
}
|
||||
},
|
||||
|
||||
"search": {
|
||||
"POST::search": {
|
||||
"description": "Recherche une entrée historique par mots-clés.",
|
||||
"permissions": [["admin"]],
|
||||
"parameters": {
|
||||
|
@ -599,40 +575,18 @@
|
|||
}
|
||||
},
|
||||
|
||||
"archive": {
|
||||
"POST::archive": {
|
||||
"description": "Archive de l'historique complet.",
|
||||
"permissions": [["admin"]],
|
||||
"options": { "download": true },
|
||||
"parameters": {},
|
||||
"output": {}
|
||||
},
|
||||
|
||||
"get_timeline": {
|
||||
"description": "Retourne la timeline d'une machine pour associée à une entrée historique.",
|
||||
"permissions": [["admin"]],
|
||||
"parameters": {
|
||||
"id_entry": { "description": "UID de l'entrée historique", "type": "id" }
|
||||
},
|
||||
"output": {
|
||||
"timeline": { "description": "Données de la timeline.", "type": "array" }
|
||||
}
|
||||
},
|
||||
|
||||
"getById": {
|
||||
"description": "Retourne les données associées à une entrée historique.",
|
||||
"permissions": [["admin"]],
|
||||
"parameters": {
|
||||
"id_entry": { "description": "UID de l'entrée historique", "type": "id" }
|
||||
},
|
||||
"output": {
|
||||
"entry": { "description": "Données de l'entrée.", "type": "array" }
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
"fetchDefault": {
|
||||
"dispatch": {
|
||||
"POST::dispatch": {
|
||||
"description": "Dispatche la gestion des données reçues par un SATS",
|
||||
"permissions": [["sats"]],
|
||||
"parameters": {
|
||||
|
@ -644,7 +598,7 @@
|
|||
}
|
||||
},
|
||||
|
||||
"rfid_read": {
|
||||
"POST::rfid_read": {
|
||||
"description": "Enregistrement de l'historique de l'e-tree READ du module RFID",
|
||||
"permissions": [["sats"]],
|
||||
"parameters": {
|
||||
|
@ -655,7 +609,7 @@
|
|||
}
|
||||
},
|
||||
|
||||
"motheure_simple": {
|
||||
"POST::motheure_simple": {
|
||||
"description": "Enregistrement du compte horaire de l'e-tree SIMPLE du module MOTHEURE",
|
||||
"permissions": [["sats"]],
|
||||
"parameters": {
|
||||
|
@ -669,7 +623,7 @@
|
|||
|
||||
"deployDefault": {
|
||||
|
||||
"dispatch": {
|
||||
"POST::dispatch": {
|
||||
"description": "Dispatche la gestion des données à synchroniser par un SATS",
|
||||
"permissions": [["sats"]],
|
||||
"parameters": {
|
||||
|
@ -680,7 +634,7 @@
|
|||
}
|
||||
},
|
||||
|
||||
"rfid_read": {
|
||||
"POST::rfid_read": {
|
||||
"description": "Enregistrement de l'historique de l'e-tree READ du module RFID",
|
||||
"permissions": [["sats"]],
|
||||
"parameters": {},
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
"search",
|
||||
|
||||
"getAll",
|
||||
"getById",
|
||||
"getByIdUser",
|
||||
"getByIdMachine",
|
||||
"getByIdAction"
|
||||
|
@ -161,7 +160,6 @@
|
|||
"getAll",
|
||||
"getById",
|
||||
"getByUsername",
|
||||
"getByIdWarehouse",
|
||||
"getByMail",
|
||||
"getByToken",
|
||||
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"name": "xdrm-brackets/logauth-smmp",
|
||||
"description": "LogAuth lib",
|
||||
"authors": [
|
||||
{
|
||||
"name": "xdrm-brackets",
|
||||
"email": "doowap31@gmail.com"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"twig/twig": "dev-master"
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue