From 4f7f1667131cc10583c4c2a2b0d9c131f7cd89b2 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Wed, 13 Apr 2016 17:06:16 +0200 Subject: [PATCH] Gestion du Routeur avec le fichier /config/menu.json. --- automate.php | 5 +---- config/menu.json | 2 +- index.php | 5 +++-- manager/MenuManager.php | 23 +++++++++++++++++++++-- 4 files changed, 26 insertions(+), 9 deletions(-) diff --git a/automate.php b/automate.php index 0fe5f56..a9b1327 100755 --- a/automate.php +++ b/automate.php @@ -66,7 +66,7 @@ var_dump( $contact ); } - // parseCallLog(); + parseCallLog(); debug(); @@ -80,8 +80,5 @@ // var_dump($response); - $menu = new \manager\MenuManager(); - - echo $menu->inflate(); ?> \ No newline at end of file diff --git a/config/menu.json b/config/menu.json index 6531ac3..62c8c61 100644 --- a/config/menu.json +++ b/config/menu.json @@ -44,7 +44,7 @@ "children": [ { "permissions": [], "text": "Téléphone", "attributes": { "data-sublink": "phone" } }, - { "permissions": [], "text": "Tout", + { "permissions": [], "text": "Toutes les données", "attributes": { "data-sublink": "all" } } ] }, diff --git a/index.php b/index.php index 4fed391..0569d3a 100755 --- a/index.php +++ b/index.php @@ -7,6 +7,7 @@ use \manager\ModuleRequest; use \manager\ManagerError; use \manager\Database; + use \manager\MenuManager; @@ -80,8 +81,8 @@ /* [2] On recupere la liste des pages du site =========================================================*/ - $views = json_decode( ResourceDispatcher::getResource( 'f/json/views/conf', true ) ); - + $temporaryMenuInflater = new MenuManager(); + $views = $temporaryMenuInflater->getCategories(); // nomPage/arg1/arg2 -> inclusion de la page diff --git a/manager/MenuManager.php b/manager/MenuManager.php index 3664cd5..3fca85c 100644 --- a/manager/MenuManager.php +++ b/manager/MenuManager.php @@ -99,13 +99,33 @@ + public function getCategories(){ + /* [1] On construit le menu + =========================================================*/ + $this->buildMenu(); + + /* [2] On recupere la liste des categories + =========================================================*/ + $views = array(); + + foreach($this->categories as $category) + array_push($views, $category['attributes']['data-link']); + + + /* [3] On retourne la liste des categories + =========================================================*/ + return $views; + } + + + /* VERIFIE TOUTES LES PERMISSIONS ET MET A JOUR LES CATEGORIES AVEC LES PARTIES QUE L'ON PEUT ACCEDER UNIQUEMENT * */ - private function buildMenu(){ + public function buildMenu(){ /* [0] Initialisation du menu qui va etre retourne (vide) =========================================================*/ $menu = array(); @@ -146,7 +166,6 @@ /* [3] On met a jour le menu =========================================================*/ $this->categories = $menu; - }