本文整理匯總了PHP中coursecat::has_capability_on_any方法的典型用法代碼示例。如果您正苦於以下問題:PHP coursecat::has_capability_on_any方法的具體用法?PHP coursecat::has_capability_on_any怎麽用?PHP coursecat::has_capability_on_any使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類coursecat
的用法示例。
在下文中一共展示了coursecat::has_capability_on_any方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: lang_string
if ($blocklist !== 0) {
$url->param('blocklist', $search);
}
if ($modulelist !== '') {
$url->param('modulelist', $search);
}
$strmanagement = new lang_string('coursecatmanagement');
$pageheading = format_string($SITE->fullname, true, array('context' => $systemcontext));
$PAGE->set_context($context);
$PAGE->set_url($url);
$PAGE->set_pagelayout('admin');
$PAGE->set_title($strmanagement);
$PAGE->set_heading($pageheading);
// This is a system level page that operates on other contexts.
require_login();
if (!coursecat::has_capability_on_any(array('moodle/category:manage', 'moodle/course:create'))) {
// The user isn't able to manage any categories. Lets redirect them to the relevant course/index.php page.
$url = new moodle_url('/course/index.php');
if ($categoryid) {
$url->param('categoryid', $categoryid);
}
redirect($url);
}
// If the user poses any of these capabilities then they will be able to see the admin
// tree and the management link within it.
// This is the most accurate form of navigation.
$capabilities = array('moodle/site:config', 'moodle/backup:backupcourse', 'moodle/category:manage', 'moodle/course:create', 'moodle/site:approvecourse');
if ($category && !has_any_capability($capabilities, $systemcontext)) {
// If the user doesn't poses any of these system capabilities then we're going to mark the manage link in the settings block
// as active, tell the page to ignore the active path and just build what the user would expect.
// This will at least give the page some relevant navigation.