mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
MDL-34791 AJAX Update a graded activity's title in the gradebook on rename
This commit is contained in:
parent
5fa7d72064
commit
53e1e390f3
1 changed files with 7 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue