/**
  * 数据字典
  */
 public function datatree($parent, $hasChildren, $checkedID = 0)
 {
     if ($hasChildren) {
         $map['parents'] = array('like', '%' . $parent . ',%');
         $result = apiCall('Admin/Datatree/queryNoPaging', array($map));
         $tree = new \Common\Model\TreeModel();
         $list = $tree->toFormatTree($result['info'], 'name', 'id', 'parentid', $parent);
     } else {
         $map = array('parentid' => $parent);
         $result = apiCall('Admin/Datatree/queryNoPaging', array($map));
         $list = $result['info'];
     }
     if ($result['status']) {
         $this->assign("checkedID", $checkedID);
         $this->assign("list", $list);
         echo $this->fetch("Widget/datatree");
     } else {
         LogRecord($result['info'], "[INFO]:" . __FILE__ . " [LINE]" . __LINE__);
         echo L('ERR_SYSTEM_BUSY');
     }
 }
 /**
  * 增加菜单
  */
 public function add()
 {
     if (IS_GET) {
         $result = apiCall('Admin/Menu/queryNoPaging', array());
         if ($result['status']) {
             $tree = new \Common\Model\TreeModel();
             $menus = $tree->toFormatTree($result['info']);
             $this->assign("pid", I('pid', 0));
             $this->assign("menus", $menus);
             $this->display();
         } else {
             $this->error($result['info']);
         }
     } else {
         $menu = I('post.');
         $menu['pid'] = I('pid', 0);
         $success_url = U('Admin/Menu/index', array('pid' => I('post.pid', 0)));
         $result = apiCall('Admin/Menu/add', array($menu));
         if ($result['status'] === false) {
             LogRecord('INFO:' . $result['info'], '[FILE] ' . __FILE__ . ' [LINE] ' . __LINE__);
             $this->error($result['info']);
         } else {
             //新增权限节点
             //				$this -> addAuthRule($menu['title'], $menu['url'], $menu['pid']);
             $this->success(L('RESULT_SUCCESS'), $success_url);
         }
     }
 }