From 32cc74166b5668b8cace09d2741da15ca7b7ba24 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Sat, 18 Feb 2017 16:10:59 +0100 Subject: [PATCH] Remove unused files (removed view:groups/permission_choice) --- build/viewer/view/group/permission_choice.php | 159 ------------------ .../viewer/view/group/permission_choice.twig | 29 ---- public_html/view/groups.php | 18 +- 3 files changed, 2 insertions(+), 204 deletions(-) delete mode 100644 build/viewer/view/group/permission_choice.php delete mode 100644 build/viewer/view/group/permission_choice.twig diff --git a/build/viewer/view/group/permission_choice.php b/build/viewer/view/group/permission_choice.php deleted file mode 100644 index 708fbdd..0000000 --- a/build/viewer/view/group/permission_choice.php +++ /dev/null @@ -1,159 +0,0 @@ - $params['id_target'], - 'class' => 1 - ]); - $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] On récupère les données de l'action - =========================================================*/ - /* (1) Rédige la requête */ - $permlistRequest = new Request('clusterDefault/getPermissions', []); - $permlistResponse = $permlistRequest->dispatch(); - - /* (2) Manage error */ - if( $permlistResponse->error->get() != Err::Success ) - return Viewer::$htmlError; - - /* (3) Get action name (non-translated) */ - $action_name = null; - foreach($permlistResponse->get('permissions') as $perm) - if( $perm['id_permission'] == $params['id_action'] ) - $action_name = $perm['name']; - - /* (4) Manage error (not found) */ - if( is_null($action_name) ) - return Viewer::$htmlError; - - - - /* [2] Init Twig - =========================================================*/ - $loader = new \Twig_Loader_Filesystem(__BUILD__.'/viewer/view'); - $twig = new \Twig_Environment($loader, []); - - - /* [3] Store variables - =========================================================*/ - $variables = [ - 'p_permname' => $action_name, - 'p_id_target' => $params['id_target'], - 'p_id_permission' => $params['id_action'], - 'p_name' => $currentCluster['name'], - 'p_theme' => $_SESSION['WAREHOUSE']['theme'] - ]; - - /* [4] Store functions - =========================================================*/ - $twig->addFunction(new \Twig_Function('f_userclusters', function($id_target, $id_action){ - /* [1] On récupère les groupes utilisateurs - =========================================================*/ - /* (1) On exécute la requête */ - $getmembersRequest = new Request('clusterDefault/getAuthenticatedClusters', [ - 'id_target' => $id_target, - 'id_action' => $id_action - ]); - $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('clusters') as $member) - $members_ids[] = $member['id_user_cluster']; - - - - /* [2] On récupère les utilisateurs non membres - =========================================================*/ - - /* (2) On exécute la requête */ - $getuclusterRequest = new Request('clusterDefault/getAll', [ - 'class' => 0 - ]); - $getuclustersResponse = $getuclusterRequest->dispatch(); - - /* (3) si erreur, on affiche l'explicitation */ - if( $getuclustersResponse->error->get() != Err::Success ) - return []; - - /* (4) On récupère la liste des utilisateurs */ - $uclusters = $getuclustersResponse->get('clusters'); - - /* (5) On ajoute s'ils sont dans le groupe ou non */ - foreach($uclusters as $u=>$ucluster) - $uclusters[$u]['already'] = in_array($ucluster['id_user_cluster'], $members_ids); - return $uclusters; - - })); - - - $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; - - default: return $word; break; - } - }else - return $word; - - })); - - - - /* [5] Build the whole stuff - =========================================================*/ - return $twig->render('group/permission_choice.twig', [ - 'p_permname' => $variables['p_permname'], - 'p_id_permission' => $variables['p_id_permission'], - 'p_name' => $variables['p_name'], - 'p_id_target' => $variables['p_id_target'], - 'p_theme' => $variables['p_theme'] - ]); - - } - - - } - - -?> diff --git a/build/viewer/view/group/permission_choice.twig b/build/viewer/view/group/permission_choice.twig deleted file mode 100644 index cf79f44..0000000 --- a/build/viewer/view/group/permission_choice.twig +++ /dev/null @@ -1,29 +0,0 @@ -Modifier d'autres permissions -

- - - -
- - - -
- - Nom du groupe - permission {{ p_permname | translate('fr') }} sur {{ p_name }} -
- - - {% for ucluster in f_userclusters(p_id_target, p_id_permission) %} - -
- {{ ucluster.name }} - - - - - -
- - {% endfor %} -
diff --git a/public_html/view/groups.php b/public_html/view/groups.php index 6f8458f..1388051 100755 --- a/public_html/view/groups.php +++ b/public_html/view/groups.php @@ -202,21 +202,7 @@ =========================================================*/ echo "
"; - /* (1) Si on a un ID_CLUSTER, on affiche la composition - ---------------------------------------------------------*/ - if( count($post) > 2 && preg_match('/^m\d+$/', $post[1]) && preg_match('/^a\d+$/', $post[2])){ - - $membersChoice = new Viewer('group.permission_choice', [ - 'id_target' => (int) substr($post[1], 1), - 'id_action' => (int) substr($post[2], 1) - ]); - $membersChoice->view(); - - }else{ - - $groupChoice = new Viewer('group.permission', []); - $groupChoice->view(); - - } + $groupChoice = new Viewer('group.permission', []); + $groupChoice->view(); echo '
';