remove origin function and add category selected

This commit is contained in:
Amberstone 2024-09-21 10:21:40 +09:00
parent 0efc73a251
commit f9d04fe6e1
Signed by: amber
GPG key ID: 094B0E55F98D8BF1
7 changed files with 21 additions and 45 deletions

View file

@ -1,4 +1,5 @@
<?php
define('G5_IS_ADMIN', true);
include_once('../common.php');
include_once(G5_ADMIN_PATH . '/admin.lib.php');
include_once '../common.php';
include_once G5_ADMIN_PATH . '/admin.lib.php';

View file

@ -1,4 +1,7 @@
<?php
if (!defined('_GNUBOARD_'))
exit;
$menu["board"] = new MenuCategory("board", "board", "게시판관리", "/board_list.php", true, 2, "", 0);
$menu["board"]->addChildMenu("member", "게시판관리", G5_ADMIN_URL . "/board_list.php", true, 1, "gear-wide-connected", 0);

View file

@ -1,4 +1,7 @@
<?php
if (!defined('_GNUBOARD_'))
exit;
$menu["member"] = new MenuCategory("member", "member", "회원관리", "/member_list.php", true, 1, "", 0);
$menu["member"]->addChildMenu("member", "회원관리", G5_ADMIN_URL . "/member_list.php", true, 1, "gear-wide-connected", 0);

View file

@ -1,4 +1,7 @@
<?php
if (!defined('_GNUBOARD_'))
exit;
$menu["other"] = new MenuCategory("other", "other", "기타관리", "/config_form.php", true, 99, "", 0);
$menu["other"]->addChildMenu("other", "홈페이지 상세관리", G5_ADMIN_URL . "/config_form.php", true, 1, "gear-wide-connected", 0);

View file

@ -1,4 +1,7 @@
<?php
if (!defined('_GNUBOARD_'))
exit;
$menu["config"] = new MenuCategory("config", "config", "사이트 설정", "/site_config_form.php", true, 0, "", 0);
$menu["config"]->addChildMenu("config", "환경설정", G5_ADMIN_URL . "/site_config_form.php", true, 1, "gear-wide-connected", 0);

View file

@ -1,50 +1,10 @@
<?php
if (!defined('_GNUBOARD_'))
exit;
$begin_time = get_microtime();
include_once G5_PATH . '/head.sub.php';
function print_menu1($key, $no)
{
global $menu;
$str = print_menu2($key, $no);
return $str;
}
function print_menu2($key, $no)
{
global $menu, $auth_menu, $is_admin, $auth, $g5, $sub_menu;
$str = "<ul class=\"gnb_2dul\">";
for ($i = 1; $i < count($menu[$key]); $i++) {
if ($is_admin != 'super' && (!array_key_exists($menu[$key][$i][0], $auth) || !strstr($auth[$menu[$key][$i][0]], 'r')))
continue;
if (($menu[$key][$i][4] == 1 && $gnb_grp_style == false) || ($menu[$key][$i][4] != 1 && $gnb_grp_style == true))
$gnb_grp_div = 'gnb_grp_div';
else
$gnb_grp_div = '';
if ($menu[$key][$i][4] == 1)
$gnb_grp_style = 'gnb_grp_style';
else
$gnb_grp_style = '';
$check_gnb_grp_style = "";
if ($menu[$key][$i][0] && isset($sub_menu) && $menu[$key][$i][0] == $sub_menu) {
$check_gnb_grp_style = "check";
}
$str .= '<li class="gnb_2dli ' . $check_gnb_grp_style . '"><a href="' . $menu[$key][$i][2] . '" class="gnb_2da ' . $gnb_grp_style . ' ' . $gnb_grp_div . '" data-text="' . $menu[$key][$i][1] . '">' . $menu[$key][$i][1] . '</a></li>';
$auth_menu[$menu[$key][$i][0]] = $menu[$key][$i][1];
}
$str .= "</ul>";
return $str;
}
?>
<script>
@ -96,7 +56,7 @@ function print_menu2($key, $no)
<?php
$gnb_str = "<ul>";
foreach ($menu as $key => $menuitem) {
$current_class = "";
$current_class = $menuitem->selected ? " gnb_1dli_air" : "";
$gnb_str .= "<li class=\"gnb_1dli{$current_class}\" data-text=\"{$menuitem->name}\">" . PHP_EOL;
$gnb_str .= "<a href=\"" . G5_ADMIN_URL . $menuitem->url . "\" class=\"gnb_1da\">";
$gnb_str .= $menuitem->name;

View file

@ -11,10 +11,12 @@ class MenuCategory extends Menu
public $key;
public $childmenu;
public $selected;
public function __construct($key, $mid, $name, $url, $display = true, $order = 0, $icon = '', $gnb_grp_div = 0)
{
$this->key = $key;
$this->selected = false;
$this->childmenu = [];
parent::__construct($mid, $name, $url, $display, $order, $icon, $gnb_grp_div);
}
@ -71,6 +73,7 @@ class MenuCategory extends Menu
$check_gnb_grp_style = "";
if (str_replace([G5_ADMIN_URL, "/adm"], ["", ""], $menu->url) == $sub_menu || in_array($sub_menu, $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 . '">' . $menu->name . '</a></li>';