MDL-40908 core_tag: replaced 'update' add_to_log calls with an event
This commit is contained in:
+9
-14
@@ -119,27 +119,22 @@ if ($tagnew = $tagform->get_data()) {
|
||||
|
||||
$tagnew = file_postupdate_standard_editor($tagnew, 'description', $editoroptions, $systemcontext, 'tag', 'description', $tag->id);
|
||||
|
||||
tag_description_set($tag_id, $tagnew->description, $tagnew->descriptionformat);
|
||||
if ($tag->description != $tagnew->description) {
|
||||
tag_description_set($tag_id, $tagnew->description, $tagnew->descriptionformat);
|
||||
}
|
||||
|
||||
$tagnew->timemodified = time();
|
||||
|
||||
if (has_capability('moodle/tag:manage', $systemcontext)) {
|
||||
// rename tag
|
||||
if(!tag_rename($tag->id, $tagnew->rawname)) {
|
||||
print_error('errorupdatingrecord', 'tag');
|
||||
// Check if we need to rename the tag.
|
||||
if (isset($tagnew->name) && ($tag->name != $tagnew->name)) {
|
||||
// Rename the tag.
|
||||
if (!tag_rename($tag->id, $tagnew->rawname)) {
|
||||
print_error('errorupdatingrecord', 'tag');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//log tag changes activity
|
||||
//if tag name exist from form, renaming is allow. record log action as rename
|
||||
//otherwise, record log action as update
|
||||
if (isset($tagnew->name) && ($tag->name != $tagnew->name)){
|
||||
add_to_log($COURSE->id, 'tag', 'update', 'index.php?id='. $tag->id, $tag->name . '->'. $tagnew->name);
|
||||
|
||||
} elseif ($tag->description != $tagnew->description) {
|
||||
add_to_log($COURSE->id, 'tag', 'update', 'index.php?id='. $tag->id, $tag->name);
|
||||
}
|
||||
|
||||
//updated related tags
|
||||
tag_set('tag', $tagnew->id, explode(',', trim($tagnew->relatedtags)), 'core', $systemcontext);
|
||||
//print_object($tagnew); die();
|
||||
|
||||
Reference in New Issue
Block a user