本文整理汇总了PHP中role::get_action_ids方法的典型用法代码示例。如果您正苦于以下问题:PHP role::get_action_ids方法的具体用法?PHP role::get_action_ids怎么用?PHP role::get_action_ids使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类role
的用法示例。
在下文中一共展示了role::get_action_ids方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* 列表
*/
public function index()
{
$this->template->content = new View("manage/action_list");
$actions = Myaction::instance()->actions();
//用户可管理权限资源的ID
$user_action_ids = role::get_action_ids();
foreach ($actions as $key => $value) {
if (!in_array($value['id'], $user_action_ids)) {
unset($actions[$key]);
}
}
$this->template->content->actions = $actions;
}
示例2: index
function index()
{
$nodes = array();
$empty_menu = array('#', 'javascript:void(0);', 'javascript:void(0)');
$action_ids = role::get_action_ids();
$orderby = array('order' => 'DESC');
$menus = ORM::factory('menu')->where('parent_id', 0)->where('active', 1)->in('action_id', $action_ids)->orderby($orderby)->find_all();
foreach ($menus as $item) {
$value = $item->as_array();
$value['name'] = '<b>' . $value['name'] . '</b>';
$sub_menus = $this->sub_menus($value['id'], $action_ids);
if (empty($sub_menus)) {
continue;
}
foreach ($sub_menus as $sub_menu_key => $sub_menu_value) {
$sub_menus[$sub_menu_key]['children'] = $this->sub_menus($sub_menu_value['id'], $action_ids);
}
$value['children'] = $sub_menus;
$value = self::to_node($value);
$nodes[] = $value;
}
die(json_encode($nodes));
//echo 'Docs.classData =[];';
}
示例3: get_avalible_menu
/**
* get user avalible menu
*/
public static function get_avalible_menu()
{
//all menus
$menus = Mymenu::instance()->get_level_menus();
//账号的资源列表
$action_ids = role::get_action_ids();
//无权限的菜单删除
foreach ($menus as $menus_key => $menus_value) {
$sub_menu = $menus_value['children'];
foreach ($sub_menu as $key => $value) {
//if ($value ['action_id'] > 0){
if (!in_array($value['action_id'], $action_ids)) {
unset($menus[$menus_key]['children'][$key]);
}
//}
}
}
return $menus;
}