public function aGetNavData() { $tree_api = new KOperation_Menu_TreeApi(); $menu_api = new KOperation_Menu_Api(); $cur_menu = $this->_aGetCurrentMenu(); $relation_menu = array(); if ($cur_menu) { $relation_menu = $tree_api->aGetParent($cur_menu['id'], 0); if ($relation_menu) { unset($relation_menu[count($relation_menu) - 1]); } $top_menu_id = $relation_menu ? $relation_menu[count($relation_menu) - 1] : $cur_menu['id']; if ($relation_menu) { $relation_menu = array_values($relation_menu); $relation_menu[] = $cur_menu['id']; } } if (!$top_menu_id) { $top_menu_id = 1; } // 如果没有关联的导航则以第一个子节点为关联导航 $menu_tree = $tree_api->aGetChild($top_menu_id, 0); if ($menu_tree) { $this->_vSetAllPriMenuIds($menu_tree); } // 获取全部导航信息 $all_menu = $menu_api->aGetAll(); // 获取顶部导航 $top_ids = array_keys($tree_api->aGetChild(0, 1)); $top_menus = array(); foreach ($top_ids as $top_id) { $top_menus[$top_id] = $all_menu[$top_id]; } //menu_tree 左侧菜单树 //relation_menu 当前节点父节点集合 $left_nav_html = $this->_sRenderingNav($menu_tree, $all_menu, $relation_menu); //顶层导航a,当前节点a,左侧菜单html return array($top_menus, $cur_menu, $left_nav_html); }
echo $sMenuTree; exit; }); Ko_Web_Route::VPost('del', function () { $iId = Ko_Web_Request::IInput("id"); $oApi = new KOperation_Menu_Api(); $iRet = $oApi->iDelete($iId); KAdmin_Helper::vOutput($iRet); }); Ko_Web_Route::VGet('edit', function () { $iId = Ko_Web_Request::IInput("id"); $iParentId = Ko_Web_Request::IInput("parentid"); $oApi = new KOperation_Menu_Api(); $oTreeApi = new KOperation_Menu_TreeApi(); $aList = $oApi->aGetAll(); $aTree = $oTreeApi->aGetChild(0, 0); if ($iId) { $aParent = $oTreeApi->aGetParent($iId, 1); $iParentId = empty($aParent) ? 0 : $aParent[0]; } $sMenuOptions = '<option value="0">顶级导航</option>'; $sMenuOptions .= _getMenuOptions($iParentId, $aTree, $aList); $smarty = new Ko_View_Smarty(); $smarty->vAssignHtml(array('title' => '编辑导航', 'info' => $iId ? $aList[$iId] : array(), 'options' => $sMenuOptions), null, array('options')); echo $smarty->sFetch('operation/menu/edit.tpl'); exit; }); Ko_Web_Route::VPost('edit', function () { $sText = Ko_Web_Request::SInput('text'); $sUrl = Ko_Web_Request::SInput('url'); $iParentId = Ko_Web_Request::IInput("parentid");