diff --git a/build/generic/core/View.php b/build/generic/core/View.php new file mode 100644 index 0000000..bb80c1a --- /dev/null +++ b/build/generic/core/View.php @@ -0,0 +1,79 @@ +Une erreur est survenue, veuilez contacter le webmaster si cette erreur persiste."; + + + /* (2) Instance constructor + * + * @view_class The target view class + * + ---------------------------------------------------------*/ + private function __construct(String $view_class){ + $this->view_class = $view_class; + } + + + + /* (3) Renders a view with injected data + * + * @injected_data Data to inject + * + * @return render Rendered view + * + ---------------------------------------------------------*/ + public function render($injected_data=[]){ + + /* (1) Create instance with data */ + $view = new $this->view_class(...$injected_data); + + /* (2) Dispatch rendering */ + return $view->render(); + + } + + + /* (4) Loads a view from its path (builder) + * + * @view_path View path + * + * @return 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 */ + $view_class = '\\view\\'.str_replace('.', '\\', $view_path).'\\main'; + + /* (3) Check if class exists */ + if( !class_exists($view_class) ) + return null; + + + /* (2) Return View instance + ---------------------------------------------------------*/ + return new self($view_class); + + } + + + + + + } \ No newline at end of file diff --git a/build/generic/core/i_view.php b/build/generic/core/i_view.php new file mode 100644 index 0000000..35ce4a4 --- /dev/null +++ b/build/generic/core/i_view.php @@ -0,0 +1,43 @@ + true, + 'cache' => false, + 'auto_reload' => true + ]); + + + /* (3) Build the view and return it back + ---------------------------------------------------------*/ + /* (1) Render and return the view */ + return $twig->render($base_path, [ 'core' => $this ]); + + } + + } \ No newline at end of file diff --git a/build/generic/view/group/member/choice/main.php b/build/generic/view/group/member/choice/main.php new file mode 100644 index 0000000..814925d --- /dev/null +++ b/build/generic/view/group/member/choice/main.php @@ -0,0 +1,127 @@ + $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; + } + } + + + } \ No newline at end of file diff --git a/build/generic/view/group/member/choice/main.twig b/build/generic/view/group/member/choice/main.twig new file mode 100644 index 0000000..4679099 --- /dev/null +++ b/build/generic/view/group/member/choice/main.twig @@ -0,0 +1,50 @@ +Modifier un autre groupe +

