当前位置: 首页>>代码示例>>PHP>>正文


PHP coursecat::has_capability_on_any方法代码示例

本文整理汇总了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.
开发者ID:abhilash1994,项目名称:moodle,代码行数:31,代码来源:management.php


注:本文中的coursecat::has_capability_on_any方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。