示例#1
0
文件: Api.php 项目: firaga/operation
 public function iUpdate($iId, $sText, $sUrl, $iParentId = 0, $iFullScreen = 0)
 {
     $oTreeApi = new KOperation_Menu_TreeApi();
     $aParent = $oTreeApi->aGetParent($iId, 1);
     $iCurrentParentId = empty($aParent) ? 0 : $aParent[0];
     try {
         $this->sqMenuDao->iUpdate($iId, array('text' => $sText, 'url' => $sUrl, 'full_screen' => $iFullScreen ? 1 : 0));
         if ($iCurrentParentId != $iParentId) {
             $oTreeApi->bDel($iId, $iCurrentParentId);
             $oTreeApi->bAdd($iId, $iParentId);
         }
         $this->bClearCache();
     } catch (Exception $e) {
         return 0;
     }
     return $iId;
 }
示例#2
0
文件: App.php 项目: firaga/operation
 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);
 }
示例#3
0
文件: menu.php 项目: firaga/operation
    exit;
});
Ko_Web_Route::VGet('suggest', function () {
    $sName = Ko_Web_Request::SInput("name");
    $suggest_result = KDuizhang_Tool::suggest($sName, "admin_user");
    Ko_Tool_Str::VConvert2UTF8($suggest_result);
    echo json_encode(array('ret' => 1, 'msg' => $suggest_result));
    exit;
});
Ko_Web_Route::VGet('suggestmenu', function () {
    $sName = Ko_Web_Request::SInput("name");
    $sName = Ko_Tool_Str::SConvert2GB18030(trim($sName));
    $suggest_result = KDuizhang_Tool::suggest($sName, "sq_menu", 'id', 'text');
    Ko_Tool_Str::VConvert2UTF8($suggest_result);
    $oApi = new KOperation_Menu_Api();
    $tree_api = new KOperation_Menu_TreeApi();
    $aList = $oApi->aGetAll();
    $result = array();
    if (!empty($suggest_result)) {
        foreach ($suggest_result as $v) {
            $relations = $tree_api->aGetParent($v['id'], 0);
            unset($relations[count($relations) - 1]);
            array_unshift($relations, $v['id']);
            if (!empty($relations)) {
                $relations = array_reverse($relations);
                $msg = '';
                foreach ($relations as $menu_id) {
                    $msg .= $aList[$menu_id]['text'] . '=>';
                }
                $msg = trim($msg, '=>');
                $result[] = array('id' => $v['id'], 'value' => $msg);