+ +
+ + + +
+ + {# USER HEADER #} + {% if core.class == 0 %} + Identifiant + Nom + Code RFID + {# MACHINE HEADER #} + {% else %} + Nom + {% endif %} + Membre de {{ core.name }} +
+ + + {% for member in core.get_members(core.id_cluster, core.class) %} + + {# USER ENTRIES #} + {% if core.class == 0 %} +
+ {{ member.username }} + {{ member.firstname }} {{ member.lastname }} + {{ member.code }} + + + + + +
+ {# MACHINE ENTRIES #} + {% else %} +
+ {{ member.name }} + + + + + +
+ {% endif %} + + {% endfor %} +
diff --git a/build/generic/view/group/member/group/main.php b/build/generic/view/group/member/group/main.php new file mode 100644 index 0000000..038f94a --- /dev/null +++ b/build/generic/view/group/member/group/main.php @@ -0,0 +1,32 @@ + $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'); + } + + + } \ No newline at end of file diff --git a/build/generic/view/group/member/group/main.twig b/build/generic/view/group/member/group/main.twig new file mode 100644 index 0000000..800ed3b --- /dev/null +++ b/build/generic/view/group/member/group/main.twig @@ -0,0 +1,16 @@ +
+ + + +
diff --git a/build/generic/view/group/permission/main.php b/build/generic/view/group/permission/main.php new file mode 100644 index 0000000..64cd3f4 --- /dev/null +++ b/build/generic/view/group/permission/main.php @@ -0,0 +1,113 @@ +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; + + } + + + } \ No newline at end of file diff --git a/build/generic/view/group/permission/main.twig b/build/generic/view/group/permission/main.twig new file mode 100644 index 0000000..ead74a8 --- /dev/null +++ b/build/generic/view/group/permission/main.twig @@ -0,0 +1,50 @@ + + +{% for machine_cluster in core.get_clusters() %} +
+ + {% set nb_machines = core.get_nb_machines(machine_cluster.id_machine_cluster) %} + + {{ machine_cluster.name }} + {# {{ core.icon.remove | raw }} + + {{ core.icon.edit | raw }} #} + + + {{ core.icon.device | raw }} + {{ nb_machines }} machines + + + + {% for permission in core.get_permissions() %} + + + + {{ core.permission_translate(permission.name, 'fr') }} + + + + + {% for user_cluster in core.get_authed_user_clusters(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/generic/view/group/view/main.php b/build/generic/view/group/view/main.php new file mode 100644 index 0000000..88b3dfd --- /dev/null +++ b/build/generic/view/group/view/main.php @@ -0,0 +1,79 @@ +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'); + } + + + } \ No newline at end of file diff --git a/build/generic/view/group/view/main.twig b/build/generic/view/group/view/main.twig new file mode 100644 index 0000000..e7119df --- /dev/null +++ b/build/generic/view/group/view/main.twig @@ -0,0 +1,101 @@ + + +{% set noresult = true %} + +{% for user_cluster in core.get_clusters(0) %} + + {% set noresult = false %} + + {% set id_user_cluster = 'u' ~ user_cluster.id_user_cluster %} + {% set memlen = core.get_members(user_cluster.id_user_cluster,0) | length %} + +
+ + {{ user_cluster.name }} + {{ core.icon.remove | raw }} + + {{ core.icon.edit | raw }} + + + {{ core.icon.user | raw }} + {{ memlen }} utilisateur{% if memlen > 1 %}s{% endif %} + + + + + {{ core.icon.group | raw }} + + + {% for user in core.get_members(user_cluster.id_user_cluster, 0) %} + + {{ user.username }} + + + {% endfor %} + + + + + + +
+{% endfor %} + + +{% for machine_cluster in core.get_clusters(1) %} + + {% set noresult = false %} + + {% set id_machine_cluster = 'm' ~ machine_cluster.id_machine_cluster %} + {% set memlen = core.get_members(machine_cluster.id_machine_cluster,1) | length %} + +
+ + {{ machine_cluster.name }} + {{ core.icon.remove | raw }} + + {{ core.icon.edit | raw }} + + + {{ core.icon.device | raw }} + {{ memlen }} machine{% if memlen > 1 %}s{% endif %} + + + + {{ core.icon.option | raw }} + {% for option in core.get_options(machine_cluster.id_machine_cluster) %} + + {{ option.name }}:{{ option.daemon }} + + {% else %} + Aucune option + {% endfor %} + + + + {{ core.icon.group | raw }} + + + {% for machine in core.get_members(machine_cluster.id_machine_cluster,1) %} + + {{ machine.name }} + + + {% endfor %} + + + + + + +
+ +{% endfor %} + + +{# if no result #} +{% if noresult %} + +
+ Aucun groupe trouvé +
+ +{% endif %} diff --git a/build/generic/view/machine/group/main.php b/build/generic/view/machine/group/main.php new file mode 100644 index 0000000..ca0d624 --- /dev/null +++ b/build/generic/view/machine/group/main.php @@ -0,0 +1,87 @@ +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'); + } + + + } \ No newline at end of file diff --git a/build/generic/view/machine/group/main.twig b/build/generic/view/machine/group/main.twig new file mode 100644 index 0000000..cbc0e62 --- /dev/null +++ b/build/generic/view/machine/group/main.twig @@ -0,0 +1,54 @@ + + +{% for cluster in core.get_clusters() %} +
+ + {% set machinelist = core.get_members(cluster.id_machine_cluster) %} + + {{ cluster.name }} + {{ core.icon.remove | raw }} + + {{ core.icon.edit | raw }} + + + {{ core.icon.device | raw }} + {{ machinelist | length }} machines + + + + + {{ core.icon.option | raw }} + {% for option in core.get_options(cluster.id_machine_cluster) %} + + {{ option.name }}:{{ option.daemon }} + + {% else %} + Aucune option + {% endfor %} + + + + {{ core.icon.group | raw }} + + + {% for machine in machinelist %} + + {{ machine.name }} + + + {% endfor %} + + + + + + +
+ +{# if no result #} +{% else %} + +
+ Aucun groupe trouvé. +
+ +{% endfor %} diff --git a/build/generic/view/machine/view/main.php b/build/generic/view/machine/view/main.php new file mode 100644 index 0000000..7c5a2b4 --- /dev/null +++ b/build/generic/view/machine/view/main.php @@ -0,0 +1,102 @@ +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'); + } + + + + + 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'); + } + + + } \ No newline at end of file diff --git a/build/generic/view/machine/view/main.twig b/build/generic/view/machine/view/main.twig new file mode 100644 index 0000000..d4e2a7f --- /dev/null +++ b/build/generic/view/machine/view/main.twig @@ -0,0 +1,45 @@ + + +{% for machine in core.get_machines() %} +
+ + + {{ machine.name }} #{{ machine.name }} + {{ core.icon.remove | raw }} + + {{ core.icon.edit | raw }} + + {# List etrees #} + {% set motheure = core.get_motheure(machine.id_machine) %} + + {% if motheure %} + + {{ core.icon.motor | raw }} + {{ motheure }}ms + + {% endif %} + + + {{ core.icon.group | raw }} + + + {% for cluster in core.get_clusters(machine.id_machine) %} + + {{ cluster.name }} + + + {% endfor %} + + + + + + +
+ +{# if no result #} +{% else %} + +
+ Aucune machine trouvée +
+{% endfor %} diff --git a/build/generic/view/user/group/main.php b/build/generic/view/user/group/main.php new file mode 100644 index 0000000..b67a875 --- /dev/null +++ b/build/generic/view/user/group/main.php @@ -0,0 +1,68 @@ +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'); + } + + } \ No newline at end of file diff --git a/build/generic/view/user/group/main.twig b/build/generic/view/user/group/main.twig new file mode 100644 index 0000000..e805cc2 --- /dev/null +++ b/build/generic/view/user/group/main.twig @@ -0,0 +1,44 @@ + + +{% for cluster in core.get_clusters() %} +
+ + {% set userlist = core.get_members(cluster.id_user_cluster) %} + + + {{ cluster.name }} + {{ core.icon.remove | raw }} + + {{ core.icon.edit | raw }} + + + {{ core.icon.type | raw }} + {{ userlist | length }} utilisateurs + + + + {{ core.icon.group | raw }} + + + {% for user in userlist %} + + + {{ user.username }} + + + + {% endfor %} + + + + + + +
+ +{# if no result #} +{% else %} + +
+ Aucun groupe trouvé. +
+{% endfor %} diff --git a/build/generic/view/user/view/main.php b/build/generic/view/user/view/main.php new file mode 100644 index 0000000..ad6146f --- /dev/null +++ b/build/generic/view/user/view/main.php @@ -0,0 +1,63 @@ +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'); + } + + + } \ No newline at end of file diff --git a/build/generic/view/user/view/main.twig b/build/generic/view/user/view/main.twig new file mode 100644 index 0000000..4cd8f99 --- /dev/null +++ b/build/generic/view/user/view/main.twig @@ -0,0 +1,53 @@ + + +{% for user in core.get_users() %} + +
+ + {{ user.firstname }} {{ user.lastname }} #{{ user.username }} + {{ core.icon.remove | raw }} + + {{ core.icon.edit | raw }} + + + {{ core.icon.card | raw }} + {{ user.code }} + + + + {{ core.icon.mail | raw }} + + + {{ user.mail }} + + + + + {{ core.icon.group | raw }} + + + {% for cluster in core.get_clusters(user.id_user) %} + + + + {{ cluster.name }} + + + + {% endfor %} + + + + + + + +
+ +{# if no result #} +{% else %} + +
+ Aucun utilisateur trouvé +
+ +{% endfor %} diff --git a/build/viewer/view/user/view.php b/build/viewer/view/user/view.php index 5698141..349de9a 100755 --- a/build/viewer/view/user/view.php +++ b/build/viewer/view/user/view.php @@ -13,7 +13,7 @@ =========================================================*/ $loader = new \Twig_Loader_Filesystem(__BUILD__.'/viewer/view'); $twig = new \Twig_Environment($loader, []); - + /* [2] Store variables =========================================================*/ diff --git a/composer.json b/composer.json index 9205177..3a07fa5 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,9 @@ "router\\": "build/router", "viewer\\": "build/viewer", "log\\": "build/log", - "token\\": "build/token" + "generic\\": "build/generic", + "view\\": "build/generic/view", + "token\\": "build/token" }, "files": ["autoloader.php", "lib/vendor/autoload.php"] } diff --git a/public_html/view/groups.php b/public_html/view/groups.php index 59210fc..27dc548 100755 --- a/public_html/view/groups.php +++ b/public_html/view/groups.php @@ -1,9 +1,9 @@ + use \generic\core\View; + ?> @@ -60,8 +60,8 @@ echo "
"; - $clusterView = new Viewer('group.view', []); - $clusterView->view(); + $view = View::load('group.view'); + echo $view->render(); echo '
'; @@ -179,20 +179,20 @@ =========================================================*/ echo "
"; - /* (1) Si on a un ID_CLUSTER, on affiche la composition - ---------------------------------------------------------*/ + /* (1) Si on a un ID_CLUSTER, on affiche la composition + ---------------------------------------------------------*/ if( isset($post[1]) && preg_match('/^(u|m)(\d+)$/', $post[1], $m) ){ - $membersChoice = new Viewer('group.members_choice', [ - 'id_cluster' => (int) $m[2], - 'class' => (int) ($m[1]=='u') ? 0 : 1 + $view = View::load('group.member.choice'); + echo $view->render([ + (int) $m[2], // id_cluster + (int) ($m[1]=='u') ? 0 : 1 // class ]); - $membersChoice->view(); }else{ - $groupChoice = new Viewer('group.group_choice', []); - $groupChoice->view(); + $view = View::load('group.member.group'); + echo $view->render(); } @@ -207,7 +207,7 @@ =========================================================*/ echo "
"; - $groupChoice = new Viewer('group.permission', []); - $groupChoice->view(); + $view = View::load('group.permission'); + echo $view->render(); echo '
'; diff --git a/public_html/view/machines.php b/public_html/view/machines.php index 58c9176..cf8a3f2 100755 --- a/public_html/view/machines.php +++ b/public_html/view/machines.php @@ -1,6 +1,6 @@ @@ -49,8 +49,8 @@ debug(); echo "
"; - $machineView = new Viewer('machine.view', []); - $machineView->view(); + $view = View::load('machine.view'); + echo $view->render(); echo '
'; @@ -145,7 +145,7 @@ =========================================================*/ echo "
"; - $grouplist = new Viewer('machine.groups', []); - $grouplist->view(); + $view = View::load('machine.group'); + echo $view->render(); echo '
'; diff --git a/public_html/view/options.php b/public_html/view/options.php index f3caaa7..6f8924a 100755 --- a/public_html/view/options.php +++ b/public_html/view/options.php @@ -51,7 +51,6 @@ echo "
"; - echo '
'; diff --git a/public_html/view/users.php b/public_html/view/users.php index f372726..989b774 100755 --- a/public_html/view/users.php +++ b/public_html/view/users.php @@ -1,8 +1,8 @@ @@ -51,8 +51,8 @@ =========================================================*/ echo "
"; - $userlist = new Viewer('user.view', []); - $userlist->view(); + $view = View::load('user.view'); + echo $view->render(); echo '
'; @@ -177,7 +177,7 @@ =========================================================*/ echo "
"; - $grouplist = new Viewer('user.groups', []); - $grouplist->view(); + $view = View::load('user.group'); + echo $view->render(); echo '
';