本文整理汇总了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'));
}