MDL-34791 AJAX Update a graded activity's title in the gradebook on rename

This commit is contained in:
Andrew Robert Nicols 2012-11-22 12:07:09 +00:00
parent 5fa7d72064
commit 53e1e390f3

View file

@ -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;