navigation MDL-21565 Update this xxx is now automatically added to the nav for all modules by default and is renamed to settings as that is what was being used in the tabs system presently anyway.
The following minor changes were also made: * Added roles links to the navigation automatically * Handling of block context for settings navigation * Tidied up init code for settings navigation
This commit is contained in:
@@ -325,33 +325,4 @@ function folder_extend_navigation($navigation, $course, $module, $cm) {
|
||||
* you content.
|
||||
*/
|
||||
$navigation->nodetype = navigation_node::NODETYPE_LEAF;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function extends the settings navigation block for the site.
|
||||
*
|
||||
* It is safe to rely on PAGE here as we will only ever be within the module
|
||||
* context when this is called.
|
||||
*
|
||||
* @param settings_navigation $settings
|
||||
* @param stdClass $module
|
||||
*/
|
||||
function folder_extend_settings_navigation($settings, $module) {
|
||||
global $PAGE, $CFG;
|
||||
|
||||
// Add a folder node to the settings navigation.
|
||||
$foldernavkey = $settings->add(get_string('folderadministration', 'folder'));
|
||||
$foldernav = $settings->get($foldernavkey);
|
||||
$foldernav->forceopen = true;
|
||||
|
||||
// If the user has the capability add an update this module link for the folder instance
|
||||
if (has_capability('moodle/course:manageactivities', $PAGE->cm->context)) {
|
||||
$url = new moodle_url('/course/mod.php', array('update'=>$PAGE->cm->id, 'return'=>true, 'sesskey'=>sesskey()));
|
||||
$foldernav->add(get_string('updatethis', '', get_string('modulename', 'folder')), $url);
|
||||
}
|
||||
|
||||
// Check if any children have been added. If not remove the node to save on clutter.
|
||||
if (count($foldernav->children)<1) {
|
||||
$settings->remove_child($foldernavkey);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user