MDL-52252 Tags: Add tags to modules (Resources and Activities)
This commit is contained in:
committed by
Marina Glancy
parent
7adc7ef14f
commit
dffcf46f43
@@ -151,6 +151,11 @@ function add_moduleinfo($moduleinfo, $course, $mform = null) {
|
||||
$DB->set_field($moduleinfo->modulename, 'intro', $moduleinfo->intro, array('id'=>$moduleinfo->instance));
|
||||
}
|
||||
|
||||
// Add module tags.
|
||||
if (core_tag_tag::is_enabled('core', 'course_modules') && isset($moduleinfo->tags)) {
|
||||
core_tag_tag::set_item_tags('core', 'course_modules', $moduleinfo->coursemodule, $modcontext, $moduleinfo->tags);
|
||||
}
|
||||
|
||||
// Course_modules and course_sections each contain a reference to each other.
|
||||
// So we have to update one of them twice.
|
||||
$sectionid = course_add_cm_to_section($course, $moduleinfo->coursemodule, $moduleinfo->section);
|
||||
@@ -578,6 +583,11 @@ function update_moduleinfo($cm, $moduleinfo, $course, $mform = null) {
|
||||
set_coursemodule_idnumber($moduleinfo->coursemodule, $moduleinfo->cmidnumber);
|
||||
}
|
||||
|
||||
// Update module tags.
|
||||
if (core_tag_tag::is_enabled('core', 'course_modules') && isset($moduleinfo->tags)) {
|
||||
core_tag_tag::set_item_tags('core', 'course_modules', $moduleinfo->coursemodule, $modcontext, $moduleinfo->tags);
|
||||
}
|
||||
|
||||
// Now that module is fully updated, also update completion data if required.
|
||||
// (this will wipe all user completion data and recalculate it)
|
||||
if ($completion->is_enabled() && !empty($moduleinfo->completionunlocked)) {
|
||||
|
||||
Reference in New Issue
Block a user