当前位置: 首页>>代码示例>>PHP>>正文


PHP AuthGroupModel::getAuthCategories方法代码示例

本文整理汇总了PHP中Admin\Model\AuthGroupModel::getAuthCategories方法的典型用法代码示例。如果您正苦于以下问题:PHP AuthGroupModel::getAuthCategories方法的具体用法?PHP AuthGroupModel::getAuthCategories怎么用?PHP AuthGroupModel::getAuthCategories使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Admin\Model\AuthGroupModel的用法示例。


在下文中一共展示了AuthGroupModel::getAuthCategories方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: recycle

 /**
  * 回收站列表
  * @author huajie <banhuajie@163.com>
  */
 public function recycle()
 {
     //获取左边菜单
     $this->getMenu();
     $map['status'] = -1;
     if (!IS_ROOT) {
         $cate_auth = AuthGroupModel::getAuthCategories(UID);
         if ($cate_auth) {
             $map['category_id'] = array('IN', $cate_auth);
         } else {
             $map['category_id'] = -1;
         }
     }
     $list = $this->lists(D('Document'), $map, 'update_time desc');
     //处理列表数据
     if (is_array($list)) {
         foreach ($list as $k => &$v) {
             $v['username'] = get_nickname($v['uid']);
         }
     }
     $this->assign('list', $list);
     $this->meta_title = '回收站';
     $this->display();
 }
开发者ID:terrydeng,项目名称:beimeibang1205,代码行数:28,代码来源:ArticleController.class.php

示例2: getMenu

 /**
  * 显示左边菜单,进行权限控制
  * @author huajie <banhuajie@163.com>
  */
 protected function getMenu()
 {
     //获取动态分类
     $cate_auth = AuthGroupModel::getAuthCategories(UID);
     //获取当前用户所有的内容权限节点
     $cate_auth = $cate_auth == null ? array() : $cate_auth;
     $cate = M('Category')->where(array('status' => 1))->field('id,title,pid,allow_publish')->order('pid,sort')->select();
     //没有权限的分类则不显示
     if (!IS_ROOT) {
         foreach ($cate as $key => $value) {
             if (!in_array($value['id'], $cate_auth)) {
                 unset($cate[$key]);
             }
         }
     }
     $cate = list_to_tree($cate);
     //生成分类树
     //获取分类id
     $cate_id = I('param.cate_id');
     $this->cate_id = $cate_id;
     //是否展开分类
     $hide_cate = false;
     if (ACTION_NAME != 'recycle' && ACTION_NAME != 'draftbox' && ACTION_NAME != 'mydocument') {
         $hide_cate = true;
     }
     //生成每个分类的url
     foreach ($cate as $key => &$value) {
         $value['url'] = 'Article/index?cate_id=' . $value['id'];
         if ($cate_id == $value['id'] && $hide_cate) {
             $value['current'] = true;
         } else {
             $value['current'] = false;
         }
         if (!empty($value['_child'])) {
             $is_child = false;
             foreach ($value['_child'] as $ka => &$va) {
                 $va['url'] = 'Article/index?cate_id=' . $va['id'];
                 if (!empty($va['_child'])) {
                     foreach ($va['_child'] as $k => &$v) {
                         $v['url'] = 'Article/index?cate_id=' . $v['id'];
                         $v['pid'] = $va['id'];
                         $is_child = $v['id'] == $cate_id ? true : false;
                     }
                 }
                 //展开子分类的父分类
                 if ($va['id'] == $cate_id || $is_child) {
                     $is_child = false;
                     if ($hide_cate) {
                         $value['current'] = true;
                         $va['current'] = true;
                     } else {
                         $value['current'] = false;
                         $va['current'] = false;
                     }
                 } else {
                     $va['current'] = false;
                 }
             }
         }
     }
     $this->assign('nodes', $cate);
     $this->assign('cate_id', $this->cate_id);
     //获取面包屑信息
     $nav = get_parent_category($cate_id);
     $this->assign('rightNav', $nav);
     //获取回收站权限
     $show_recycle = $this->checkRule('Admin/article/recycle');
     $this->assign('show_recycle', IS_ROOT || $show_recycle);
     //获取草稿箱权限
     $show_draftbox = C('OPEN_DRAFTBOX');
     $this->assign('show_draftbox', IS_ROOT || $show_draftbox);
 }
