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.