/**
  * 系统设置-节点设置-编辑节点 已经修改
  */
 public function adminNodeEdit()
 {
     $DB = M('admin_menu');
     $id = I('get.id', '', 'intval');
     if (IS_POST) {
         $info = I('post.info');
         //新增图标
         if (I('post.icon')) {
             $info['icon'] = I('post.icon');
         }
         if (!$DB->create($info)) {
             $this->ajaxReturn(array('statusCode' => 300, 'message' => $DB->getError()));
         } else {
             $DB->where('id=' . $id)->save($info);
             $this->ajaxReturn(array('statusCode' => 200, 'closeCurrent' => 'true', 'tabid' => 'System_adminNodeLists'));
         }
     } else {
         $this->Detail = $DB->where('id=' . $id)->find();
         $tree = new \Lain\Phpcms\tree();
         $result = $DB->select();
         foreach ($result as $r) {
             $r['cname'] = $r['name'];
             $r['selected'] = $r['id'] == $this->Detail['parentid'] ? 'selected' : '';
             $array[] = $r;
         }
         $str = "<option value='\$id' \$selected>\$spacer \$cname</option>";
         $tree->init($array);
         $this->select_categorys = $tree->get_tree(0, $str);
         $this->display();
     }
 }
 public function category()
 {
     $tree = new \Lain\Phpcms\tree();
     $tree->icon = array('&nbsp;&nbsp;&nbsp;│ ', '&nbsp;&nbsp;&nbsp;├─ ', '&nbsp;&nbsp;&nbsp;└─ ');
     $tree->nbsp = '&nbsp;&nbsp;&nbsp;';
     $result = $this->categorys;
     if (!empty($result)) {
         foreach ($result as $r) {
             $categoryList[$r['catid']] = $r;
             $categoryList[$r['catid']]['typename'] = $r['type'] == 1 ? '单网页' : '内部栏目';
             $categoryList[$r['catid']]['str_manage'] = '<a class="btn btn-green" href="' . U('Article/categoryEdit?catid=' . $r['catid']) . '" data-toggle="dialog" data-width="520" data-height="290" data-id="dialog-mask" data-mask="true">修改</a> <a class="btn btn-green" href="' . U('Article/categoryTemplate?catid=' . $r['catid']) . '" data-toggle="dialog" data-width="900" data-height="500" data-id="dialog-mask" data-mask="true">设置</a> <a href="' . U('Article/categoryDelete?catid=' . $r['catid']) . '" class="btn btn-red" data-toggle="doajax" data-confirm-msg="确定要删除该栏目吗?">删</a> ';
         }
     }
     $str = "<tr target='rid' rel='\$catid'>\n    \t\t\t\t<td>\$catid</td>\n    \t\t\t\t<td>\$spacer\$catname</td>\n    \t\t\t\t<td>\$typename</td>\n    \t\t\t\t<td>\$listorder</td>\n    \t\t\t\t<td align='center'>\$str_manage</td>\n\t\t\t\t</tr>";
     $tree->init($categoryList);
     $this->categoryList = $tree->get_tree(0, $str);
     /* foreach ( $this->categorys as $key => $category ) {
     			$data [$key] = $category;
     			$data [$key] ['name'] = $category ['catname'];
     			$data [$key] ['name'] = $category ['catname'];
     			// 如果有子分类的父级, 去掉url
     			if ($category ['parentid'] == 0 && $category ['child'] != 0) {
     				unset ( $data [$key] ['url'] );
     			}
     		}
     		$nodes = list_to_tree ( $data, 'catid', 'parentid', 'children' );
     		$this->assign ( 'json_nodes', json_encode ( $nodes ) ); */
     $this->display();
 }