/**
  * 
  * 递归获取菜单
  * @author 张骥
  */
 public function getChildMenu($parentId)
 {
     $Menu = new Widget_Menu();
     $ChildMenu = $Menu->getChildMenu($parentId);
     if (count($ChildMenu)) {
         foreach ($ChildMenu as $key => $val) {
             $rescurTree = $this->getChildMenu($val['menu_id']);
             if (count($rescurTree)) {
                 $ChildMenu[$key]['tree'] = $rescurTree;
             }
         }
     }
     return $ChildMenu;
 }
 /**
  * 
  * 获取子级菜单
  * @author 张骥
  */
 public function getChildMenuAction()
 {
     $partnerId = $this->request->partnerId;
     $menu_id = $this->request->menu;
     $level = $this->request->level;
     $is_table = $this->request->is_table;
     $Menu = new Widget_Menu();
     $childmenu = $Menu->getChildMenu($partnerId);
     $menuCount = count($childmenu);
     if ($is_table) {
         $pfix = "";
         for ($i = 1; $i <= $level; $i++) {
             for ($j = 1; $j <= $level; $j++) {
                 $pfix .= "&nbsp;&nbsp;";
             }
         }
         $pfix .= "┠&nbsp;&nbsp;";
         $return = array("count" => $menuCount, "tr" => '<tr class="' . $partnerId . '_' . $level . '" level="' . $level . '"><td colspan="6" style="padding:0px;border-top:none;border-bottom:none;"><table border="0" cellpadding="0" cellspacing="0">');
         if ($menuCount) {
             foreach ($childmenu as $key => $arr) {
                 $Child = $Menu->getChildMenu($arr['menu_id']);
                 if (count($Child) > 0) {
                     $arr['permission_list'] = "双击打开下级菜单";
                     $arr['update_permission'] = '';
                 } else {
                     $arr['update_permission'] = '| <a href="?ctl=menu/permission&ac=modify.by.menu&menu_id=' . $arr['menu_id'] . '">权限</a>';
                 }
                 $return['tr'] .= '<tr class="hover" id="' . $arr['menu_id'] . '" level="' . $level . '" ondblclick="getChildMenu(this.id,' . ($level + 1) . ')" style="cursor: pointer;">';
                 $return['tr'] .= '<td width="100"><input type="text" name="sort[' . $arr['menu_id'] . ']" value="' . $arr['sort'] . '" size="3"/></td>
                                   <td width="100">' . $arr['menu_id'] . '</td>
                                   <td style="text-align:left" width="500">' . $pfix . $arr['name'] . '</td>
                                   <td width="400">' . $arr['link'] . '</td>
                                   <td width="400">' . $arr['permission_list'] . '</td>
                                   <td width="200">
                                     <a href="javascript:;" onclick="divBox.showBox(\'?ctl=menu&ac=modify&menu_id=' . $arr['menu_id'] . '\', {title:\'修改菜单\',height:450,width:620});">修改</a>
                                   | <a href="javascript:;" onclick="divBox.confirmBox({content:\'是否确认删除 ' . $arr['name'] . ' ?\',ok:function(){location.href=\'?ctl=menu&ac=delete&menu_id=' . $arr['menu_id'] . '\';}});">删除</a>' . $arr['update_permission'] . '
                                   </td>
                                   </tr>';
             }
         }
         $return['tr'] .= '</table></td></tr>';
     } else {
         $menu = $Menu->get($menu_id);
         $return = array("count" => $menuCount, "select" => '<select id="parent_' . $level . '" level="' . $level . '" onchange="getChildMenu(this.id,' . ($level + 1) . ');" name="parent_' . $level . '">');
         if ($menu['parent'] == $partnerId) {
             $return['select'] .= '<option value="0" selected="selected">无</option>';
             if ($menuCount) {
                 foreach ($childmenu as $key => $arr) {
                     if ($arr['menu_id'] != $menu_id) {
                         $return['select'] .= '<option value="' . $arr['menu_id'] . '">' . $arr['name'] . '</option>';
                     }
                 }
             }
         } else {
             $return['select'] .= '<option value="0">无</option>';
             if ($menuCount) {
                 foreach ($childmenu as $key => $arr) {
                     if ($arr['menu_id'] != $menu_id) {
                         if ($arr['menu_id'] == $menu['parent']) {
                             $return['select'] .= '<option value="' . $arr['menu_id'] . '" selected>' . $arr['name'] . '</option>';
                         } else {
                             $return['select'] .= '<option value="' . $arr['menu_id'] . '">' . $arr['name'] . '</option>';
                         }
                     }
                 }
             }
         }
         $return['select'] .= '</select>';
         $return['myid'] = "parent_{$level}";
     }
     echo json_encode($return);
 }