Ejemplo n.º 1
0
 /**
  * @return mixed
  */
 public function nodeList()
 {
     $cat = new Category('Node', array('id', 'pid', 'title', 'fullname'));
     $temp = $cat->getList();
     // 获取分类结构
     foreach ($temp as $key => $value) {
         if ($value['level'] = 1 && array_key_exists($value['name'], get_opinion('group_level_1'))) {
             $group_level_1 = get_opinion('group_level_1');
             $temp[$key]["remark"] = $group_level_1[$value['name']];
         } else {
             if ($value['level'] = 2 && array_key_exists($value['name'], get_opinion('admin_level_2'))) {
                 $admin_level_2 = get_opinion('admin_level_2');
                 $temp[$key]["remark"] = $admin_level_2[$value['name']];
             }
         }
     }
     $level = array("1" => "项目(GROUP_NAME)", "2" => "模块(MODEL_NAME)", "3" => "操作(ACTION_NAME)");
     foreach ($temp as $k => $v) {
         $temp[$k]['statusTxt'] = $v['status'] == 1 ? "启用" : "禁用";
         $temp[$k]['chStatusTxt'] = $v['status'] == 0 ? "启用" : "禁用";
         $temp[$k]['level'] = $level[$v['level']];
         $list[$v['id']] = $temp[$k];
     }
     unset($temp);
     return $list;
 }
Ejemplo n.º 2
0
 /**
  * @return mixed
  */
 public function nodeList()
 {
     $cat = new Category('Node', array('id', 'pid', 'title', 'fullname'));
     $temp = $cat->getList();
     // 获取分类结构
     $level = array("1" => "项目(GROUP_NAME)", "2" => "模块(MODEL_NAME)", "3" => "操作(ACTION_NAME)");
     foreach ($temp as $k => $v) {
         $temp[$k]['statusTxt'] = $v['status'] == 1 ? "启用" : "禁用";
         $temp[$k]['chStatusTxt'] = $v['status'] == 0 ? "启用" : "禁用";
         $temp[$k]['level'] = $level[$v['level']];
         $list[$v['id']] = $temp[$k];
     }
     unset($temp);
     return $list;
 }
Ejemplo n.º 3
0
 /**
  * @param $info
  * @return mixed
  */
 private function getPid($info)
 {
     $arr = array("请选择", "项目", "模块", "操作");
     for ($i = 1; $i < 4; $i++) {
         $selected = $info['level'] == $i ? " selected='selected'" : "";
         $info['levelOption'] .= '<option value="' . $i . '" ' . $selected . '>' . $arr[$i] . '</option>';
     }
     $level = $info['level'] - 1;
     $cat = new Category('Node', array('id', 'pid', 'title', 'fullname'));
     $list = $cat->getList();
     // 获取分类结构
     $option = $level == 0 ? '<option value="0" level="-1">根节点</option>' : '<option value="0" disabled="disabled">根节点</option>';
     foreach ($list as $k => $v) {
         // $disabled = $v['level'] == $level ? "" : ' disabled="disabled"';
         $selected = $v['id'] != $info['pid'] ? "" : ' selected="selected"';
         $option .= '<option value="' . $v['id'] . '"' . $disabled . $selected . '  level="' . $v['level'] . '">' . $v['fullname'] . '</option>';
     }
     $info['pidOption'] = $option;
     return $info;
 }
Ejemplo n.º 4
0
 /**
  * 获取结构化分类
  * @return array
  */
 public function category()
 {
     $Cat = new Category('Cats', array('cat_id', 'cat_father', 'cat_name', 'cat_slug'));
     // , array('cid', 'pid', 'name', 'fullname')
     return $Cat->getList();
 }
Ejemplo n.º 5
0
 /**
  * 获取结构化分类With 文章数量统计
  * 此操作消耗资源,仅限后台使用
  * @return array
  */
 public function selectWithPostsCount()
 {
     $Cat = new Category('Cats', array('cat_id', 'cat_father', 'cat_name', 'cat_slug'));
     // , array('cid', 'pid', 'name', 'fullname')
     return $Cat->getListWithCount(null, 0, 'cat_order');
 }