开发者ID:jayfjso,项目名称:pinsen,代码行数:76,代码来源:DrugController.class.php

示例3: recycle

 /**
  * 回收站列表
  * @author huajie <banhuajie@163.com>
  */
 public function recycle()
 {
     //获取左边菜单
     $this->getMenu();
     if (IS_ROOT) {
         $map = array('status' => -1);
     } else {
         $cate_auth = AuthGroupModel::getAuthCategories(UID);
         if ($cate_auth) {
             $map = array('status' => -1, 'category_id' => array('IN', implode(',', $cate_auth)));
         } else {
             $map = array('status' => -1, 'category_id' => -1);
         }
     }
     $list = M('Document')->where($map)->field('id,title,uid,category_id,type,update_time')->order('update_time desc')->select();
     //处理列表数据
     foreach ($list as $k => &$v) {
         $v['username'] = get_nickname($v['uid']);
         //$v['create_time']   =   time_format($v['create_time']);
     }
     $this->assign('list', $list);
     $this->meta_title = '回收站';
     $this->display();
 }
开发者ID:commiunty,项目名称:Mytest,代码行数:28,代码来源:ArticleController.class.php

示例4: remove

 /**
  * 删除状态为-1的数据(包含扩展模型)
  * @return true 删除成功, false 删除失败
  * @author huajie <banhuajie@163.com>
  */
 public function remove()
 {
     //查询假删除的基础数据
     if (is_administrator()) {
         $map = array('status' => -1);
     } else {
         $cate_ids = AuthGroupModel::getAuthCategories(UID);
         $map = array('status' => -1, 'category_id' => array('IN', trim(implode(',', $cate_ids), ',')));
     }
     $base_list = $this->where($map)->field('id,model_id')->select();
     //删除扩展模型数据
     $base_ids = array_column($base_list, 'id');
     //孤儿数据
     $orphan = get_stemma($base_ids, $this, 'id,model_id');
     $all_list = array_merge($base_list, $orphan);
     foreach ($all_list as $key => $value) {
         $logic = $this->logic($value['model_id']);
         $logic->delete($value['id']);
     }
     //删除基础数据
     $ids = array_merge($base_ids, (array) array_column($orphan, 'id'));
     if (!empty($ids)) {
         $res = $this->where(array('id' => array('IN', trim(implode(',', $ids), ','))))->delete();
     }
     return $res;
 }
开发者ID:zqstudio2015,项目名称:myweiphp,代码行数:31,代码来源:DocumentModel.class.php

示例5: checkDynamic

 protected function checkDynamic()
 {
     $cates = AuthGroupModel::getAuthCategories(UID);
     switch (strtolower(ACTION_NAME)) {
         case 'index':
             //文档列表
         //文档列表
         case 'add':
             // 新增
             $cate_id = I('cate_id');
             break;
         case 'edit':
             //编辑
         //编辑
         case 'update':
             //更新
             $doc_id = I('id');
             $cate_id = M('Document')->where(array('id' => $doc_id))->getField('category_id');
             break;
         case 'setstatus':
             //更改状态
         //更改状态
         case 'permit':
             //回收站
             $doc_id = (array) I('ids');
             $cate_id = M('Document')->where(array('id' => array('in', $doc_id)))->getField('category_id', true);
             $cate_id = array_unique($cate_id);
             break;
     }
     if (!$cate_id) {
         return null;
         //不明
     } elseif (!is_array($cate_id) && in_array($cate_id, $cates)) {
         return true;
         //有权限
     } elseif (is_array($cate_id) && $cate_id == array_intersect($cate_id, $cates)) {
         return true;
         //有权限
     } else {
         return false;
         //无权限
     }
 }
开发者ID:Johnzero,项目名称:zero,代码行数:43,代码来源:AskController.class.php


注:本文中的Admin\Model\AuthGroupModel::getAuthCategories方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。