fix
This commit is contained in:
parent
ca0a04bc24
commit
0df973e534
1 changed files with 16 additions and 11 deletions
|
|
@ -38,7 +38,7 @@ class MenuCategory extends Menu
|
|||
|
||||
public function orderMenu()
|
||||
{
|
||||
usort($this->childmenu, function($a, $b) {
|
||||
usort($this->childmenu, function ($a, $b) {
|
||||
return $a->order - $b->order;
|
||||
});
|
||||
}
|
||||
|
|
@ -47,39 +47,44 @@ class MenuCategory extends Menu
|
|||
{
|
||||
return $this->last_menu;
|
||||
}
|
||||
|
||||
public function buildHtml()
|
||||
{
|
||||
global $g5, $is_admin, $auth, $menu, $auth_menu;
|
||||
$sub_menu = str_replace([G5_ADMIN_URL, "/adm"], ["", ""], $_SERVER["SCRIPT_NAME"]);
|
||||
$sub_menu = preg_replace('/^.*\/([^\/]+\.php)$/', '/$1', str_replace([G5_ADMIN_URL, "/adm"], ["", ""], $_SERVER["SCRIPT_NAME"]));
|
||||
|
||||
$str = "<ul class=\"gnb_2dul\">";
|
||||
foreach($this->childmenu as $key => $menu) {
|
||||
foreach ($this->childmenu as $key => $menu) {
|
||||
if ($is_admin != 'super')
|
||||
continue;
|
||||
|
||||
if (!$menu->display) continue;
|
||||
|
||||
if (!$menu->display)
|
||||
continue;
|
||||
|
||||
if (($menu->gnb_grp_div == 1 && $gnb_grp_style == false) || ($menu->gnb_grp_div != 1 && $gnb_grp_style == true))
|
||||
$gnb_grp_div = 'gnb_grp_div';
|
||||
else
|
||||
$gnb_grp_div = '';
|
||||
|
||||
|
||||
if ($menu->gnb_grp_div == 1)
|
||||
$gnb_grp_style = 'gnb_grp_style';
|
||||
else
|
||||
$gnb_grp_style = '';
|
||||
|
||||
|
||||
$check_gnb_grp_style = "";
|
||||
if (str_replace([G5_ADMIN_URL, "/adm"], ["", ""], $menu->url) == $sub_menu || in_array($sub_menu, $menu->suburl)) {
|
||||
$menu_url = preg_replace('/^.*\/([^\/]+\.php)$/', '/$1', str_replace([G5_ADMIN_URL, "/adm"], ["", ""], $menu->url));
|
||||
if (
|
||||
$menu_url == $sub_menu || in_array($sub_menu, array_map(function ($url) {
|
||||
return preg_replace('/^.*\/([^\/]+\.php)$/', '/$1', str_replace([G5_ADMIN_URL, "/adm"], ["", ""], $url));
|
||||
}, $menu->suburl))
|
||||
) {
|
||||
$check_gnb_grp_style = "check";
|
||||
$this->selected = true;
|
||||
}
|
||||
|
||||
|
||||
$str .= '<li class="gnb_2dli ' . $check_gnb_grp_style . '"><a href="' . $menu->url . '" class="gnb_2da ' . $gnb_grp_style . ' ' . $gnb_grp_div . '" data-text="' . $menu->name . '" style="--icon:\'' . $menu->icon . '\'">' . $menu->name . '</a></li>';
|
||||
}
|
||||
$str .= "</ul>";
|
||||
|
||||
|
||||
return $str;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue