function menu_active($menu_item = null) { if (is_array($menu_item)) { $menu_item = get_menu_item('id', $menu_item); } if (!$menu_item) { $menu_item = Registry::get('menu_item'); } if ($menu_item) { return $menu_item->active(); } }
<?php include "config.php"; if (!isset($_GET["id"])) { echo "No ID Found."; die; } $id = $_GET["id"]; $result = mysql_query("select * from `order` where id={$id}") or die(mysql_error()); $ara = array(); $counter = 0; while ($x = mysql_fetch_assoc($result)) { $sara["name"] = get_menu_item($x["item_id"])["name"]; $sara["quantity"] = $x["quantity"]; $sara["price"] = $x["price"]; $sara["status"] = $x["status"]; array_push($ara, $sara); } echo json_encode($ara);
$i++; } } /** hiển thị nestable */ function nestable($args_menu, $parent = 0) { foreach ($args_menu as $menu_item) { $id = $menu_item->id; $menu_name = get_men_val(array('name' => 'menu_name', 'id' => $id)); $menu_class = get_men_val(array('name' => 'menu_class', 'id' => $id)); $menu_attr = get_men_val(array('name' => 'menu_attr', 'id' => $id)); $menu_icon = get_men_val(array('name' => 'menu_icon', 'id' => $id)); $menu_request_uri = get_men_val(array('name' => 'menu_request_uri', 'id' => $id)); ?> <li class="dd-item" data-id="<?php echo $id; ?> "> <div data-id="<?php echo $id; ?> " class="dd-handle"> <span><?php echo $menu_name; ?> </span> </div> <form data-id="<?php echo $id; ?> " action="?run=menu_ajax.php&id=<?php echo $id; ?> &action=edit_item" method="post" class="ajaxForm ajaxFormmenuEditItem"> <div class="dd-handle-btn" data-id="<?php echo $id; ?> "> <i class="fa fa-cog"></i> </div> <div class="dd-option-panel" data-id="<?php echo $id; ?> "> <div class="row"> <div class="col-md-6"> <?php $field_array = array('nice_name' => _('Nhãn Điều Hướng'), 'name' => 'menu_name', 'input_type' => 'text', 'placeholder' => _('Bạn có thể đặt lại tên theo ý mình'), 'default_value' => $menu_name, 'handle' => FALSE); build_input_form($field_array); ?> </div> <div class="col-md-6"> <?php $field_array = array('nice_name' => _('Lớp CSS'), 'name' => 'menu_class', 'input_type' => 'text', 'placeholder' => _('Thêm class CSS để tùy biến tốt hơn'), 'default_value' => $menu_class, 'handle' => FALSE); build_input_form($field_array); ?> </div> </div> <div class="row"> <div class="col-md-6"> <?php $field_array = array('nice_name' => _('Thuộc tính tùy chỉnh'), 'name' => 'menu_attr', 'input_type' => 'text', 'placeholder' => _('Ví dụ : onclick="dropdown_menu()"'), 'default_value' => $menu_attr, 'handle' => FALSE); build_input_form($field_array); ?> </div> <div class="col-md-6"> <?php $field_array = array('name' => 'menu_icon', 'label' => 'Chọn biểu tượng', 'imageonly' => TRUE); media_file_input($field_array); ?> </div> <div class="col-md-12"> <?php if (is_numeric($menu_request_uri)) {
function main($id, $mode) { global $db, $user, $auth, $template, $cache; global $config, $SID, $phpbb_root_path, $phpbb_admin_path, $phpEx; $store = ''; $user->add_lang('acp/k_menus'); $this->tpl_name = 'acp_k_menus'; $this->page_title = 'ACP_MENUS'; $form_key = 'acp_k_menus'; add_form_key($form_key); //$action = request_var('action', ''); $submit = isset($_POST['submit']) ? true : false; if ($submit && !check_form_key($form_key)) { $submit = false; $mode = ''; trigger_error('Error! ' . $user->lang['FORM_INVALID'] . basename(dirname(__FILE__)) . '/' . basename(__FILE__) . ', line ' . __LINE__); } $menuitem = request_var('menuitem', ''); $template->assign_vars(array('U_BACK' => "{$phpbb_root_path}adm/index.{$phpEx}{$SID}&i=k_menus&mode=nav", 'U_EDIT' => "{$phpbb_root_path}adm/index.{$phpEx}{$SID}&i=k_menus&mode=edit" . '&menu=' . $menuitem, 'U_UP' => "{$phpbb_root_path}adm/index.{$phpEx}{$SID}&i=k_menus&mode=up" . '&menu=' . $menuitem, 'U_DOWN' => "{$phpbb_root_path}adm/index.{$phpEx}{$SID}&i=k_menus&mode=down" . '&menu=' . $menuitem, 'U_DELETE' => "{$phpbb_root_path}adm/index.{$phpEx}{$SID}&i=k_menus&mode=delete" . '&menu=' . $menuitem)); // Set up general vars //$action = request_var('action', ''); $mode = request_var('mode', ''); $menu = request_var('menu', 0); $menuitem = request_var('menuitem', ''); $u_action = append_sid("{$phpbb_admin_path}index.{$phpEx}", "i={$id}&mode={$mode}"); if ($mode == '') { $mode = 'head'; } if ($submit) { $store = $mode; } switch ($mode) { case 'head': get_menu(0); $template->assign_var('S_OPTIONS', 'head'); break; case 'nav': get_menu(1); $template->assign_var('S_OPTIONS', 'nav'); break; case 'sub': get_menu(2); $template->assign_var('S_OPTIONS', 'sub'); break; case 'all': get_menu(90); $template->assign_var('S_OPTIONS', 'all'); break; case 'unalloc': get_menu(99); $template->assign_var('S_OPTIONS', 'unalloc'); break; case 'edit': if ($submit) { $m_id = request_var('m_id', 0); $ndx = request_var('ndx', 0); $menu_type = request_var('menu_type', ''); $menu_icon = request_var('menu_icon', ''); $name = utf8_normalize_nfc(request_var('name', '', true)); $link_to = request_var('link_to', ''); $append_sid = request_var('append_sid', 0); $append_uid = request_var('append_uid', 0); $extern = request_var('extern', 0); $soft_hr = request_var('soft_hr', 0); $sub_heading = request_var('sub_heading', 0); $view_by = request_var('view_by', 1); $view_all = request_var('view_all', 1); $view_groups = request_var('view_groups', ''); if ($view_all) { $view_by = 1; $view_groups = ''; } if (strstr($menu_icon, '..')) { $menu_icon = 'default.png'; } //echo $menu_icon; $sql_ary = array('menu_type' => $menu_type, 'ndx' => $ndx, 'menu_icon' => $menu_icon, 'name' => $name, 'link_to' => $link_to, 'append_sid' => $append_sid, 'append_uid' => $append_uid, 'extern' => $extern, 'soft_hr' => $soft_hr, 'sub_heading' => $sub_heading, 'view_all' => $view_all, 'view_by' => $view_by, 'view_groups' => $view_groups); $sql = 'UPDATE ' . K_MENUS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " WHERE m_id = " . (int) $m_id; if (!($result = $db->sql_query($sql))) { trigger_error($user->lang['ERROR_PORTAL_MENUS'] . basename(dirname(__FILE__)) . '/' . basename(__FILE__) . ', line ' . __LINE__); } $cache->destroy('sql', K_MENUS_TABLE); switch ($menu_type) { case 1: $mode = 'nav'; break; case 2: $mode = 'sub'; break; default: $mode = 'manage'; break; } $template->assign_vars(array('L_MENU_REPORT' => $user->lang['DATA_IS_BEING_SAVED'] . '</font><br />', 'S_OPTIONS' => 'save')); meta_refresh(1, append_sid("{$phpbb_admin_path}index.{$phpEx}", 'i=k_menus&mode=' . $mode)); break; } // get all groups and fill array // get_all_groups(); // A simple fix to allow delete if ($menu > 99) { $menu = $menu / 100; } if ($submit == 1) { get_menu_item($m_id); } else { get_menu_item($menu); } $template->assign_var('S_OPTIONS', 'edit'); get_menu_icons(); break; case 'delete': if (!$menu) { trigger_error($user->lang['MUST_SELECT_VALID_MENU_DATA'] . adm_back_link($this->u_action), E_USER_WARNING); } if (confirm_box(true)) { $sql = 'SELECT name, m_id FROM ' . K_MENUS_TABLE . ' WHERE m_id = ' . (int) $menu; $result = $db->sql_query($sql); $name = (string) $db->sql_fetchfield('name'); $id = (int) $db->sql_fetchfield('m_id'); $db->sql_freeresult($result); $name .= ' Menu '; $sql = 'DELETE FROM ' . K_MENUS_TABLE . "\n\t\t\t\t\t\tWHERE m_id = " . (int) $menu; $db->sql_query($sql); $template->assign_var('L_MENU_REPORT', $name . $user->lang['DELETED'] . '</font><br />'); $cache->destroy('sql', K_MENUS_TABLE); meta_refresh(1, append_sid("{$phpbb_admin_path}index.{$phpEx}", 'i=k_menus&mode=all')); break; } else { confirm_box(false, $user->lang['CONFIRM_OPERATION_MENUS'], build_hidden_fields(array('i' => $id, 'mode' => $mode, 'action' => 'delete'))); } $template->assign_var('L_MENU_REPORT', $user->lang['ACTION_CANCELLED']); meta_refresh(1, append_sid("{$phpbb_admin_path}index.{$phpEx}", 'i=k_menus&mode=all')); break; case 'up': case 'down': $to_move = $move_to = ''; // get current menu data // $sql = "SELECT m_id, ndx, menu_type FROM " . K_MENUS_TABLE . "\n\t\t\t\t\tWHERE m_id = " . (int) $menu . " LIMIT 1"; if (!($result = $db->sql_query($sql))) { trigger_error($user->lang['ERROR_PORTAL_MENUS'] . basename(dirname(__FILE__)) . '/' . basename(__FILE__) . ', line ' . __LINE__); } $row = $db->sql_fetchrow($result); $to_move['m_id'] = $row['m_id']; $to_move['ndx'] = $temp = $row['ndx']; $type = $row['menu_type']; if ($mode == 'up') { $temp = $temp - 1; } if ($mode == 'down') { $temp = $temp + 1; } // get move_to menu data// $sql = "SELECT m_id, ndx, menu_type FROM " . K_MENUS_TABLE . "\n\t\t\t\t\tWHERE ndx = {$temp}\n\t\t\t\t\t\tAND menu_type = '" . $db->sql_escape($type) . "' LIMIT 1"; if (!($result = $db->sql_query($sql))) { trigger_error($user->lang['MENU_MOVE_ERROR'] . basename(dirname(__FILE__)) . '/' . basename(__FILE__) . ', line ' . __LINE__); } $row = $db->sql_fetchrow($result); $move_to['m_id'] = $row['m_id']; $move_to['ndx'] = $row['ndx']; if ($move_to['ndx'] != $temp) { trigger_error($user->lang['MENU_MOVE_ERROR'] . basename(dirname(__FILE__)) . '/' . basename(__FILE__) . ', line ' . __LINE__); } if ($mode == 'up') { // sql is not duplicated $sql = "UPDATE " . K_MENUS_TABLE . " SET ndx = " . (int) $to_move['ndx'] . " WHERE m_id = " . (int) $move_to['m_id']; if (!($result = $db->sql_query($sql))) { trigger_error($user->lang['MENU_MOVE_ERROR'] . basename(dirname(__FILE__)) . '/' . basename(__FILE__) . ', line ' . __LINE__); } $sql = "UPDATE " . K_MENUS_TABLE . " SET ndx = " . (int) $move_to['ndx'] . " WHERE m_id = " . (int) $to_move['m_id']; if (!($result = $db->sql_query($sql))) { trigger_error($user->lang['MENU_MOVE_ERROR'] . basename(dirname(__FILE__)) . '/' . basename(__FILE__) . ', line ' . __LINE__); } } if ($mode == 'down') { // sql is not duplicated $sql = "UPDATE " . K_MENUS_TABLE . " SET ndx = " . (int) $move_to['ndx'] . " WHERE m_id = " . (int) $to_move['m_id']; if (!($result = $db->sql_query($sql))) { trigger_error($user->lang['MENU_MOVE_ERROR'] . basename(dirname(__FILE__)) . '/' . basename(__FILE__) . ', line ' . __LINE__); } $sql = "UPDATE " . K_MENUS_TABLE . " SET ndx = " . (int) $to_move['ndx'] . " WHERE m_id = " . (int) $move_to['m_id']; if (!($result = $db->sql_query($sql))) { trigger_error($user->lang['MENU_MOVE_ERROR'] . basename(dirname(__FILE__)) . '/' . basename(__FILE__) . ', line ' . __LINE__); } } $template->assign_vars(array('L_MENU_REPORT' => $user->lang['SORT_ORDER_UPDATING'], 'S_OPTIONS' => 'updn')); $mode = 'nav'; $cache->destroy('sql', K_MENUS_TABLE); meta_refresh(1, append_sid("{$phpbb_admin_path}index.{$phpEx}", 'i=k_menus&mode=nav')); break; case 'create': if ($submit) { //$m_id =request_var('m_id', ''); //$ndx = request_var('ndx', ''); $menu_type = request_var('menu_type', ''); $menu_icon = request_var('menu_icon', ''); $name = utf8_normalize_nfc(request_var('name', '', true)); $link_to = request_var('link_to', ''); $append_sid = request_var('append_sid', 0); $append_uid = request_var('append_uid', 0); $extern = request_var('extern', 0); $soft_hr = request_var('soft_hr', 0); $sub_heading = request_var('sub_heading', 0); $view_by = request_var('view_by', 1); $view_all = request_var('view_all', 1); $view_groups = request_var('view_groups', ''); if ($menu_type == NULL || $name == NULL) { // catch all we check menu_type, $name, view_by) $template->assign_vars(array('L_MENU_REPORT' => $user->lang['MISSING_DATA'], 'S_OPTIONS' => 'updn')); return; } if (strstr($menu_icon, '..') && !$sub_heading) { $menu_icon = 'default.png'; } $ndx = get_next_ndx($menu_type); if ($view_all) { $view_by = 1; $view_groups = ''; } $sql_array = array('menu_type' => $menu_type, 'ndx' => $ndx, 'menu_icon' => $menu_icon, 'name' => $name, 'link_to' => $link_to, 'append_sid' => $append_sid, 'append_uid' => $append_uid, 'extern' => $extern, 'soft_hr' => $soft_hr, 'sub_heading' => $sub_heading, 'view_all' => $view_all, 'view_by' => $view_by, 'view_groups' => $view_groups); $db->sql_query('INSERT INTO ' . K_MENUS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_array)); $cache->destroy('sql', K_MENUS_TABLE); //fix for the different menus... meta_refresh(1, append_sid("{$phpbb_admin_path}index.{$phpEx}", 'i=k_menus&mode=' . $store)); $template->assign_var('L_MENU_REPORT', $user->lang['MENU_CREATED']); break; //return; } else { // get all groups and fill array // get_all_groups(); get_menu_icons(); $template->assign_var('S_OPTIONS', 'add'); break; } case 'icons': $dirslist = ''; $i = get_menu_icons(); $template->assign_vars(array('S_OPTIONS' => 'icons', 'S_HIDE' => 'HIDE', 'L_ICONS_REPORT' => '', 'S_MENU_ICON_COUNT' => $i, 'S_MENU_ICONS_LIST' => $dirslist)); break; case 'manage': $template->assign_var('L_MENU_REPORT', $user->lang['FUTURE_DEVELOPMENT'] . '</font><br />'); $template->assign_var('S_OPTIONS', 'manage'); break; case 'sync': $template->assign_vars('L_MENU_REPORT', $user->lang['NOT_ASSIGNED'] . '</font><br />'); $template->assign_var('S_OPTIONS', 'sync'); break; case 'tools': $template->assign_var('S_OPTIONS', 'tools'); break; case 'default': } $template->assign_var('U_ACTION', $u_action); }
* Tệp tin xử lý trình đơn trong admin * Vị trí : admin/menu.php */ if (!defined('BASEPATH')) { exit('403'); } /** gọi tệp tin admin base */ require_once dirname(__FILE__) . '/admin.php'; /** gọi model xử lý menu */ require_once dirname(__FILE__) . '/menu/menu_model.php'; require_once dirname(__FILE__) . '/taxonomy/taxonomy_model.php'; $key = hm_get('key'); $id = hm_get('id'); $action = hm_get('action'); switch ($action) { case 'edit': if (isset_menu_id($id)) { $args_tax = $hmtaxonomy->hmtaxonomy; $args_menu = get_menu_item($id); /** Hiển thị giao diện chỉnh sửa menu */ function admin_content_page() { global $args_tax; global $args_menu; require_once BASEPATH . HM_ADMINCP_DIR . '/' . LAYOUT_DIR . '/' . 'menu_edit.php'; } } else { /** Hiển thị giao diện 404 */ function admin_content_page() { require_once BASEPATH . HM_ADMINCP_DIR . '/' . LAYOUT_DIR . '/' . 'admincp_404.php';
<?php get_header(); $parentId = $_GET['bread']; $menuItems = wp_get_nav_menu_items('glowne'); $parent = get_menu_item($menuItems , $parentId); ?> <div class="dbline"></br></div> <h1><?php echo $parent->title; ?></h1> <div class="dbline"></br></div> <div style="display: block; height: 20px;"></div> <div class="text"> <?php foreach($menuItems as $item) { $id=$item->menu_item_parent; if ($id!=$parentId) continue; $title = $item->title; $url = $item->url; if ( ($url=='') || ($url=='#')) if (hasChildren($menuItems, $item->ID)) $url="?bread=".$item->ID; echo "<a href='$url'>$title</a>"; echo '</br>'; }
function breadcrumbs($forcedUrl='', $noBold=false){ global $post; $menuItems = wp_get_nav_menu_items('glowne'); $url = "http://".$_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]; //if (is_paged()){ // $url = preg_replace('#&paged=\d*#', '', $url); //} if ( is_single() || is_search() ){ $url=get_permalink(); $bold_suffix = false; if (!find_menu_item($menuItems, get_permalink())){ $url=get_post_type_archive_link( get_post_type($post) ); $suffix = get_the_title(); $bold_suffix=true; } } if (!empty($forcedUrl)){ $url=$forcedUrl; $suffix=''; $bold_suffix=false; } $s=''; $baseUrl = "http://".$_SERVER["HTTP_HOST"]."/"; foreach($menuItems as $menuItem) { $absoluteUrl = url_to_absolute( $baseUrl, $menuItem->url); // bo w menu link moze byc zapisany jako samo "?post_type=xxx"; if($absoluteUrl == $url ) { $id=$menuItem->ID; for ($x=0; $x<50; $x++){ if (empty($id)) break; $item = get_menu_item($menuItems, $id); $parentId = $item->menu_item_parent; $title = $item->title; $title = htmlentities( $title, ENT_QUOTES ,"UTF-8" ); //if (!empty_link($item->url)){ // $title='<a href="'.$item->url.'">'.$title.'</a>'; //} $href=$item->url; if ( ($href=='') || ($href=='#') ) //$href='?bread='.$item->ID; $href = "#"; if ( ($x==0) && (!$bold_suffix) && (!$noBold)){ $s = '<span>'.$title.'</span>'. $s; //$s = '<span class="breadcrumbs first">'.$title.'</span>'. $s; }else{ if($x != 1){ $separator = '<span> > </span>'; //$separator = '<span class="breadcrumbs sep"> > </span>'; }else{ $separator = ''; } $s = ' <a href="'.$href.'">'.$title.' </a>'.$separator. $s; //$s = ' <a href="'.$href.'" class="breadcrumbs">'.$title.' </a>'.$separator. $s; } $id = $parentId; } if (!$noBold) $s.= '<span>'.$suffix.'</span>'; //dokladamy tytul postu //$s.= '<span class="breadcrumbsBold last">'.$suffix.'</span>'; //dokladamy tytul postu //echo $s; break; } } if ( (empty($s)) && (empty($forcedUrl)) && (!$noBold) ) $s='<span>'.get_the_title().'</span>'; //$s='<span class="breadcrumbsBold single">'.get_the_title().'</span>'; echo $s; }