Permalink
Browse files

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

…ename
  • Loading branch information...
1 parent 4bd6f71 commit a71d9a9414fd51c46539a3ee749f6d887f0846f1 @andrewnicols andrewnicols committed Nov 22, 2012
Showing with 7 additions and 0 deletions.
  1. +7 −0 course/rest.php
View
@@ -146,6 +146,7 @@
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;
@@ -164,6 +165,12 @@
$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;

0 comments on commit a71d9a9

Please sign in to comment.