diff --git a/build/generic/view/machine/form/create/main.php b/build/generic/view/machine/form/create/main.php
new file mode 100644
index 0000000..a86fb55
--- /dev/null
+++ b/build/generic/view/machine/form/create/main.php
@@ -0,0 +1,12 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/build/generic/view/machine/form/edit/main.php b/build/generic/view/machine/form/edit/main.php
new file mode 100644
index 0000000..5740576
--- /dev/null
+++ b/build/generic/view/machine/form/edit/main.php
@@ -0,0 +1,12 @@
+
+
+
+
+
+ machine 0 sur 0
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/build/generic/view/machine/form/remove/main.php b/build/generic/view/machine/form/remove/main.php
new file mode 100644
index 0000000..81b7d10
--- /dev/null
+++ b/build/generic/view/machine/form/remove/main.php
@@ -0,0 +1,12 @@
+
+
+
+
+
+ machine 0 sur 0
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/build/viewer/core/Viewer.php b/build/viewer/core/Viewer.php
deleted file mode 100755
index 68297c6..0000000
--- a/build/viewer/core/Viewer.php
+++ /dev/null
@@ -1,146 +0,0 @@
-Une erreur est survenue, veuilez contacter le webmaster si cette erreur persiste.";
-
-
-
- /* INITIALISATION DE LA VUE VUE
- *
- * @template Nom du modèle de la vue à utiliser
- * @args 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 Chemin du modèle
- *
- * @return status 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();
-//
-
-
-?>
diff --git a/build/viewer/view/group/group_choice.php b/build/viewer/view/group/group_choice.php
deleted file mode 100755
index f9e30fd..0000000
--- a/build/viewer/view/group/group_choice.php
+++ /dev/null
@@ -1,52 +0,0 @@
- $_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']
- ]);
- }
-
-
- }
-
-
-?>
diff --git a/build/viewer/view/group/group_choice.twig b/build/viewer/view/group/group_choice.twig
deleted file mode 100755
index 1bfc01d..0000000
--- a/build/viewer/view/group/group_choice.twig
+++ /dev/null
@@ -1,16 +0,0 @@
-
diff --git a/build/viewer/view/group/members_choice.php b/build/viewer/view/group/members_choice.php
deleted file mode 100755
index acc0dba..0000000
--- a/build/viewer/view/group/members_choice.php
+++ /dev/null
@@ -1,138 +0,0 @@
- $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']
- ]);
- }
-
-
- }
-
-
-?>
diff --git a/build/viewer/view/group/members_choice.twig b/build/viewer/view/group/members_choice.twig
deleted file mode 100755
index e6206f1..0000000
--- a/build/viewer/view/group/members_choice.twig
+++ /dev/null
@@ -1,50 +0,0 @@
-Modifier un autre groupe
-
-
-
-
-
-
-
-
- {# USER HEADER #}
- {% if p_class == 0 %}
- Identifiant
- Nom
- Code RFID
- {# MACHINE HEADER #}
- {% else %}
- Nom
- {% endif %}
- Membre de {{ p_name }}
-
-
-
- {% for member in f_members(p_id_cluster, p_class) %}
-
- {# USER ENTRIES #}
- {% if p_class == 0 %}
-
- {{ member.username }}
- {{ member.firstname }} {{ member.lastname }}
- {{ member.code }}
-
-
-
-
-
-
- {# MACHINE ENTRIES #}
- {% else %}
-
- {{ member.name }}
-
-
-
-
-
-
- {% endif %}
-
- {% endfor %}
-
diff --git a/build/viewer/view/group/permission.php b/build/viewer/view/group/permission.php
deleted file mode 100755
index 94c245c..0000000
--- a/build/viewer/view/group/permission.php
+++ /dev/null
@@ -1,126 +0,0 @@
- [
- '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']
- ]);
- }
-
-
- }
-
-
-?>
diff --git a/build/viewer/view/group/permission.twig b/build/viewer/view/group/permission.twig
deleted file mode 100755
index 4d2d7dd..0000000
--- a/build/viewer/view/group/permission.twig
+++ /dev/null
@@ -1,50 +0,0 @@
-
-
-{% for machine_cluster in f_clusters() %}
-
-
- {% set nbmachines = f_nbmachines(machine_cluster.id_machine_cluster) %}
-
- {{ machine_cluster.name }}
- {# {{ p_icon.remove | raw }}
-
- {{ p_icon.edit | raw }} #}
-
-
- {{ p_icon.device | raw }}
- {{ nbmachines }} machines
-
-
-
- {% for permission in f_permissions() %}
-
-
-
- {{ permission.name | translate('fr') }}
-
-
-
-
- {% for user_cluster in f_userclusters(machine_cluster.id_machine_cluster,permission.id_permission) %}
-
- {{ user_cluster.name }}
-
-
- {% endfor %}
-
-
- +
-
-
- {% endfor %}
-
-
-
-{# if no result #}
-{% else %}
-
-
- Aucun groupe trouvé.
-
-
-{% endfor %}
diff --git a/build/viewer/view/group/view.php b/build/viewer/view/group/view.php
deleted file mode 100755
index 6959476..0000000
--- a/build/viewer/view/group/view.php
+++ /dev/null
@@ -1,90 +0,0 @@
- [
- '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']
- ]);
- }
-
-
- }
-
-
-?>
diff --git a/build/viewer/view/group/view.twig b/build/viewer/view/group/view.twig
deleted file mode 100755
index 4a84a3d..0000000
--- a/build/viewer/view/group/view.twig
+++ /dev/null
@@ -1,101 +0,0 @@
-
-
-{% 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 %}
-
-
-
- {{ user_cluster.name }}
- {{ p_icon.remove | raw }}
-
- {{ p_icon.edit | raw }}
-
-
- {{ p_icon.user | raw }}
- {{ memlen }} utilisateur{% if memlen > 1 %}s{% endif %}
-
-
-
-
- {{ p_icon.group | raw }}
-
-
- {% for user in f_members(user_cluster.id_user_cluster, 0) %}
-
- {{ user.username }}
-
-
- {% endfor %}
-
-
- +
-
-
-
-{% 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 %}
-
-
-
- {{ machine_cluster.name }}
- {{ p_icon.remove | raw }}
-
- {{ p_icon.edit | raw }}
-
-
- {{ p_icon.device | raw }}
- {{ memlen }} machine{% if memlen > 1 %}s{% endif %}
-
-
-
- {{ p_icon.option | raw }}
- {% for option in f_options(machine_cluster.id_machine_cluster) %}
-
- {{ option.name }}:{{ option.daemon }}
-
- {% else %}
- Aucune option
- {% endfor %}
-
-
-
- {{ p_icon.group | raw }}
-
-
- {% for machine in f_members(machine_cluster.id_machine_cluster,1) %}
-
- {{ machine.name }}
-
-
- {% endfor %}
-
-
- +
-
-
-
-
-{% endfor %}
-
-
-{# if no result #}
-{% if noresult %}
-
-
- Aucun groupe trouvé
-
-
-{% endif %}
diff --git a/build/viewer/view/history/view.php b/build/viewer/view/history/view.php
deleted file mode 100755
index 2652dd5..0000000
--- a/build/viewer/view/history/view.php
+++ /dev/null
@@ -1,129 +0,0 @@
- $_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 Timestamp to process
- *
- * @return relative 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, '.'];
- }
-
-
- }
diff --git a/build/viewer/view/history/view.twig b/build/viewer/view/history/view.twig
deleted file mode 100755
index e78eaa9..0000000
--- a/build/viewer/view/history/view.twig
+++ /dev/null
@@ -1,44 +0,0 @@
-
-
-
-
-{% for entry in f_history() %}
-
-
- {% if loop.index == 1 %}
-
-
- Machine
- Dernière utilisation
- Utilisateur
- Action
- Historique détaillé
-
-
- {% endif %}
-
-
-
- #{{ entry.machine_name }}
-
-
- {{ entry.timestamp | f_tsformat }}
- Il y a {{ entry.timestamp | f_tsrelative }}
-
-
-
-
- {{ entry.user_name }}
- {{ entry.user_firstname }} {{ entry.user_lastname }}
-
-
-
- {{ entry.action_name }}
-
-
-
-
-
-
-
-{% endfor %}
diff --git a/build/viewer/view/machine/groups.php b/build/viewer/view/machine/groups.php
deleted file mode 100755
index 774d82a..0000000
--- a/build/viewer/view/machine/groups.php
+++ /dev/null
@@ -1,91 +0,0 @@
- [
- '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']
- ]);
- }
-
-
- }
-
-
-?>
diff --git a/build/viewer/view/machine/groups.twig b/build/viewer/view/machine/groups.twig
deleted file mode 100755
index 1fc09e8..0000000
--- a/build/viewer/view/machine/groups.twig
+++ /dev/null
@@ -1,54 +0,0 @@
-
-
-{% for cluster in f_clusters() %}
-
-
- {% set machinelist = f_machines(cluster.id_machine_cluster) %}
-
- {{ cluster.name }}
- {{ p_icon.remove | raw }}
-
- {{ p_icon.edit | raw }}
-
-
- {{ p_icon.device | raw }}
- {{ machinelist | length }} machines
-
-
-
-
- {{ p_icon.option | raw }}
- {% for option in f_options(cluster.id_machine_cluster) %}
-
- {{ option.name }}:{{ option.daemon }}
-
- {% else %}
- Aucune option
- {% endfor %}
-
-
-
- {{ p_icon.group | raw }}
-
-
- {% for machine in machinelist %}
-
- {{ machine.name }}
-
-
- {% endfor %}
-
-
- +
-
-
-
-
-{# if no result #}
-{% else %}
-
-
- Aucun groupe trouvé.
-
-
-{% endfor %}
diff --git a/build/viewer/view/machine/view.php b/build/viewer/view/machine/view.php
deleted file mode 100755
index 88eaba1..0000000
--- a/build/viewer/view/machine/view.php
+++ /dev/null
@@ -1,102 +0,0 @@
- [
- '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']
- ]);
- }
-
-
- }
-
-
-?>
diff --git a/build/viewer/view/machine/view.twig b/build/viewer/view/machine/view.twig
deleted file mode 100755
index 0298c7b..0000000
--- a/build/viewer/view/machine/view.twig
+++ /dev/null
@@ -1,45 +0,0 @@
-
-
-{% for machine in f_machines() %}
-
-
-
- {{ machine.name }} #{{ machine.name }}
- {{ p_icon.remove | raw }}
-
- {{ p_icon.edit | raw }}
-
- {# List etrees #}
- {% set motheure = f_motheure(machine.id_machine) %}
-
- {% if motheure %}
-
- {{ p_icon.motor | raw }}
- {{ motheure }}ms
-
- {% endif %}
-
-
- {{ p_icon.group | raw }}
-
-
- {% for cluster in f_clusters(machine.id_machine) %}
-
- {{ cluster.name }}
-
-
- {% endfor %}
-
-
- +
-
-
-
-
-{# if no result #}
-{% else %}
-
-
- Aucune machine trouvée
-
-{% endfor %}
diff --git a/build/viewer/view/user/groups.php b/build/viewer/view/user/groups.php
deleted file mode 100755
index 3ea17c2..0000000
--- a/build/viewer/view/user/groups.php
+++ /dev/null
@@ -1,84 +0,0 @@
- [
- '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']
- ]);
- }
-
-
-
-
-
-
-
-
-
-
- }
-
-
-?>
diff --git a/build/viewer/view/user/groups.twig b/build/viewer/view/user/groups.twig
deleted file mode 100755
index d5382da..0000000
--- a/build/viewer/view/user/groups.twig
+++ /dev/null
@@ -1,44 +0,0 @@
-
-
-{% for cluster in f_clusters() %}
-
-
- {% set userlist = f_users(cluster.id_user_cluster) %}
-
-
- {{ cluster.name }}
- {{ p_icon.remove | raw }}
-
- {{ p_icon.edit | raw }}
-
-
- {{ p_icon.type | raw }}
- {{ userlist | length }} utilisateurs
-
-
-
- {{ p_icon.group | raw }}
-
-
- {% for user in userlist %}
-
-
- {{ user.username }}
-
-
-
- {% endfor %}
-
-
- +
-
-
-
-
-{# if no result #}
-{% else %}
-
-
- Aucun groupe trouvé.
-
-{% endfor %}
diff --git a/build/viewer/view/user/view.php b/build/viewer/view/user/view.php
deleted file mode 100755
index 349de9a..0000000
--- a/build/viewer/view/user/view.php
+++ /dev/null
@@ -1,70 +0,0 @@
- [
- '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']
- ]);
- }
-
-
- }
-
-
-?>
diff --git a/build/viewer/view/user/view.twig b/build/viewer/view/user/view.twig
deleted file mode 100755
index 7cea9cb..0000000
--- a/build/viewer/view/user/view.twig
+++ /dev/null
@@ -1,53 +0,0 @@
-
-
-{% for user in f_users() %}
-
-
-
- {{ user.firstname }} {{ user.lastname }} #{{ user.username }}
- {{ p_icon.remove | raw }}
-
- {{ p_icon.edit | raw }}
-
-
- {{ p_icon.card | raw }}
- {{ user.code }}
-
-
-
- {{ p_icon.mail | raw }}
-
-
- {{ user.mail }}
-
-
-
-
- {{ p_icon.group | raw }}
-
-
- {% for cluster in f_clusters(user.id_user) %}
-
-
-
- {{ cluster.name }}
-
-
-
- {% endfor %}
-
-
- +
-
-
-
-
-
-{# if no result #}
-{% else %}
-
-
- Aucun utilisateur trouvé
-
-
-{% endfor %}
diff --git a/composer.json b/composer.json
index 3a07fa5..71c6677 100644
--- a/composer.json
+++ b/composer.json
@@ -22,7 +22,6 @@
"http\\": "build/http",
"orm\\": "build/orm",
"router\\": "build/router",
- "viewer\\": "build/viewer",
"log\\": "build/log",
"generic\\": "build/generic",
"view\\": "build/generic/view",
diff --git a/public_html/view/machines.php b/public_html/view/machines.php
index cf8a3f2..84d8861 100755
--- a/public_html/view/machines.php
+++ b/public_html/view/machines.php
@@ -69,11 +69,8 @@
=========================================================*/
echo "";
- echo "";
+ $view = View::load('machine.form.create');
+ echo $view->render();
echo '';
@@ -92,18 +89,8 @@
=========================================================*/
echo "";
- echo "";
+ $view = View::load('machine.form.remove');
+ echo $view->render();
echo '';
@@ -122,19 +109,8 @@
=========================================================*/
echo "";
- echo "";
+ $view = View::load('machine.form.edit');
+ echo $view->render();
echo '';