本文整理汇总了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.