Ejemplo n.º 6
0
 /**
  * 父类与子类分类列表
  * @usage {:W('Widget/catSidebar',array("cat_id"=>$cat_id))}
  */
 public function catSidebar($cat_id = 0, $default_title)
 {
     if ($cat_id == null) {
         $this->assign('cat_sidebar_title', $default_title);
         // 赋值数据集
         $CatList = new CatsLogic();
         $Cat = new Category('Cats', array('cat_id', 'cat_father', 'cat_name', 'cat_name'));
         $children['cat_children'] = $Cat->getList();
         foreach ($children['cat_children'] as $key => $value) {
             $children['cat_children'][$key]['cat_children'] = $children['cat_children'][$key];
         }
         $this->assign('children2', $children);
     } else {
         $Cat = new CatsLogic();
         $children = $Cat->getChildren($cat_id);
         if (empty($children['cat_children'])) {
             //无子类处理
             if ($children['cat_father'] == 0) {
                 //无父类
                 $this->assign('cat_sidebar_title', $children["cat_name"]);
                 // 赋值数据集
             } else {
                 //有父类
                 $children2 = $Cat->getChildren($children['cat_father']);
                 $this->assign('cat_sidebar_title', $children2["cat_name"]);
                 // 赋值数据集
                 $this->assign('children2', $children2);
             }
         } else {
             //有子类处理
             $this->assign('cat_sidebar_title', $children["cat_name"]);
             // 赋值数据集
             $this->assign('children2', $children);
         }
     }
     $this->assign('cat_id', $cat_id);
     // 赋值数据集
     $this->display('Widget:cat_sidebar');
 }
Ejemplo n.º 7
0
 /**
  * 编辑菜单
  * @param $id
  */
 public function menuEdit($id)
 {
     $menu_item = D('Menu')->where(array('menu_id' => $id))->find();
     if (!$menu_item) {
         $this->error('不存在这个菜单项');
     }
     $this->assign('info', $menu_item);
     $CatsLogic = new CatsLogic();
     $TagsLogic = new TagsLogic();
     $PostsLogic = new PostsLogic();
     /**
      *  文章分类标签 start
      */
     $cat_list = $CatsLogic->category();
     $tag_list = $TagsLogic->field('tag_id,tag_name')->select();
     $post_list = $PostsLogic->field('post_id,post_title')->select();
     $cat_list = array_column_5($cat_list, 'cat_slug', 'cat_id');
     $tag_list = array_column_5($tag_list, 'tag_name', 'tag_id');
     $post_list = array_column_5($post_list, 'post_title', 'post_id');
     $this->assign('cat_list', gen_opinion_list($cat_list));
     $this->assign('tag_list', gen_opinion_list($tag_list));
     $this->assign('post_list', gen_opinion_list($post_list));
     /**
      *  文章分类标签 end
      */
     $action = '编辑菜单';
     $action_url = U('Admin/Custom/menuEdit', array('id' => $id));
     $form_url = U('Admin/Custom/menuEditHandle', array('id' => $id));
     $Menu = new Category('Menu', array('menu_id', 'menu_pid', 'menu_name', 'menu_construct'));
     $menu_list = $Menu->getList();
     // 获取分类结构
     $url_function = get_opinion('url_function');
     $this->assign('url_function', gen_opinion_list($url_function, $menu_item["menu_function"]));
     $url_open = get_opinion('url_open');
     $this->assign('url_open', gen_opinion_list($url_open, $menu_item["menu_action"]));
     //父级节点
     $menu_list2 = array_column_5($menu_list, 'menu_construct', 'menu_id');
     $this->assign('menu_list2', gen_opinion_list($menu_list2, $menu_item['menu_pid']));
     //显示排序
     $menu_list3 = array_column_5($menu_list, 'menu_construct', 'menu_sort');
     $this->assign('menu_list3', gen_opinion_list($menu_list3, $menu_item['menu_sort']));
     $this->assign('menu', $menu_list);
     $this->assign('action', $action);
     $this->assign('action_url', $action_url);
     $this->assign('form_url', $form_url);
     $this->display();
 }
Ejemplo n.º 8
0
 /**
  * @param $id
  */
 public function menuEdit($id)
 {
     $action = '编辑菜单';
     $action_url = U('Admin/Custom/menuEdit', array('id' => $id));
     $form_url = U('Admin/Custom/menuEditHandle', array('id' => $id));
     $Menu = new Category('Menu', array('menu_id', 'menu_pid', 'menu_name', 'menu_construct'));
     $menu_list = $Menu->getList();
     // 获取分类结构
     $m = D('Menu')->where(array('menu_id' => $id))->find();
     $this->assign('info', $m);
     $this->assign('menu', $menu_list);
     $this->assign('action', $action);
     $this->assign('action_url', $action_url);
     $this->assign('form_url', $form_url);
     $this->display();
 }