mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
MDL-41101 assign: Add relateduserid to some events
When events are acting on another users submission, it makes sense to put the submission->userid in the relateduserid field.
This commit is contained in:
parent
43a7ac723d
commit
5cfa441ba7
@ -52,6 +52,8 @@ class assessable_submitted extends base {
|
||||
* @return assessable_submitted
|
||||
*/
|
||||
public static function create_from_submission(\assign $assign, \stdClass $submission, $editable) {
|
||||
global $USER;
|
||||
|
||||
$data = array(
|
||||
'context' => $assign->get_context(),
|
||||
'objectid' => $submission->id,
|
||||
@ -59,6 +61,9 @@ class assessable_submitted extends base {
|
||||
'submission_editable' => $editable,
|
||||
),
|
||||
);
|
||||
if (!empty($submission->userid) && ($submission->userid != $USER->id)) {
|
||||
$data['relateduserid'] = $submission->userid;
|
||||
}
|
||||
/** @var assessable_submitted $event */
|
||||
$event = self::create($data);
|
||||
$event->set_assign($assign);
|
||||
|
@ -227,6 +227,9 @@ class assign_submission_file extends assign_submission_plugin {
|
||||
'pathnamehashes' => array_keys($files)
|
||||
)
|
||||
);
|
||||
if (!empty($submission->userid) && ($submission->userid != $USER->id)) {
|
||||
$params->relateduserid = $submission->userid;
|
||||
}
|
||||
$event = \assignsubmission_file\event\assessable_uploaded::create($params);
|
||||
$event->set_legacy_files($files);
|
||||
$event->trigger();
|
||||
|
@ -228,6 +228,9 @@ class assign_submission_onlinetext extends assign_submission_plugin {
|
||||
'format' => $data->onlinetext_editor['format']
|
||||
)
|
||||
);
|
||||
if (!empty($submission->userid) && ($submission->userid != $USER->id)) {
|
||||
$params['relateduserid'] = $submission->userid;
|
||||
}
|
||||
$event = \assignsubmission_onlinetext\event\assessable_uploaded::create($params);
|
||||
$event->trigger();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user