Permalink
Browse files

Merge branch 'wip-MDL-32184-s22' of http://github.com/phalacee/moodle

…into MOODLE_22_STABLE
  • Loading branch information...
danpoltawski committed Oct 16, 2012
2 parents 83c45d6 + 04c1d5a commit 991eb4f6d01768f7bfb3929666b8cb4604d2b972
Showing with 6 additions and 1 deletion.
  1. +5 −0 course/view.php
  2. +1 −1 lib/navigationlib.php
View
@@ -17,6 +17,7 @@
$move = optional_param('move', 0, PARAM_INT);
$marker = optional_param('marker',-1 , PARAM_INT);
$switchrole = optional_param('switchrole',-1, PARAM_INT);
+ $return = optional_param('return', 0, PARAM_LOCALURL);
if (empty($id) && empty($name) && empty($idnumber)) {
print_error('unspecifycourseid', 'error');
@@ -110,6 +111,8 @@
// Redirect to site root if Editing is toggled on frontpage
if ($course->id == SITEID) {
redirect($CFG->wwwroot .'/?redirect=0');
+ } else if (!empty($return)) {
+ redirect($CFG->wwwroot . $return);
} else {
redirect($PAGE->url);
}
@@ -122,6 +125,8 @@
// Redirect to site root if Editing is toggled on frontpage
if ($course->id == SITEID) {
redirect($CFG->wwwroot .'/?redirect=0');
+ } else if (!empty($return)) {
+ redirect($CFG->wwwroot . $return);
} else {
redirect($PAGE->url);
}
View
@@ -3177,7 +3177,7 @@ 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()));
+ $url = new moodle_url('/course/view.php', array('id'=>$course->id, 'return'=>str_replace($CFG->wwwroot, '', $this->page->url->out(false)), 'sesskey'=>sesskey()));
if ($this->page->user_is_editing()) {
$url->param('edit', 'off');
$editstring = get_string('turneditingoff');

0 comments on commit 991eb4f

Please sign in to comment.