diff --git a/mod/assign/classes/event/all_submissions_downloaded.php b/mod/assign/classes/event/all_submissions_downloaded.php index 541e40757bd..09b6c824112 100644 --- a/mod/assign/classes/event/all_submissions_downloaded.php +++ b/mod/assign/classes/event/all_submissions_downloaded.php @@ -115,4 +115,8 @@ class all_submissions_downloaded extends base { parent::validate_data(); } + + public static function get_objectid_mapping() { + return array('db' => 'assign', 'restore' => 'assign'); + } } diff --git a/mod/assign/classes/event/assessable_submitted.php b/mod/assign/classes/event/assessable_submitted.php index b1e16e51cab..c26375cd0f1 100644 --- a/mod/assign/classes/event/assessable_submitted.php +++ b/mod/assign/classes/event/assessable_submitted.php @@ -150,4 +150,13 @@ class assessable_submitted extends base { throw new \coding_exception('The \'submission_editable\' value must be set in other.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'assign_submission', 'restore' => 'submission'); + } + + public static function get_other_mapping() { + // Nothing to map. + return false; + } } diff --git a/mod/assign/classes/event/batch_set_marker_allocation_viewed.php b/mod/assign/classes/event/batch_set_marker_allocation_viewed.php index 510549d22a9..9481b0cb950 100644 --- a/mod/assign/classes/event/batch_set_marker_allocation_viewed.php +++ b/mod/assign/classes/event/batch_set_marker_allocation_viewed.php @@ -123,4 +123,11 @@ class batch_set_marker_allocation_viewed extends base { throw new \coding_exception('The \'assignid\' value must be set in other.'); } } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['assignid'] = array('db' => 'assign', 'restore' => 'assign'); + + return $othermapped; + } } diff --git a/mod/assign/classes/event/batch_set_workflow_state_viewed.php b/mod/assign/classes/event/batch_set_workflow_state_viewed.php index b4b5c2511e8..b91c04537ea 100644 --- a/mod/assign/classes/event/batch_set_workflow_state_viewed.php +++ b/mod/assign/classes/event/batch_set_workflow_state_viewed.php @@ -123,4 +123,11 @@ class batch_set_workflow_state_viewed extends base { throw new \coding_exception('The \'assignid\' value must be set in other.'); } } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['assignid'] = array('db' => 'assign', 'restore' => 'assign'); + + return $othermapped; + } } diff --git a/mod/assign/classes/event/extension_granted.php b/mod/assign/classes/event/extension_granted.php index 3ed455830c0..51c4a9f7a5b 100644 --- a/mod/assign/classes/event/extension_granted.php +++ b/mod/assign/classes/event/extension_granted.php @@ -121,4 +121,8 @@ class extension_granted extends base { throw new \coding_exception('The \'relateduserid\' must be set.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'assign', 'restore' => 'assign'); + } } diff --git a/mod/assign/classes/event/feedback_viewed.php b/mod/assign/classes/event/feedback_viewed.php index 37e0359ef6a..93d6aea615a 100644 --- a/mod/assign/classes/event/feedback_viewed.php +++ b/mod/assign/classes/event/feedback_viewed.php @@ -119,4 +119,15 @@ class feedback_viewed extends base { throw new \coding_exception('The \'assignid\' value must be set in other.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'assign_grades', 'restore' => 'grade'); + } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['assignid'] = array('db' => 'assign', 'restore' => 'assign'); + + return $othermapped; + } } diff --git a/mod/assign/classes/event/grading_form_viewed.php b/mod/assign/classes/event/grading_form_viewed.php index 6ee48c20365..dfa6b94bcc0 100644 --- a/mod/assign/classes/event/grading_form_viewed.php +++ b/mod/assign/classes/event/grading_form_viewed.php @@ -131,4 +131,11 @@ class grading_form_viewed extends base { throw new \coding_exception('The \'assignid\' value must be set in other.'); } } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['assignid'] = array('db' => 'assign', 'restore' => 'assign'); + + return $othermapped; + } } diff --git a/mod/assign/classes/event/grading_table_viewed.php b/mod/assign/classes/event/grading_table_viewed.php index e3bd463bc97..464e8b02c56 100644 --- a/mod/assign/classes/event/grading_table_viewed.php +++ b/mod/assign/classes/event/grading_table_viewed.php @@ -123,4 +123,11 @@ class grading_table_viewed extends base { throw new \coding_exception('The \'assignid\' value must be set in other.'); } } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['assignid'] = array('db' => 'assign', 'restore' => 'assign'); + + return $othermapped; + } } diff --git a/mod/assign/classes/event/identities_revealed.php b/mod/assign/classes/event/identities_revealed.php index 339a6f4ea3a..983ce4f0b69 100644 --- a/mod/assign/classes/event/identities_revealed.php +++ b/mod/assign/classes/event/identities_revealed.php @@ -115,4 +115,8 @@ class identities_revealed extends base { parent::validate_data(); } + + public static function get_objectid_mapping() { + return array('db' => 'assign', 'restore' => 'assign'); + } } diff --git a/mod/assign/classes/event/marker_updated.php b/mod/assign/classes/event/marker_updated.php index 64b50840e00..761afc29cb0 100644 --- a/mod/assign/classes/event/marker_updated.php +++ b/mod/assign/classes/event/marker_updated.php @@ -140,4 +140,15 @@ class marker_updated extends base { throw new \coding_exception('The \'markerid\' value must be set in other.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'assign', 'restore' => 'assign'); + } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['markerid'] = array('db' => 'user', 'restore' => 'user'); + + return $othermapped; + } } diff --git a/mod/assign/classes/event/reveal_identities_confirmation_page_viewed.php b/mod/assign/classes/event/reveal_identities_confirmation_page_viewed.php index 34913303588..922ec3b65c5 100644 --- a/mod/assign/classes/event/reveal_identities_confirmation_page_viewed.php +++ b/mod/assign/classes/event/reveal_identities_confirmation_page_viewed.php @@ -122,4 +122,11 @@ class reveal_identities_confirmation_page_viewed extends base { throw new \coding_exception('The \'assignid\' value must be set in other.'); } } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['assignid'] = array('db' => 'assign', 'restore' => 'assign'); + + return $othermapped; + } } diff --git a/mod/assign/classes/event/statement_accepted.php b/mod/assign/classes/event/statement_accepted.php index ec5d59cf36b..9212c9b3fa0 100644 --- a/mod/assign/classes/event/statement_accepted.php +++ b/mod/assign/classes/event/statement_accepted.php @@ -119,4 +119,8 @@ class statement_accepted extends base { parent::validate_data(); } + + public static function get_objectid_mapping() { + return array('db' => 'assign_submission', 'restore' => 'submission'); + } } diff --git a/mod/assign/classes/event/submission_confirmation_form_viewed.php b/mod/assign/classes/event/submission_confirmation_form_viewed.php index 833d2801b0a..727b811d3c5 100644 --- a/mod/assign/classes/event/submission_confirmation_form_viewed.php +++ b/mod/assign/classes/event/submission_confirmation_form_viewed.php @@ -123,4 +123,11 @@ class submission_confirmation_form_viewed extends base { throw new \coding_exception('The \'assignid\' value must be set in other.'); } } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['assignid'] = array('db' => 'assign', 'restore' => 'assign'); + + return $othermapped; + } } diff --git a/mod/assign/classes/event/submission_created.php b/mod/assign/classes/event/submission_created.php index c420ce38255..81fe71b3bc2 100644 --- a/mod/assign/classes/event/submission_created.php +++ b/mod/assign/classes/event/submission_created.php @@ -81,4 +81,12 @@ abstract class submission_created extends base { throw new \coding_exception('The \'submissionstatus\' value must be set in other.'); } } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['submissionid'] = array('db' => 'assign_submission', 'restore' => 'submission'); + $othermapped['groupid'] = array('db' => 'groups', 'restore' => 'group'); + + return $othermapped; + } } diff --git a/mod/assign/classes/event/submission_duplicated.php b/mod/assign/classes/event/submission_duplicated.php index ac7875c2699..e2020b4fc6e 100644 --- a/mod/assign/classes/event/submission_duplicated.php +++ b/mod/assign/classes/event/submission_duplicated.php @@ -117,4 +117,8 @@ class submission_duplicated extends base { parent::validate_data(); } + + public static function get_objectid_mapping() { + return array('db' => 'assign_submission', 'restore' => 'submission'); + } } diff --git a/mod/assign/classes/event/submission_form_viewed.php b/mod/assign/classes/event/submission_form_viewed.php index bea0352a28e..fc2de8880e1 100644 --- a/mod/assign/classes/event/submission_form_viewed.php +++ b/mod/assign/classes/event/submission_form_viewed.php @@ -139,4 +139,11 @@ class submission_form_viewed extends base { throw new \coding_exception('The \'assignid\' value must be set in other.'); } } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['assignid'] = array('db' => 'assign', 'restore' => 'assign'); + + return $othermapped; + } } diff --git a/mod/assign/classes/event/submission_graded.php b/mod/assign/classes/event/submission_graded.php index 8e16305a0b7..a6b0853cf0a 100644 --- a/mod/assign/classes/event/submission_graded.php +++ b/mod/assign/classes/event/submission_graded.php @@ -123,4 +123,8 @@ class submission_graded extends base { throw new \coding_exception('The \'relateduserid\' must be set.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'assign_grades', 'restore' => 'grade'); + } } diff --git a/mod/assign/classes/event/submission_locked.php b/mod/assign/classes/event/submission_locked.php index 3aaf9277e54..32d99a0cc67 100644 --- a/mod/assign/classes/event/submission_locked.php +++ b/mod/assign/classes/event/submission_locked.php @@ -123,4 +123,8 @@ class submission_locked extends base { throw new \coding_exception('The \'relateduserid\' must be set.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'assign', 'restore' => 'assign'); + } } diff --git a/mod/assign/classes/event/submission_status_updated.php b/mod/assign/classes/event/submission_status_updated.php index 5609e169add..16297169795 100644 --- a/mod/assign/classes/event/submission_status_updated.php +++ b/mod/assign/classes/event/submission_status_updated.php @@ -121,4 +121,13 @@ class submission_status_updated extends base { throw new \coding_exception('The \'newstatus\' value must be set in other.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'assign_submission', 'restore' => 'submission'); + } + + public static function get_other_mapping() { + // Nothing to map. + return false; + } } diff --git a/mod/assign/classes/event/submission_status_viewed.php b/mod/assign/classes/event/submission_status_viewed.php index 898042d04c6..532cd150898 100644 --- a/mod/assign/classes/event/submission_status_viewed.php +++ b/mod/assign/classes/event/submission_status_viewed.php @@ -124,4 +124,11 @@ class submission_status_viewed extends base { throw new \coding_exception('The \'assignid\' value must be set in other.'); } } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['assignid'] = array('db' => 'assign', 'restore' => 'assign'); + + return $othermapped; + } } diff --git a/mod/assign/classes/event/submission_unlocked.php b/mod/assign/classes/event/submission_unlocked.php index c4610686453..eba152a1943 100644 --- a/mod/assign/classes/event/submission_unlocked.php +++ b/mod/assign/classes/event/submission_unlocked.php @@ -123,4 +123,8 @@ class submission_unlocked extends base { throw new \coding_exception('The \'relateduserid\' must be set.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'assign', 'restore' => 'assign'); + } } diff --git a/mod/assign/classes/event/submission_updated.php b/mod/assign/classes/event/submission_updated.php index deb2e13feb4..2e38625e445 100644 --- a/mod/assign/classes/event/submission_updated.php +++ b/mod/assign/classes/event/submission_updated.php @@ -81,4 +81,12 @@ abstract class submission_updated extends base { throw new \coding_exception('The \'submissionstatus\' value must be set in other.'); } } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['submissionid'] = array('db' => 'assign_submission', 'restore' => 'submission'); + $othermapped['groupid'] = array('db' => 'groups', 'restore' => 'group'); + + return $othermapped; + } } diff --git a/mod/assign/classes/event/submission_viewed.php b/mod/assign/classes/event/submission_viewed.php index e0956ab10c8..4793786c23f 100644 --- a/mod/assign/classes/event/submission_viewed.php +++ b/mod/assign/classes/event/submission_viewed.php @@ -119,4 +119,15 @@ class submission_viewed extends base { throw new \coding_exception('The \'assignid\' value must be set in other.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'assign_submission', 'restore' => 'submission'); + } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['assignid'] = array('db' => 'assign', 'restore' => 'assign'); + + return $othermapped; + } } diff --git a/mod/assign/classes/event/workflow_state_updated.php b/mod/assign/classes/event/workflow_state_updated.php index cfba9dbb1e8..5928f537159 100644 --- a/mod/assign/classes/event/workflow_state_updated.php +++ b/mod/assign/classes/event/workflow_state_updated.php @@ -138,4 +138,13 @@ class workflow_state_updated extends base { throw new \coding_exception('The \'newstate\' value must be set in other.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'assign', 'restore' => 'assign'); + } + + public static function get_other_mapping() { + // Nothing to map. + return false; + } } diff --git a/mod/assign/submission/file/classes/event/assessable_uploaded.php b/mod/assign/submission/file/classes/event/assessable_uploaded.php index 3c60a8da222..06f7fdbc539 100644 --- a/mod/assign/submission/file/classes/event/assessable_uploaded.php +++ b/mod/assign/submission/file/classes/event/assessable_uploaded.php @@ -120,4 +120,7 @@ class assessable_uploaded extends \core\event\assessable_uploaded { $this->data['objecttable'] = 'assign_submission'; } + public static function get_objectid_mapping() { + return array('db' => 'assign_submission', 'restore' => 'submission'); + } } diff --git a/mod/assign/submission/file/classes/event/submission_created.php b/mod/assign/submission/file/classes/event/submission_created.php index a788a119ff4..d71d1f3710f 100644 --- a/mod/assign/submission/file/classes/event/submission_created.php +++ b/mod/assign/submission/file/classes/event/submission_created.php @@ -80,4 +80,9 @@ class submission_created extends \mod_assign\event\submission_created { throw new \coding_exception('The \'filesubmissioncount\' value must be set in other.'); } } + + public static function get_objectid_mapping() { + // No mapping available for 'assignsubmission_file'. + return false; + } } diff --git a/mod/assign/submission/file/classes/event/submission_updated.php b/mod/assign/submission/file/classes/event/submission_updated.php index 65e8b542607..bf184759ae1 100644 --- a/mod/assign/submission/file/classes/event/submission_updated.php +++ b/mod/assign/submission/file/classes/event/submission_updated.php @@ -80,4 +80,9 @@ class submission_updated extends \mod_assign\event\submission_updated { throw new \coding_exception('The \'filesubmissioncount\' value must be set in other.'); } } + + public static function get_objectid_mapping() { + // No mapping available for 'assignsubmission_file'. + return false; + } } diff --git a/mod/assign/submission/onlinetext/classes/event/assessable_uploaded.php b/mod/assign/submission/onlinetext/classes/event/assessable_uploaded.php index aae666be45b..d1ef0766f2c 100644 --- a/mod/assign/submission/onlinetext/classes/event/assessable_uploaded.php +++ b/mod/assign/submission/onlinetext/classes/event/assessable_uploaded.php @@ -107,4 +107,8 @@ class assessable_uploaded extends \core\event\assessable_uploaded { parent::init(); $this->data['objecttable'] = 'assign_submission'; } + + public static function get_objectid_mapping() { + return array('db' => 'assign_submission', 'restore' => 'submission'); + } } diff --git a/mod/assign/submission/onlinetext/classes/event/submission_created.php b/mod/assign/submission/onlinetext/classes/event/submission_created.php index f730d32db1a..0108c1f0717 100644 --- a/mod/assign/submission/onlinetext/classes/event/submission_created.php +++ b/mod/assign/submission/onlinetext/classes/event/submission_created.php @@ -47,7 +47,7 @@ class submission_created extends \mod_assign\event\submission_created { */ protected function init() { parent::init(); - $this->data['objecttable'] = 'assignsubmission_file'; + $this->data['objecttable'] = 'assignsubmission_onlinetext'; } /** @@ -80,4 +80,9 @@ class submission_created extends \mod_assign\event\submission_created { throw new \coding_exception('The \'onlinetextwordcount\' value must be set in other.'); } } + + public static function get_objectid_mapping() { + // No mapping available for 'assignsubmission_onlinetext'. + return false; + } } diff --git a/mod/assign/submission/onlinetext/classes/event/submission_updated.php b/mod/assign/submission/onlinetext/classes/event/submission_updated.php index 356d3a66514..8f95aa2d5cb 100644 --- a/mod/assign/submission/onlinetext/classes/event/submission_updated.php +++ b/mod/assign/submission/onlinetext/classes/event/submission_updated.php @@ -47,7 +47,7 @@ class submission_updated extends \mod_assign\event\submission_updated { */ protected function init() { parent::init(); - $this->data['objecttable'] = 'assignsubmission_file'; + $this->data['objecttable'] = 'assignsubmission_onlinetext'; } /** @@ -80,4 +80,9 @@ class submission_updated extends \mod_assign\event\submission_updated { throw new \coding_exception('The \'onlinetextwordcount\' value must be set in other.'); } } + + public static function get_objectid_mapping() { + // No mapping available for 'assignsubmission_onlinetext'. + return false; + } } diff --git a/mod/book/classes/event/chapter_created.php b/mod/book/classes/event/chapter_created.php index 0fd344c572d..0adef111a40 100644 --- a/mod/book/classes/event/chapter_created.php +++ b/mod/book/classes/event/chapter_created.php @@ -108,4 +108,7 @@ class chapter_created extends \core\event\base { $this->data['objecttable'] = 'book_chapters'; } + public static function get_objectid_mapping() { + return array('db' => 'book_chapters', 'restore' => 'book_chapter'); + } } diff --git a/mod/book/classes/event/chapter_deleted.php b/mod/book/classes/event/chapter_deleted.php index b53a9d0264d..c58c04ae96c 100644 --- a/mod/book/classes/event/chapter_deleted.php +++ b/mod/book/classes/event/chapter_deleted.php @@ -104,4 +104,8 @@ class chapter_deleted extends \core\event\base { $this->data['edulevel'] = self::LEVEL_TEACHING; $this->data['objecttable'] = 'book_chapters'; } + + public static function get_objectid_mapping() { + return array('db' => 'book_chapters', 'restore' => 'book_chapter'); + } } diff --git a/mod/book/classes/event/chapter_updated.php b/mod/book/classes/event/chapter_updated.php index c577e4efce4..7f8580c82a0 100644 --- a/mod/book/classes/event/chapter_updated.php +++ b/mod/book/classes/event/chapter_updated.php @@ -108,4 +108,7 @@ class chapter_updated extends \core\event\base { $this->data['objecttable'] = 'book_chapters'; } + public static function get_objectid_mapping() { + return array('db' => 'book_chapters', 'restore' => 'book_chapter'); + } } diff --git a/mod/book/classes/event/chapter_viewed.php b/mod/book/classes/event/chapter_viewed.php index 6d5bb0056a0..7a0fc782418 100644 --- a/mod/book/classes/event/chapter_viewed.php +++ b/mod/book/classes/event/chapter_viewed.php @@ -104,4 +104,8 @@ class chapter_viewed extends \core\event\base { $this->data['edulevel'] = self::LEVEL_PARTICIPATING; $this->data['objecttable'] = 'book_chapters'; } + + public static function get_objectid_mapping() { + return array('db' => 'book_chapters', 'restore' => 'book_chapter'); + } } diff --git a/mod/book/classes/event/course_module_viewed.php b/mod/book/classes/event/course_module_viewed.php index d24eceb3575..f6ecdb9ee3b 100644 --- a/mod/book/classes/event/course_module_viewed.php +++ b/mod/book/classes/event/course_module_viewed.php @@ -64,4 +64,8 @@ class course_module_viewed extends \core\event\course_module_viewed { $this->data['edulevel'] = self::LEVEL_PARTICIPATING; $this->data['objecttable'] = 'book'; } + + public static function get_objectid_mapping() { + return array('db' => 'book', 'restore' => 'book'); + } } diff --git a/mod/book/tool/exportimscp/classes/event/book_exported.php b/mod/book/tool/exportimscp/classes/event/book_exported.php index 08d5a442596..08b63fdac50 100644 --- a/mod/book/tool/exportimscp/classes/event/book_exported.php +++ b/mod/book/tool/exportimscp/classes/event/book_exported.php @@ -102,4 +102,7 @@ class book_exported extends \core\event\base { $this->data['objecttable'] = 'book'; } + public static function get_objectid_mapping() { + return array('db' => 'book', 'restore' => 'book'); + } } diff --git a/mod/book/tool/print/classes/event/book_printed.php b/mod/book/tool/print/classes/event/book_printed.php index ef11cbd410f..62d91b184df 100644 --- a/mod/book/tool/print/classes/event/book_printed.php +++ b/mod/book/tool/print/classes/event/book_printed.php @@ -102,4 +102,7 @@ class book_printed extends \core\event\base { $this->data['objecttable'] = 'book'; } + public static function get_objectid_mapping() { + return array('db' => 'book', 'restore' => 'book'); + } } diff --git a/mod/book/tool/print/classes/event/chapter_printed.php b/mod/book/tool/print/classes/event/chapter_printed.php index 8f83074c74c..c0c3b7ade77 100644 --- a/mod/book/tool/print/classes/event/chapter_printed.php +++ b/mod/book/tool/print/classes/event/chapter_printed.php @@ -102,7 +102,10 @@ class chapter_printed extends \core\event\base { protected function init() { $this->data['crud'] = 'r'; $this->data['edulevel'] = self::LEVEL_PARTICIPATING; - $this->data['objecttable'] = 'book'; + $this->data['objecttable'] = 'book_chapters'; } + public static function get_objectid_mapping() { + return array('db' => 'book_chapters', 'restore' => 'book_chapter'); + } } diff --git a/mod/chat/classes/event/course_module_viewed.php b/mod/chat/classes/event/course_module_viewed.php index 21fc8f8bac7..854699262a5 100644 --- a/mod/chat/classes/event/course_module_viewed.php +++ b/mod/chat/classes/event/course_module_viewed.php @@ -40,4 +40,8 @@ class course_module_viewed extends \core\event\course_module_viewed { $this->data['edulevel'] = self::LEVEL_PARTICIPATING; $this->data['objecttable'] = 'chat'; } + + public static function get_objectid_mapping() { + return array('db' => 'chat', 'restore' => 'chat'); + } } diff --git a/mod/chat/classes/event/message_sent.php b/mod/chat/classes/event/message_sent.php index 5b14c348423..8397bb50905 100644 --- a/mod/chat/classes/event/message_sent.php +++ b/mod/chat/classes/event/message_sent.php @@ -97,4 +97,8 @@ class message_sent extends \core\event\base { throw new \coding_exception('The \'relateduserid\' must be set.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'chat_messages', 'restore' => 'chat_message'); + } } diff --git a/mod/chat/classes/event/sessions_viewed.php b/mod/chat/classes/event/sessions_viewed.php index 8b369bfec52..b2ec0c4431b 100644 --- a/mod/chat/classes/event/sessions_viewed.php +++ b/mod/chat/classes/event/sessions_viewed.php @@ -107,4 +107,12 @@ class sessions_viewed extends \core\event\base { } } + public static function get_objectid_mapping() { + return array('db' => 'chat', 'restore' => 'chat'); + } + + public static function get_other_mapping() { + // Nothing to map. + return false; + } } diff --git a/mod/choice/classes/event/answer_submitted.php b/mod/choice/classes/event/answer_submitted.php index 323bdc52510..41aec7b3110 100644 --- a/mod/choice/classes/event/answer_submitted.php +++ b/mod/choice/classes/event/answer_submitted.php @@ -93,6 +93,10 @@ class answer_submitted extends \core\event\base { * @return void */ protected function init() { + // The objecttable here is wrong. We are submitting an answer, not a choice activity. + // This also makes the description misleading as it states we made a choice with id + // '$this->objectid' which just refers to the 'choice' table. The trigger for + // this event should be triggered after we insert to the 'choice_answers' table. $this->data['crud'] = 'c'; $this->data['edulevel'] = self::LEVEL_PARTICIPATING; $this->data['objecttable'] = 'choice'; @@ -111,4 +115,22 @@ class answer_submitted extends \core\event\base { throw new \coding_exception('The \'choiceid\' value must be set in other.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'choice', 'restore' => 'choice'); + } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['choiceid'] = array('db' => 'choice', 'restore' => 'choice'); + + // The 'optionid' is being passed as an array, so we can't map it. The event is + // triggered each time a choice is answered, where it may be possible to select + // multiple choices, so the value is converted to an array, which is then passed + // to the event. Ideally this event should be triggered every time we insert to the + // 'choice_answers' table so this will only be an int. + // $othermapped['optionid'] = array('db' => 'choice_options', 'restore' => 'choice_option'); + + return $othermapped; + } } diff --git a/mod/choice/classes/event/answer_updated.php b/mod/choice/classes/event/answer_updated.php index 3f205b89383..4fb8c4c11b6 100644 --- a/mod/choice/classes/event/answer_updated.php +++ b/mod/choice/classes/event/answer_updated.php @@ -93,6 +93,10 @@ class answer_updated extends \core\event\base { * @return void */ protected function init() { + // The objecttable here is wrong. We are updating an answer, not a choice activity. + // This also makes the description misleading as it states we made a choice with id + // '$this->objectid' which just refers to the 'choice' table. The trigger for + // this event should be triggered after we update the 'choice_answers' table. $this->data['crud'] = 'u'; $this->data['edulevel'] = self::LEVEL_PARTICIPATING; $this->data['objecttable'] = 'choice'; @@ -111,4 +115,22 @@ class answer_updated extends \core\event\base { throw new \coding_exception('The \'choiceid\' value must be set in other.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'choice', 'restore' => 'choice'); + } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['choiceid'] = array('db' => 'choice', 'restore' => 'choice'); + + // The 'optionid' is being passed as an array, so we can't map it. The event is + // triggered each time a choice is answered, where it may be possible to select + // multiple choices, so the value is converted to an array, which is then passed + // to the event. Ideally this event should be triggered every time we update the + // 'choice_answers' table so this will only be an int. + // $othermapped['optionid'] = array('db' => 'choice_options', 'restore' => 'choice_option'); + + return $othermapped; + } } diff --git a/mod/choice/classes/event/course_module_viewed.php b/mod/choice/classes/event/course_module_viewed.php index 5069a89e583..7ccad4911d6 100644 --- a/mod/choice/classes/event/course_module_viewed.php +++ b/mod/choice/classes/event/course_module_viewed.php @@ -43,4 +43,8 @@ class course_module_viewed extends \core\event\course_module_viewed { $this->data['edulevel'] = self::LEVEL_PARTICIPATING; $this->data['objecttable'] = 'choice'; } + + public static function get_objectid_mapping() { + return array('db' => 'choice', 'restore' => 'choice'); + } } diff --git a/mod/choice/classes/event/report_viewed.php b/mod/choice/classes/event/report_viewed.php index 4611427728f..213ffa0882a 100644 --- a/mod/choice/classes/event/report_viewed.php +++ b/mod/choice/classes/event/report_viewed.php @@ -80,4 +80,8 @@ class report_viewed extends \core\event\base { $url = new \moodle_url('report.php', array('id' => $this->contextinstanceid)); return array($this->courseid, 'choice', 'report', $url->out(), $this->objectid, $this->contextinstanceid); } + + public static function get_objectid_mapping() { + return array('db' => 'choice', 'restore' => 'choice'); + } } diff --git a/mod/data/classes/event/course_module_viewed.php b/mod/data/classes/event/course_module_viewed.php index a3feffaa032..46cbca9df28 100644 --- a/mod/data/classes/event/course_module_viewed.php +++ b/mod/data/classes/event/course_module_viewed.php @@ -47,4 +47,8 @@ class course_module_viewed extends \core\event\course_module_viewed { $this->data['crud'] = 'r'; $this->data['edulevel'] = self::LEVEL_PARTICIPATING; } + + public static function get_objectid_mapping() { + return array('db' => 'data', 'restore' => 'data'); + } } diff --git a/mod/data/classes/event/field_created.php b/mod/data/classes/event/field_created.php index 20847246aa1..dc1bb0e0ec6 100644 --- a/mod/data/classes/event/field_created.php +++ b/mod/data/classes/event/field_created.php @@ -110,4 +110,15 @@ class field_created extends \core\event\base { throw new \coding_exception('The \'dataid\' value must be set in other.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'data_fields', 'restore' => 'data_field'); + } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['dataid'] = array('db' => 'data', 'restore' => 'data'); + + return $othermapped; + } } diff --git a/mod/data/classes/event/field_deleted.php b/mod/data/classes/event/field_deleted.php index ff597eb2cf9..4a6b4af135f 100644 --- a/mod/data/classes/event/field_deleted.php +++ b/mod/data/classes/event/field_deleted.php @@ -109,4 +109,15 @@ class field_deleted extends \core\event\base { throw new \coding_exception('The \'dataid\' value must be set in other.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'data_fields', 'restore' => 'data_field'); + } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['dataid'] = array('db' => 'data', 'restore' => 'data'); + + return $othermapped; + } } diff --git a/mod/data/classes/event/field_updated.php b/mod/data/classes/event/field_updated.php index 416dad0715c..0f35080a514 100644 --- a/mod/data/classes/event/field_updated.php +++ b/mod/data/classes/event/field_updated.php @@ -109,4 +109,15 @@ class field_updated extends \core\event\base { throw new \coding_exception('The \'dataid\' value must be set in other.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'data_fields', 'restore' => 'data_field'); + } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['dataid'] = array('db' => 'data', 'restore' => 'data'); + + return $othermapped; + } } diff --git a/mod/data/classes/event/record_created.php b/mod/data/classes/event/record_created.php index f90465d3276..d0c15af0cbf 100644 --- a/mod/data/classes/event/record_created.php +++ b/mod/data/classes/event/record_created.php @@ -104,4 +104,15 @@ class record_created extends \core\event\base { throw new \coding_exception('The \'dataid\' value must be set in other.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'data_records', 'restore' => 'data_record'); + } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['dataid'] = array('db' => 'data', 'restore' => 'data'); + + return $othermapped; + } } diff --git a/mod/data/classes/event/record_deleted.php b/mod/data/classes/event/record_deleted.php index cbaafd9a1ba..58356ad926f 100644 --- a/mod/data/classes/event/record_deleted.php +++ b/mod/data/classes/event/record_deleted.php @@ -104,4 +104,15 @@ class record_deleted extends \core\event\base { throw new \coding_exception('The \'dataid\' value must be set in other.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'data_records', 'restore' => 'data_record'); + } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['dataid'] = array('db' => 'data', 'restore' => 'data'); + + return $othermapped; + } } diff --git a/mod/data/classes/event/record_updated.php b/mod/data/classes/event/record_updated.php index baa6ed5c46b..b053d12df3d 100644 --- a/mod/data/classes/event/record_updated.php +++ b/mod/data/classes/event/record_updated.php @@ -104,4 +104,15 @@ class record_updated extends \core\event\base { throw new \coding_exception('The \'dataid\' value must be set in other.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'data_records', 'restore' => 'data_record'); + } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['dataid'] = array('db' => 'data', 'restore' => 'data'); + + return $othermapped; + } } diff --git a/mod/data/classes/event/template_updated.php b/mod/data/classes/event/template_updated.php index 78211b3cc5b..e484e51da11 100644 --- a/mod/data/classes/event/template_updated.php +++ b/mod/data/classes/event/template_updated.php @@ -104,4 +104,11 @@ class template_updated extends \core\event\base { throw new \coding_exception('The \'dataid\' value must be set in other.'); } } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['dataid'] = array('db' => 'data', 'restore' => 'data'); + + return $othermapped; + } } diff --git a/mod/data/classes/event/template_viewed.php b/mod/data/classes/event/template_viewed.php index a9a385e94ff..00f921749ee 100644 --- a/mod/data/classes/event/template_viewed.php +++ b/mod/data/classes/event/template_viewed.php @@ -103,4 +103,11 @@ class template_viewed extends \core\event\base { throw new \coding_exception('The \'dataid\' value must be set in other.'); } } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['dataid'] = array('db' => 'data', 'restore' => 'data'); + + return $othermapped; + } } diff --git a/mod/feedback/classes/event/course_module_viewed.php b/mod/feedback/classes/event/course_module_viewed.php index ad9585bc061..81b7fdc3818 100644 --- a/mod/feedback/classes/event/course_module_viewed.php +++ b/mod/feedback/classes/event/course_module_viewed.php @@ -98,5 +98,9 @@ class course_module_viewed extends \core\event\course_module_viewed { throw new \coding_exception('The \'anonymous\' value must be set in other.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'feedback', 'restore' => 'feedback'); + } } diff --git a/mod/feedback/classes/event/response_deleted.php b/mod/feedback/classes/event/response_deleted.php index 00a1105a722..b5d583cd7b0 100644 --- a/mod/feedback/classes/event/response_deleted.php +++ b/mod/feedback/classes/event/response_deleted.php @@ -126,5 +126,17 @@ class response_deleted extends \core\event\base { throw new \coding_exception('The \'instanceid\' value must be set in other.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'feedback_completed', 'restore' => 'feedback_completed'); + } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['cmid'] = array('db' => 'course_modules', 'restore' => 'course_module'); + $othermapped['instanceid'] = array('db' => 'feedback', 'restore' => 'feedback'); + + return $othermapped; + } } diff --git a/mod/feedback/classes/event/response_submitted.php b/mod/feedback/classes/event/response_submitted.php index acd1dcc7fea..b9a6fa39d26 100644 --- a/mod/feedback/classes/event/response_submitted.php +++ b/mod/feedback/classes/event/response_submitted.php @@ -148,5 +148,17 @@ class response_submitted extends \core\event\base { throw new \coding_exception('The \'instanceid\' value must be set in other.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'feedback_completed', 'restore' => 'feedback_completed'); + } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['cmid'] = array('db' => 'course_modules', 'restore' => 'course_module'); + $othermapped['instanceid'] = array('db' => 'feedback', 'restore' => 'feedback'); + + return $othermapped; + } } diff --git a/mod/folder/classes/event/course_module_viewed.php b/mod/folder/classes/event/course_module_viewed.php index 475c72fcd7e..e39fff9c873 100644 --- a/mod/folder/classes/event/course_module_viewed.php +++ b/mod/folder/classes/event/course_module_viewed.php @@ -44,4 +44,8 @@ class course_module_viewed extends \core\event\course_module_viewed { $this->data['edulevel'] = self::LEVEL_PARTICIPATING; $this->data['objecttable'] = 'folder'; } + + public static function get_objectid_mapping() { + return array('db' => 'folder', 'restore' => 'folder'); + } } diff --git a/mod/folder/classes/event/folder_updated.php b/mod/folder/classes/event/folder_updated.php index 2b744f45ef8..d3a20e84361 100644 --- a/mod/folder/classes/event/folder_updated.php +++ b/mod/folder/classes/event/folder_updated.php @@ -81,4 +81,8 @@ class folder_updated extends \core\event\base { return array($this->courseid, 'folder', 'edit', 'edit.php?id=' . $this->contextinstanceid, $this->objectid, $this->contextinstanceid); } + + public static function get_objectid_mapping() { + return array('db' => 'folder', 'restore' => 'folder'); + } } diff --git a/mod/forum/classes/event/assessable_uploaded.php b/mod/forum/classes/event/assessable_uploaded.php index b5d9c0b05de..93f37bdbbcd 100644 --- a/mod/forum/classes/event/assessable_uploaded.php +++ b/mod/forum/classes/event/assessable_uploaded.php @@ -126,4 +126,15 @@ class assessable_uploaded extends \core\event\assessable_uploaded { throw new \coding_exception('The \'triggeredfrom\' value must be set in other.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'forum_posts', 'restore' => 'forum_post'); + } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['discussionid'] = array('db' => 'forum_discussions', 'restore' => 'forum_discussion'); + + return $othermapped; + } } diff --git a/mod/forum/classes/event/course_module_viewed.php b/mod/forum/classes/event/course_module_viewed.php index 8621898cc83..a4c2f033dbc 100644 --- a/mod/forum/classes/event/course_module_viewed.php +++ b/mod/forum/classes/event/course_module_viewed.php @@ -66,5 +66,8 @@ class course_module_viewed extends \core\event\course_module_viewed { $this->objectid, $this->contextinstanceid); } + public static function get_objectid_mapping() { + return array('db' => 'forum', 'restore' => 'forum'); + } } diff --git a/mod/forum/classes/event/course_searched.php b/mod/forum/classes/event/course_searched.php index c9f6f0db1f2..40ab3dc88b0 100644 --- a/mod/forum/classes/event/course_searched.php +++ b/mod/forum/classes/event/course_searched.php @@ -111,5 +111,8 @@ class course_searched extends \core\event\base { } } + public static function get_other_mapping() { + return false; + } } diff --git a/mod/forum/classes/event/discussion_created.php b/mod/forum/classes/event/discussion_created.php index e974753b8d5..ad5e372ba03 100644 --- a/mod/forum/classes/event/discussion_created.php +++ b/mod/forum/classes/event/discussion_created.php @@ -109,4 +109,15 @@ class discussion_created extends \core\event\base { throw new \coding_exception('Context level must be CONTEXT_MODULE.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'forum_discussions', 'restore' => 'forum_discussion'); + } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['forumid'] = array('db' => 'forum', 'restore' => 'forum'); + + return $othermapped; + } } diff --git a/mod/forum/classes/event/discussion_deleted.php b/mod/forum/classes/event/discussion_deleted.php index 813f37bda73..6bd2d2ffa14 100644 --- a/mod/forum/classes/event/discussion_deleted.php +++ b/mod/forum/classes/event/discussion_deleted.php @@ -107,5 +107,16 @@ class discussion_deleted extends \core\event\base { throw new \coding_exception('Context level must be CONTEXT_MODULE.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'forum_discussions', 'restore' => 'forum_discussion'); + } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['forumid'] = array('db' => 'forum', 'restore' => 'forum'); + + return $othermapped; + } } diff --git a/mod/forum/classes/event/discussion_moved.php b/mod/forum/classes/event/discussion_moved.php index 4d2382ea3d9..c0aaa1b93ca 100644 --- a/mod/forum/classes/event/discussion_moved.php +++ b/mod/forum/classes/event/discussion_moved.php @@ -111,4 +111,16 @@ class discussion_moved extends \core\event\base { throw new \coding_exception('Context level must be CONTEXT_MODULE.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'forum_discussions', 'restore' => 'forum_discussion'); + } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['fromforumid'] = array('db' => 'forum', 'restore' => 'forum'); + $othermapped['toforumid'] = array('db' => 'forum', 'restore' => 'forum'); + + return $othermapped; + } } diff --git a/mod/forum/classes/event/discussion_subscription_created.php b/mod/forum/classes/event/discussion_subscription_created.php index d430292fc6b..da452509909 100644 --- a/mod/forum/classes/event/discussion_subscription_created.php +++ b/mod/forum/classes/event/discussion_subscription_created.php @@ -109,4 +109,16 @@ class discussion_subscription_created extends \core\event\base { throw new \coding_exception('Context level must be CONTEXT_MODULE.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'forum_discussion_subs', 'restore' => 'forum_discussion_sub'); + } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['forumid'] = array('db' => 'forum', 'restore' => 'forum'); + $othermapped['discussion'] = array('db' => 'forum_discussions', 'restore' => 'forum_discussion'); + + return $othermapped; + } } diff --git a/mod/forum/classes/event/discussion_subscription_deleted.php b/mod/forum/classes/event/discussion_subscription_deleted.php index 7a773912eba..68533966306 100644 --- a/mod/forum/classes/event/discussion_subscription_deleted.php +++ b/mod/forum/classes/event/discussion_subscription_deleted.php @@ -109,4 +109,16 @@ class discussion_subscription_deleted extends \core\event\base { throw new \coding_exception('Context level must be CONTEXT_MODULE.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'forum_discussion_subs', 'restore' => 'forum_discussion_sub'); + } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['forumid'] = array('db' => 'forum', 'restore' => 'forum'); + $othermapped['discussion'] = array('db' => 'forum_discussions', 'restore' => 'forum_discussion'); + + return $othermapped; + } } diff --git a/mod/forum/classes/event/discussion_updated.php b/mod/forum/classes/event/discussion_updated.php index c0c78148157..001a8a679b5 100644 --- a/mod/forum/classes/event/discussion_updated.php +++ b/mod/forum/classes/event/discussion_updated.php @@ -97,4 +97,15 @@ class discussion_updated extends \core\event\base { throw new \coding_exception('Context level must be CONTEXT_MODULE.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'forum_discussions', 'restore' => 'forum_discussion'); + } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['forumid'] = array('db' => 'forum', 'restore' => 'forum'); + + return $othermapped; + } } diff --git a/mod/forum/classes/event/discussion_viewed.php b/mod/forum/classes/event/discussion_viewed.php index 3986531a69a..e99290e0cb0 100644 --- a/mod/forum/classes/event/discussion_viewed.php +++ b/mod/forum/classes/event/discussion_viewed.php @@ -99,5 +99,8 @@ class discussion_viewed extends \core\event\base { } } + public static function get_objectid_mapping() { + return array('db' => 'forum_discussions', 'restore' => 'forum_discussion'); + } } diff --git a/mod/forum/classes/event/post_created.php b/mod/forum/classes/event/post_created.php index 91f1554a8e3..ea170e569ae 100644 --- a/mod/forum/classes/event/post_created.php +++ b/mod/forum/classes/event/post_created.php @@ -128,4 +128,16 @@ class post_created extends \core\event\base { throw new \coding_exception('Context level must be CONTEXT_MODULE.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'forum_posts', 'restore' => 'forum_post'); + } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['forumid'] = array('db' => 'forum', 'restore' => 'forum'); + $othermapped['discussionid'] = array('db' => 'forum_discussions', 'restore' => 'forum_discussion'); + + return $othermapped; + } } diff --git a/mod/forum/classes/event/post_deleted.php b/mod/forum/classes/event/post_deleted.php index 311d89979d5..91d2f4c12db 100644 --- a/mod/forum/classes/event/post_deleted.php +++ b/mod/forum/classes/event/post_deleted.php @@ -127,4 +127,16 @@ class post_deleted extends \core\event\base { throw new \coding_exception('Context level must be CONTEXT_MODULE.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'forum_posts', 'restore' => 'forum_post'); + } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['forumid'] = array('db' => 'forum', 'restore' => 'forum'); + $othermapped['discussionid'] = array('db' => 'forum_discussions', 'restore' => 'forum_discussion'); + + return $othermapped; + } } diff --git a/mod/forum/classes/event/post_updated.php b/mod/forum/classes/event/post_updated.php index eff30eb4505..2ab41ff3a16 100644 --- a/mod/forum/classes/event/post_updated.php +++ b/mod/forum/classes/event/post_updated.php @@ -128,4 +128,16 @@ class post_updated extends \core\event\base { throw new \coding_exception('Context level must be CONTEXT_MODULE.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'forum_posts', 'restore' => 'forum_post'); + } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['forumid'] = array('db' => 'forum', 'restore' => 'forum'); + $othermapped['discussionid'] = array('db' => 'forum_discussions', 'restore' => 'forum_discussion'); + + return $othermapped; + } } diff --git a/mod/forum/classes/event/readtracking_disabled.php b/mod/forum/classes/event/readtracking_disabled.php index 44b005ece8b..3e35ff3cc9b 100644 --- a/mod/forum/classes/event/readtracking_disabled.php +++ b/mod/forum/classes/event/readtracking_disabled.php @@ -110,4 +110,11 @@ class readtracking_disabled extends \core\event\base { throw new \coding_exception('Context level must be CONTEXT_MODULE.'); } } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['forumid'] = array('db' => 'forum', 'restore' => 'forum'); + + return $othermapped; + } } diff --git a/mod/forum/classes/event/readtracking_enabled.php b/mod/forum/classes/event/readtracking_enabled.php index 07de971dd3e..c2dcc40c87e 100644 --- a/mod/forum/classes/event/readtracking_enabled.php +++ b/mod/forum/classes/event/readtracking_enabled.php @@ -110,4 +110,11 @@ class readtracking_enabled extends \core\event\base { throw new \coding_exception('Context level must be CONTEXT_MODULE.'); } } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['forumid'] = array('db' => 'forum', 'restore' => 'forum'); + + return $othermapped; + } } diff --git a/mod/forum/classes/event/subscribers_viewed.php b/mod/forum/classes/event/subscribers_viewed.php index b7b6139b7fd..deec581902c 100644 --- a/mod/forum/classes/event/subscribers_viewed.php +++ b/mod/forum/classes/event/subscribers_viewed.php @@ -108,5 +108,11 @@ class subscribers_viewed extends \core\event\base { } } + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['forumid'] = array('db' => 'forum', 'restore' => 'forum'); + + return $othermapped; + } } diff --git a/mod/forum/classes/event/subscription_created.php b/mod/forum/classes/event/subscription_created.php index 9d099669b61..c3531aafd9a 100644 --- a/mod/forum/classes/event/subscription_created.php +++ b/mod/forum/classes/event/subscription_created.php @@ -111,4 +111,15 @@ class subscription_created extends \core\event\base { throw new \coding_exception('Context level must be CONTEXT_MODULE.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'forum_subscriptions', 'restore' => 'forum_subscription'); + } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['forumid'] = array('db' => 'forum', 'restore' => 'forum'); + + return $othermapped; + } } diff --git a/mod/forum/classes/event/subscription_deleted.php b/mod/forum/classes/event/subscription_deleted.php index 97892b0a8d5..129e9b2e6c3 100644 --- a/mod/forum/classes/event/subscription_deleted.php +++ b/mod/forum/classes/event/subscription_deleted.php @@ -111,4 +111,15 @@ class subscription_deleted extends \core\event\base { throw new \coding_exception('Context level must be CONTEXT_MODULE.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'forum_subscriptions', 'restore' => 'forum_subscription'); + } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['forumid'] = array('db' => 'forum', 'restore' => 'forum'); + + return $othermapped; + } } diff --git a/mod/forum/classes/event/user_report_viewed.php b/mod/forum/classes/event/user_report_viewed.php index a03fe6152ce..1fdc5c96f0b 100644 --- a/mod/forum/classes/event/user_report_viewed.php +++ b/mod/forum/classes/event/user_report_viewed.php @@ -128,5 +128,8 @@ class user_report_viewed extends \core\event\base { } } + public static function get_other_mapping() { + return false; + } } diff --git a/mod/glossary/classes/event/category_created.php b/mod/glossary/classes/event/category_created.php index cc289e3b9cc..56a644612c5 100644 --- a/mod/glossary/classes/event/category_created.php +++ b/mod/glossary/classes/event/category_created.php @@ -96,5 +96,9 @@ class category_created extends \core\event\base { throw new \coding_exception('Context level must be CONTEXT_MODULE.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'glossary_categories', 'restore' => 'glossary_category'); + } } diff --git a/mod/glossary/classes/event/category_deleted.php b/mod/glossary/classes/event/category_deleted.php index 620c71c2cb7..3b25a4699b9 100644 --- a/mod/glossary/classes/event/category_deleted.php +++ b/mod/glossary/classes/event/category_deleted.php @@ -96,5 +96,9 @@ class category_deleted extends \core\event\base { throw new \coding_exception('Context level must be CONTEXT_MODULE.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'glossary_categories', 'restore' => 'glossary_category'); + } } diff --git a/mod/glossary/classes/event/category_updated.php b/mod/glossary/classes/event/category_updated.php index fa9f0457b94..887123d48ed 100644 --- a/mod/glossary/classes/event/category_updated.php +++ b/mod/glossary/classes/event/category_updated.php @@ -96,5 +96,9 @@ class category_updated extends \core\event\base { throw new \coding_exception('Context level must be CONTEXT_MODULE.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'glossary_categories', 'restore' => 'glossary_category'); + } } diff --git a/mod/glossary/classes/event/course_module_viewed.php b/mod/glossary/classes/event/course_module_viewed.php index 32e459035a8..33680aa5da6 100644 --- a/mod/glossary/classes/event/course_module_viewed.php +++ b/mod/glossary/classes/event/course_module_viewed.php @@ -28,6 +28,12 @@ defined('MOODLE_INTERNAL') || die(); /** * The mod_glossary course module viewed event class. * + * @property-read array $other { + * Extra information about event. + * + * - string mode: (optional) + * } + * * @package mod_glossary * @since Moodle 2.7 * @copyright 2014 Marina Glancy @@ -68,4 +74,13 @@ class course_module_viewed extends \core\event\course_module_viewed { 'view.php?id=' . $this->contextinstanceid . '&tab=-1', $this->objectid, $this->contextinstanceid); } + + public static function get_objectid_mapping() { + return array('db' => 'glossary', 'restore' => 'glossary'); + } + + public static function get_other_mapping() { + // Nothing to map. + return false; + } } diff --git a/mod/glossary/classes/event/entry_approved.php b/mod/glossary/classes/event/entry_approved.php index 6e690e82a45..38bae26cf49 100644 --- a/mod/glossary/classes/event/entry_approved.php +++ b/mod/glossary/classes/event/entry_approved.php @@ -98,5 +98,9 @@ class entry_approved extends \core\event\base { throw new \coding_exception('Context level must be CONTEXT_MODULE.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'glossary_entries', 'restore' => 'glossary_entry'); + } } diff --git a/mod/glossary/classes/event/entry_created.php b/mod/glossary/classes/event/entry_created.php index 98387f8ec0a..fba39d75a19 100644 --- a/mod/glossary/classes/event/entry_created.php +++ b/mod/glossary/classes/event/entry_created.php @@ -104,5 +104,14 @@ class entry_created extends \core\event\base { throw new \coding_exception('Context level must be CONTEXT_MODULE.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'glossary_entries', 'restore' => 'glossary_entry'); + } + + public static function get_other_mapping() { + // Nothing to map. + return false; + } } diff --git a/mod/glossary/classes/event/entry_deleted.php b/mod/glossary/classes/event/entry_deleted.php index f116600a8be..7721668d17b 100644 --- a/mod/glossary/classes/event/entry_deleted.php +++ b/mod/glossary/classes/event/entry_deleted.php @@ -118,5 +118,14 @@ class entry_deleted extends \core\event\base { throw new \coding_exception('Context level must be CONTEXT_MODULE.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'glossary_entries', 'restore' => 'glossary_entry'); + } + + public static function get_other_mapping() { + // Nothing to map. + return false; + } } diff --git a/mod/glossary/classes/event/entry_disapproved.php b/mod/glossary/classes/event/entry_disapproved.php index 8a74289c336..faa47213d2a 100644 --- a/mod/glossary/classes/event/entry_disapproved.php +++ b/mod/glossary/classes/event/entry_disapproved.php @@ -98,5 +98,9 @@ class entry_disapproved extends \core\event\base { throw new \coding_exception('Context level must be CONTEXT_MODULE.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'glossary_entries', 'restore' => 'glossary_entry'); + } } diff --git a/mod/glossary/classes/event/entry_updated.php b/mod/glossary/classes/event/entry_updated.php index ea831fd59f8..88c10de469c 100644 --- a/mod/glossary/classes/event/entry_updated.php +++ b/mod/glossary/classes/event/entry_updated.php @@ -104,5 +104,14 @@ class entry_updated extends \core\event\base { throw new \coding_exception('Context level must be CONTEXT_MODULE.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'glossary_entries', 'restore' => 'glossary_entry'); + } + + public static function get_other_mapping() { + // Nothing to map. + return false; + } } diff --git a/mod/glossary/classes/event/entry_viewed.php b/mod/glossary/classes/event/entry_viewed.php index fbaba29a276..f04695568a5 100644 --- a/mod/glossary/classes/event/entry_viewed.php +++ b/mod/glossary/classes/event/entry_viewed.php @@ -98,5 +98,9 @@ class entry_viewed extends \core\event\base { throw new \coding_exception('Context level must be CONTEXT_MODULE.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'glossary_entries', 'restore' => 'glossary_entry'); + } } diff --git a/mod/imscp/classes/event/course_module_viewed.php b/mod/imscp/classes/event/course_module_viewed.php index 5a1681ffbc1..71acd68d5ba 100644 --- a/mod/imscp/classes/event/course_module_viewed.php +++ b/mod/imscp/classes/event/course_module_viewed.php @@ -45,4 +45,8 @@ class course_module_viewed extends \core\event\course_module_viewed { $this->data['crud'] = 'r'; $this->data['edulevel'] = self::LEVEL_PARTICIPATING; } + + public static function get_objectid_mapping() { + return array('db' => 'imscp', 'restore' => 'imscp'); + } } diff --git a/mod/lesson/classes/event/content_page_viewed.php b/mod/lesson/classes/event/content_page_viewed.php index 90875cfa66e..d98bdbf6de5 100644 --- a/mod/lesson/classes/event/content_page_viewed.php +++ b/mod/lesson/classes/event/content_page_viewed.php @@ -86,4 +86,8 @@ class content_page_viewed extends \core\event\base { throw new \coding_exception('Context level must be CONTEXT_MODULE.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'lesson_pages', 'restore' => 'lesson_page'); + } } diff --git a/mod/lesson/classes/event/course_module_viewed.php b/mod/lesson/classes/event/course_module_viewed.php index 8b7992bdea7..3244e754ee2 100644 --- a/mod/lesson/classes/event/course_module_viewed.php +++ b/mod/lesson/classes/event/course_module_viewed.php @@ -45,4 +45,8 @@ class course_module_viewed extends \core\event\course_module_viewed { $this->data['crud'] = 'r'; $this->data['edulevel'] = self::LEVEL_PARTICIPATING; } + + public static function get_objectid_mapping() { + return array('db' => 'lesson', 'restore' => 'lesson'); + } } diff --git a/mod/lesson/classes/event/essay_assessed.php b/mod/lesson/classes/event/essay_assessed.php index f3117d15db6..92079ac4e89 100644 --- a/mod/lesson/classes/event/essay_assessed.php +++ b/mod/lesson/classes/event/essay_assessed.php @@ -111,4 +111,16 @@ class essay_assessed extends \core\event\base { throw new \coding_exception('The \'attemptid\' value must be set in other.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'lesson_grades', 'restore' => 'lesson_grade'); + } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['lessonid'] = array('db' => 'lesson', 'restore' => 'lesson'); + $othermapped['attemptid'] = array('db' => 'lesson_attempts', 'restore' => 'lesson_attept'); + + return $othermapped; + } } diff --git a/mod/lesson/classes/event/essay_attempt_viewed.php b/mod/lesson/classes/event/essay_attempt_viewed.php index 5e179228624..1af109f0bd9 100644 --- a/mod/lesson/classes/event/essay_attempt_viewed.php +++ b/mod/lesson/classes/event/essay_attempt_viewed.php @@ -97,4 +97,8 @@ class essay_attempt_viewed extends \core\event\base { throw new \coding_exception('The \'relateduserid\' must be set.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'lesson_attempts', 'restore' => 'lesson_attempt'); + } } diff --git a/mod/lesson/classes/event/group_override_created.php b/mod/lesson/classes/event/group_override_created.php index 1edc21bbb37..fff0e617019 100644 --- a/mod/lesson/classes/event/group_override_created.php +++ b/mod/lesson/classes/event/group_override_created.php @@ -97,4 +97,16 @@ class group_override_created extends \core\event\base { throw new \coding_exception('The \'groupid\' value must be set in other.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'lesson_overrides', 'restore' => 'lesson_override'); + } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['lessonid'] = array('db' => 'lesson', 'restore' => 'lesson'); + $othermapped['groupid'] = array('db' => 'groups', 'restore' => 'group'); + + return $othermapped; + } } diff --git a/mod/lesson/classes/event/group_override_deleted.php b/mod/lesson/classes/event/group_override_deleted.php index 16700850afa..49ba8569d79 100644 --- a/mod/lesson/classes/event/group_override_deleted.php +++ b/mod/lesson/classes/event/group_override_deleted.php @@ -96,4 +96,16 @@ class group_override_deleted extends \core\event\base { throw new \coding_exception('The \'groupid\' value must be set in other.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'lesson_overrides', 'restore' => 'lesson_override'); + } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['lessonid'] = array('db' => 'lesson', 'restore' => 'lesson'); + $othermapped['groupid'] = array('db' => 'groups', 'restore' => 'group'); + + return $othermapped; + } } diff --git a/mod/lesson/classes/event/group_override_updated.php b/mod/lesson/classes/event/group_override_updated.php index 7096cd11b42..a5fd6ca138a 100644 --- a/mod/lesson/classes/event/group_override_updated.php +++ b/mod/lesson/classes/event/group_override_updated.php @@ -96,4 +96,16 @@ class group_override_updated extends \core\event\base { throw new \coding_exception('The \'groupid\' value must be set in other.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'lesson_overrides', 'restore' => 'lesson_override'); + } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['lessonid'] = array('db' => 'lesson', 'restore' => 'lesson'); + $othermapped['groupid'] = array('db' => 'groups', 'restore' => 'group'); + + return $othermapped; + } } diff --git a/mod/lesson/classes/event/highscore_added.php b/mod/lesson/classes/event/highscore_added.php index e5d9513f97f..25d61bebc94 100644 --- a/mod/lesson/classes/event/highscore_added.php +++ b/mod/lesson/classes/event/highscore_added.php @@ -111,4 +111,14 @@ class highscore_added extends \core\event\base { throw new \coding_exception('The \'nickname\' value must be set in other.'); } } + + public static function get_objectid_mapping() { + // The 'highscore' functionality was removed from core. + return false; + } + + public static function get_other_mapping() { + // The 'highscore' functionality was removed from core. + return false; + } } diff --git a/mod/lesson/classes/event/highscores_viewed.php b/mod/lesson/classes/event/highscores_viewed.php index 614ef0900c8..91fa720cd22 100644 --- a/mod/lesson/classes/event/highscores_viewed.php +++ b/mod/lesson/classes/event/highscores_viewed.php @@ -87,4 +87,14 @@ class highscores_viewed extends \core\event\base { return array($this->courseid, 'lesson', 'view highscores', 'highscores.php?id=' . $this->contextinstanceid, $lesson->name, $this->contextinstanceid); } + + public static function get_objectid_mapping() { + // The 'highscore' functionality was removed from core. + return false; + } + + public static function get_other_mapping() { + // The 'highscore' functionality was removed from core. + return false; + } } diff --git a/mod/lesson/classes/event/lesson_ended.php b/mod/lesson/classes/event/lesson_ended.php index aea1c2f55dd..e090a789f86 100644 --- a/mod/lesson/classes/event/lesson_ended.php +++ b/mod/lesson/classes/event/lesson_ended.php @@ -82,4 +82,8 @@ class lesson_ended extends \core\event\base { return array($this->courseid, 'lesson', 'end', 'view.php?id=' . $this->contextinstanceid, $this->objectid, $this->contextinstanceid); } + + public static function get_objectid_mapping() { + return array('db' => 'lesson', 'restore' => 'lesson'); + } } diff --git a/mod/lesson/classes/event/lesson_restarted.php b/mod/lesson/classes/event/lesson_restarted.php index c2c8b6750ff..7870e43d77a 100644 --- a/mod/lesson/classes/event/lesson_restarted.php +++ b/mod/lesson/classes/event/lesson_restarted.php @@ -72,4 +72,8 @@ class lesson_restarted extends \core\event\base { return "The user with id '$this->userid' abandoned their previous incomplete attempt ". "and started a new attempt on the lesson with course module id '$this->contextinstanceid'."; } + + public static function get_objectid_mapping() { + return array('db' => 'lesson', 'restore' => 'lesson'); + } } diff --git a/mod/lesson/classes/event/lesson_resumed.php b/mod/lesson/classes/event/lesson_resumed.php index 30638f46095..89abc44bb7f 100644 --- a/mod/lesson/classes/event/lesson_resumed.php +++ b/mod/lesson/classes/event/lesson_resumed.php @@ -72,4 +72,8 @@ class lesson_resumed extends \core\event\base { return "The user with id '$this->userid' resumed their previous incomplete attempt on". " the lesson with course module id '$this->contextinstanceid'."; } + + public static function get_objectid_mapping() { + return array('db' => 'lesson', 'restore' => 'lesson'); + } } diff --git a/mod/lesson/classes/event/lesson_started.php b/mod/lesson/classes/event/lesson_started.php index d35b37230de..204d0ce7798 100644 --- a/mod/lesson/classes/event/lesson_started.php +++ b/mod/lesson/classes/event/lesson_started.php @@ -81,4 +81,8 @@ class lesson_started extends \core\event\base { return array($this->courseid, 'lesson', 'start', 'view.php?id=' . $this->contextinstanceid, $this->objectid, $this->contextinstanceid); } + + public static function get_objectid_mapping() { + return array('db' => 'lesson', 'restore' => 'lesson'); + } } diff --git a/mod/lesson/classes/event/page_created.php b/mod/lesson/classes/event/page_created.php index de3c1f94cd9..f2dc4e1b287 100644 --- a/mod/lesson/classes/event/page_created.php +++ b/mod/lesson/classes/event/page_created.php @@ -30,9 +30,9 @@ defined('MOODLE_INTERNAL') || die(); * The mod_lesson page_created event class. * * @property-read array $other { - * Extra information about event. + * Extra information about event. * - * - string pagetype: the name of the pagetype as defined in the individual page class + * - string pagetype: the name of the pagetype as defined in the individual page class * } * * @package mod_lesson @@ -95,4 +95,13 @@ class page_created extends \core\event\base { throw new \coding_exception('The \'pagetype\' value must be set in other.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'lesson_pages', 'restore' => 'lesson_page'); + } + + public static function get_other_mapping() { + // Nothing to map. + return false; + } } \ No newline at end of file diff --git a/mod/lesson/classes/event/page_deleted.php b/mod/lesson/classes/event/page_deleted.php index a4342a30b02..037e3dc49cd 100644 --- a/mod/lesson/classes/event/page_deleted.php +++ b/mod/lesson/classes/event/page_deleted.php @@ -30,9 +30,9 @@ defined('MOODLE_INTERNAL') || die(); * The mod_lesson page_deleted event class. * * @property-read array $other { - * Extra information about event. + * Extra information about event. * - * - string pagetype: the name of the pagetype as defined in the individual page class + * - string pagetype: the name of the pagetype as defined in the individual page class * } * * @package mod_lesson @@ -95,4 +95,13 @@ class page_deleted extends \core\event\base { throw new \coding_exception('The \'pagetype\' value must be set in other.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'lesson_pages', 'restore' => 'lesson_page'); + } + + public static function get_other_mapping() { + // Nothing to map. + return false; + } } \ No newline at end of file diff --git a/mod/lesson/classes/event/page_moved.php b/mod/lesson/classes/event/page_moved.php index 91ce667111b..5f4b254517c 100644 --- a/mod/lesson/classes/event/page_moved.php +++ b/mod/lesson/classes/event/page_moved.php @@ -30,11 +30,11 @@ defined('MOODLE_INTERNAL') || die(); * The mod_lesson page_moved event class. * * @property-read array $other { - * Extra information about event. + * Extra information about event. * - * - string pagetype: the name of the pagetype as defined in the individual page class - * - int prevpageid: the id of the previous lesson page - * - int nextpageid: the id of the next lesson page + * - string pagetype: the name of the pagetype as defined in the individual page class + * - int prevpageid: the id of the previous lesson page + * - int nextpageid: the id of the next lesson page * } * * @package mod_lesson @@ -105,4 +105,16 @@ class page_moved extends \core\event\base { throw new \coding_exception('The \'nextpageid\' value must be set in other.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'lesson_pages', 'restore' => 'lesson_page'); + } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['prevpageid'] = array('db' => 'lesson_pages', 'restore' => 'lesson_page'); + $othermapped['nextpageid'] = array('db' => 'lesson_pages', 'restore' => 'lesson_page'); + + return $othermapped; + } } diff --git a/mod/lesson/classes/event/page_updated.php b/mod/lesson/classes/event/page_updated.php index 55065f18fa0..2f11224741d 100644 --- a/mod/lesson/classes/event/page_updated.php +++ b/mod/lesson/classes/event/page_updated.php @@ -28,10 +28,11 @@ defined('MOODLE_INTERNAL') || die(); /** * The mod_lesson page_updated event class. - * @property-read array $other { - * Extra information about event. * - * - string pagetype: the name of the pagetype as defined in the individual page class + * @property-read array $other { + * Extra information about event. + * + * - string pagetype: the name of the pagetype as defined in the individual page class * } * * @package mod_lesson @@ -113,4 +114,13 @@ class page_updated extends \core\event\base { throw new \coding_exception('The \'pagetype\' value must be set in other.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'lesson_pages', 'restore' => 'lesson_page'); + } + + public static function get_other_mapping() { + // Nothing to map. + return false; + } } \ No newline at end of file diff --git a/mod/lesson/classes/event/question_answered.php b/mod/lesson/classes/event/question_answered.php index 5f1b5fef95b..ef037ae3489 100644 --- a/mod/lesson/classes/event/question_answered.php +++ b/mod/lesson/classes/event/question_answered.php @@ -30,9 +30,9 @@ defined('MOODLE_INTERNAL') || die(); * The mod_lesson question answered event class. * * @property-read array $other { - * Extra information about event. + * Extra information about event. * - * - string pagetype: the name of the pagetype as defined in the individual page class + * - string pagetype: the name of the pagetype as defined in the individual page class * } * * @package mod_lesson @@ -95,4 +95,13 @@ class question_answered extends \core\event\base { throw new \coding_exception('The \'pagetype\' value must be set in other.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'lesson_pages', 'restore' => 'lesson_page'); + } + + public static function get_other_mapping() { + // Nothing to map. + return false; + } } diff --git a/mod/lesson/classes/event/question_viewed.php b/mod/lesson/classes/event/question_viewed.php index a6d82a699ba..a72aa4612a6 100644 --- a/mod/lesson/classes/event/question_viewed.php +++ b/mod/lesson/classes/event/question_viewed.php @@ -30,9 +30,9 @@ defined('MOODLE_INTERNAL') || die(); * The mod_lesson question viewed event class. * * @property-read array $other { - * Extra information about event. + * Extra information about event. * - * - string pagetype: the name of the pagetype as defined in the individual page class + * - string pagetype: the name of the pagetype as defined in the individual page class * } * * @package mod_lesson @@ -95,4 +95,13 @@ class question_viewed extends \core\event\base { throw new \coding_exception('The \'pagetype\' value must be set in other.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'lesson_pages', 'restore' => 'lesson_page'); + } + + public static function get_other_mapping() { + // Nothing to map. + return false; + } } diff --git a/mod/lesson/classes/event/user_override_created.php b/mod/lesson/classes/event/user_override_created.php index 9e47d57cb92..6d6cae6c3c2 100644 --- a/mod/lesson/classes/event/user_override_created.php +++ b/mod/lesson/classes/event/user_override_created.php @@ -95,4 +95,15 @@ class user_override_created extends \core\event\base { throw new \coding_exception('The \'lessonid\' value must be set in other.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'lesson_overrides', 'restore' => 'lesson_override'); + } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['lessonid'] = array('db' => 'lesson', 'restore' => 'lesson'); + + return $othermapped; + } } diff --git a/mod/lesson/classes/event/user_override_deleted.php b/mod/lesson/classes/event/user_override_deleted.php index 6fc90aac5d3..1c77ea6c050 100644 --- a/mod/lesson/classes/event/user_override_deleted.php +++ b/mod/lesson/classes/event/user_override_deleted.php @@ -95,4 +95,15 @@ class user_override_deleted extends \core\event\base { throw new \coding_exception('The \'lessonid\' value must be set in other.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'lesson_overrides', 'restore' => 'lesson_override'); + } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['lessonid'] = array('db' => 'lesson', 'restore' => 'lesson'); + + return $othermapped; + } } diff --git a/mod/lesson/classes/event/user_override_updated.php b/mod/lesson/classes/event/user_override_updated.php index 4c30e4bb85a..b845df5c52e 100644 --- a/mod/lesson/classes/event/user_override_updated.php +++ b/mod/lesson/classes/event/user_override_updated.php @@ -96,4 +96,15 @@ class user_override_updated extends \core\event\base { throw new \coding_exception('The \'lessonid\' value must be set in other.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'lesson_overrides', 'restore' => 'lesson_override'); + } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['lessonid'] = array('db' => 'lesson', 'restore' => 'lesson'); + + return $othermapped; + } } diff --git a/mod/lti/classes/event/course_module_viewed.php b/mod/lti/classes/event/course_module_viewed.php index a42d007ec41..6cb886d1fd9 100644 --- a/mod/lti/classes/event/course_module_viewed.php +++ b/mod/lti/classes/event/course_module_viewed.php @@ -44,4 +44,8 @@ class course_module_viewed extends \core\event\course_module_viewed { $this->data['crud'] = 'r'; $this->data['edulevel'] = self::LEVEL_PARTICIPATING; } + + public static function get_objectid_mapping() { + return array('db' => 'lti', 'restore' => 'lti'); + } } diff --git a/mod/page/classes/event/course_module_viewed.php b/mod/page/classes/event/course_module_viewed.php index c61cbe374af..d0086629462 100644 --- a/mod/page/classes/event/course_module_viewed.php +++ b/mod/page/classes/event/course_module_viewed.php @@ -43,5 +43,9 @@ class course_module_viewed extends \core\event\course_module_viewed { $this->data['edulevel'] = self::LEVEL_PARTICIPATING; $this->data['objecttable'] = 'page'; } + + public static function get_objectid_mapping() { + return array('db' => 'page', 'restore' => 'page'); + } } diff --git a/mod/quiz/classes/event/attempt_abandoned.php b/mod/quiz/classes/event/attempt_abandoned.php index 08e56076388..5960954557b 100644 --- a/mod/quiz/classes/event/attempt_abandoned.php +++ b/mod/quiz/classes/event/attempt_abandoned.php @@ -126,4 +126,16 @@ class attempt_abandoned extends \core\event\base { throw new \coding_exception('The \'submitterid\' value must be set in other.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'quiz_attempts', 'restore' => 'quiz_attempt'); + } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['submitterid'] = array('db' => 'user', 'restore' => 'user'); + $othermapped['quizid'] = array('db' => 'quiz', 'restore' => 'quiz'); + + return $othermapped; + } } diff --git a/mod/quiz/classes/event/attempt_becameoverdue.php b/mod/quiz/classes/event/attempt_becameoverdue.php index 5318048ea12..549e839c326 100644 --- a/mod/quiz/classes/event/attempt_becameoverdue.php +++ b/mod/quiz/classes/event/attempt_becameoverdue.php @@ -128,4 +128,16 @@ class attempt_becameoverdue extends \core\event\base { throw new \coding_exception('The \'submitterid\' value must be set in other.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'quiz_attempts', 'restore' => 'quiz_attempt'); + } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['submitterid'] = array('db' => 'user', 'restore' => 'user'); + $othermapped['quizid'] = array('db' => 'quiz', 'restore' => 'quiz'); + + return $othermapped; + } } diff --git a/mod/quiz/classes/event/attempt_deleted.php b/mod/quiz/classes/event/attempt_deleted.php index b0dbfc482de..0662f397304 100644 --- a/mod/quiz/classes/event/attempt_deleted.php +++ b/mod/quiz/classes/event/attempt_deleted.php @@ -28,6 +28,12 @@ defined('MOODLE_INTERNAL') || die(); /** * The mod_quiz attempt deleted event class. * + * @property-read array $other { + * Extra information about event. + * + * - int quizid: the id of the quiz. + * } + * * @package mod_quiz * @since Moodle 2.7 * @copyright 2014 Mark Nelson @@ -99,4 +105,15 @@ class attempt_deleted extends \core\event\base { throw new \coding_exception('The \'quizid\' value must be set in other.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'quiz_attempts', 'restore' => 'quiz_attempt'); + } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['quizid'] = array('db' => 'quiz', 'restore' => 'quiz'); + + return $othermapped; + } } diff --git a/mod/quiz/classes/event/attempt_preview_started.php b/mod/quiz/classes/event/attempt_preview_started.php index cbea2372568..7b00db28e9b 100644 --- a/mod/quiz/classes/event/attempt_preview_started.php +++ b/mod/quiz/classes/event/attempt_preview_started.php @@ -106,4 +106,15 @@ class attempt_preview_started extends \core\event\base { throw new \coding_exception('The \'quizid\' value must be set in other.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'quiz_attempts', 'restore' => 'quiz_attempt'); + } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['quizid'] = array('db' => 'quiz', 'restore' => 'quiz'); + + return $othermapped; + } } diff --git a/mod/quiz/classes/event/attempt_reviewed.php b/mod/quiz/classes/event/attempt_reviewed.php index 989f7880eeb..fbfdd8dc62a 100644 --- a/mod/quiz/classes/event/attempt_reviewed.php +++ b/mod/quiz/classes/event/attempt_reviewed.php @@ -105,4 +105,15 @@ class attempt_reviewed extends \core\event\base { throw new \coding_exception('The \'quizid\' value must be set in other.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'quiz_attempts', 'restore' => 'quiz_attempt'); + } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['quizid'] = array('db' => 'quiz', 'restore' => 'quiz'); + + return $othermapped; + } } diff --git a/mod/quiz/classes/event/attempt_started.php b/mod/quiz/classes/event/attempt_started.php index 149b56a5714..f5e70162a74 100644 --- a/mod/quiz/classes/event/attempt_started.php +++ b/mod/quiz/classes/event/attempt_started.php @@ -27,6 +27,12 @@ defined('MOODLE_INTERNAL') || die(); /** * The mod_quiz attempt started event class. * + * @property-read array $other { + * Extra information about event. + * + * - int quizid: (optional) the id of the quiz. + * } + * * @package mod_quiz * @since Moodle 2.6 * @copyright 2013 Adrian Greeve @@ -125,4 +131,15 @@ class attempt_started extends \core\event\base { throw new \coding_exception('The \'relateduserid\' must be set.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'quiz_attempts', 'restore' => 'quiz_attempt'); + } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['quizid'] = array('db' => 'quiz', 'restore' => 'quiz'); + + return $othermapped; + } } diff --git a/mod/quiz/classes/event/attempt_submitted.php b/mod/quiz/classes/event/attempt_submitted.php index b64a967b345..efa5302c007 100644 --- a/mod/quiz/classes/event/attempt_submitted.php +++ b/mod/quiz/classes/event/attempt_submitted.php @@ -126,4 +126,16 @@ class attempt_submitted extends \core\event\base { throw new \coding_exception('The \'submitterid\' value must be set in other.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'quiz_attempts', 'restore' => 'quiz_attempt'); + } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['submitterid'] = array('db' => 'user', 'restore' => 'user'); + $othermapped['quizid'] = array('db' => 'quiz', 'restore' => 'quiz'); + + return $othermapped; + } } diff --git a/mod/quiz/classes/event/attempt_summary_viewed.php b/mod/quiz/classes/event/attempt_summary_viewed.php index 6b480cf7d89..385e2b356d3 100644 --- a/mod/quiz/classes/event/attempt_summary_viewed.php +++ b/mod/quiz/classes/event/attempt_summary_viewed.php @@ -108,4 +108,15 @@ class attempt_summary_viewed extends \core\event\base { throw new \coding_exception('The \'quizid\' must be set in other.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'quiz_attempts', 'restore' => 'quiz_attempt'); + } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['quizid'] = array('db' => 'quiz', 'restore' => 'quiz'); + + return $othermapped; + } } diff --git a/mod/quiz/classes/event/attempt_viewed.php b/mod/quiz/classes/event/attempt_viewed.php index edde520f7b1..f08739936c3 100644 --- a/mod/quiz/classes/event/attempt_viewed.php +++ b/mod/quiz/classes/event/attempt_viewed.php @@ -106,4 +106,15 @@ class attempt_viewed extends \core\event\base { throw new \coding_exception('The \'quizid\' value must be set in other.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'quiz_attempts', 'restore' => 'quiz_attempt'); + } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['quizid'] = array('db' => 'quiz', 'restore' => 'quiz'); + + return $othermapped; + } } diff --git a/mod/quiz/classes/event/course_module_viewed.php b/mod/quiz/classes/event/course_module_viewed.php index f1977873fa6..dbdf0fc8621 100644 --- a/mod/quiz/classes/event/course_module_viewed.php +++ b/mod/quiz/classes/event/course_module_viewed.php @@ -46,4 +46,8 @@ class course_module_viewed extends \core\event\course_module_viewed { $this->data['edulevel'] = self::LEVEL_PARTICIPATING; $this->data['objecttable'] = 'quiz'; } + + public static function get_objectid_mapping() { + return array('db' => 'quiz', 'restore' => 'quiz'); + } } diff --git a/mod/quiz/classes/event/edit_page_viewed.php b/mod/quiz/classes/event/edit_page_viewed.php index 7f1473aa3c9..80247260376 100644 --- a/mod/quiz/classes/event/edit_page_viewed.php +++ b/mod/quiz/classes/event/edit_page_viewed.php @@ -101,4 +101,11 @@ class edit_page_viewed extends \core\event\base { throw new \coding_exception('The \'quizid\' value must be set in other.'); } } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['quizid'] = array('db' => 'quiz', 'restore' => 'quiz'); + + return $othermapped; + } } diff --git a/mod/quiz/classes/event/group_override_created.php b/mod/quiz/classes/event/group_override_created.php index 0f5025ce72d..2d21b8dd132 100644 --- a/mod/quiz/classes/event/group_override_created.php +++ b/mod/quiz/classes/event/group_override_created.php @@ -97,4 +97,16 @@ class group_override_created extends \core\event\base { throw new \coding_exception('The \'groupid\' value must be set in other.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'quiz_overrides', 'restore' => 'quiz_override'); + } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['quizid'] = array('db' => 'quiz', 'restore' => 'quiz'); + $othermapped['groupid'] = array('db' => 'groups', 'restore' => 'group'); + + return $othermapped; + } } diff --git a/mod/quiz/classes/event/group_override_deleted.php b/mod/quiz/classes/event/group_override_deleted.php index 7814b79bd56..9fe90c15b5d 100644 --- a/mod/quiz/classes/event/group_override_deleted.php +++ b/mod/quiz/classes/event/group_override_deleted.php @@ -106,4 +106,16 @@ class group_override_deleted extends \core\event\base { throw new \coding_exception('The \'groupid\' value must be set in other.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'quiz_overrides', 'restore' => 'quiz_override'); + } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['quizid'] = array('db' => 'quiz', 'restore' => 'quiz'); + $othermapped['groupid'] = array('db' => 'groups', 'restore' => 'group'); + + return $othermapped; + } } diff --git a/mod/quiz/classes/event/group_override_updated.php b/mod/quiz/classes/event/group_override_updated.php index 711147e5893..5476b019e61 100644 --- a/mod/quiz/classes/event/group_override_updated.php +++ b/mod/quiz/classes/event/group_override_updated.php @@ -106,4 +106,16 @@ class group_override_updated extends \core\event\base { throw new \coding_exception('The \'groupid\' value must be set in other.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'quiz_overrides', 'restore' => 'quiz_override'); + } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['quizid'] = array('db' => 'quiz', 'restore' => 'quiz'); + $othermapped['groupid'] = array('db' => 'groups', 'restore' => 'group'); + + return $othermapped; + } } diff --git a/mod/quiz/classes/event/question_manually_graded.php b/mod/quiz/classes/event/question_manually_graded.php index 70d7bb915d1..a77912ee3ed 100644 --- a/mod/quiz/classes/event/question_manually_graded.php +++ b/mod/quiz/classes/event/question_manually_graded.php @@ -111,6 +111,17 @@ class question_manually_graded extends \core\event\base { if (!isset($this->other['slot'])) { throw new \coding_exception('The \'slot\' value must be set in other.'); } + } + public static function get_objectid_mapping() { + return array('db' => 'question', 'restore' => 'question'); + } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['quizid'] = array('db' => 'quiz', 'restore' => 'quiz'); + $othermapped['attemptid'] = array('db' => 'quiz_attempts', 'restore' => 'quiz_attempt'); + + return $othermapped; } } diff --git a/mod/quiz/classes/event/report_viewed.php b/mod/quiz/classes/event/report_viewed.php index 12e5d519131..de23f9df4a3 100644 --- a/mod/quiz/classes/event/report_viewed.php +++ b/mod/quiz/classes/event/report_viewed.php @@ -109,4 +109,11 @@ class report_viewed extends \core\event\base { throw new \coding_exception('The \'reportname\' value must be set in other.'); } } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['quizid'] = array('db' => 'quiz', 'restore' => 'quiz'); + + return $othermapped; + } } diff --git a/mod/quiz/classes/event/user_override_created.php b/mod/quiz/classes/event/user_override_created.php index c1f5a663101..e8cbfd0411b 100644 --- a/mod/quiz/classes/event/user_override_created.php +++ b/mod/quiz/classes/event/user_override_created.php @@ -95,4 +95,15 @@ class user_override_created extends \core\event\base { throw new \coding_exception('The \'quizid\' value must be set in other.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'quiz_overrides', 'restore' => 'quiz_override'); + } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['quizid'] = array('db' => 'quiz', 'restore' => 'quiz'); + + return $othermapped; + } } diff --git a/mod/quiz/classes/event/user_override_deleted.php b/mod/quiz/classes/event/user_override_deleted.php index 59b1ac52233..f851189292f 100644 --- a/mod/quiz/classes/event/user_override_deleted.php +++ b/mod/quiz/classes/event/user_override_deleted.php @@ -105,4 +105,15 @@ class user_override_deleted extends \core\event\base { throw new \coding_exception('The \'quizid\' value must be set in other.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'quiz_overrides', 'restore' => 'quiz_override'); + } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['quizid'] = array('db' => 'quiz', 'restore' => 'quiz'); + + return $othermapped; + } } diff --git a/mod/quiz/classes/event/user_override_updated.php b/mod/quiz/classes/event/user_override_updated.php index 8f3cfc83d3d..2b902a28949 100644 --- a/mod/quiz/classes/event/user_override_updated.php +++ b/mod/quiz/classes/event/user_override_updated.php @@ -106,4 +106,15 @@ class user_override_updated extends \core\event\base { throw new \coding_exception('The \'quizid\' value must be set in other.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'quiz_overrides', 'restore' => 'quiz_override'); + } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['quizid'] = array('db' => 'quiz', 'restore' => 'quiz'); + + return $othermapped; + } } diff --git a/mod/resource/classes/event/course_module_viewed.php b/mod/resource/classes/event/course_module_viewed.php index 880a0ae5b30..8d4b43df285 100644 --- a/mod/resource/classes/event/course_module_viewed.php +++ b/mod/resource/classes/event/course_module_viewed.php @@ -46,4 +46,8 @@ class course_module_viewed extends \core\event\course_module_viewed { $this->data['crud'] = 'r'; $this->data['edulevel'] = self::LEVEL_PARTICIPATING; } + + public static function get_objectid_mapping() { + return array('db' => 'resource', 'restore' => 'resource'); + } } diff --git a/mod/scorm/classes/event/attempt_deleted.php b/mod/scorm/classes/event/attempt_deleted.php index 3e465639c3c..ddd22fff69f 100644 --- a/mod/scorm/classes/event/attempt_deleted.php +++ b/mod/scorm/classes/event/attempt_deleted.php @@ -100,4 +100,9 @@ class attempt_deleted extends \core\event\base { throw new \coding_exception('The \'attemptid\' must be set in other.'); } } + + public static function get_other_mapping() { + // Can't map the 'attemptid' value. + return false; + } } diff --git a/mod/scorm/classes/event/course_module_viewed.php b/mod/scorm/classes/event/course_module_viewed.php index e598045b489..a81e411a571 100644 --- a/mod/scorm/classes/event/course_module_viewed.php +++ b/mod/scorm/classes/event/course_module_viewed.php @@ -53,5 +53,9 @@ class course_module_viewed extends \core\event\course_module_viewed { return array($this->courseid, 'scorm', 'pre-view', 'view.php?id=' . $this->contextinstanceid, $this->objectid, $this->contextinstanceid); } + + public static function get_objectid_mapping() { + return array('db' => 'scorm', 'restore' => 'scorm'); + } } diff --git a/mod/scorm/classes/event/interactions_viewed.php b/mod/scorm/classes/event/interactions_viewed.php index 91dcc8e1419..ad3f41be844 100644 --- a/mod/scorm/classes/event/interactions_viewed.php +++ b/mod/scorm/classes/event/interactions_viewed.php @@ -115,4 +115,11 @@ class interactions_viewed extends \core\event\base { throw new \coding_exception('The \'instanceid\' must be set in other.'); } } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['instanceid'] = array('db' => 'scorm', 'restore' => 'scorm'); + + return $othermapped; + } } diff --git a/mod/scorm/classes/event/report_viewed.php b/mod/scorm/classes/event/report_viewed.php index edd61f3f3d5..e86e9466050 100644 --- a/mod/scorm/classes/event/report_viewed.php +++ b/mod/scorm/classes/event/report_viewed.php @@ -105,4 +105,11 @@ class report_viewed extends \core\event\base { throw new \coding_exception('The \'mode\' value must be set in other.'); } } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['scormid'] = array('db' => 'scorm', 'restore' => 'scorm'); + + return $othermapped; + } } diff --git a/mod/scorm/classes/event/sco_launched.php b/mod/scorm/classes/event/sco_launched.php index 62c0de877e7..06b66d2bb67 100644 --- a/mod/scorm/classes/event/sco_launched.php +++ b/mod/scorm/classes/event/sco_launched.php @@ -102,4 +102,15 @@ class sco_launched extends \core\event\base { throw new \coding_exception('The \'loadedcontent\' value must be set in other.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'scorm_scoes', 'restore' => 'scorm_sco'); + } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['instanceid'] = array('db' => 'scorm', 'restore' => 'scorm'); + + return $othermapped; + } } diff --git a/mod/scorm/classes/event/tracks_viewed.php b/mod/scorm/classes/event/tracks_viewed.php index d76812ddb50..25364c3f741 100644 --- a/mod/scorm/classes/event/tracks_viewed.php +++ b/mod/scorm/classes/event/tracks_viewed.php @@ -118,4 +118,12 @@ class tracks_viewed extends \core\event\base { throw new \coding_exception('The \'scoid\' value must be set in other.'); } } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['instanceid'] = array('db' => 'scorm', 'restore' => 'scorm'); + $othermapped['scoid'] = array('db' => 'scorm_scoes', 'restore' => 'scorm_scoe'); + + return $othermapped; + } } diff --git a/mod/scorm/classes/event/user_report_viewed.php b/mod/scorm/classes/event/user_report_viewed.php index b91ad5582b1..6cec96852fb 100644 --- a/mod/scorm/classes/event/user_report_viewed.php +++ b/mod/scorm/classes/event/user_report_viewed.php @@ -112,4 +112,11 @@ class user_report_viewed extends \core\event\base { throw new \coding_exception('The \'instanceid\' value must be set in other.'); } } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['instanceid'] = array('db' => 'scorm', 'restore' => 'scorm'); + + return $othermapped; + } } diff --git a/mod/survey/classes/event/course_module_viewed.php b/mod/survey/classes/event/course_module_viewed.php index c8cf62a4ce1..5f27140e90c 100644 --- a/mod/survey/classes/event/course_module_viewed.php +++ b/mod/survey/classes/event/course_module_viewed.php @@ -67,4 +67,8 @@ class course_module_viewed extends \core\event\course_module_viewed { throw new \coding_exception('Other must contain the key viewed.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'survey', 'restore' => 'survey'); + } } diff --git a/mod/survey/classes/event/report_downloaded.php b/mod/survey/classes/event/report_downloaded.php index 9ca6f11d63a..62f9f92e3b2 100644 --- a/mod/survey/classes/event/report_downloaded.php +++ b/mod/survey/classes/event/report_downloaded.php @@ -104,4 +104,15 @@ class report_downloaded extends \core\event\base { throw new \coding_exception('The \'type\' value must be set in other.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'survey', 'restore' => 'survey'); + } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['groupid'] = array('db' => 'groups', 'restore' => 'group'); + + return $othermapped; + } } diff --git a/mod/survey/classes/event/report_viewed.php b/mod/survey/classes/event/report_viewed.php index 1055c0896d4..a9a44b4b036 100644 --- a/mod/survey/classes/event/report_viewed.php +++ b/mod/survey/classes/event/report_viewed.php @@ -93,4 +93,15 @@ class report_viewed extends \core\event\base { return array($this->courseid, "survey", "view report", "report.php?id=" . $this->contextinstanceid, $this->objectid, $this->contextinstanceid); } + + public static function get_objectid_mapping() { + return array('db' => 'survey', 'restore' => 'survey'); + } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['groupid'] = array('db' => 'groups', 'restore' => 'group'); + + return $othermapped; + } } diff --git a/mod/survey/classes/event/response_submitted.php b/mod/survey/classes/event/response_submitted.php index ab4234e3326..9d748f422dc 100644 --- a/mod/survey/classes/event/response_submitted.php +++ b/mod/survey/classes/event/response_submitted.php @@ -99,4 +99,11 @@ class response_submitted extends \core\event\base { throw new \coding_exception('The \'surveyid\' value must be set in other.'); } } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['surveyid'] = array('db' => 'survey', 'restore' => 'survey'); + + return $othermapped; + } } diff --git a/mod/url/classes/event/course_module_viewed.php b/mod/url/classes/event/course_module_viewed.php index 2f86aa46622..e0342b1bfa8 100644 --- a/mod/url/classes/event/course_module_viewed.php +++ b/mod/url/classes/event/course_module_viewed.php @@ -46,4 +46,8 @@ class course_module_viewed extends \core\event\course_module_viewed { $this->data['crud'] = 'r'; $this->data['edulevel'] = self::LEVEL_PARTICIPATING; } + + public static function get_objectid_mapping() { + return array('db' => 'url', 'restore' => 'url'); + } } diff --git a/mod/wiki/classes/event/comments_viewed.php b/mod/wiki/classes/event/comments_viewed.php index 952637944d8..9d18302bd3c 100644 --- a/mod/wiki/classes/event/comments_viewed.php +++ b/mod/wiki/classes/event/comments_viewed.php @@ -73,4 +73,8 @@ class comments_viewed extends \core\event\comments_viewed { public function get_url() { return new \moodle_url('/mod/wiki/comments.php', array('pageid' => $this->objectid)); } + + public static function get_objectid_mapping() { + return array('db' => 'wiki_pages', 'restore' => 'wiki_page'); + } } diff --git a/mod/wiki/classes/event/course_module_viewed.php b/mod/wiki/classes/event/course_module_viewed.php index 52a86603433..9e16d637230 100644 --- a/mod/wiki/classes/event/course_module_viewed.php +++ b/mod/wiki/classes/event/course_module_viewed.php @@ -45,4 +45,8 @@ class course_module_viewed extends \core\event\course_module_viewed { $this->data['edulevel'] = self::LEVEL_PARTICIPATING; $this->data['objecttable'] = 'wiki'; } + + public static function get_objectid_mapping() { + return array('db' => 'wiki', 'restore' => 'wiki'); + } } diff --git a/mod/wiki/classes/event/page_created.php b/mod/wiki/classes/event/page_created.php index 734b07808d5..9b97a94e750 100644 --- a/mod/wiki/classes/event/page_created.php +++ b/mod/wiki/classes/event/page_created.php @@ -82,4 +82,8 @@ class page_created extends \core\event\base { public function get_url() { return new \moodle_url('/mod/wiki/view.php', array('pageid' => $this->objectid)); } + + public static function get_objectid_mapping() { + return array('db' => 'wiki_pages', 'restore' => 'wiki_page'); + } } diff --git a/mod/wiki/classes/event/page_deleted.php b/mod/wiki/classes/event/page_deleted.php index de69394208e..52eed433370 100644 --- a/mod/wiki/classes/event/page_deleted.php +++ b/mod/wiki/classes/event/page_deleted.php @@ -88,4 +88,15 @@ class page_deleted extends \core\event\base { public function get_url() { return new \moodle_url('/mod/wiki/admin.php', array('pageid' => $this->objectid)); } + + public static function get_objectid_mapping() { + return array('db' => 'wiki_pages', 'restore' => 'wiki_page'); + } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['subwikiid'] = array('db' => 'wiki_subwikis', 'restore' => 'wiki_subwiki'); + + return $othermapped; + } } diff --git a/mod/wiki/classes/event/page_diff_viewed.php b/mod/wiki/classes/event/page_diff_viewed.php index 4c0007c0faf..8d43c1352b0 100644 --- a/mod/wiki/classes/event/page_diff_viewed.php +++ b/mod/wiki/classes/event/page_diff_viewed.php @@ -110,4 +110,13 @@ class page_diff_viewed extends \core\event\base { throw new \coding_exception('The \'compare\' value must be set in other.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'wiki_pages', 'restore' => 'wiki_page'); + } + + public static function get_other_mapping() { + // Nothing to map. + return false; + } } diff --git a/mod/wiki/classes/event/page_history_viewed.php b/mod/wiki/classes/event/page_history_viewed.php index 8ace0becd5e..52af74d77e5 100644 --- a/mod/wiki/classes/event/page_history_viewed.php +++ b/mod/wiki/classes/event/page_history_viewed.php @@ -82,4 +82,8 @@ class page_history_viewed extends \core\event\base { public function get_url() { return new \moodle_url('/mod/wiki/history.php', array('pageid' => $this->objectid)); } + + public static function get_objectid_mapping() { + return array('db' => 'wiki_pages', 'restore' => 'wiki_page'); + } } diff --git a/mod/wiki/classes/event/page_locks_deleted.php b/mod/wiki/classes/event/page_locks_deleted.php index 991c8e42464..cf81976b27d 100644 --- a/mod/wiki/classes/event/page_locks_deleted.php +++ b/mod/wiki/classes/event/page_locks_deleted.php @@ -31,7 +31,7 @@ defined('MOODLE_INTERNAL') || die(); * @property-read array $other { * Extra information about event. * - * - int section: (optional) section id. + * - string section: (optional) section name. * } * * @package mod_wiki @@ -88,4 +88,13 @@ class page_locks_deleted extends \core\event\base { public function get_url() { return new \moodle_url('/mod/wiki/view.php', array('pageid' => $this->objectid)); } + + public static function get_objectid_mapping() { + return array('db' => 'wiki_pages', 'restore' => 'wiki_page'); + } + + public static function get_other_mapping() { + // Nothing to map. + return false; + } } diff --git a/mod/wiki/classes/event/page_map_viewed.php b/mod/wiki/classes/event/page_map_viewed.php index f10f7e4b93a..a668badefb9 100644 --- a/mod/wiki/classes/event/page_map_viewed.php +++ b/mod/wiki/classes/event/page_map_viewed.php @@ -101,4 +101,13 @@ class page_map_viewed extends \core\event\base { throw new \coding_exception('The \'option\' value must be set in other, even if 0.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'wiki_pages', 'restore' => 'wiki_page'); + } + + public static function get_other_mapping() { + // Nothing to map. + return false; + } } diff --git a/mod/wiki/classes/event/page_updated.php b/mod/wiki/classes/event/page_updated.php index ab792b4ad93..7075535c21f 100644 --- a/mod/wiki/classes/event/page_updated.php +++ b/mod/wiki/classes/event/page_updated.php @@ -88,4 +88,13 @@ class page_updated extends \core\event\base { public function get_url() { return new \moodle_url('/mod/wiki/view.php', array('pageid' => $this->objectid)); } + + public static function get_objectid_mapping() { + return array('db' => 'wiki_pages', 'restore' => 'wiki_page'); + } + + public static function get_other_mapping() { + // Nothing to map. + return false; + } } diff --git a/mod/wiki/classes/event/page_version_deleted.php b/mod/wiki/classes/event/page_version_deleted.php index 2fcf2dfd942..ef0f7bfbd6f 100644 --- a/mod/wiki/classes/event/page_version_deleted.php +++ b/mod/wiki/classes/event/page_version_deleted.php @@ -101,4 +101,15 @@ class page_version_deleted extends \core\event\base { throw new \coding_exception('The \'pageid\' value must be set in other.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'wiki_versions', 'restore' => 'wiki_version'); + } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['pageid'] = array('db' => 'wiki_pages', 'restore' => 'wiki_page'); + + return $othermapped; + } } diff --git a/mod/wiki/classes/event/page_version_restored.php b/mod/wiki/classes/event/page_version_restored.php index ddef9726aa3..3a10c0f8978 100644 --- a/mod/wiki/classes/event/page_version_restored.php +++ b/mod/wiki/classes/event/page_version_restored.php @@ -102,4 +102,15 @@ class page_version_restored extends \core\event\base { throw new \coding_exception('The pageid needs to be set in $other'); } } + + public static function get_objectid_mapping() { + return array('db' => 'wiki_versions', 'restore' => 'wiki_version'); + } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['pageid'] = array('db' => 'wiki_pages', 'restore' => 'wiki_page'); + + return $othermapped; + } } diff --git a/mod/wiki/classes/event/page_version_viewed.php b/mod/wiki/classes/event/page_version_viewed.php index 6a4e49d8b59..aed8a7c84f7 100644 --- a/mod/wiki/classes/event/page_version_viewed.php +++ b/mod/wiki/classes/event/page_version_viewed.php @@ -103,4 +103,15 @@ class page_version_viewed extends \core\event\base { throw new \coding_exception('The versionid need to be set in $other'); } } + + public static function get_objectid_mapping() { + return array('db' => 'wiki_pages', 'restore' => 'wiki_page'); + } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['versionid'] = array('db' => 'wiki_versions', 'restore' => 'wiki_version'); + + return $othermapped; + } } diff --git a/mod/wiki/classes/event/page_viewed.php b/mod/wiki/classes/event/page_viewed.php index 8d10d2dc132..af3b46e31d7 100644 --- a/mod/wiki/classes/event/page_viewed.php +++ b/mod/wiki/classes/event/page_viewed.php @@ -102,4 +102,8 @@ class page_viewed extends \core\event\base { return new \moodle_url('/mod/wiki/view.php', array('pageid' => $this->objectid)); } } + + public static function get_objectid_mapping() { + return array('db' => 'wiki_pages', 'restore' => 'wiki_page'); + } } diff --git a/mod/workshop/classes/event/assessable_uploaded.php b/mod/workshop/classes/event/assessable_uploaded.php index 861f92de9ed..34e1a1a0f6e 100644 --- a/mod/workshop/classes/event/assessable_uploaded.php +++ b/mod/workshop/classes/event/assessable_uploaded.php @@ -128,4 +128,8 @@ class assessable_uploaded extends \core\event\assessable_uploaded { public function set_legacy_logdata($legacylogdata) { $this->legacylogdata = $legacylogdata; } + + public static function get_objectid_mapping() { + return array('db' => 'workshop_submissions', 'restore' => 'workshop_submission'); + } } diff --git a/mod/workshop/classes/event/assessment_evaluated.php b/mod/workshop/classes/event/assessment_evaluated.php index a865b738239..2392a6822c1 100644 --- a/mod/workshop/classes/event/assessment_evaluated.php +++ b/mod/workshop/classes/event/assessment_evaluated.php @@ -80,4 +80,13 @@ class assessment_evaluated extends \core\event\base { public function get_url() { return new \moodle_url('/mod/workshop/view.php', array('id' => $this->contextinstanceid)); } + + public static function get_objectid_mapping() { + return array('db' => 'workshop_aggregations', 'restore' => 'workshop_aggregation'); + } + + public static function get_other_mapping() { + // Nothing to map. + return false; + } } diff --git a/mod/workshop/classes/event/assessment_evaluations_reset.php b/mod/workshop/classes/event/assessment_evaluations_reset.php index 68145df942d..e9ea908f36a 100644 --- a/mod/workshop/classes/event/assessment_evaluations_reset.php +++ b/mod/workshop/classes/event/assessment_evaluations_reset.php @@ -103,4 +103,11 @@ class assessment_evaluations_reset extends \core\event\base { throw new \coding_exception('The \'workshopid\' value must be set in other.'); } } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['workshopid'] = array('db' => 'workshop', 'restore' => 'workshop'); + + return $othermapped; + } } diff --git a/mod/workshop/classes/event/assessment_reevaluated.php b/mod/workshop/classes/event/assessment_reevaluated.php index 1e401c473f2..8e4f8a39746 100644 --- a/mod/workshop/classes/event/assessment_reevaluated.php +++ b/mod/workshop/classes/event/assessment_reevaluated.php @@ -90,4 +90,13 @@ class assessment_reevaluated extends \core\event\base { public function get_url() { return new \moodle_url('/mod/workshop/view.php', array('id' => $this->contextinstanceid)); } + + public static function get_objectid_mapping() { + return array('db' => 'workshop_aggregations', 'restore' => 'workshop_aggregation'); + } + + public static function get_other_mapping() { + // Nothing to map. + return false; + } } diff --git a/mod/workshop/classes/event/assessments_reset.php b/mod/workshop/classes/event/assessments_reset.php index 2e1a32b6c4c..8d7d2a083d9 100644 --- a/mod/workshop/classes/event/assessments_reset.php +++ b/mod/workshop/classes/event/assessments_reset.php @@ -102,4 +102,11 @@ class assessments_reset extends \core\event\base { throw new \coding_exception('The \'workshopid\' value must be set in other.'); } } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['workshopid'] = array('db' => 'workshop', 'restore' => 'workshop'); + + return $othermapped; + } } diff --git a/mod/workshop/classes/event/course_module_viewed.php b/mod/workshop/classes/event/course_module_viewed.php index 00e184bfb1d..794384c4150 100644 --- a/mod/workshop/classes/event/course_module_viewed.php +++ b/mod/workshop/classes/event/course_module_viewed.php @@ -71,4 +71,8 @@ class course_module_viewed extends \core\event\course_module_viewed { $workshop = new \workshop($workshop, $cm, $course); return (object)array('workshop' => $workshop, 'user' => $USER); } + + public static function get_objectid_mapping() { + return array('db' => 'workshop', 'restore' => 'workshop'); + } } diff --git a/mod/workshop/classes/event/phase_switched.php b/mod/workshop/classes/event/phase_switched.php index faefe75e920..16281932354 100644 --- a/mod/workshop/classes/event/phase_switched.php +++ b/mod/workshop/classes/event/phase_switched.php @@ -103,4 +103,13 @@ class phase_switched extends \core\event\base { throw new \coding_exception('The \'workshopphase\' value must be set in other.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'workshop', 'restore' => 'workshop'); + } + + public static function get_other_mapping() { + // Nothing to map. + return false; + } } diff --git a/mod/workshop/classes/event/submission_assessed.php b/mod/workshop/classes/event/submission_assessed.php index 94dda7002a4..e2c9e3943d2 100644 --- a/mod/workshop/classes/event/submission_assessed.php +++ b/mod/workshop/classes/event/submission_assessed.php @@ -108,4 +108,16 @@ class submission_assessed extends \core\event\base { throw new \coding_exception('The \'submissionid\' value must be set in other.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'workshop_assessments', 'restore' => 'workshop_assessment'); + } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['submissionid'] = array('db' => 'workshop_submissions', 'restore' => 'workshop_submission'); + $othermapped['workshopid'] = array('db' => 'workshop', 'restore' => 'workshop'); + + return $othermapped; + } } diff --git a/mod/workshop/classes/event/submission_created.php b/mod/workshop/classes/event/submission_created.php index 928eb566631..3503f5265b9 100644 --- a/mod/workshop/classes/event/submission_created.php +++ b/mod/workshop/classes/event/submission_created.php @@ -88,4 +88,13 @@ class submission_created extends \core\event\base { 'submission.php?cmid=' . $this->contextinstanceid . '&id=' . $this->objectid, $this->objectid, $this->contextinstanceid); } + + public static function get_objectid_mapping() { + return array('db' => 'workshop_submissions', 'restore' => 'workshop_submission'); + } + + public static function get_other_mapping() { + // Nothing to map. + return false; + } } diff --git a/mod/workshop/classes/event/submission_reassessed.php b/mod/workshop/classes/event/submission_reassessed.php index 30b5967b10f..1c55c9678a6 100644 --- a/mod/workshop/classes/event/submission_reassessed.php +++ b/mod/workshop/classes/event/submission_reassessed.php @@ -109,4 +109,16 @@ class submission_reassessed extends \core\event\base { throw new \coding_exception('The \'submissionid\' value must be set in other.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'workshop_assessments', 'restore' => 'workshop_assessment'); + } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['submissionid'] = array('db' => 'workshop_submissions', 'restore' => 'workshop_submission'); + $othermapped['workshopid'] = array('db' => 'workshop', 'restore' => 'workshop'); + + return $othermapped; + } } diff --git a/mod/workshop/classes/event/submission_updated.php b/mod/workshop/classes/event/submission_updated.php index cb727fb4e21..b23ee777b0a 100644 --- a/mod/workshop/classes/event/submission_updated.php +++ b/mod/workshop/classes/event/submission_updated.php @@ -88,4 +88,13 @@ class submission_updated extends \core\event\base { 'submission.php?cmid=' . $this->contextinstanceid . '&id=' . $this->objectid, $this->objectid, $this->contextinstanceid); } + + public static function get_objectid_mapping() { + return array('db' => 'workshop_submissions', 'restore' => 'workshop_submission'); + } + + public static function get_other_mapping() { + // Nothing to map. + return false; + } } diff --git a/mod/workshop/classes/event/submission_viewed.php b/mod/workshop/classes/event/submission_viewed.php index eac6caee2f1..c6ae693a5c1 100644 --- a/mod/workshop/classes/event/submission_viewed.php +++ b/mod/workshop/classes/event/submission_viewed.php @@ -102,4 +102,15 @@ class submission_viewed extends \core\event\base { throw new \coding_exception('The \'relateduserid\' must be set.'); } } + + public static function get_objectid_mapping() { + return array('db' => 'workshop_submissions', 'restore' => 'workshop_submission'); + } + + public static function get_other_mapping() { + $othermapped = array(); + $othermapped['workshopid'] = array('db' => 'workshop', 'restore' => 'workshop'); + + return $othermapped; + } }