This commit is contained in:
xdrm-brackets 2016-08-06 11:32:50 +02:00
parent 5836c06983
commit 28a478d506
21 changed files with 85 additions and 81 deletions

3
.gitignore vendored
View File

@ -1,3 +1,4 @@
.sass-cache/
*.css.map
.htaccess
.htaccess
.tags

View File

@ -122,8 +122,10 @@
$answer = $request->dispatch();
// Si c'est une réponse (et non un download)
if( $answer instanceof ModuleResponse )
if( $answer instanceof ModuleResponse ){
header('Content-Type: application/json; charset=UTF-8');
echo $answer->serialize();
}
});

View File

@ -115,8 +115,8 @@
case self::WrongPathRepo: return "Le chemin de délégation est incorrect ('nomRepo/nomMethode')."; break;
case self::UnknownModule: return "Le module n'existe pas."; break;
case self::UnknownRepo: return "Le repo n'existe pas."; break;
case self::UnknownMethod: return "Le methode n'existe pas."; break;
case self::UncallableMethod: return "Le methode n'est pas amorçable."; break;
case self::UnknownMethod: return "Le méthode n'existe pas."; break;
case self::UncallableMethod: return "Le méthode n'est pas amorçable."; break;
case self::ParamError: return "Un ou plusieurs paramètres sont manquants ou incorrects."; break;
case self::ModuleError: return "Erreur lors du traitement du module."; break;

View File

