From 7f4550529a54997d39d41673a0365e3b067a4b58 Mon Sep 17 00:00:00 2001 From: Marina Glancy Date: Tue, 9 Oct 2012 16:07:46 +0800 Subject: [PATCH] MDL-35895 Correctly build return to course link in book module --- mod/book/view.php | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/mod/book/view.php b/mod/book/view.php index 6b9365d7c40..18f6395c98a 100644 --- a/mod/book/view.php +++ b/mod/book/view.php @@ -152,15 +152,8 @@ if ($nextid) { $chnavigation .= ''.get_string('navnext', 'book').''; } else { - $sec = ''; - if ($section = $DB->get_record('course_sections', array('id'=>$cm->section))) { - $sec = $section->section; - } - if ($course->id == $SITE->id) { - $returnurl = "$CFG->wwwroot/"; - } else { - $returnurl = "$CFG->wwwroot/course/view.php?id=$course->id#section-$sec"; - } + $sec = $DB->get_field('course_sections', 'section', array('id' => $cm->section)); + $returnurl = course_get_url($course, $sec); $chnavigation .= ''.get_string('navexit', 'book').'';