update
Nav label added
This commit is contained in:
parent
7e0e09f9bf
commit
10e788e9a2
@ -17,7 +17,7 @@ $menu_registered = array();
|
|||||||
* | Customer menu: AFTER_DASHBOARD, ORDER, HISTORY, ACCOUNTS
|
* | Customer menu: AFTER_DASHBOARD, ORDER, HISTORY, ACCOUNTS
|
||||||
* @param string icon from ion icon, ion-person, only for AFTER_
|
* @param string icon from ion icon, ion-person, only for AFTER_
|
||||||
*/
|
*/
|
||||||
function register_menu($name, $admin, $function, $position, $icon = '')
|
function register_menu($name, $admin, $function, $position, $icon = '', $label = '', $color = '')
|
||||||
{
|
{
|
||||||
global $menu_registered;
|
global $menu_registered;
|
||||||
$menu_registered[] = [
|
$menu_registered[] = [
|
||||||
@ -25,7 +25,9 @@ function register_menu($name, $admin, $function, $position, $icon = '')
|
|||||||
"admin" => $admin,
|
"admin" => $admin,
|
||||||
"position" => $position,
|
"position" => $position,
|
||||||
"icon" => $icon,
|
"icon" => $icon,
|
||||||
"function" => $function
|
"function" => $function,
|
||||||
|
"label" => $label,
|
||||||
|
"color" => $color
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,4 +50,3 @@ function run_hook($action){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -223,7 +223,13 @@ function _admin($login = true)
|
|||||||
|
|
||||||
function _log($description, $type = '', $userid = '0')
|
function _log($description, $type = '', $userid = '0')
|
||||||
{
|
{
|
||||||
Log::put($type, $description, $userid);
|
$d = ORM::for_table('tbl_logs')->create();
|
||||||
|
$d->date = date('Y-m-d H:i:s');
|
||||||
|
$d->type = $type;
|
||||||
|
$d->description = $description;
|
||||||
|
$d->userid = $userid;
|
||||||
|
$d->ip = $_SERVER["REMOTE_ADDR"];
|
||||||
|
$d->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
function Lang($key)
|
function Lang($key)
|
||||||
@ -316,20 +322,30 @@ try {
|
|||||||
// "function" => $function
|
// "function" => $function
|
||||||
$ui->assign('_system_menu', $routes[0]);
|
$ui->assign('_system_menu', $routes[0]);
|
||||||
foreach ($menu_registered as $menu) {
|
foreach ($menu_registered as $menu) {
|
||||||
if ($menu['admin'] && _admin(false)) {
|
if ($menu['admin'] && _admin(false)) {
|
||||||
$menus[$menu['position']] .= '<li' . (($routes[1] == $menu['function']) ? ' class="active"' : '') . '><a href="' . U . 'plugin/' . $menu['function'] . '">';
|
$menus[$menu['position']] .= '<li' . (($routes[1] == $menu['function']) ? ' class="active"' : '') . '><a href="' . U . 'plugin/' . $menu['function'] . '">';
|
||||||
if (!empty($menu['icon'])) {
|
if (!empty($menu['icon'])) {
|
||||||
$menus[$menu['position']] .= '<i class="' . $menu['icon'] . '"></i>';
|
$menus[$menu['position']] .= '<i class="' . $menu['icon'] . '"></i>';
|
||||||
}
|
}
|
||||||
$menus[$menu['position']] .= '<span class="text">' . $menu['name'] . '</span></a></li>';
|
if (!empty($menu['label'])) {
|
||||||
} else if (!$menu['admin'] && _auth(false)) {
|
$menus[$menu['position']] .= '<span class="pull-right-container">
|
||||||
$menus[$menu['position']] .= '<li' . (($routes[1] == $menu['function']) ? ' class="active"' : '') . '><a href="' . U . 'plugin/' . $menu['function'] . '">';
|
<small class="label pull-right bg-'. $menu['color'] .'">' . $menu['label'] . '</small>
|
||||||
if (!empty($menu['icon'])) {
|
</span>';
|
||||||
$menus[$menu['position']] .= '<i class="' . $menu['icon'] . '"></i>';
|
}
|
||||||
}
|
$menus[$menu['position']] .= '<span class="text">' . $menu['name'] . '</span></a></li>';
|
||||||
$menus[$menu['position']] .= '<span class="text">' . $menu['name'] . '</span></a></li>';
|
} else if (!$menu['admin'] && _auth(false)) {
|
||||||
}
|
$menus[$menu['position']] .= '<li' . (($routes[1] == $menu['function']) ? ' class="active"' : '') . '><a href="' . U . 'plugin/' . $menu['function'] . '">';
|
||||||
}
|
if (!empty($menu['icon'])) {
|
||||||
|
$menus[$menu['position']] .= '<i class="' . $menu['icon'] . '"></i>';
|
||||||
|
}
|
||||||
|
if (!empty($menu['label'])) {
|
||||||
|
$menus[$menu['position']] .= '<span class="pull-right-container">
|
||||||
|
<small class="label pull-right bg-'. $menu['color'] .'">' . $menu['label'] . '</small>
|
||||||
|
</span>';
|
||||||
|
}
|
||||||
|
$menus[$menu['position']] .= '<span class="text">' . $menu['name'] . '</span></a></li>';
|
||||||
|
}
|
||||||
|
}
|
||||||
foreach ($menus as $k => $v) {
|
foreach ($menus as $k => $v) {
|
||||||
$ui->assign('_MENU_' . $k, $v);
|
$ui->assign('_MENU_' . $k, $v);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user