Permalink
Browse files

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
  • Loading branch information...
danpoltawski committed Apr 30, 2012
1 parent 1abf125 commit d628215d498c40da53c7952856a631be4a2b65e3
Showing with 10 additions and 2 deletions.
  1. +1 −1 course/view.php
  2. +9 −1 lib/navigationlib.php
View
@@ -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);
}
View
@@ -3282,7 +3282,15 @@ protected function load_course_settings($forceopen = false) {
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');

0 comments on commit d628215

Please sign in to comment.