From 1f4bd28045069f66a7aab538646443ceef76c3db Mon Sep 17 00:00:00 2001 From: Ibnu Maksum Date: Tue, 1 Aug 2023 15:00:17 +0700 Subject: [PATCH] Add Custom UI Folder to customize UI --- .gitignore | 5 ++++- system/boot.php | 33 ++++++++++++++++----------------- ui/ui_custom/README.md | 5 +++++ ui/ui_custom/index.html | 0 4 files changed, 25 insertions(+), 18 deletions(-) create mode 100644 ui/ui_custom/README.md create mode 100644 ui/ui_custom/index.html diff --git a/.gitignore b/.gitignore index bfd3e7e..5a2ce6e 100644 --- a/.gitignore +++ b/.gitignore @@ -16,4 +16,7 @@ system/paymentgateway/** !system/paymentgateway/index.html !system/plugin/ui/ system/plugin/ui/* -!system/plugin/ui/index.html \ No newline at end of file +!system/plugin/ui/index.html +ui/ui_custom/** +!ui/ui_custom/index.html +!ui/ui_custom/README.md \ No newline at end of file diff --git a/system/boot.php b/system/boot.php index 6f98ab7..c2e0c63 100644 --- a/system/boot.php +++ b/system/boot.php @@ -55,7 +55,7 @@ ORM::configure('username', $db_user); ORM::configure('password', $db_password); ORM::configure('driver_options', array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8')); ORM::configure('return_result_sets', true); -if($_app_stage != 'Live'){ +if ($_app_stage != 'Live') { ORM::configure('logging', true); } @@ -67,7 +67,7 @@ foreach ($result as $value) { date_default_timezone_set($config['timezone']); $_c = $config; -if($config['radius_mode']){ +if ($config['radius_mode']) { ORM::configure("mysql:host=$radius_host;dbname=$radius_name", null, 'radius'); ORM::configure('username', $radius_user, 'radius'); ORM::configure('password', $radius_password, 'radius'); @@ -84,7 +84,7 @@ function _notify($msg, $type = 'e') $lan_file = 'system/lan/' . $config['language'] . '/common.lan.php'; require($lan_file); $ui = new Smarty(); -$ui->setTemplateDir('ui/ui/'); +$ui->setTemplateDir(['custom' => 'ui/ui_custom/', 'default' => 'ui/ui/']); $ui->addTemplateDir('system/paymentgateway/ui/', 'pg'); $ui->addTemplateDir('system/plugin/ui/', 'plugin'); $ui->setCompileDir('ui/compiled/'); @@ -130,8 +130,7 @@ include "autoload/Hookers.php"; //register all plugin -foreach (glob("system/plugin/*.php") as $filename) -{ +foreach (glob("system/plugin/*.php") as $filename) { include $filename; } @@ -290,25 +289,25 @@ if (file_exists($sys_render)) { // "function" => $function $ui->assign('_system_menu', $routes[0]); foreach ($menu_registered as $menu) { - if($menu['admin'] && _admin(false)) { - $menus[$menu['position']] .= ''; - if(!empty($menu['icon'])){ - $menus[$menu['position']] .= ''; + if ($menu['admin'] && _admin(false)) { + $menus[$menu['position']] .= ''; + if (!empty($menu['icon'])) { + $menus[$menu['position']] .= ''; } - $menus[$menu['position']] .= ''.$menu['name'].''; - }else if(!$menu['admin'] && _auth(false)) { - $menus[$menu['position']] .= ''; - if(!empty($menu['icon'])){ - $menus[$menu['position']] .= ''; + $menus[$menu['position']] .= '' . $menu['name'] . ''; + } else if (!$menu['admin'] && _auth(false)) { + $menus[$menu['position']] .= ''; + if (!empty($menu['icon'])) { + $menus[$menu['position']] .= ''; } - $menus[$menu['position']] .= ''.$menu['name'].''; + $menus[$menu['position']] .= '' . $menu['name'] . ''; } } foreach ($menus as $k => $v) { - $ui->assign('_MENU_'.$k, $v); + $ui->assign('_MENU_' . $k, $v); } unset($menus, $menu_registered); include($sys_render); } else { - r2(U.'dashboard', 'e', 'not found'); + r2(U . 'dashboard', 'e', 'not found'); } diff --git a/ui/ui_custom/README.md b/ui/ui_custom/README.md new file mode 100644 index 0000000..e83eb16 --- /dev/null +++ b/ui/ui_custom/README.md @@ -0,0 +1,5 @@ +# CUSTOM DESIGN + +If you want to change the UI, copy the file from UI, to here, and edit as you need, so it will not be overwrite when updating + +Jika mau mengubah tampilan UI, salin filenya dari folder UI kesini, lalu ubah sesuai keinginan, sehingga tidak akan ditimpa saat ada update \ No newline at end of file diff --git a/ui/ui_custom/index.html b/ui/ui_custom/index.html new file mode 100644 index 0000000..e69de29