-
Bug
-
Resolution: Duplicate
-
Minor
-
None
-
2.5.3
-
None
-
MOODLE_25_STABLE
When modifying an activity name via the main course view does not trigger the mod_updated event.
See course/rest.php case statement updatetitle, when the title is updated the mod_updated event is not triggered.
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;
|
|
// Escape strings as they would be by mform
|
if (!empty($CFG->formatstringstriptags)) {
|
$module->name = clean_param($title, PARAM_TEXT);
|
} else {
|
$module->name = clean_param($title, PARAM_CLEANHTML);
|
}
|
|
if (!empty($module->name)) {
|
$DB->update_record($cm->modname, $module);
|
rebuild_course_cache($cm->course);
|
} else {
|
$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;
|
echo json_encode(array('instancename' => html_entity_decode(format_string($module->name, true, $stringoptions))));
|
- duplicates
-
MDL-39393 Changing activity title on course front page with AJAX does not fire mod_updated event
-
- Closed
-