@ -140,7 +140,7 @@
ManagerError::setHttpCode($this->error);
// Type de contenu
// header('Content-Type: application/json');
// header('Content-Type: application/json; charset=utf-8');
// On rajoute l'erreur au message
$returnData = array_merge([

View File

@ -2,13 +2,13 @@
namespace manager;
use \manager\View;
use \manager\ViewManager;
use \manager\ManagerError;
class View{
class ViewManager{
public $error = ManagerError::Success;
@ -105,7 +105,7 @@
/* [2] On vérifie que le template existe
=========================================================*/
$class = '\\manager\\views\\'.$match[1].'\\'.$match[2];
$class = '\\manager\\views\\'.$match[1].'\\'.$match[1].'_'.$match[2];
$method = 'view';
/* (1) On vérifie que la classe existe */
@ -181,7 +181,7 @@
// USE case
//
// $myView = new View('templateParent.templateModel', [
// $myView = new ViewManager('templateParent.templateModel', [
// 'myVar' => 1,
// 'helloMsg' => 'Hello',
// ]);

View File

@ -1,7 +1,7 @@
<?php
namespace manager\module;
use \manager\View;
use \manager\ViewManager;
use \manager\Database;
use \manager\sessionManager;
use \manager\ManagerError;

View File

@ -331,6 +331,7 @@
=========================================================*/
$actionsReq = new Repo('action/getAll');
$actions = ($actionsReq->error==0) ? $actionsReq->answer() : [];
var_dump($actionsReq->answer());
/* [2] On regroupe les actions par TIMEOUT
=========================================================*/
@ -398,11 +399,16 @@
/* (2) Pour formatte et indexe les permissions par CODE RFID */
$indexed_permissions = [];
foreach($permissions as $p=>$permission)
foreach($permissions as $p=>$permission){
$actionList = explode(',', $permission['agg_id_action']);
sort($actionList);
$indexed_permissions[$permission['code']] = [
'id_user' => $permission['id_user'],
'actions' => explode(',', $permission['actions'])
'actions' => $actionList
];
}

View File

@ -1,13 +1,13 @@
<?php
namespace manager\views\group;
use \manager\View;
use \manager\ViewManager;
use \manager\ModuleRequest;
use \manager\ManagerError;
use \manager\Authentification;
use \manager\repo\cluster as clusterRepo;
class groupChoice{
class group_groupChoice{
public static function template($type=null){
@ -49,7 +49,7 @@
/* (2) Si on ne le trouve pas, on retourne une erreur */
if( $getUserClusters->error != ManagerError::Success )
return View::$htmlError;
return ViewManager::$htmlError;
/* (3) On récupère les données du groupe */
$USERCLUSTERS = $getUserClusters->get('clusters');
@ -59,7 +59,7 @@
$USERCLUSTERS[$c]['id_cluster'] = $cluster['id_user_cluster'];
/* (5) On construit la vue */
$user_view = View::replaceMultiple(
$user_view = ViewManager::replaceMultiple(
self::template('clusterlist'),
$USERCLUSTERS,
[
@ -79,7 +79,7 @@
/* (2) Si on ne le trouve pas, on retourne une erreur */
if( $getMachineClusters->error != ManagerError::Success )
return View::$htmlError;
return ViewManager::$htmlError;
/* (3) On récupère les données du groupe */
$MACHINECLUSTERS = $getMachineClusters->get('clusters');
@ -89,7 +89,7 @@
$MACHINECLUSTERS[$c]['id_cluster'] = $cluster['id_machine_cluster'];
/* (5) On construit la vue */
$machine_view = View::replaceMultiple(
$machine_view = ViewManager::replaceMultiple(
self::template('clusterlist'),
$MACHINECLUSTERS,
[
@ -101,7 +101,7 @@
/* [3] On renvoie la vue globale
=========================================================*/
return View::replaceSingle(
return ViewManager::replaceSingle(
self::template(), [
'clusters' => $user_view.$machine_view
]

View File

@ -1,13 +1,13 @@
<?php
namespace manager\views\group;
use \manager\View;
use \manager\ViewManager;
use \manager\ModuleRequest;
use \manager\ManagerError;
use \manager\Authentification;
use \manager\repo\cluster as clusterRepo;
class membersChoice{
class group_membersChoice{
public static function template($type=null){
@ -79,7 +79,7 @@
=========================================================*/
/* (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 View::$htmlError;
return ViewManager::$htmlError;
/* (2) On initialise les vues */
$view = '';
@ -99,7 +99,7 @@
/* (2) Si on ne le trouve pas, on retourne une erreur */
if( $checktypeResponse->error != ManagerError::Success )
return View::$htmlError;
return ViewManager::$htmlError;
/* (3) On récupère les données du groupe */
$currentCluster = $checktypeResponse->get('cluster');
@ -117,7 +117,7 @@
/* (2) Si erreur, on retourne l'erreur */
if( $getmembersResponse->error != ManagerError::Success )
return View::$htmlError;
return ViewManager::$htmlError;
/* (3) On récupère la liste des UID uniquement */
$members_id = [];
@ -138,7 +138,7 @@
/* (2) si erreur, on affiche l'explicitation */
if( $getusersResponse->error != ManagerError::Success )
return View::$htmlError;
return ViewManager::$htmlError;
/* (3) On récupère la liste des utilisateurs */
$USERLIST = $getusersResponse->get('users');
@ -153,7 +153,7 @@
/* (2) On génère la vue */
$header = self::template('userheader');
$members_view = View::replaceMultiple(
$members_view = ViewManager::replaceMultiple(
self::template('userlist'),
$USERLIST
);
@ -171,7 +171,7 @@
/* (2) si erreur, on affiche l'explicitation */
if( $getmachinesResponse->error != ManagerError::Success )
return View::$htmlError;
return ViewManager::$htmlError;
/* (3) On récupère la liste des machines */
$MACHINELIST = $getmachinesResponse->get('machines');
@ -186,7 +186,7 @@
/* (2) On génère la vue */
$header = self::template('machineheader');
$members_view = View::replaceMultiple(
$members_view = ViewManager::replaceMultiple(
self::template('machinelist'),
$MACHINELIST
);
@ -195,7 +195,7 @@
return View::replaceSingle(
return ViewManager::replaceSingle(
self::template(), [
'id_cluster' => $params['id_cluster'],
'class' => $params['class'],

View File

@ -1,12 +1,12 @@
<?php
namespace manager\views\group;
use \manager\View;
use \manager\ViewManager;
use \manager\ModuleRequest;
use \manager\Authentification;
use \manager\ManagerError;
class view{
class group_view{
public static function template($type=null){
@ -92,7 +92,7 @@
/* (2) si erreur, on affiche l'explicitation */
if( $getAllUsers->error != ManagerError::Success )
return View::$htmlError;
return ViewManager::$htmlError;
/* (3) On enregistre le résultat */
$USERCLUSTERS = $getAllUsers->get('clusters');
@ -107,7 +107,7 @@
/* (2) si erreur, on affiche l'explicitation */
if( $getAllMachines->error != ManagerError::Success )
return View::$htmlError;
return ViewManager::$htmlError;
/* (3) On enregistre le résultat */
$MACHINECLUSTERS = $getAllMachines->get('clusters');
@ -128,7 +128,7 @@
else $members = [];
/* (3) On crées les vues des membres (utilisateurs) */
$USERCLUSTERS[$u]['users'] = View::replaceMultiple(
$USERCLUSTERS[$u]['users'] = ViewManager::replaceMultiple(
self::template('user'),
$members,
[ 'id_cluster' => 'u'.$cluster['id_user_cluster'] ]
@ -141,7 +141,7 @@
}
/* (5) On crée la vue de la liste des tous les groupes d'utilisateurs */
$user_clusters = View::replaceMultiple(
$user_clusters = ViewManager::replaceMultiple(
self::template('user_cluster'),
$USERCLUSTERS, [
'icon_type' => file_get_contents( __ROOT__.'/src/static/menu-side/users.svg' ),
@ -169,7 +169,7 @@
else $members = [];
/* (3) On crées les vues des membres (machines) */
$MACHINECLUSTERS[$u]['machines'] = View::replaceMultiple(
$MACHINECLUSTERS[$u]['machines'] = ViewManager::replaceMultiple(
self::template('machine'),
$members,
[ 'id_cluster' => 'm'.$cluster['id_machine_cluster'] ]
@ -182,7 +182,7 @@
}
/* (5) On crée la vue de la liste des tous les groupes de machines */
$machine_clusters = View::replaceMultiple(
$machine_clusters = ViewManager::replaceMultiple(
self::template('machine_cluster'),
$MACHINECLUSTERS, [
'icon_type' => file_get_contents( __ROOT__.'/src/static/menu-side/device.svg' ),
@ -195,7 +195,7 @@
return View::replaceSingle(self::template(), [ 'clusterlist' => $user_clusters.''.$machine_clusters ]);
return ViewManager::replaceSingle(self::template(), [ 'clusterlist' => $user_clusters.''.$machine_clusters ]);
}

View File

@ -1,12 +1,12 @@
<?php
namespace manager\views\machine;
use \manager\View;
use \manager\ViewManager;
use \manager\ModuleRequest;
use \manager\Authentification;
use \manager\ManagerError;
class groups{
class machine_groups{
public static function template($type=null){
@ -62,7 +62,7 @@
// si erreur, on affiche l'explicitation
if( $answer->error != ManagerError::Success )
return View::$htmlError;
return ViewManager::$htmlError;
$CLUSTERLIST = $answer->get('clusters');
@ -80,7 +80,7 @@
$CLUSTERLIST[$c]['count'] = count($machines);
$CLUSTERLIST[$c]['machines'] = View::replaceMultiple(
$CLUSTERLIST[$c]['machines'] = ViewManager::replaceMultiple(
self::template('machine'),
$machines,
[ 'id_cluster' => $cluster['id_machine_cluster'] ]
@ -88,7 +88,7 @@
}
$view_cluster = View::replaceMultiple(
$view_cluster = ViewManager::replaceMultiple(
self::template('machine_cluster'),
$CLUSTERLIST, [
'icon_remove' => file_get_contents( __ROOT__.'/src/static/sub-menu-side/remove.svg' ),
@ -101,7 +101,7 @@
return View::replaceSingle(self::template(), [ 'clusterlist' => $view_cluster ]);
return ViewManager::replaceSingle(self::template(), [ 'clusterlist' => $view_cluster ]);
}

View File

@ -1,12 +1,12 @@
<?php
namespace manager\views\machine;
use \manager\View;
use \manager\ViewManager;
use \manager\ModuleRequest;
use \manager\Authentification;
use \manager\ManagerError;
class view{
class machine_view{
public static function template($type=null){
@ -55,7 +55,7 @@
// si erreur, on affiche l'explicitation
if( $answer->error != ManagerError::Success )
return View::$htmlError;
return ViewManager::$htmlError;
$MACHINELIST = $answer->get('machines');
@ -68,7 +68,7 @@
if( $clustersRes->error == ManagerError::Success ) $clusters = $clustersRes->get('clusters');
else $clusters = [];
$MACHINELIST[$u]['grouplist'] = View::replaceMultiple(
$MACHINELIST[$u]['grouplist'] = ViewManager::replaceMultiple(
self::template('cluster'),
$clusters,
[ 'id_machine' => $machine['id_machine'] ]
@ -76,7 +76,7 @@
}
$view_machine = View::replaceMultiple(
$view_machine = ViewManager::replaceMultiple(
self::template('machine'),
$MACHINELIST, [
'icon_remove' => file_get_contents( __ROOT__.'/src/static/sub-menu-side/remove.svg' ),
@ -88,7 +88,7 @@
return View::replaceSingle(self::template(), [ 'machinelist' => $view_machine ]);
return ViewManager::replaceSingle(self::template(), [ 'machinelist' => $view_machine ]);
}

View File

@ -1,12 +1,12 @@
<?php
namespace manager\views\user;
use \manager\View;
use \manager\ViewManager;
use \manager\ModuleRequest;
use \manager\Authentification;
use \manager\ManagerError;
class groups{
class user_groups{
public static function template($type=null){
@ -62,7 +62,7 @@
// si erreur, on affiche l'explicitation
if( $answer->error != ManagerError::Success )
return View::$htmlError;
return ViewManager::$htmlError;
$CLUSTERLIST = $answer->get('clusters');
@ -80,7 +80,7 @@
$CLUSTERLIST[$c]['count'] = count($users);
$CLUSTERLIST[$c]['users'] = View::replaceMultiple(
$CLUSTERLIST[$c]['users'] = ViewManager::replaceMultiple(
self::template('user'),
$users,
[ 'id_cluster' => $cluster['id_user_cluster'] ]
@ -88,7 +88,7 @@
}
$view_cluster = View::replaceMultiple(
$view_cluster = ViewManager::replaceMultiple(
self::template('user_cluster'),
$CLUSTERLIST, [
'icon_remove' => file_get_contents( __ROOT__.'/src/static/sub-menu-side/remove.svg' ),
@ -101,7 +101,7 @@
return View::replaceSingle(self::template(), [ 'clusterlist' => $view_cluster ]);
return ViewManager::replaceSingle(self::template(), [ 'clusterlist' => $view_cluster ]);
}

View File

@ -1,12 +1,12 @@
<?php
namespace manager\views\user;
use \manager\View;
use \manager\ViewManager;
use \manager\ModuleRequest;
use \manager\Authentification;
use \manager\ManagerError;
class view{
class user_view{
public static function template($type=null){
@ -68,7 +68,7 @@
// si erreur, on affiche l'explicitation
if( $answer->error != ManagerError::Success )
return View::$htmlError;
return ViewManager::$htmlError;
$USERLIST = $answer->get('users');
@ -80,7 +80,7 @@
if( $clustersRes->error == ManagerError::Success ) $clusters = $clustersRes->get('clusters');
else $clusters = [];
$USERLIST[$u]['grouplist'] = View::replaceMultiple(
$USERLIST[$u]['grouplist'] = ViewManager::replaceMultiple(
self::template('cluster'),
$clusters,
[ 'id_user' => $user['id_user'] ]
@ -88,7 +88,7 @@
}
$view_user = View::replaceMultiple(
$view_user = ViewManager::replaceMultiple(
self::template('user'),
$USERLIST, [
'icon_remove' => file_get_contents( __ROOT__.'/src/static/sub-menu-side/remove.svg' ),
@ -102,7 +102,7 @@
return View::replaceSingle(self::template(), [ 'userlist' => $view_user ]);
return ViewManager::replaceSingle(self::template(), [ 'userlist' => $view_user ]);
}

View File

@ -453,8 +453,4 @@
// ]);
//
// $a->dispatch();
?>

View File

@ -7,7 +7,7 @@
$hash = 'password';
$times = 10000;
$times = 1;
$start = microtime(true);
$hashed = sessionManager::secure_hash($hash, $times);

View File

@ -2,6 +2,7 @@
require_once __ROOT__.'/manager/autoloader.php';
use \manager\ModuleRequest;
use \manager\ManagerError;
use \manager\ORM\Table;
?>
@ -49,7 +50,7 @@
echo "<section data-sublink='analytics'>";
echo 'Statistiques';
var_dump( manager\Database::getPDO()->query('SELECT * from user')->fetchAll() );
var_dump( Table::get('user')->select('*')->fetch() );
echo '</section>';
// }

View File

@ -1,6 +1,6 @@
<?php define('__ROOT__', dirname(dirname(__FILE__)) );
require_once __ROOT__.'/manager/autoloader.php';
use \manager\View;
use \manager\ViewManager;
use \manager\ModuleRequest;
use \manager\ManagerError;
use \manager\Repo;
@ -62,7 +62,7 @@
echo "<section data-sublink='view' class='list'>";
debug();
$clusterView = new View('group.view', []);
$clusterView = new ViewManager('group.view', []);
$clusterView->view();
echo '</section>';
@ -180,7 +180,7 @@
---------------------------------------------------------*/
if( isset($post[1]) && preg_match('/^(u|m)(\d+)$/', $post[1], $m) ){
$membersChoice = new View('group.membersChoice', [
$membersChoice = new ViewManager('group.membersChoice', [
'id_cluster' => $m[2],
'class' => ($m[1]=='u') ? 0 : 1
]);
@ -188,7 +188,7 @@
}else{
$groupChoice = new View('group.groupChoice', []);
$groupChoice = new ViewManager('group.groupChoice', []);
$groupChoice->view();
}

View File

@ -66,8 +66,6 @@
->select('id_history', Rows::SEL_COUNT, Rows::SEL_DISTINCT)
->fetch();
var_dump($selected);
echo "<article class='inline-row' style='border: 0; box-shadow: none;background: transparent;'>";
echo "<span>Machine</span>";
@ -89,7 +87,7 @@
echo "<span>";
echo "<span>".$mac['id_history']." conducteur(s)</span>";
echo "<span>".$mac['agg_id_history']." conducteur(s)</span>";
echo "<span>test</span>";
echo "</span>";

View File

@ -1,6 +1,6 @@
<?php define('__ROOT__', dirname(dirname(__FILE__)) );
require_once __ROOT__.'/manager/autoloader.php';
use \manager\View;
use \manager\ViewManager;
use \manager\ModuleRequest;
use \manager\ManagerError;
use \manager\Repo;
@ -52,7 +52,7 @@
debug();
echo "<section data-sublink='view' class='list'>";
$machineView = new View('machine.view', []);
$machineView = new ViewManager('machine.view', []);
$machineView->view();
echo '</section>';
@ -146,7 +146,7 @@
=========================================================*/
echo "<section data-sublink='groups' class='list'>";
$grouplist = new View('machine.groups', []);
$grouplist = new ViewManager('machine.groups', []);
$grouplist->view();
echo '</section>';

View File

@ -2,7 +2,7 @@
require_once __ROOT__.'/manager/autoloader.php';
use \manager\ModuleRequest;
use \manager\ManagerError;
use \manager\View;
use \manager\ViewManager;
use \manager\Repo;
?>
@ -52,7 +52,7 @@
=========================================================*/
echo "<section data-sublink='view' class='list'>";
$userlist = new View('user.view', []);
$userlist = new ViewManager('user.view', []);
$userlist->view();
echo '</section>';
@ -166,7 +166,7 @@
=========================================================*/
echo "<section data-sublink='groups' class='list'>";
$grouplist = new View('user.groups', []);
$grouplist = new ViewManager('user.groups', []);
$grouplist->view();
echo '</section>';