From 53e1e390f37210169a50353b9862664c133423e4 Mon Sep 17 00:00:00 2001 From: Andrew Robert Nicols Date: Thu, 22 Nov 2012 12:07:09 +0000 Subject: [PATCH] MDL-34791 AJAX Update a graded activity's title in the gradebook on rename --- course/rest.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/course/rest.php b/course/rest.php index 61392ea99d2..a0b038c960f 100644 --- a/course/rest.php +++ b/course/rest.php @@ -150,6 +150,7 @@ switch($requestmethod) { break; case 'updatetitle': require_capability('moodle/course:manageactivities', $modcontext); + require_once($CFG->libdir . '/gradelib.php'); $cm = get_coursemodule_from_id('', $id, 0, false, MUST_EXIST); $module = new stdClass(); $module->id = $cm->instance; @@ -167,6 +168,12 @@ switch($requestmethod) { $module->name = $cm->name; } + // Attempt to update the grade item if relevant + $grademodule = $DB->get_record($cm->modname, array('id' => $cm->instance)); + $grademodule->cmidnumber = $cm->idnumber; + $grademodule->modname = $cm->modname; + grade_update_mod_grades($grademodule); + // We need to return strings after they've been through filters for multilang $stringoptions = new stdClass; $stringoptions->context = $coursecontext;