當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。