本文整理匯總了PHP中Admin\Model\AuthGroupModel::getExtendOfGroup方法的典型用法代碼示例。如果您正苦於以下問題:PHP AuthGroupModel::getExtendOfGroup方法的具體用法?PHP AuthGroupModel::getExtendOfGroup怎麽用?PHP AuthGroupModel::getExtendOfGroup使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Admin\Model\AuthGroupModel
的用法示例。
在下文中一共展示了AuthGroupModel::getExtendOfGroup方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getMenu
/**
* 顯示左邊菜單,進行權限控製
* @author huajie <banhuajie@163.com>
*/
protected function getMenu($ismenu = null)
{
//獲取動態分類
$cate_auth = AuthGroupModel::getAuthCategories(UID);
//獲取當前用戶所有的內容權限節點
$cate_auth = $cate_auth == null ? array() : $cate_auth;
$cate = M('Category')->where(array('status' => 1, 'ismenu' => $ismenu))->field('id,title,pid,allow_publish')->order('pid,sort')->select();
//沒有權限的分類則不顯示
// 獲取擴展權限表的權限id
$extendArr = AuthGroupModel::getExtendOfGroup(UID, 1);
//用於顯示商品分類左邊silder 二〇一六年二月四日 09:16:18
self::$save_cate;
if (!IS_ROOT) {
foreach ($extendArr as $v) {
foreach ($cate as $key => $value) {
if ($value['id'] == $v) {
self::$save_cate[] = $value;
}
}
}
// 原作者寫的
/*foreach ($cate as $key=>$value){
if(!in_array($value['id'], $cate_auth)){
unset($cate[$key]);
}
}*/
} else {
self::$save_cate = $cate;
}
// $cate = list_to_tree($cate); //生成分類樹
$cate = list_to_tree(self::$save_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'] = 'Goods/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'] = 'Goods/index?cate_id=' . $va['id'];
if (!empty($va['_child'])) {
foreach ($va['_child'] as $k => &$v) {
$v['url'] = 'Goods/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);
//獲取回收站權限
$this->assign('show_recycle', IS_ROOT || $this->checkRule('Admin/article/recycle'));
//獲取草稿箱權限
$this->assign('show_draftbox', C('OPEN_DRAFTBOX'));
//獲取審核列表權限
$this->assign('show_examine', IS_ROOT || $this->checkRule('Admin/article/examine'));
}