diff --git a/data/menu.php b/data/menu.php index b900626..057d69d 100644 --- a/data/menu.php +++ b/data/menu.php @@ -9,7 +9,7 @@ function _get_menu_list() { 'product', 'customer', 'marketing', - 'investor_relation', + //'investor_relation', 'article', 'job', 'pcbuilder', @@ -21,8 +21,21 @@ function _get_menu_list() { $menu_list = []; foreach ($main_items as $item) { - $menu_list[$item] = include_once __DIR__."/menu_item/".$item.".php"; + $item_menu = include_once __DIR__."/menu_item/".$item.".php"; + + // skip not enabled + if(!$item_menu['enable']) continue; + + // skip not enabled children + $item_menu_children_enabled = array_filter($item_menu['menu'], function ($menu_child) { return $menu_child['enable'];}); + if(!sizeof($item_menu_children_enabled)) continue; + + // reset menu for $item_menu + $item_menu['menu'] = $item_menu_children_enabled; + + $menu_list[$item] = $item_menu; } + return $menu_list; } diff --git a/data/menu_item/job.php b/data/menu_item/job.php index 5ab1a29..be261a6 100644 --- a/data/menu_item/job.php +++ b/data/menu_item/job.php @@ -5,7 +5,6 @@ return array( "name" => "Tuyển dụng", "url" => "", "menu" => array( - array( 'enable' => true , 'module' => 'job', diff --git a/data/menu_item/marketing.php b/data/menu_item/marketing.php index 067d02c..91ec640 100644 --- a/data/menu_item/marketing.php +++ b/data/menu_item/marketing.php @@ -2,7 +2,6 @@ return array( 'enable' => true , - "name" => "Marketing", "url" => "", "menu" => array( @@ -51,23 +50,23 @@ return array( 'url' => '/admin/?opt=marketing&view=poster-upload', ), - array( + /* array( 'enable' => true , 'module' => 'system', 'view' => 'store-design', 'id' => 'system/store-design', 'name' => 'Hình nền website', 'url' => '/admin/?opt=system&view=store-design§ion=background', - ), + ),*/ - array( + /* array( 'enable' => false, 'module' => 'email', 'view' => 'home', 'id' => 'email/home', 'name' => 'Email', 'url' => '/admin/?opt=email', - ), + ),*/ array( 'enable' => false, diff --git a/data/menu_item/payinstall.php b/data/menu_item/payinstall.php index c1b609b..925ffe0 100644 --- a/data/menu_item/payinstall.php +++ b/data/menu_item/payinstall.php @@ -2,11 +2,10 @@ return array( 'enable' => true , - "name" => "Trả góp", "url" => "", "menu" => array( - 0 => array( + array( 'enable' => true , 'module' => 'payinstall', 'view' => 'order', @@ -15,7 +14,7 @@ return array( 'url' => '/admin/?opt=payinstall&view=order', ), - 1 => array( + array( 'enable' => true , 'module' => 'payinstall', 'view' => 'home', @@ -24,7 +23,7 @@ return array( 'url' => '/admin/?opt=payinstall', ), - 2 => array( + array( 'enable' => true , 'module' => 'payinstall', 'view' => 'category', diff --git a/data/menu_item/product.php b/data/menu_item/product.php index 7f90b41..d24ab22 100644 --- a/data/menu_item/product.php +++ b/data/menu_item/product.php @@ -4,7 +4,6 @@ return array( 'enable' => true , - "name" => "Sản phẩm", "url" => "", "menu" => array( @@ -17,32 +16,32 @@ return array( 'url' => '/admin/?opt=product', ), - array( + /* array( 'enable' => false , 'module' => 'product', 'view' => 'user-rating', 'id' => 'product/user-rating', 'name' => 'Đánh giá ', 'url' => '/admin/?opt=product&view=user-rating', - ), + ),*/ - array( + /*array( 'enable' => false , 'module' => 'product', 'view' => 'product-customer-image', 'id' => 'product/product-customer-image', 'name' => 'Ảnh người dùng gửi', 'url' => '/admin/?opt=product&view=product-customer-image', - ), + ),*/ - array( + /*array( 'enable' => true , 'module' => 'product', 'view' => 'product-list-update', 'id' => 'product/product-list-update', 'name' => 'Bảng giá cập nhật', 'url' => '/admin/?opt=product&view=product-list-update', - ), + ),*/ array( 'enable' => true , @@ -87,7 +86,7 @@ return array( ), array( - 'enable' => false , + 'enable' => true , 'module' => 'addon', 'view' => 'home', 'id' => 'addon/home', @@ -96,7 +95,7 @@ return array( ), array( - 'enable' => false , + 'enable' => true , 'module' => 'config_group', 'view' => 'home', 'id' => 'config_group/home', @@ -104,53 +103,35 @@ return array( 'url' => '/admin/?opt=config_group', ), - array( + /*array( 'enable' => false , 'module' => 'supplier', 'view' => 'home', 'id' => 'supplier/home', 'name' => 'Nhà cung cấp', 'url' => '/admin/?opt=supplier', - ), + ),*/ - array( - 'enable' => false , - 'module' => 'product', - 'view' => 'product-erp-not-web', - 'id' => 'product/product-erp-not-web', - 'name' => 'SP ERP chưa có trên web', - 'url' => '/admin/?opt=product&view=product-erp-not-web', - ), - - array( + /* array( 'enable' => false , 'module' => 'product', 'view' => 'set-promotion-price', 'id' => 'product/set-promotion-price', 'name' => 'Cài đặt giá khuyến mại', 'url' => '/admin/?opt=product&view=set-promotion-price', - ), + ),*/ - array( + /*array( 'enable' => false , 'module' => 'product', 'view' => 'product-per-customer-group', 'id' => 'product/product-per-customer-group', 'name' => 'Giá theo nhóm khách hàng', 'url' => '/admin/?opt=product&view=product-per-customer-group', - ), + ),*/ array( - 'enable' => false , - 'module' => 'product', - 'view' => 'list-competitor', - 'id' => 'product/list-competitor', - 'name' => 'So sánh giá đối thủ', - 'url' => '/admin/?opt=product&view=list-competitor', - ), - - array( - 'enable' => false , + 'enable' => true , 'module' => 'product', 'view' => 'set', 'id' => 'product/set', @@ -166,6 +147,5 @@ return array( 'name' => 'Nhóm thông số kỹ thuật', 'url' => '/admin/?opt=product&view=spec-group', ), - ), ); diff --git a/data/menu_item/report.php b/data/menu_item/report.php index 7677ca2..e6b634c 100644 --- a/data/menu_item/report.php +++ b/data/menu_item/report.php @@ -6,7 +6,7 @@ return array( "name" => "Thống kê", "url" => "", "menu" => array( - 0 => array( + array( 'enable' => true , 'module' => 'report', 'view' => 'visitor', @@ -15,7 +15,7 @@ return array( 'url' => '/admin/?opt=report&view=visitor', ), - 1 => array( + array( 'enable' => true , 'module' => 'report', 'view' => 'customer', @@ -24,7 +24,7 @@ return array( 'url' => '/admin/?opt=report&view=customer', ), - 2 => array( + array( 'enable' => true , 'module' => 'report', 'view' => 'order', @@ -33,7 +33,7 @@ return array( 'url' => '/admin/?opt=report&view=order', ), - 3 => array( + array( 'enable' => true , 'module' => 'report', 'view' => 'product-buy', @@ -42,7 +42,7 @@ return array( 'url' => '/admin/?opt=report&view=product-buy', ), - 4 => array( + array( 'enable' => true , 'module' => 'report', 'view' => 'product-visit', @@ -51,7 +51,7 @@ return array( 'url' => '/admin/?opt=report&view=product-visit', ), - 5 => array( + array( 'enable' => true , 'module' => 'report', 'view' => 'referer', @@ -60,7 +60,7 @@ return array( 'url' => '/admin/?opt=report&view=referer', ), - 6 => array( + array( 'enable' => true , 'module' => 'report', 'view' => 'search', @@ -69,13 +69,13 @@ return array( 'url' => '/admin/?opt=report&view=search', ), - /*7 => array( + array( 'enable' => true , 'module' => 'report', 'view' => 'error-page', 'id' => '', 'name' => 'Lỗi website', 'url' => '/admin/?opt=report&view=error-page', - ),*/ + ), ), ); diff --git a/inc/Hura8/AppAdmin.php b/inc/Hura8/AppAdmin.php index 04e94c8..b743330 100644 --- a/inc/Hura8/AppAdmin.php +++ b/inc/Hura8/AppAdmin.php @@ -55,8 +55,8 @@ class AppAdmin $data = include_once $module_file; - $global_data = [ - "name" => $this->current_route_info['module'], + $global_data = [ + "module" => $this->current_route_info['module'], "view" => $this->current_route_info['view'], "main_menu" => include_once ROOT_DIR."/data/menu.php", ]; diff --git a/inc/common.php b/inc/common.php index cc63e25..3f4dea9 100644 --- a/inc/common.php +++ b/inc/common.php @@ -1,5 +1,14 @@ ', $content, '']) ; +} + function init_autoload(){ $classLoader = require_once ROOT_DIR . '/package/vendor/autoload.php'; $classLoader->add("Hura8", ROOT_DIR . '/inc' ); diff --git a/template/javascript/index.html b/template/javascript/index.html index 52b1a1b..ba1630d 100644 --- a/template/javascript/index.html +++ b/template/javascript/index.html @@ -1,9 +1,10 @@ {% include javascript/global %} -{% if global.name == 'home' %} -{% include javascript/homepage %} +{% if global.module == 'home' %} + {% include javascript/homepage %} + +{% elsif global.module == 'product' %} + {% include javascript/product_form %} + {% endif %} -{% if global.name == 'product' %} -{% include javascript/product_form %} -{% endif %} \ No newline at end of file diff --git a/template/theme.html b/template/theme.html index dfe7798..8ea3bf2 100644 --- a/template/theme.html +++ b/template/theme.html @@ -24,12 +24,12 @@ -{{ global | show_var }} -{{ page | show_var }} +
- +