MDL-32508 course: turn editting on/off stays on current page
Rather than always going to the index page, we can edit on section page
This commit is contained in:
+1
-1
@@ -177,7 +177,7 @@
|
||||
// what to do, even though the link also appears in the course admin block. It also
|
||||
// means you can back out of a situation where you removed the admin block. :)
|
||||
if ($PAGE->user_allowed_editing()) {
|
||||
$buttons = $OUTPUT->edit_button(new moodle_url('/course/view.php', array('id' => $course->id)));
|
||||
$buttons = $OUTPUT->edit_button($PAGE->url);
|
||||
$PAGE->set_button($buttons);
|
||||
}
|
||||
|
||||
|
||||
@@ -3282,7 +3282,15 @@ class settings_navigation extends navigation_node {
|
||||
|
||||
if (has_capability('moodle/course:update', $coursecontext)) {
|
||||
// Add the turn on/off settings
|
||||
$url = new moodle_url('/course/view.php', array('id'=>$course->id, 'sesskey'=>sesskey()));
|
||||
|
||||
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.
|
||||
$url = clone($this->page->url);
|
||||
$url->param('sesskey', sesskey());
|
||||
} else {
|
||||
// Edit on the main course page.
|
||||
$url = new moodle_url('/course/view.php', array('id'=>$course->id, 'sesskey'=>sesskey()));
|
||||
}
|
||||
if ($this->page->user_is_editing()) {
|
||||
$url->param('edit', 'off');
|
||||
$editstring = get_string('turneditingoff');
|
||||
|
||||
Reference in New Issue
Block a user