MDL-59244 mod_workshop: Move event triggering to API
Event triggering when a submission is deleted is now inside the delete_submission function.
This commit is contained in:
@@ -1204,6 +1204,20 @@ class workshop {
|
||||
$fs->delete_area_files($this->context->id, 'mod_workshop', 'submission_attachment', $submission->id);
|
||||
|
||||
$DB->delete_records('workshop_submissions', array('id' => $submission->id));
|
||||
|
||||
// Event information.
|
||||
$params = array(
|
||||
'context' => $this->context,
|
||||
'courseid' => $this->course->id,
|
||||
'relateduserid' => $submission->authorid,
|
||||
'other' => array(
|
||||
'submissiontitle' => $submission->title
|
||||
)
|
||||
);
|
||||
$params['objectid'] = $submission->id;
|
||||
$event = \mod_workshop\event\submission_deleted::create($params);
|
||||
$event->add_record_snapshot('workshop', $this->dbrecord);
|
||||
$event->trigger();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -119,20 +119,6 @@ if ($submission->id and $delete and $confirm and $deletable) {
|
||||
require_sesskey();
|
||||
$workshop->delete_submission($submission);
|
||||
|
||||
// Event information.
|
||||
$params = array(
|
||||
'context' => $workshop->context,
|
||||
'courseid' => $workshop->course->id,
|
||||
'relateduserid' => $submission->authorid,
|
||||
'other' => array(
|
||||
'submissiontitle' => $submission->title
|
||||
)
|
||||
);
|
||||
$params['objectid'] = $submission->id;
|
||||
$event = \mod_workshop\event\submission_deleted::create($params);
|
||||
$event->add_record_snapshot('workshop', $workshoprecord);
|
||||
$event->trigger();
|
||||
|
||||
redirect($workshop->view_url());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user