MDL-73316 contentbank: Add in secondary navigation
This commit is contained in:
@@ -46,7 +46,11 @@ if ($PAGE->course) {
|
||||
require_login($PAGE->course->id);
|
||||
}
|
||||
$PAGE->set_url('/contentbank/index.php');
|
||||
$PAGE->set_context($context);
|
||||
if ($contextid == \context_system::instance()->id) {
|
||||
$PAGE->set_context(context_course::instance($contextid));
|
||||
} else {
|
||||
$PAGE->set_context($context);
|
||||
}
|
||||
$PAGE->set_title($title);
|
||||
$PAGE->set_heading($title);
|
||||
$PAGE->add_body_class('limitedwidth');
|
||||
|
||||
@@ -120,6 +120,7 @@ class secondary extends view {
|
||||
],
|
||||
self::TYPE_CUSTOM => [
|
||||
'advgrading' => 2,
|
||||
'contentbank' => 12,
|
||||
],
|
||||
];
|
||||
}
|
||||
@@ -134,11 +135,7 @@ class secondary extends view {
|
||||
* @return array
|
||||
*/
|
||||
protected function get_default_category_mapping(): array {
|
||||
return [
|
||||
self::TYPE_CUSTOM => [
|
||||
'contentbank' => 5,
|
||||
],
|
||||
];
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
use core_contentbank\contentbank;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
@@ -5357,6 +5359,13 @@ class settings_navigation extends navigation_node {
|
||||
$categorynode->add(get_string('checkpermissions', 'role'), $url, self::TYPE_SETTING, null, 'checkpermissions', new pix_icon('i/checkpermissions', ''));
|
||||
}
|
||||
|
||||
$cb = new contentbank();
|
||||
if ($cb->is_context_allowed($catcontext)
|
||||
&& has_capability('moodle/contentbank:access', $catcontext)) {
|
||||
$url = new \moodle_url('/contentbank/index.php', ['contextid' => $catcontext->id]);
|
||||
$categorynode->add(get_string('contentbank'), $url, self::TYPE_CUSTOM, null, 'contentbank', new \pix_icon('i/contentbank', ''));
|
||||
}
|
||||
|
||||
// Add the context locking node.
|
||||
$this->add_context_locking_node($categorynode, $catcontext);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user