diff --git a/.gitignore b/.gitignore
index 1b1abab..bd0bb75 100755
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
.sass-cache/
*.css.map
-.htaccess
\ No newline at end of file
+.htaccess
+.tags
diff --git a/index.php b/index.php
index 4b5e881..c5b4259 100755
--- a/index.php
+++ b/index.php
@@ -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();
+ }
});
diff --git a/manager/ManagerError.php b/manager/ManagerError.php
index 3b6b8e9..f036349 100755
--- a/manager/ManagerError.php
+++ b/manager/ManagerError.php
@@ -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;
diff --git a/manager/ModuleResponse.php b/manager/ModuleResponse.php
index c50263b..fe00268 100755
--- a/manager/ModuleResponse.php
+++ b/manager/ModuleResponse.php
@@ -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([
diff --git a/manager/View.php b/manager/ViewManager.php
similarity index 95%
rename from manager/View.php
rename to manager/ViewManager.php
index 8ddd782..7a92377 100644
--- a/manager/View.php
+++ b/manager/ViewManager.php
@@ -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',
// ]);
diff --git a/manager/module/clusterDefault.php b/manager/module/clusterDefault.php
index 9bd4181..898c854 100644
--- a/manager/module/clusterDefault.php
+++ b/manager/module/clusterDefault.php
@@ -1,7 +1,7 @@
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
];
+ }
diff --git a/manager/views/group/groupChoice.php b/manager/views/group/group_groupChoice.php
similarity index 91%
rename from manager/views/group/groupChoice.php
rename to manager/views/group/group_groupChoice.php
index 0e525c7..9b7cee8 100644
--- a/manager/views/group/groupChoice.php
+++ b/manager/views/group/group_groupChoice.php
@@ -1,13 +1,13 @@
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
]
diff --git a/manager/views/group/membersChoice.php b/manager/views/group/group_membersChoice.php
similarity index 94%
rename from manager/views/group/membersChoice.php
rename to manager/views/group/group_membersChoice.php
index 1e7d82a..7ff7099 100644
--- a/manager/views/group/membersChoice.php
+++ b/manager/views/group/group_membersChoice.php
@@ -1,13 +1,13 @@
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'],
diff --git a/manager/views/group/view.php b/manager/views/group/group_view.php
similarity index 93%
rename from manager/views/group/view.php
rename to manager/views/group/group_view.php
index 2ba9f02..291f75c 100644
--- a/manager/views/group/view.php
+++ b/manager/views/group/group_view.php
@@ -1,12 +1,12 @@
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 ]);
}
diff --git a/manager/views/machine/groups.php b/manager/views/machine/machine_groups.php
similarity index 90%
rename from manager/views/machine/groups.php
rename to manager/views/machine/machine_groups.php
index b442ab5..3bb7edc 100644
--- a/manager/views/machine/groups.php
+++ b/manager/views/machine/machine_groups.php
@@ -1,12 +1,12 @@
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 ]);
}
diff --git a/manager/views/machine/view.php b/manager/views/machine/machine_view.php
similarity index 89%
rename from manager/views/machine/view.php
rename to manager/views/machine/machine_view.php
index 1b301e8..6f34448 100644
--- a/manager/views/machine/view.php
+++ b/manager/views/machine/machine_view.php
@@ -1,12 +1,12 @@
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 ]);
}
diff --git a/manager/views/user/groups.php b/manager/views/user/user_groups.php
similarity index 90%
rename from manager/views/user/groups.php
rename to manager/views/user/user_groups.php
index 392bbbb..0d68a02 100644
--- a/manager/views/user/groups.php
+++ b/manager/views/user/user_groups.php
@@ -1,12 +1,12 @@
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 ]);
}
diff --git a/manager/views/user/view.php b/manager/views/user/user_view.php
similarity index 90%
rename from manager/views/user/view.php
rename to manager/views/user/user_view.php
index d66d12d..2996a58 100644
--- a/manager/views/user/view.php
+++ b/manager/views/user/user_view.php
@@ -1,12 +1,12 @@
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 ]);
}
diff --git a/test/automate.php b/test/automate.php
index e662819..6a4a4f7 100755
--- a/test/automate.php
+++ b/test/automate.php
@@ -453,8 +453,4 @@
// ]);
//
// $a->dispatch();
-
-
-
-
?>
diff --git a/test/testHashChain.php b/test/testHashChain.php
index 90101c0..c1b2e40 100644
--- a/test/testHashChain.php
+++ b/test/testHashChain.php
@@ -7,7 +7,7 @@
$hash = 'password';
- $times = 10000;
+ $times = 1;
$start = microtime(true);
$hashed = sessionManager::secure_hash($hash, $times);
diff --git a/view/analytics.php b/view/analytics.php
index 2bb87eb..41683e8 100755
--- a/view/analytics.php
+++ b/view/analytics.php
@@ -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 "";
echo 'Statistiques';
- var_dump( manager\Database::getPDO()->query('SELECT * from user')->fetchAll() );
+ var_dump( Table::get('user')->select('*')->fetch() );
echo '';
// }
diff --git a/view/groups.php b/view/groups.php
index 7e46870..f2c0093 100755
--- a/view/groups.php
+++ b/view/groups.php
@@ -1,6 +1,6 @@
";
debug();
- $clusterView = new View('group.view', []);
+ $clusterView = new ViewManager('group.view', []);
$clusterView->view();
echo '';
@@ -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();
}
diff --git a/view/history.php b/view/history.php
index 3f2eccb..c1318d5 100755
--- a/view/history.php
+++ b/view/history.php
@@ -66,8 +66,6 @@
->select('id_history', Rows::SEL_COUNT, Rows::SEL_DISTINCT)
->fetch();
- var_dump($selected);
-
echo "";
echo "Machine";
@@ -89,7 +87,7 @@
echo "";
- echo "".$mac['id_history']." conducteur(s)";
+ echo "".$mac['agg_id_history']." conducteur(s)";
echo "test";
echo "";
diff --git a/view/machines.php b/view/machines.php
index f9087c1..f95df87 100755
--- a/view/machines.php
+++ b/view/machines.php
@@ -1,6 +1,6 @@
";
- $machineView = new View('machine.view', []);
+ $machineView = new ViewManager('machine.view', []);
$machineView->view();
echo '';
@@ -146,7 +146,7 @@
=========================================================*/
echo "";
- $grouplist = new View('machine.groups', []);
+ $grouplist = new ViewManager('machine.groups', []);
$grouplist->view();
echo '';
diff --git a/view/users.php b/view/users.php
index 75ddd34..05de1a7 100755
--- a/view/users.php
+++ b/view/users.php
@@ -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 "";
- $userlist = new View('user.view', []);
+ $userlist = new ViewManager('user.view', []);
$userlist->view();
echo '';
@@ -166,7 +166,7 @@
=========================================================*/
echo "";
- $grouplist = new View('user.groups', []);
+ $grouplist = new ViewManager('user.groups', []);
$grouplist->view();
echo '';