From 2c7a4204e7ce7b735d10e3100d503ba36287c8b7 Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Wed, 4 Dec 2013 15:34:31 +0000 Subject: [PATCH] MDL-43068 course&gradebook: fix use of new API in old branches. --- course/lib.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/course/lib.php b/course/lib.php index ef1a721d924..6a65243a4fc 100644 --- a/course/lib.php +++ b/course/lib.php @@ -2925,13 +2925,16 @@ function set_coursemodule_visible($id, $visible) { $cminfo->visibleold = $visible; $DB->update_record('course_modules', $cminfo); + require_once($CFG->dirroot . '/mod/' . $modulename . '/lib.php'); + $functionname = $modulename . '_grade_item_update'; + // Hide the associated grade items so the teacher doesn't also have to go to the gradebook and hide them there. // Note that this must be done after updating the row in course_modules, in case // the modules grade_item_update function needs to access $cm->visible. if (plugin_supports('mod', $modulename, FEATURE_CONTROLS_GRADE_VISIBILITY) && - component_callback_exists('mod_' . $modulename, 'grade_item_update')) { + function_exists($functionname)) { $instance = $DB->get_record($modulename, array('id' => $cm->instance), '*', MUST_EXIST); - component_callback('mod_' . $modulename, 'grade_item_update', array($instance)); + $functionname($instance); } else { $grade_items = grade_item::fetch_all(array('itemtype'=>'mod', 'itemmodule'=>$modulename, 'iteminstance'=>$cm->instance, 'courseid'=>$cm->course)); if ($grade_items) {