MDL-55074 navigation: Add editing links back to nav

In theme boost - don't support edit_buttons in the page.
This commit is contained in:
Damyon Wiese 2016-10-13 11:38:17 +08:00
parent 598b3f095f
commit e226461dab
2 changed files with 35 additions and 0 deletions

View File

@ -4160,10 +4160,37 @@ class settings_navigation extends navigation_node {
$coursenode->force_open();
}
if ($adminoptions->update) {
// Add the course settings link
$url = new moodle_url('/course/edit.php', array('id'=>$course->id));
$coursenode->add(get_string('editsettings'), $url, self::TYPE_SETTING, null, 'editsettings', new pix_icon('i/settings', ''));
}
if ($this->page->user_allowed_editing()) {
// Add the turn on/off settings
if ($this->page->url->compare(new moodle_url('/course/view.php'), URL_MATCH_BASE)) {
// We are on the course page, retain the current page params e.g. section.
$baseurl = clone($this->page->url);
$baseurl->param('sesskey', sesskey());
} else {
// Edit on the main course page.
$baseurl = new moodle_url('/course/view.php', array('id'=>$course->id, 'return'=>$this->page->url->out_as_local_url(false), 'sesskey'=>sesskey()));
}
$editurl = clone($baseurl);
if ($this->page->user_is_editing()) {
$editurl->param('edit', 'off');
$editstring = get_string('turneditingoff');
} else {
$editurl->param('edit', 'on');
$editstring = get_string('turneditingon');
}
$coursenode->add($editstring, $editurl, self::TYPE_SETTING, null, 'turneditingonoff', new pix_icon('i/edit', ''));
}
if ($adminoptions->update) {
// Add the course completion settings link
if ($CFG->enablecompletion && $course->enablecompletion) {

View File

@ -115,6 +115,14 @@ class core_renderer extends \core_renderer {
return $this->render_from_template('core/navbar', $this->page->navbar);
}
/**
* We don't like these...
*
*/
public function edit_button(moodle_url $url) {
return '';
}
/**
* Override to inject the logo.
*