mirror of
https://github.com/hotspotbilling/phpnuxbill.git
synced 2024-11-10 17:26:48 +08:00
update
Nav label added
This commit is contained in:
parent
7e0e09f9bf
commit
10e788e9a2
2 changed files with 35 additions and 18 deletions
|
@ -17,7 +17,7 @@ $menu_registered = array();
|
|||
* | Customer menu: AFTER_DASHBOARD, ORDER, HISTORY, ACCOUNTS
|
||||
* @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;
|
||||
$menu_registered[] = [
|
||||
|
@ -25,7 +25,9 @@ function register_menu($name, $admin, $function, $position, $icon = '')
|
|||
"admin" => $admin,
|
||||
"position" => $position,
|
||||
"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')
|
||||
{
|
||||
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)
|
||||
|
@ -316,20 +322,30 @@ try {
|
|||
// "function" => $function
|
||||
$ui->assign('_system_menu', $routes[0]);
|
||||
foreach ($menu_registered as $menu) {
|
||||
if ($menu['admin'] && _admin(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>';
|
||||
}
|
||||
$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>';
|
||||
}
|
||||
$menus[$menu['position']] .= '<span class="text">' . $menu['name'] . '</span></a></li>';
|
||||
}
|
||||
}
|
||||
if ($menu['admin'] && _admin(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>';
|
||||
} 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) {
|
||||
$ui->assign('_MENU_' . $k, $v);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue