MDL-37085 Moved completion info box rendering code to renderer

Was part of function print_section(), now it is
new function core_course_renderer::course_section_cm_completion()
This commit is contained in:
Marina Glancy 2012-12-14 10:17:33 +08:00
parent 9a6aa5c17d
commit 7e29340f7c
3 changed files with 116 additions and 86 deletions

View file

@ -123,7 +123,7 @@ switch($targetstate) {
}
// Get course-modules entry
$cm = get_coursemodule_from_id(null, $cmid, null, false, MUST_EXIST);
$cm = get_coursemodule_from_id(null, $cmid, null, true, MUST_EXIST);
$course = $DB->get_record('course', array('id'=>$cm->course), '*', MUST_EXIST);
// Check user is logged in
@ -152,8 +152,12 @@ if ($fromajax) {
} else {
// In case of use in other areas of code we allow a 'backto' parameter,
// otherwise go back to course page
$backto = optional_param('backto', 'view.php?id='.$course->id, PARAM_URL);
redirect($backto);
if ($backto = optional_param('backto', null, PARAM_URL)) {
redirect($backto);
} else {
redirect(course_get_url($course, $cm->sectionnum));
}
}
// utility functions