本文整理匯總了PHP中Rights::hasRight方法的典型用法代碼示例。如果您正苦於以下問題:PHP Rights::hasRight方法的具體用法?PHP Rights::hasRight怎麽用?PHP Rights::hasRight使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Rights
的用法示例。
在下文中一共展示了Rights::hasRight方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: return_navigation_array
function return_navigation_array()
{
$navigation = array();
$menu_navigation = array();
$possible_tabs = get_tabs();
// Campus Homepage
if (api_get_setting('show_tabs', 'campus_homepage') == 'true') {
$navigation[SECTION_CAMPUS] = $possible_tabs[SECTION_CAMPUS];
} else {
$menu_navigation[SECTION_CAMPUS] = $possible_tabs[SECTION_CAMPUS];
}
if (api_get_user_id() && !api_is_anonymous()) {
// My Courses
if (api_get_setting('show_tabs', 'my_courses') == 'true') {
$navigation['mycourses'] = $possible_tabs['mycourses'];
} else {
$menu_navigation['mycourses'] = $possible_tabs['mycourses'];
}
// My Profile
if (api_get_setting('show_tabs', 'my_profile') == 'true' && api_get_setting('allow_social_tool') != 'true') {
$navigation['myprofile'] = $possible_tabs['myprofile'];
} else {
$menu_navigation['myprofile'] = $possible_tabs['myprofile'];
}
// My Agenda
if (api_get_setting('show_tabs', 'my_agenda') == 'true') {
$navigation['myagenda'] = $possible_tabs['myagenda'];
} else {
$menu_navigation['myagenda'] = $possible_tabs['myagenda'];
}
// Gradebook
if (api_get_setting('gradebook_enable') == 'true') {
if (api_get_setting('show_tabs', 'my_gradebook') == 'true') {
$navigation['mygradebook'] = $possible_tabs['mygradebook'];
} else {
$menu_navigation['mygradebook'] = $possible_tabs['mygradebook'];
}
}
// Reporting
if (api_get_setting('show_tabs', 'reporting') == 'true') {
if (api_is_allowed_to_create_course() || api_is_drh() || api_is_session_admin()) {
$navigation['session_my_space'] = $possible_tabs['session_my_space'];
} else {
$navigation['session_my_space'] = $possible_tabs['session_my_progress'];
}
} else {
if (api_is_allowed_to_create_course() || api_is_drh() || api_is_session_admin()) {
$menu_navigation['session_my_space'] = $possible_tabs['session_my_space'];
} else {
$menu_navigation['session_my_space'] = $possible_tabs['session_my_progress'];
}
}
// Social Networking
if (api_get_setting('show_tabs', 'social') == 'true') {
if (api_get_setting('allow_social_tool') == 'true') {
$navigation['social'] = isset($possible_tabs['social']) ? $possible_tabs['social'] : null;
}
} else {
$menu_navigation['social'] = isset($possible_tabs['social']) ? $possible_tabs['social'] : null;
}
// Dashboard
if (api_get_setting('show_tabs', 'dashboard') == 'true') {
if (api_is_platform_admin() || api_is_drh() || api_is_session_admin()) {
$navigation['dashboard'] = isset($possible_tabs['dashboard']) ? $possible_tabs['dashboard'] : null;
}
} else {
$menu_navigation['dashboard'] = isset($possible_tabs['dashboard']) ? $possible_tabs['dashboard'] : null;
}
// Administration
if (api_is_platform_admin(true)) {
if (api_get_setting('show_tabs', 'platform_administration') == 'true') {
$navigation['platform_admin'] = $possible_tabs['platform_admin'];
} else {
$menu_navigation['platform_admin'] = $possible_tabs['platform_admin'];
}
}
// Reports
if (!empty($possible_tabs['reports'])) {
if (api_get_setting('show_tabs', 'reports') == 'true') {
if ((api_is_platform_admin() || api_is_drh() || api_is_session_admin()) && Rights::hasRight('show_tabs:reports')) {
$navigation['reports'] = $possible_tabs['reports'];
}
} else {
$menu_navigation['reports'] = $possible_tabs['reports'];
}
}
// Custom tabs
$customTabs = getCustomTabs();
if (!empty($customTabs)) {
foreach ($customTabs as $tab) {
if (api_get_setting($tab['variable'], $tab['subkey']) == 'true' && isset($possible_tabs[$tab['subkey']])) {
$possible_tabs[$tab['subkey']]['url'] = api_get_path(WEB_PATH) . $possible_tabs[$tab['subkey']]['url'];
$navigation[$tab['subkey']] = $possible_tabs[$tab['subkey']];
} else {
if (isset($possible_tabs[$tab['subkey']])) {
$possible_tabs[$tab['subkey']]['url'] = api_get_path(WEB_PATH) . $possible_tabs[$tab['subkey']]['url'];
$menu_navigation[$tab['subkey']] = $possible_tabs[$tab['subkey']];
}
}
}
//.........這裏部分代碼省略.........
示例2: returnNavigationArray
/**
* Gets the main menu
*
* @return array
*/
public function returnNavigationArray()
{
$navigation = array();
$menu_navigation = array();
$possible_tabs = $this->getTabs();
// Campus Homepage
/*if (api_get_setting('show_tabs', 'campus_homepage') == 'true') {
$navigation[SECTION_CAMPUS] = $possible_tabs[SECTION_CAMPUS];
} else {
$menu_navigation[SECTION_CAMPUS] = $possible_tabs[SECTION_CAMPUS];
}*/
if (api_get_user_id() && !api_is_anonymous()) {
// My Courses
/*if (api_get_setting('show_tabs', 'my_courses') == 'true') {
$navigation['mycourses'] = $possible_tabs['mycourses'];
} else {
$menu_navigation['mycourses'] = $possible_tabs['mycourses'];
}*/
// My Profile
/*
if (api_get_setting('show_tabs', 'my_profile') == 'true' && api_get_setting('social.allow_social_tool') != 'true') {
if (isset($possible_tabs['myprofile'])) {
$navigation['myprofile'] = $possible_tabs['myprofile'];
}
} else {
if (isset($possible_tabs['myprofile'])) {
$menu_navigation['myprofile'] = $possible_tabs['myprofile'];
}
}*/
// My Agenda
/*
if (api_get_setting('show_tabs', 'my_agenda') == 'true') {
$navigation['myagenda'] = $possible_tabs['myagenda'];
} else {
$menu_navigation['myagenda'] = $possible_tabs['myagenda'];
}*/
// Gradebook
/*
if (api_get_setting('gradebook_enable') == 'true') {
if (api_get_setting('show_tabs', 'my_gradebook') == 'true') {
$navigation['mygradebook'] = $possible_tabs['mygradebook'];
} else {
$menu_navigation['mygradebook'] = $possible_tabs['mygradebook'];
}
}*/
// Reporting
/*
if (api_get_setting('show_tabs', 'reporting') == 'true') {
if (api_is_allowed_to_create_course() || api_is_drh() || api_is_session_admin()) {
$navigation['session_my_space'] = $possible_tabs['session_my_space'];
} else {
$navigation['session_my_space'] = $possible_tabs['session_my_progress'];
}
} else {
if (api_is_allowed_to_create_course() || api_is_drh() || api_is_session_admin()) {
$menu_navigation['session_my_space'] = $possible_tabs['session_my_space'];
} else {
$menu_navigation['session_my_space'] = $possible_tabs['session_my_progress'];
}
}*/
/*
// Social Networking
if (api_get_setting('show_tabs', 'social') == 'true') {
if (api_get_setting('social.allow_social_tool') == 'true') {
$navigation['social'] = $possible_tabs['social'];
}
} else {
$menu_navigation['social'] = isset($possible_tabs['social']) ? $possible_tabs['social'] : null;
}
*/
// Dashboard
/*
if (api_get_setting('show_tabs', 'dashboard') == 'true') {
if (api_is_platform_admin() || api_is_drh() || api_is_session_admin()) {
$navigation['dashboard'] = $possible_tabs['dashboard'];
}
} else {
$menu_navigation['dashboard'] = isset($possible_tabs['dashboard']) ? $possible_tabs['dashboard'] : null;
}*/
if (isset($possible_tabs['admin'])) {
$navigation['platform_admin'] = $possible_tabs['admin'];
$navigation['platform_admin'] = $possible_tabs['admin'];
}
// Reports
if (!empty($possible_tabs['reports'])) {
if (api_get_setting('show_tabs', 'reports') == 'true') {
if ((api_is_platform_admin() || api_is_drh() || api_is_session_admin()) && Rights::hasRight('show_tabs:reports')) {
$navigation['reports'] = $possible_tabs['reports'];
}
} else {
$menu_navigation['reports'] = $possible_tabs['reports'];
}
}
// Custom tabs
for ($i = 1; $i <= 3; $i++) {
//.........這裏部分代碼省略.........