From 77a530601a751a72d440dddbb166636b1f91b35d Mon Sep 17 00:00:00 2001 From: Damyon Wiese Date: Sun, 17 Apr 2016 22:33:09 +0800 Subject: [PATCH] MDL-53841 assign: Fix for assignment listing page. Was throwing debugging because there is no course module defined on this page. --- mod/assign/locallib.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mod/assign/locallib.php b/mod/assign/locallib.php index 19cc6546d1c..8eee5936ae2 100644 --- a/mod/assign/locallib.php +++ b/mod/assign/locallib.php @@ -205,7 +205,12 @@ class assign { public function register_return_link($action, $params) { global $PAGE; $params['action'] = $action; - $currenturl = new moodle_url('/mod/assign/view.php', array('id' => $this->get_course_module()->id)); + $cm = $this->get_course_module(); + if ($cm) { + $currenturl = new moodle_url('/mod/assign/view.php', array('id' => $cm->id)); + } else { + $currenturl = new moodle_url('/mod/assign/index.php', array('id' => $this->get_course()->id)); + } $currenturl->params($params); $PAGE->set_url($currenturl);