diff --git a/lib/classes/event/assessable_submitted.php b/lib/classes/event/assessable_submitted.php index 8f49ae19b23..66dc0b93e26 100644 --- a/lib/classes/event/assessable_submitted.php +++ b/lib/classes/event/assessable_submitted.php @@ -59,7 +59,7 @@ abstract class assessable_submitted extends \core\event\base { * @return void */ protected function validate_data() { - if (!$this->context->contextlevel === CONTEXT_MODULE) { + if (!$this->contextlevel === CONTEXT_MODULE) { throw new \coding_exception('Content level must be CONTEXT_MODULE.'); } } diff --git a/lib/classes/event/assessable_uploaded.php b/lib/classes/event/assessable_uploaded.php index efdc7ec65a4..83a3361487f 100644 --- a/lib/classes/event/assessable_uploaded.php +++ b/lib/classes/event/assessable_uploaded.php @@ -66,7 +66,7 @@ abstract class assessable_uploaded extends \core\event\base { * @return void */ protected function validate_data() { - if (!$this->context->contextlevel === CONTEXT_MODULE) { + if (!$this->contextlevel === CONTEXT_MODULE) { throw new \coding_exception('Content level must be CONTEXT_MODULE.'); } else if (!isset($this->other['pathnamehashes']) || !is_array($this->other['pathnamehashes'])) { throw new \coding_exception('pathnamehashes must be set in $other and must be an array.'); diff --git a/lib/classes/event/base.php b/lib/classes/event/base.php index d1cbe32c9a1..38a999e53ea 100644 --- a/lib/classes/event/base.php +++ b/lib/classes/event/base.php @@ -355,7 +355,7 @@ abstract class base implements \IteratorAggregate { if (isset($this->context)) { return $this->context; } - $this->context = \context::instance_by_id($this->data['contextid'], false); + $this->context = \context::instance_by_id($this->data['contextid'], IGNORE_MISSING); return $this->context; } diff --git a/lib/classes/event/blog_association_created.php b/lib/classes/event/blog_association_created.php index f09d4d7b07d..0fa689beeaf 100644 --- a/lib/classes/event/blog_association_created.php +++ b/lib/classes/event/blog_association_created.php @@ -69,8 +69,8 @@ class blog_association_created extends \core\event\base { * @return string */ public function get_description() { - return "Blog association added between entry id $this->other['blogid'] and $this->other['associatetype'] with id - $this->other['associateid']"; + return "Blog association added between entry id {$this->other['blogid']} and {$this->other['associatetype']} with id + {$this->other['associateid']}"; } /** diff --git a/lib/classes/event/comment_created.php b/lib/classes/event/comment_created.php index 09935b8b22f..420c4b8e4f7 100644 --- a/lib/classes/event/comment_created.php +++ b/lib/classes/event/comment_created.php @@ -79,7 +79,12 @@ abstract class comment_created extends \core\event\base { * @return \moodle_url */ public function get_url() { - return $this->context->get_url(); + $context = $this->get_context(); + if ($context) { + return $context->get_url(); + } else { + return null; + } } /** diff --git a/lib/classes/event/comment_deleted.php b/lib/classes/event/comment_deleted.php index 2c20348caf0..57084fbab1a 100644 --- a/lib/classes/event/comment_deleted.php +++ b/lib/classes/event/comment_deleted.php @@ -79,7 +79,12 @@ abstract class comment_deleted extends \core\event\base { * @return \moodle_url */ public function get_url() { - return $this->context->get_url(); + $context = $this->get_context(); + if ($context) { + return $context->get_url(); + } else { + return null; + } } /** diff --git a/lib/classes/event/comments_viewed.php b/lib/classes/event/comments_viewed.php index a048d01dbfd..fbea09d486d 100644 --- a/lib/classes/event/comments_viewed.php +++ b/lib/classes/event/comments_viewed.php @@ -72,6 +72,11 @@ abstract class comments_viewed extends \core\event\base { * @return \moodle_url */ public function get_url() { - return $this->context->get_url(); + $context = $this->get_context(); + if ($context) { + return $context->get_url(); + } else { + return null; + } } } diff --git a/lib/classes/event/course_module_instance_list_viewed.php b/lib/classes/event/course_module_instance_list_viewed.php index cf94035cf06..f83b5d73545 100644 --- a/lib/classes/event/course_module_instance_list_viewed.php +++ b/lib/classes/event/course_module_instance_list_viewed.php @@ -105,7 +105,7 @@ abstract class course_module_instance_list_viewed extends base{ * @return void */ protected function validate_data() { - if ($this->context->contextlevel !== CONTEXT_COURSE) { + if ($this->contextlevel !== CONTEXT_COURSE) { throw new \coding_exception('The context must be a course level context.'); } } diff --git a/lib/classes/event/course_module_viewed.php b/lib/classes/event/course_module_viewed.php index 43e1504dfe5..b455b345bbc 100644 --- a/lib/classes/event/course_module_viewed.php +++ b/lib/classes/event/course_module_viewed.php @@ -72,7 +72,7 @@ abstract class course_module_viewed extends base { * @return \moodle_url */ public function get_url() { - return new \moodle_url("/mod/$this->objecttable/view.php", array('id' => $this->context->instanceid)); + return new \moodle_url("/mod/$this->objecttable/view.php", array('id' => $this->contextinstanceid)); } /** @@ -81,8 +81,8 @@ abstract class course_module_viewed extends base { * @return array|null */ protected function get_legacy_logdata() { - return array($this->courseid, $this->objecttable, 'view', 'view.php?id=' . $this->context->instanceid, $this->objectid, - $this->context->instanceid); + return array($this->courseid, $this->objecttable, 'view', 'view.php?id=' . $this->contextinstanceid, $this->objectid, + $this->contextinstanceid); } /** diff --git a/mod/assign/classes/event/all_submissions_downloaded.php b/mod/assign/classes/event/all_submissions_downloaded.php index b33f6899ee7..6ceb783a93d 100644 --- a/mod/assign/classes/event/all_submissions_downloaded.php +++ b/mod/assign/classes/event/all_submissions_downloaded.php @@ -75,7 +75,7 @@ class all_submissions_downloaded extends \core\event\base { * @return \moodle_url */ public function get_url() { - return new \moodle_url('/mod/assign/view.php', array('id' => $this->context->instanceid)); + return new \moodle_url('/mod/assign/view.php', array('id' => $this->contextinstanceid)); } /** diff --git a/mod/assign/classes/event/assessable_submitted.php b/mod/assign/classes/event/assessable_submitted.php index 5e7d6e8ded1..2f519f0f510 100644 --- a/mod/assign/classes/event/assessable_submitted.php +++ b/mod/assign/classes/event/assessable_submitted.php @@ -65,7 +65,7 @@ class assessable_submitted extends \core\event\assessable_submitted { protected function get_legacy_eventdata() { $eventdata = new \stdClass(); $eventdata->modulename = 'assign'; - $eventdata->cmid = $this->context->instanceid; + $eventdata->cmid = $this->contextinstanceid; $eventdata->itemid = $this->objectid; $eventdata->courseid = $this->courseid; $eventdata->userid = $this->userid; @@ -106,7 +106,7 @@ class assessable_submitted extends \core\event\assessable_submitted { * @return \moodle_url */ public function get_url() { - return new \moodle_url('/mod/assign/view.php', array('id' => $this->context->instanceid)); + return new \moodle_url('/mod/assign/view.php', array('id' => $this->contextinstanceid)); } /** diff --git a/mod/assign/classes/event/extension_granted.php b/mod/assign/classes/event/extension_granted.php index 287f847af03..07eae945e3b 100644 --- a/mod/assign/classes/event/extension_granted.php +++ b/mod/assign/classes/event/extension_granted.php @@ -75,7 +75,7 @@ class extension_granted extends \core\event\base { * @return \moodle_url */ public function get_url() { - return new \moodle_url('/mod/assign/view.php', array('id' => $this->context->instanceid)); + return new \moodle_url('/mod/assign/view.php', array('id' => $this->contextinstanceid)); } /** diff --git a/mod/assign/classes/event/identities_revealed.php b/mod/assign/classes/event/identities_revealed.php index 3dc67b1aebd..f6b726c1fb2 100644 --- a/mod/assign/classes/event/identities_revealed.php +++ b/mod/assign/classes/event/identities_revealed.php @@ -75,7 +75,7 @@ class identities_revealed extends \core\event\base { * @return \moodle_url */ public function get_url() { - return new \moodle_url('/mod/assign/view.php', array('id' => $this->context->instanceid)); + return new \moodle_url('/mod/assign/view.php', array('id' => $this->contextinstanceid)); } /** diff --git a/mod/assign/classes/event/marker_updated.php b/mod/assign/classes/event/marker_updated.php index b59ecd1eff8..20b20f29056 100644 --- a/mod/assign/classes/event/marker_updated.php +++ b/mod/assign/classes/event/marker_updated.php @@ -81,7 +81,7 @@ class marker_updated extends \core\event\base { * @return \moodle_url */ public function get_url() { - return new \moodle_url('/mod/assign/view.php', array('id' => $this->context->instanceid)); + return new \moodle_url('/mod/assign/view.php', array('id' => $this->contextinstanceid)); } /** diff --git a/mod/assign/classes/event/statement_accepted.php b/mod/assign/classes/event/statement_accepted.php index 63816820296..4169ea6dc24 100644 --- a/mod/assign/classes/event/statement_accepted.php +++ b/mod/assign/classes/event/statement_accepted.php @@ -75,7 +75,7 @@ class statement_accepted extends \core\event\base { * @return \moodle_url */ public function get_url() { - return new \moodle_url('/mod/assign/view.php', array('id' => $this->context->instanceid)); + return new \moodle_url('/mod/assign/view.php', array('id' => $this->contextinstanceid)); } /** diff --git a/mod/assign/classes/event/submission_duplicated.php b/mod/assign/classes/event/submission_duplicated.php index a5bf9c00c3d..b52b9841236 100644 --- a/mod/assign/classes/event/submission_duplicated.php +++ b/mod/assign/classes/event/submission_duplicated.php @@ -75,7 +75,7 @@ class submission_duplicated extends \core\event\base { * @return \moodle_url */ public function get_url() { - return new \moodle_url('/mod/assign/view.php', array('id' => $this->context->instanceid)); + return new \moodle_url('/mod/assign/view.php', array('id' => $this->contextinstanceid)); } /** diff --git a/mod/assign/classes/event/submission_graded.php b/mod/assign/classes/event/submission_graded.php index cac5fac23ae..bc3f47417c2 100644 --- a/mod/assign/classes/event/submission_graded.php +++ b/mod/assign/classes/event/submission_graded.php @@ -75,7 +75,7 @@ class submission_graded extends \core\event\base { * @return \moodle_url */ public function get_url() { - return new \moodle_url('/mod/assign/view.php', array('id' => $this->context->instanceid)); + return new \moodle_url('/mod/assign/view.php', array('id' => $this->contextinstanceid)); } /** diff --git a/mod/assign/classes/event/submission_locked.php b/mod/assign/classes/event/submission_locked.php index 082a1a4c0e0..7d9445392de 100644 --- a/mod/assign/classes/event/submission_locked.php +++ b/mod/assign/classes/event/submission_locked.php @@ -75,7 +75,7 @@ class submission_locked extends \core\event\base { * @return \moodle_url */ public function get_url() { - return new \moodle_url('/mod/assign/view.php', array('id' => $this->context->instanceid)); + return new \moodle_url('/mod/assign/view.php', array('id' => $this->contextinstanceid)); } /** diff --git a/mod/assign/classes/event/submission_status_updated.php b/mod/assign/classes/event/submission_status_updated.php index e0d21c90816..cbf526fe346 100644 --- a/mod/assign/classes/event/submission_status_updated.php +++ b/mod/assign/classes/event/submission_status_updated.php @@ -81,7 +81,7 @@ class submission_status_updated extends \core\event\base { * @return \moodle_url */ public function get_url() { - return new \moodle_url('/mod/assign/view.php', array('id' => $this->context->instanceid)); + return new \moodle_url('/mod/assign/view.php', array('id' => $this->contextinstanceid)); } /** diff --git a/mod/assign/classes/event/submission_unlocked.php b/mod/assign/classes/event/submission_unlocked.php index b50bd36d2a5..e5594b10d25 100644 --- a/mod/assign/classes/event/submission_unlocked.php +++ b/mod/assign/classes/event/submission_unlocked.php @@ -75,7 +75,7 @@ class submission_unlocked extends \core\event\base { * @return \moodle_url */ public function get_url() { - return new \moodle_url('/mod/assign/view.php', array('id' => $this->context->instanceid)); + return new \moodle_url('/mod/assign/view.php', array('id' => $this->contextinstanceid)); } /** diff --git a/mod/assign/classes/event/submission_updated.php b/mod/assign/classes/event/submission_updated.php index f9e6e47217d..505452b26ab 100644 --- a/mod/assign/classes/event/submission_updated.php +++ b/mod/assign/classes/event/submission_updated.php @@ -75,7 +75,7 @@ class submission_updated extends \core\event\base { * @return \moodle_url */ public function get_url() { - return new \moodle_url('/mod/assign/view.php', array('id' => $this->context->instanceid)); + return new \moodle_url('/mod/assign/view.php', array('id' => $this->contextinstanceid)); } /** diff --git a/mod/assign/classes/event/workflow_state_updated.php b/mod/assign/classes/event/workflow_state_updated.php index a52b93ac37c..1ef903740c4 100644 --- a/mod/assign/classes/event/workflow_state_updated.php +++ b/mod/assign/classes/event/workflow_state_updated.php @@ -81,7 +81,7 @@ class workflow_state_updated extends \core\event\base { * @return \moodle_url */ public function get_url() { - return new \moodle_url('/mod/assign/view.php', array('id' => $this->context->instanceid)); + return new \moodle_url('/mod/assign/view.php', array('id' => $this->contextinstanceid)); } /** diff --git a/mod/assign/submission/file/classes/event/assessable_uploaded.php b/mod/assign/submission/file/classes/event/assessable_uploaded.php index b32eb00d9dc..1b33df2a6b9 100644 --- a/mod/assign/submission/file/classes/event/assessable_uploaded.php +++ b/mod/assign/submission/file/classes/event/assessable_uploaded.php @@ -66,7 +66,7 @@ class assessable_uploaded extends \core\event\assessable_uploaded { protected function get_legacy_eventdata() { $eventdata = new \stdClass(); $eventdata->modulename = 'assign'; - $eventdata->cmid = $this->context->instanceid; + $eventdata->cmid = $this->contextinstanceid; $eventdata->itemid = $this->objectid; $eventdata->courseid = $this->courseid; $eventdata->userid = $this->userid; @@ -102,7 +102,7 @@ class assessable_uploaded extends \core\event\assessable_uploaded { * @return \moodle_url */ public function get_url() { - return new \moodle_url('/mod/assign/view.php', array('id' => $this->context->instanceid)); + return new \moodle_url('/mod/assign/view.php', array('id' => $this->contextinstanceid)); } /** diff --git a/mod/assign/submission/onlinetext/classes/event/assessable_uploaded.php b/mod/assign/submission/onlinetext/classes/event/assessable_uploaded.php index 214ba1f1eab..5b2a6d6f18f 100644 --- a/mod/assign/submission/onlinetext/classes/event/assessable_uploaded.php +++ b/mod/assign/submission/onlinetext/classes/event/assessable_uploaded.php @@ -60,7 +60,7 @@ class assessable_uploaded extends \core\event\assessable_uploaded { protected function get_legacy_eventdata() { $eventdata = new \stdClass(); $eventdata->modulename = 'assign'; - $eventdata->cmid = $this->context->instanceid; + $eventdata->cmid = $this->contextinstanceid; $eventdata->itemid = $this->objectid; $eventdata->courseid = $this->courseid; $eventdata->userid = $this->userid; @@ -95,7 +95,7 @@ class assessable_uploaded extends \core\event\assessable_uploaded { * @return \moodle_url */ public function get_url() { - return new \moodle_url('/mod/assign/view.php', array('id' => $this->context->instanceid)); + return new \moodle_url('/mod/assign/view.php', array('id' => $this->contextinstanceid)); } /** diff --git a/mod/book/classes/event/chapter_created.php b/mod/book/classes/event/chapter_created.php index c89e479bea1..36a77730171 100644 --- a/mod/book/classes/event/chapter_created.php +++ b/mod/book/classes/event/chapter_created.php @@ -40,7 +40,7 @@ class chapter_created extends \core\event\base { * @return string */ public function get_description() { - return "The chapter $this->objectid of the book $this->context->instanceid has been created."; + return "The chapter $this->objectid of the book " . $this->contextinstanceid . " has been created."; } /** @@ -49,8 +49,8 @@ class chapter_created extends \core\event\base { * @return array|null */ protected function get_legacy_logdata() { - return array($this->courseid, 'book', 'add chapter', 'view.php?id=' . $this->context->instanceid . '&chapterid=' . - $this->objectid, $this->objectid, $this->context->instanceid); + return array($this->courseid, 'book', 'add chapter', 'view.php?id=' . $this->contextinstanceid . '&chapterid=' . + $this->objectid, $this->objectid, $this->contextinstanceid); } /** @@ -69,7 +69,7 @@ class chapter_created extends \core\event\base { */ public function get_url() { return new \moodle_url('/mod/book/view.php', array( - 'id' => $this->context->instanceid, + 'id' => $this->contextinstanceid, 'chapterid' => $this->objectid )); } diff --git a/mod/book/classes/event/chapter_deleted.php b/mod/book/classes/event/chapter_deleted.php index ff9d9af8e9f..8186409584d 100644 --- a/mod/book/classes/event/chapter_deleted.php +++ b/mod/book/classes/event/chapter_deleted.php @@ -47,7 +47,7 @@ class chapter_deleted extends \core\event\base { * @return string */ public function get_description() { - return "The chapter $this->objectid of the book $this->context->instanceid has been deleted."; + return "The chapter $this->objectid of the book " . $this->contextinstanceid . " has been deleted."; } /** @@ -74,7 +74,7 @@ class chapter_deleted extends \core\event\base { * @return \moodle_url */ public function get_url() { - return new \moodle_url('/mod/book/view.php', array('id' => $this->context->instanceid)); + return new \moodle_url('/mod/book/view.php', array('id' => $this->contextinstanceid)); } /** diff --git a/mod/book/classes/event/chapter_updated.php b/mod/book/classes/event/chapter_updated.php index c889de0fc12..ec59f1c0c77 100644 --- a/mod/book/classes/event/chapter_updated.php +++ b/mod/book/classes/event/chapter_updated.php @@ -40,7 +40,7 @@ class chapter_updated extends \core\event\base { * @return string */ public function get_description() { - return "The chapter $this->objectid of the book $this->context->instanceid has been updated."; + return "The chapter $this->objectid of the book " . $this->contextinstanceid . " has been updated."; } /** @@ -49,8 +49,8 @@ class chapter_updated extends \core\event\base { * @return array|null */ protected function get_legacy_logdata() { - return array($this->courseid, 'book', 'update chapter', 'view.php?id=' . $this->context->instanceid . '&chapterid=' . - $this->objectid, $this->objectid, $this->context->instanceid); + return array($this->courseid, 'book', 'update chapter', 'view.php?id=' . $this->contextinstanceid . '&chapterid=' . + $this->objectid, $this->objectid, $this->contextinstanceid); } /** @@ -69,7 +69,7 @@ class chapter_updated extends \core\event\base { */ public function get_url() { return new \moodle_url('/mod/book/view.php', array( - 'id' => $this->context->instanceid, + 'id' => $this->contextinstanceid, 'chapterid' => $this->objectid )); } diff --git a/mod/book/classes/event/chapter_viewed.php b/mod/book/classes/event/chapter_viewed.php index a1f87032ad1..7f1d83f0b0a 100644 --- a/mod/book/classes/event/chapter_viewed.php +++ b/mod/book/classes/event/chapter_viewed.php @@ -40,7 +40,7 @@ class chapter_viewed extends \core\event\content_viewed { * @return string */ public function get_description() { - return "The user $this->userid has viewed the chapter $this->objectid of book module $this->context->instanceid"; + return "The user $this->userid has viewed the chapter $this->objectid of book module $this->contextinstanceid"; } /** @@ -49,8 +49,8 @@ class chapter_viewed extends \core\event\content_viewed { * @return array|null */ protected function get_legacy_logdata() { - return array($this->courseid, 'book', 'view chapter', 'view.php?id=' . $this->context->instanceid . - '&chapterid=' . $this->objectid, $this->objectid, $this->context->instanceid); + return array($this->courseid, 'book', 'view chapter', 'view.php?id=' . $this->contextinstanceid . + '&chapterid=' . $this->objectid, $this->objectid, $this->contextinstanceid); } /** @@ -68,7 +68,7 @@ class chapter_viewed extends \core\event\content_viewed { * @return \moodle_url */ public function get_url() { - return new \moodle_url('/mod/book/view.php', array('id' => $this->context->instanceid, 'chapterid' => $this->objectid)); + return new \moodle_url('/mod/book/view.php', array('id' => $this->contextinstanceid, 'chapterid' => $this->objectid)); } /** diff --git a/mod/book/tool/exportimscp/classes/event/book_exported.php b/mod/book/tool/exportimscp/classes/event/book_exported.php index 2d094dee9b0..d051839a2a4 100644 --- a/mod/book/tool/exportimscp/classes/event/book_exported.php +++ b/mod/book/tool/exportimscp/classes/event/book_exported.php @@ -49,8 +49,8 @@ class book_exported extends \core\event\base { * @return array|null */ protected function get_legacy_logdata() { - return array($this->courseid, 'book', 'exportimscp', 'tool/exportimscp/index.php?id=' . $this->context->instanceid, - $this->objectid, $this->context->instanceid); + return array($this->courseid, 'book', 'exportimscp', 'tool/exportimscp/index.php?id=' . $this->contextinstanceid, + $this->objectid, $this->contextinstanceid); } /** @@ -68,7 +68,7 @@ class book_exported extends \core\event\base { * @return \moodle_url */ public function get_url() { - return new \moodle_url('/mod/book/view.php', array('id' => $this->context->instanceid)); + return new \moodle_url('/mod/book/view.php', array('id' => $this->contextinstanceid)); } /** diff --git a/mod/book/tool/print/classes/event/book_printed.php b/mod/book/tool/print/classes/event/book_printed.php index 0917406707b..ce861b1b2c6 100644 --- a/mod/book/tool/print/classes/event/book_printed.php +++ b/mod/book/tool/print/classes/event/book_printed.php @@ -49,8 +49,8 @@ class book_printed extends \core\event\base { * @return array|null */ protected function get_legacy_logdata() { - return array($this->courseid, 'book', 'print', 'tool/print/index.php?id=' . $this->context->instanceid, - $this->objectid, $this->context->instanceid); + return array($this->courseid, 'book', 'print', 'tool/print/index.php?id=' . $this->contextinstanceid, + $this->objectid, $this->contextinstanceid); } /** @@ -68,7 +68,7 @@ class book_printed extends \core\event\base { * @return \moodle_url */ public function get_url() { - return new \moodle_url('/mod/book/tool/print/index.php', array('id' => $this->context->instanceid)); + return new \moodle_url('/mod/book/tool/print/index.php', array('id' => $this->contextinstanceid)); } /** diff --git a/mod/book/tool/print/classes/event/chapter_printed.php b/mod/book/tool/print/classes/event/chapter_printed.php index ea4d2ecabd9..1feff1cc164 100644 --- a/mod/book/tool/print/classes/event/chapter_printed.php +++ b/mod/book/tool/print/classes/event/chapter_printed.php @@ -40,7 +40,8 @@ class chapter_printed extends \core\event\base { * @return string */ public function get_description() { - return "The user $this->userid has printed the chapter $this->objectid of the book module $this->context->instanceid."; + return "The user " . $this->userid . " has printed the chapter $this->objectid of the book module " . + $this->contextinstanceid; } /** @@ -49,8 +50,8 @@ class chapter_printed extends \core\event\base { * @return array|null */ protected function get_legacy_logdata() { - return array($this->courseid, 'book', 'print chapter', 'tool/print/index.php?id=' . $this->context->instanceid . - '&chapterid=' . $this->objectid, $this->objectid, $this->context->instanceid); + return array($this->courseid, 'book', 'print chapter', 'tool/print/index.php?id=' . $this->contextinstanceid . + '&chapterid=' . $this->objectid, $this->objectid, $this->contextinstanceid); } /** @@ -68,7 +69,7 @@ class chapter_printed extends \core\event\base { * @return \moodle_url */ public function get_url() { - return new \moodle_url('/mod/book/tool/print/index.php', array('id' => $this->context->instanceid)); + return new \moodle_url('/mod/book/tool/print/index.php', array('id' => $this->contextinstanceid)); } /** diff --git a/mod/chat/classes/event/message_sent.php b/mod/chat/classes/event/message_sent.php index fdb1d5e23e5..b290a01d3c7 100644 --- a/mod/chat/classes/event/message_sent.php +++ b/mod/chat/classes/event/message_sent.php @@ -50,8 +50,8 @@ class message_sent extends \core\event\base { */ protected function get_legacy_logdata() { $message = $this->get_record_snapshot('chat_messages', $this->objectid); - return array($this->courseid, 'chat', 'talk', 'view.php?id=' . $this->context->instanceid, - $message->chatid, $this->context->instanceid, $this->relateduserid); + return array($this->courseid, 'chat', 'talk', 'view.php?id=' . $this->contextinstanceid, + $message->chatid, $this->contextinstanceid, $this->relateduserid); } /** @@ -69,7 +69,7 @@ class message_sent extends \core\event\base { * @return \moodle_url */ public function get_url() { - return new \moodle_url('/mod/chat/view.php', array('id' => $this->context->instanceid)); + return new \moodle_url('/mod/chat/view.php', array('id' => $this->contextinstanceid)); } /** diff --git a/mod/chat/classes/event/sessions_viewed.php b/mod/chat/classes/event/sessions_viewed.php index 71be7c09378..9964e034acf 100644 --- a/mod/chat/classes/event/sessions_viewed.php +++ b/mod/chat/classes/event/sessions_viewed.php @@ -56,8 +56,8 @@ class sessions_viewed extends \core\event\content_viewed { * @return array|null */ protected function get_legacy_logdata() { - return array($this->courseid, 'chat', 'report', 'report.php?id=' . $this->context->instanceid, - $this->objectid, $this->context->instanceid); + return array($this->courseid, 'chat', 'report', 'report.php?id=' . $this->contextinstanceid, + $this->objectid, $this->contextinstanceid); } /** @@ -75,7 +75,7 @@ class sessions_viewed extends \core\event\content_viewed { * @return \moodle_url */ public function get_url() { - return new \moodle_url('/mod/chat/report.php', array('id' => $this->context->instanceid)); + return new \moodle_url('/mod/chat/report.php', array('id' => $this->contextinstanceid)); } /** diff --git a/mod/choice/classes/event/answer_submitted.php b/mod/choice/classes/event/answer_submitted.php index bc7256fee41..3978fee51eb 100644 --- a/mod/choice/classes/event/answer_submitted.php +++ b/mod/choice/classes/event/answer_submitted.php @@ -60,9 +60,9 @@ class answer_submitted extends \core\event\base { $legacylogdata = array($this->courseid, 'choice', 'choose', - 'view.php?id=' . $this->context->instanceid, + 'view.php?id=' . $this->contextinstanceid, $this->other['choiceid'], - $this->context->instanceid); + $this->contextinstanceid); return $legacylogdata; } @@ -82,7 +82,7 @@ class answer_submitted extends \core\event\base { * @return \moodle_url */ public function get_url() { - return new \moodle_url('/mod/choice/view.php', array('id' => $this->context->instanceid)); + return new \moodle_url('/mod/choice/view.php', array('id' => $this->contextinstanceid)); } /** diff --git a/mod/choice/classes/event/answer_updated.php b/mod/choice/classes/event/answer_updated.php index 2df2afb15d2..47780d463b2 100644 --- a/mod/choice/classes/event/answer_updated.php +++ b/mod/choice/classes/event/answer_updated.php @@ -60,9 +60,9 @@ class answer_updated extends \core\event\base { $legacylogdata = array($this->courseid, 'choice', 'choose again', - 'view.php?id=' . $this->context->instanceid, + 'view.php?id=' . $this->contextinstanceid, $this->other['choiceid'], - $this->context->instanceid); + $this->contextinstanceid); return $legacylogdata; } @@ -82,7 +82,7 @@ class answer_updated extends \core\event\base { * @return \moodle_url */ public function get_url() { - return new \moodle_url('/mod/choice/view.php', array('id' => $this->context->instanceid)); + return new \moodle_url('/mod/choice/view.php', array('id' => $this->contextinstanceid)); } /** diff --git a/mod/choice/classes/event/report_viewed.php b/mod/choice/classes/event/report_viewed.php index c7b62257407..ce36d2f5974 100644 --- a/mod/choice/classes/event/report_viewed.php +++ b/mod/choice/classes/event/report_viewed.php @@ -64,7 +64,7 @@ class report_viewed extends \core\event\content_viewed { */ public function get_url() { $url = '/mod/choice/report.php'; - return new \moodle_url($url, array('id' => $this->context->instanceid)); + return new \moodle_url($url, array('id' => $this->contextinstanceid)); } /** @@ -73,7 +73,7 @@ class report_viewed extends \core\event\content_viewed { * @return array of parameters to be passed to legacy add_to_log() function. */ protected function get_legacy_logdata() { - $url = new \moodle_url('report.php', array('id' => $this->context->instanceid)); - return array($this->courseid, 'choice', 'report', $url->out(), $this->objectid, $this->context->instanceid); + $url = new \moodle_url('report.php', array('id' => $this->contextinstanceid)); + return array($this->courseid, 'choice', 'report', $url->out(), $this->objectid, $this->contextinstanceid); } } diff --git a/mod/feedback/classes/event/response_deleted.php b/mod/feedback/classes/event/response_deleted.php index cbd086fcbcd..14ab5ee59d4 100644 --- a/mod/feedback/classes/event/response_deleted.php +++ b/mod/feedback/classes/event/response_deleted.php @@ -68,7 +68,7 @@ class response_deleted extends \core\event\base { * @return string */ public function get_description() { - return 'The feedback from user ' . $this->other['relateduserid']. ' was deleted by' . $this->userid; + return 'The feedback from user ' . $this->relateduserid . ' was deleted by' . $this->userid; } /** diff --git a/mod/feedback/classes/event/response_submitted.php b/mod/feedback/classes/event/response_submitted.php index 52253880451..239232ff4a8 100644 --- a/mod/feedback/classes/event/response_submitted.php +++ b/mod/feedback/classes/event/response_submitted.php @@ -71,7 +71,7 @@ class response_submitted extends \core\event\base { * @return string */ public function get_description() { - return 'The user ' . $this->other['relateduserid']. ' submited a feedback'; + return 'The user ' . $this->relateduserid . ' submited a feedback'; } /** @@ -84,7 +84,7 @@ class response_submitted extends \core\event\base { 'do_show' => 'showoneentry' , 'userid' => $this->relateduserid)); } else { return new \moodle_url('/mod/feedback/show_entries_anonym.php', array('id' => $this->other['cmid'], - 'do_show' => 'showoneentry', 'showall', 'showcompleted' => $this->objectid)); + 'do_show' => 'showoneentry', 'showall' => 1, 'showcompleted' => $this->objectid)); } } diff --git a/mod/feedback/tests/events_test.php b/mod/feedback/tests/events_test.php index ff5dcbb9ab9..a23b6a57af9 100644 --- a/mod/feedback/tests/events_test.php +++ b/mod/feedback/tests/events_test.php @@ -130,6 +130,7 @@ class mod_feedback_events_testcase extends advanced_testcase { $arr = array($this->eventcourse->id, 'feedback', 'delete', 'view.php?id=' . $this->eventcm->id, $this->eventfeedback->id, $this->eventfeedback->id); $this->assertEventLegacyLogData($arr, $event); + $this->assertEventContextNotUsed($event); // Test can_view() . $this->setUser($this->eventuser); diff --git a/mod/folder/classes/event/folder_updated.php b/mod/folder/classes/event/folder_updated.php index e972d861dcd..75065f9dcd9 100644 --- a/mod/folder/classes/event/folder_updated.php +++ b/mod/folder/classes/event/folder_updated.php @@ -61,7 +61,7 @@ class folder_updated extends \core\event\base { * @return \moodle_url */ public function get_url() { - return new \moodle_url('/mod/folder/edit.php', array('id' => $this->context->instanceid)); + return new \moodle_url('/mod/folder/edit.php', array('id' => $this->contextinstanceid)); } /** @@ -70,7 +70,7 @@ class folder_updated extends \core\event\base { * @return array|null */ protected function get_legacy_logdata() { - return array($this->courseid, 'folder', 'edit', 'edit.php?id=' . $this->context->instanceid, $this->objectid, - $this->context->instanceid); + return array($this->courseid, 'folder', 'edit', 'edit.php?id=' . $this->contextinstanceid, $this->objectid, + $this->contextinstanceid); } } diff --git a/mod/forum/classes/event/assessable_uploaded.php b/mod/forum/classes/event/assessable_uploaded.php index 5cbfd3c9230..58abfadf94b 100644 --- a/mod/forum/classes/event/assessable_uploaded.php +++ b/mod/forum/classes/event/assessable_uploaded.php @@ -62,7 +62,7 @@ class assessable_uploaded extends \core\event\assessable_uploaded { $eventdata = new \stdClass(); $eventdata->modulename = 'forum'; $eventdata->name = $this->other['triggeredfrom']; - $eventdata->cmid = $this->context->instanceid; + $eventdata->cmid = $this->contextinstanceid; $eventdata->itemid = $this->objectid; $eventdata->courseid = $this->courseid; $eventdata->userid = $this->userid; diff --git a/mod/lesson/classes/event/essay_assessed.php b/mod/lesson/classes/event/essay_assessed.php index ce488e0a9be..3e7bcbd5bfd 100644 --- a/mod/lesson/classes/event/essay_assessed.php +++ b/mod/lesson/classes/event/essay_assessed.php @@ -71,7 +71,7 @@ class essay_assessed extends \core\event\base { protected function get_legacy_logdata() { $lesson = $this->get_record_snapshot('lesson', $this->other['lessonid']); return array($this->courseid, 'lesson', 'update grade', 'essay.php?id=' . - $this->context->instanceid, $lesson->name, $this->context->instanceid); + $this->contextinstanceid, $lesson->name, $this->contextinstanceid); } /** @@ -89,7 +89,7 @@ class essay_assessed extends \core\event\base { * @return \moodle_url */ public function get_url() { - return new \moodle_url('/mod/lesson/essay.php', array('id' => $this->context->instanceid)); + return new \moodle_url('/mod/lesson/essay.php', array('id' => $this->contextinstanceid)); } /** diff --git a/mod/lesson/classes/event/essay_attempt_viewed.php b/mod/lesson/classes/event/essay_attempt_viewed.php index eec32b3d6f0..1e236783be5 100644 --- a/mod/lesson/classes/event/essay_attempt_viewed.php +++ b/mod/lesson/classes/event/essay_attempt_viewed.php @@ -52,7 +52,7 @@ class essay_attempt_viewed extends \core\event\base { * @return \moodle_url */ public function get_url() { - return new \moodle_url('/mod/lesson/essay.php', array('id' => $this->context->instanceid, + return new \moodle_url('/mod/lesson/essay.php', array('id' => $this->contextinstanceid, 'mode' => 'grade', 'attemptid' => $this->objectid)); } @@ -72,7 +72,7 @@ class essay_attempt_viewed extends \core\event\base { * @return array of parameters to be passed to legacy add_to_log() function. */ protected function get_legacy_logdata() { - return array($this->courseid, 'lesson', 'view grade', 'essay.php?id=' . $this->context->instanceid . '&mode=grade&attemptid=' - . $this->objectid, get_string('manualgrading', 'lesson'), $this->context->instanceid); + return array($this->courseid, 'lesson', 'view grade', 'essay.php?id=' . $this->contextinstanceid . '&mode=grade&attemptid=' + . $this->objectid, get_string('manualgrading', 'lesson'), $this->contextinstanceid); } } diff --git a/mod/lesson/classes/event/highscore_added.php b/mod/lesson/classes/event/highscore_added.php index 645d113fb8f..52283c392fe 100644 --- a/mod/lesson/classes/event/highscore_added.php +++ b/mod/lesson/classes/event/highscore_added.php @@ -52,7 +52,7 @@ class highscore_added extends \core\event\base { * @return \moodle_url */ public function get_url() { - return new \moodle_url('/mod/lesson/highscores.php', array('id' => $this->context->instanceid)); + return new \moodle_url('/mod/lesson/highscores.php', array('id' => $this->contextinstanceid)); } /** @@ -75,7 +75,7 @@ class highscore_added extends \core\event\base { protected function get_legacy_logdata() { $highscore = $this->get_record_snapshot('lesson_high_scores', $this->objectid); - return array($this->courseid, 'lesson', 'update highscores', 'highscores.php?id=' . $this->context->instanceid, - $highscore->nickname, $this->context->instanceid); + return array($this->courseid, 'lesson', 'update highscores', 'highscores.php?id=' . $this->contextinstanceid, + $highscore->nickname, $this->contextinstanceid); } } diff --git a/mod/lesson/classes/event/highscores_viewed.php b/mod/lesson/classes/event/highscores_viewed.php index cd0aff219cf..fc527c8e928 100644 --- a/mod/lesson/classes/event/highscores_viewed.php +++ b/mod/lesson/classes/event/highscores_viewed.php @@ -52,7 +52,7 @@ class highscores_viewed extends \core\event\base { * @return \moodle_url */ public function get_url() { - return new \moodle_url('/mod/lesson/highscores.php', array('id' => $this->context->instanceid)); + return new \moodle_url('/mod/lesson/highscores.php', array('id' => $this->contextinstanceid)); } /** @@ -72,7 +72,7 @@ class highscores_viewed extends \core\event\base { protected function get_legacy_logdata() { $lesson = $this->get_record_snapshot('lesson', $this->objectid); - return array($this->courseid, 'lesson', 'view highscores', 'highscores.php?id=' . $this->context->instanceid, - $lesson->name, $this->context->instanceid); + return array($this->courseid, 'lesson', 'view highscores', 'highscores.php?id=' . $this->contextinstanceid, + $lesson->name, $this->contextinstanceid); } } diff --git a/mod/lesson/classes/event/lesson_ended.php b/mod/lesson/classes/event/lesson_ended.php index a3cef8ccd88..b0b3e0354d1 100644 --- a/mod/lesson/classes/event/lesson_ended.php +++ b/mod/lesson/classes/event/lesson_ended.php @@ -52,7 +52,7 @@ class lesson_ended extends \core\event\base { * @return \moodle_url */ public function get_url() { - return new \moodle_url('/mod/lesson/view.php', array('id' => $this->context->instanceid)); + return new \moodle_url('/mod/lesson/view.php', array('id' => $this->contextinstanceid)); } /** @@ -70,7 +70,7 @@ class lesson_ended extends \core\event\base { * @return array of parameters to be passed to legacy add_to_log() function. */ protected function get_legacy_logdata() { - return array($this->courseid, 'lesson', 'end', 'view.php?id=' . $this->context->instanceid, $this->objectid, - $this->context->instanceid); + return array($this->courseid, 'lesson', 'end', 'view.php?id=' . $this->contextinstanceid, $this->objectid, + $this->contextinstanceid); } } diff --git a/mod/lesson/classes/event/lesson_started.php b/mod/lesson/classes/event/lesson_started.php index afd3b05d4d4..15fc203d3e7 100644 --- a/mod/lesson/classes/event/lesson_started.php +++ b/mod/lesson/classes/event/lesson_started.php @@ -52,7 +52,7 @@ class lesson_started extends \core\event\base { * @return \moodle_url */ public function get_url() { - return new \moodle_url('/mod/lesson/view.php', array('id' => $this->context->instanceid)); + return new \moodle_url('/mod/lesson/view.php', array('id' => $this->contextinstanceid)); } /** @@ -70,7 +70,7 @@ class lesson_started extends \core\event\base { * @return array of parameters to be passed to legacy add_to_log() function. */ protected function get_legacy_logdata() { - return array($this->courseid, 'lesson', 'start', 'view.php?id=' . $this->context->instanceid, - $this->objectid, $this->context->instanceid); + return array($this->courseid, 'lesson', 'start', 'view.php?id=' . $this->contextinstanceid, + $this->objectid, $this->contextinstanceid); } } diff --git a/mod/quiz/attemptlib.php b/mod/quiz/attemptlib.php index 863064aa527..302a752046a 100644 --- a/mod/quiz/attemptlib.php +++ b/mod/quiz/attemptlib.php @@ -1512,14 +1512,15 @@ class quiz_attempt { */ protected function fire_state_transition_event($eventclass, $timestamp) { global $USER; - + $quizrecord = $this->get_quiz(); $params = array( 'context' => $this->get_quizobj()->get_context(), 'courseid' => $this->get_courseid(), 'objectid' => $this->attempt->id, 'relateduserid' => $this->attempt->userid, 'other' => array( - 'submitterid' => CLI_SCRIPT ? null : $USER->id + 'submitterid' => CLI_SCRIPT ? null : $USER->id, + 'quizid' => $quizrecord->id ) ); diff --git a/mod/quiz/classes/event/attempt_abandoned.php b/mod/quiz/classes/event/attempt_abandoned.php index f277af41020..4338d58c08f 100644 --- a/mod/quiz/classes/event/attempt_abandoned.php +++ b/mod/quiz/classes/event/attempt_abandoned.php @@ -99,7 +99,7 @@ class attempt_abandoned extends \core\event\base { $legacyeventdata->timestamp = $attempt->timemodified; $legacyeventdata->userid = $this->relateduserid; $legacyeventdata->quizid = $attempt->quiz; - $legacyeventdata->cmid = $this->context->instanceid; + $legacyeventdata->cmid = $this->contextinstanceid; $legacyeventdata->courseid = $this->courseid; $legacyeventdata->submitterid = $this->other['submitterid']; diff --git a/mod/quiz/classes/event/attempt_becameoverdue.php b/mod/quiz/classes/event/attempt_becameoverdue.php index 552905d9eed..3816a82edb9 100644 --- a/mod/quiz/classes/event/attempt_becameoverdue.php +++ b/mod/quiz/classes/event/attempt_becameoverdue.php @@ -102,7 +102,7 @@ class attempt_becameoverdue extends \core\event\base { $legacyeventdata->timestamp = $attempt->timemodified; $legacyeventdata->userid = $this->relateduserid; $legacyeventdata->quizid = $attempt->quiz; - $legacyeventdata->cmid = $this->context->instanceid; + $legacyeventdata->cmid = $this->contextinstanceid; $legacyeventdata->courseid = $this->courseid; $legacyeventdata->submitterid = $this->other['submitterid']; diff --git a/mod/quiz/classes/event/attempt_started.php b/mod/quiz/classes/event/attempt_started.php index 8b97404285c..8fec60cf303 100644 --- a/mod/quiz/classes/event/attempt_started.php +++ b/mod/quiz/classes/event/attempt_started.php @@ -94,7 +94,7 @@ class attempt_started extends \core\event\base { $legacyeventdata->timestamp = $attempt->timestart; $legacyeventdata->userid = $this->relateduserid; $legacyeventdata->quizid = $attempt->quiz; - $legacyeventdata->cmid = $this->context->instanceid; + $legacyeventdata->cmid = $this->contextinstanceid; $legacyeventdata->courseid = $this->courseid; return $legacyeventdata; diff --git a/mod/quiz/classes/event/attempt_submitted.php b/mod/quiz/classes/event/attempt_submitted.php index 3190edff5ab..2fa8d8160ef 100644 --- a/mod/quiz/classes/event/attempt_submitted.php +++ b/mod/quiz/classes/event/attempt_submitted.php @@ -99,7 +99,7 @@ class attempt_submitted extends \core\event\base { $legacyeventdata->timestamp = $attempt->timefinish; $legacyeventdata->userid = $this->relateduserid; $legacyeventdata->quizid = $attempt->quiz; - $legacyeventdata->cmid = $this->context->instanceid; + $legacyeventdata->cmid = $this->contextinstanceid; $legacyeventdata->courseid = $this->courseid; $legacyeventdata->submitterid = $this->other['submitterid']; $legacyeventdata->timefinish = $attempt->timefinish; diff --git a/mod/scorm/classes/event/attempt_deleted.php b/mod/scorm/classes/event/attempt_deleted.php index 825be7deb86..906860b2cc5 100644 --- a/mod/scorm/classes/event/attempt_deleted.php +++ b/mod/scorm/classes/event/attempt_deleted.php @@ -71,7 +71,7 @@ class attempt_deleted extends \core\event\base { * @return \moodle_url */ public function get_url() { - return new \moodle_url('/mod/scorm/report.php', array('id' => $this->context->instanceid)); + return new \moodle_url('/mod/scorm/report.php', array('id' => $this->contextinstanceid)); } /** @@ -80,8 +80,8 @@ class attempt_deleted extends \core\event\base { * @return array of parameters to be passed to legacy add_to_log() function. */ protected function get_legacy_logdata() { - return array($this->courseid, 'scorm', 'delete attempts', 'report.php?id=' . $this->context->instanceid, - $this->other['attemptid'], $this->context->instanceid); + return array($this->courseid, 'scorm', 'delete attempts', 'report.php?id=' . $this->contextinstanceid, + $this->other['attemptid'], $this->contextinstanceid); } /** diff --git a/mod/scorm/classes/event/course_module_viewed.php b/mod/scorm/classes/event/course_module_viewed.php index 9471348345e..0754b8c792c 100644 --- a/mod/scorm/classes/event/course_module_viewed.php +++ b/mod/scorm/classes/event/course_module_viewed.php @@ -49,8 +49,8 @@ class course_module_viewed extends \core\event\course_module_viewed { * @return array of parameters to be passed to legacy add_to_log() function. */ protected function get_legacy_logdata() { - return array($this->courseid, 'scorm', 'pre-view', 'view.php?id=' . $this->context->instanceid, $this->objectid, - $this->context->instanceid); + return array($this->courseid, 'scorm', 'pre-view', 'view.php?id=' . $this->contextinstanceid, $this->objectid, + $this->contextinstanceid); } } diff --git a/mod/scorm/classes/event/interactions_viewed.php b/mod/scorm/classes/event/interactions_viewed.php index 0323c0e3cb6..f50fea2e8db 100644 --- a/mod/scorm/classes/event/interactions_viewed.php +++ b/mod/scorm/classes/event/interactions_viewed.php @@ -73,7 +73,7 @@ class interactions_viewed extends \core\event\base { */ public function get_url() { $params = array( - 'id' => $this->context->instanceid, + 'id' => $this->contextinstanceid, 'user' => $this->relateduserid, 'attempt' => $this->other['attemptid'] ); @@ -87,8 +87,8 @@ class interactions_viewed extends \core\event\base { */ protected function get_legacy_logdata() { return array($this->courseid, 'scorm', 'userreportinteractions', 'report/userreportinteractions.php?id=' . - $this->context->instanceid . '&user=' . $this->relateduserid . '&attempt=' . $this->other['attemptid'], - $this->other['instanceid'], $this->context->instanceid); + $this->contextinstanceid . '&user=' . $this->relateduserid . '&attempt=' . $this->other['attemptid'], + $this->other['instanceid'], $this->contextinstanceid); } /** diff --git a/mod/scorm/classes/event/report_viewed.php b/mod/scorm/classes/event/report_viewed.php index 53e936c0c2c..a39e2152580 100644 --- a/mod/scorm/classes/event/report_viewed.php +++ b/mod/scorm/classes/event/report_viewed.php @@ -73,7 +73,7 @@ class report_viewed extends \core\event\base { * @return \moodle_url */ public function get_url() { - return new \moodle_url('/mod/scorm/report.php', array('id' => $this->context->instanceid, 'mode' => $this->other['mode'])); + return new \moodle_url('/mod/scorm/report.php', array('id' => $this->contextinstanceid, 'mode' => $this->other['mode'])); } /** @@ -82,8 +82,8 @@ class report_viewed extends \core\event\base { * @return array of parameters to be passed to legacy add_to_log() function. */ protected function get_legacy_logdata() { - return array($this->courseid, 'scorm', 'report', 'report.php?id=' . $this->context->instanceid . - '&mode=' . $this->other['mode'], $this->objectid, $this->context->instanceid); + return array($this->courseid, 'scorm', 'report', 'report.php?id=' . $this->contextinstanceid . + '&mode=' . $this->other['mode'], $this->objectid, $this->contextinstanceid); } /** diff --git a/mod/scorm/classes/event/sco_launched.php b/mod/scorm/classes/event/sco_launched.php index 5aa3a95050e..47019ed0b6f 100644 --- a/mod/scorm/classes/event/sco_launched.php +++ b/mod/scorm/classes/event/sco_launched.php @@ -74,7 +74,7 @@ class sco_launched extends \core\event\base { * @return \moodle_url */ public function get_url() { - return new \moodle_url('/mod/scorm/player.php', array('id' => $this->context->instanceid, 'scoid' => $this->objectid)); + return new \moodle_url('/mod/scorm/player.php', array('id' => $this->contextinstanceid, 'scoid' => $this->objectid)); } /** @@ -83,8 +83,8 @@ class sco_launched extends \core\event\base { * @return array of parameters to be passed to legacy add_to_log() function. */ protected function get_legacy_logdata() { - return array($this->courseid, 'scorm', 'launch', 'view.php?id=' . $this->context->instanceid, - $this->other['loadedcontent'], $this->context->instanceid); + return array($this->courseid, 'scorm', 'launch', 'view.php?id=' . $this->contextinstanceid, + $this->other['loadedcontent'], $this->contextinstanceid); } /** diff --git a/mod/scorm/classes/event/tracks_viewed.php b/mod/scorm/classes/event/tracks_viewed.php index a1ca2570ffe..30e5bd19684 100644 --- a/mod/scorm/classes/event/tracks_viewed.php +++ b/mod/scorm/classes/event/tracks_viewed.php @@ -74,7 +74,7 @@ class tracks_viewed extends \core\event\base { */ public function get_url() { $params = array( - 'id' => $this->context->instanceid, + 'id' => $this->contextinstanceid, 'user' => $this->relateduserid, 'attempt' => $this->other['attemptid'], 'scoid' => $this->other['scoid'] @@ -88,9 +88,9 @@ class tracks_viewed extends \core\event\base { * @return array */ protected function get_legacy_logdata() { - return array($this->courseid, 'scorm', 'userreporttracks', 'report/userreporttracks.php?id=' . $this->context->instanceid + return array($this->courseid, 'scorm', 'userreporttracks', 'report/userreporttracks.php?id=' . $this->contextinstanceid . '&user=' . $this->relateduserid . '&attempt=' . $this->other['attemptid'] . '&scoid=' . $this->other['scoid'], - $this->other['instanceid'], $this->context->instanceid); + $this->other['instanceid'], $this->contextinstanceid); } /** diff --git a/mod/scorm/classes/event/user_report_viewed.php b/mod/scorm/classes/event/user_report_viewed.php index 7ebf2394935..3f3519fdf3d 100644 --- a/mod/scorm/classes/event/user_report_viewed.php +++ b/mod/scorm/classes/event/user_report_viewed.php @@ -73,7 +73,7 @@ class user_report_viewed extends \core\event\base { */ public function get_url() { $params = array( - 'id' => $this->context->instanceid, + 'id' => $this->contextinstanceid, 'user' => $this->relateduserid, 'attempt' => $this->other['attemptid'] ); @@ -87,8 +87,8 @@ class user_report_viewed extends \core\event\base { */ protected function get_legacy_logdata() { return array($this->courseid, 'scorm', 'userreport', 'report/userreport.php?id=' . - $this->context->instanceid . '&user=' . $this->relateduserid . '&attempt=' . $this->other['attemptid'], - $this->other['instanceid'], $this->context->instanceid); + $this->contextinstanceid . '&user=' . $this->relateduserid . '&attempt=' . $this->other['attemptid'], + $this->other['instanceid'], $this->contextinstanceid); } /** diff --git a/mod/wiki/classes/event/comments_viewed.php b/mod/wiki/classes/event/comments_viewed.php index bd4cb708aa6..d36f439b2ee 100644 --- a/mod/wiki/classes/event/comments_viewed.php +++ b/mod/wiki/classes/event/comments_viewed.php @@ -61,7 +61,7 @@ class comments_viewed extends \core\event\comments_viewed { */ protected function get_legacy_logdata() { return(array($this->courseid, 'wiki', 'comments', - 'comments.php?pageid=' . $this->objectid, $this->objectid, $this->context->instanceid)); + 'comments.php?pageid=' . $this->objectid, $this->objectid, $this->contextinstanceid)); } /** diff --git a/mod/wiki/classes/event/page_created.php b/mod/wiki/classes/event/page_created.php index 6381ee82c7d..189132dd385 100644 --- a/mod/wiki/classes/event/page_created.php +++ b/mod/wiki/classes/event/page_created.php @@ -69,7 +69,7 @@ class page_created extends \core\event\base { */ protected function get_legacy_logdata() { return(array($this->courseid, 'wiki', 'add page', - 'view.php?pageid=' . $this->objectid, $this->objectid, $this->context->instanceid)); + 'view.php?pageid=' . $this->objectid, $this->objectid, $this->contextinstanceid)); } /** diff --git a/mod/wiki/classes/event/page_deleted.php b/mod/wiki/classes/event/page_deleted.php index 30ca84b5029..41e526e5f58 100644 --- a/mod/wiki/classes/event/page_deleted.php +++ b/mod/wiki/classes/event/page_deleted.php @@ -75,7 +75,7 @@ class page_deleted extends \core\event\base { */ protected function get_legacy_logdata() { return(array($this->courseid, 'wiki', 'admin', 'admin.php?pageid=' . $this->objectid, $this->objectid, - $this->context->instanceid)); + $this->contextinstanceid)); } /** diff --git a/mod/wiki/classes/event/page_diff_viewed.php b/mod/wiki/classes/event/page_diff_viewed.php index 2dd39dd5f74..b837a09f23e 100644 --- a/mod/wiki/classes/event/page_diff_viewed.php +++ b/mod/wiki/classes/event/page_diff_viewed.php @@ -77,7 +77,7 @@ class page_diff_viewed extends \core\event\base { protected function get_legacy_logdata() { return(array($this->courseid, 'wiki', 'diff', 'diff.php?pageid=' . $this->objectid . '&comparewith=' . $this->other['comparewith'] . '&compare=' . $this->other['compare'], $this->objectid, - $this->context->instanceid)); + $this->contextinstanceid)); } /** diff --git a/mod/wiki/classes/event/page_history_viewed.php b/mod/wiki/classes/event/page_history_viewed.php index 6e59e975601..ff1e5187dd0 100644 --- a/mod/wiki/classes/event/page_history_viewed.php +++ b/mod/wiki/classes/event/page_history_viewed.php @@ -69,7 +69,7 @@ class page_history_viewed extends \core\event\base { */ protected function get_legacy_logdata() { return(array($this->courseid, 'wiki', 'history', - 'history.php?pageid=' . $this->objectid, $this->objectid, $this->context->instanceid)); + 'history.php?pageid=' . $this->objectid, $this->objectid, $this->contextinstanceid)); } /** diff --git a/mod/wiki/classes/event/page_locks_deleted.php b/mod/wiki/classes/event/page_locks_deleted.php index 8971936b2c8..1ae2b32b82a 100644 --- a/mod/wiki/classes/event/page_locks_deleted.php +++ b/mod/wiki/classes/event/page_locks_deleted.php @@ -75,7 +75,7 @@ class page_locks_deleted extends \core\event\base { */ protected function get_legacy_logdata() { return(array($this->courseid, 'wiki', 'overridelocks', 'view.php?pageid=' . $this->objectid, $this->objectid, - $this->context->instanceid)); + $this->contextinstanceid)); } /** diff --git a/mod/wiki/classes/event/page_map_viewed.php b/mod/wiki/classes/event/page_map_viewed.php index abc7e903b60..70bb3f33952 100644 --- a/mod/wiki/classes/event/page_map_viewed.php +++ b/mod/wiki/classes/event/page_map_viewed.php @@ -75,7 +75,7 @@ class page_map_viewed extends \core\event\base { */ protected function get_legacy_logdata() { return(array($this->courseid, 'wiki', 'map', - 'map.php?pageid=' . $this->objectid, $this->objectid, $this->context->instanceid)); + 'map.php?pageid=' . $this->objectid, $this->objectid, $this->contextinstanceid)); } /** diff --git a/mod/wiki/classes/event/page_updated.php b/mod/wiki/classes/event/page_updated.php index a0c60df4e0b..8075e381786 100644 --- a/mod/wiki/classes/event/page_updated.php +++ b/mod/wiki/classes/event/page_updated.php @@ -75,7 +75,7 @@ class page_updated extends \core\event\base { */ protected function get_legacy_logdata() { return(array($this->courseid, 'wiki', 'edit', 'view.php?pageid=' . $this->objectid, $this->objectid, - $this->context->instanceid)); + $this->contextinstanceid)); } /** diff --git a/mod/wiki/classes/event/page_version_deleted.php b/mod/wiki/classes/event/page_version_deleted.php index 3ece834d903..a9a6f4ded5e 100644 --- a/mod/wiki/classes/event/page_version_deleted.php +++ b/mod/wiki/classes/event/page_version_deleted.php @@ -76,7 +76,7 @@ class page_version_deleted extends \core\event\base { */ protected function get_legacy_logdata() { return(array($this->courseid, 'wiki', 'admin', 'admin.php?pageid=' . $this->other['pageid'], $this->other['pageid'], - $this->context->instanceid)); + $this->contextinstanceid)); } /** diff --git a/mod/wiki/classes/event/page_version_restored.php b/mod/wiki/classes/event/page_version_restored.php index 99e038906c5..e1cad39d849 100644 --- a/mod/wiki/classes/event/page_version_restored.php +++ b/mod/wiki/classes/event/page_version_restored.php @@ -75,7 +75,7 @@ class page_version_restored extends \core\event\base { */ protected function get_legacy_logdata() { return(array($this->courseid, 'wiki', 'restore', - 'view.php?pageid=' . $this->other['pageid'], $this->other['pageid'], $this->context->instanceid)); + 'view.php?pageid=' . $this->other['pageid'], $this->other['pageid'], $this->contextinstanceid)); } /** diff --git a/mod/wiki/classes/event/page_version_viewed.php b/mod/wiki/classes/event/page_version_viewed.php index 5304ed8e5c2..15158b64992 100644 --- a/mod/wiki/classes/event/page_version_viewed.php +++ b/mod/wiki/classes/event/page_version_viewed.php @@ -77,7 +77,7 @@ class page_version_viewed extends \core\event\base { protected function get_legacy_logdata() { return(array($this->courseid, 'wiki', 'history', 'viewversion.php?pageid=' . $this->objectid . '&versionid=' . $this->other['versionid'], - $this->objectid, $this->context->instanceid)); + $this->objectid, $this->contextinstanceid)); } /** diff --git a/mod/wiki/classes/event/page_viewed.php b/mod/wiki/classes/event/page_viewed.php index c1153c923b2..f6d2ca5b942 100644 --- a/mod/wiki/classes/event/page_viewed.php +++ b/mod/wiki/classes/event/page_viewed.php @@ -71,13 +71,13 @@ class page_viewed extends \core\event\base { if (!empty($this->other['wid'])) { return(array($this->courseid, 'wiki', 'view', 'view.php?wid=' . $this->data['other']['wid'] . '&title=' . $this->data['other']['title'], - $this->data['other']['wid'], $this->context->instanceid)); + $this->data['other']['wid'], $this->contextinstanceid)); } else if (!empty($this->other['prettyview'])) { return(array($this->courseid, 'wiki', 'view', - 'prettyview.php?pageid=' . $this->objectid, $this->objectid, $this->context->instanceid)); + 'prettyview.php?pageid=' . $this->objectid, $this->objectid, $this->contextinstanceid)); } else { return(array($this->courseid, 'wiki', 'view', - 'view.php?pageid=' . $this->objectid, $this->objectid, $this->context->instanceid)); + 'view.php?pageid=' . $this->objectid, $this->objectid, $this->contextinstanceid)); } } diff --git a/mod/workshop/classes/event/assessable_uploaded.php b/mod/workshop/classes/event/assessable_uploaded.php index bef08cdc6eb..591fb6c5b8f 100644 --- a/mod/workshop/classes/event/assessable_uploaded.php +++ b/mod/workshop/classes/event/assessable_uploaded.php @@ -66,7 +66,7 @@ class assessable_uploaded extends \core\event\assessable_uploaded { protected function get_legacy_eventdata() { $eventdata = new \stdClass(); $eventdata->modulename = 'workshop'; - $eventdata->cmid = $this->context->instanceid; + $eventdata->cmid = $this->contextinstanceid; $eventdata->itemid = $this->objectid; $eventdata->courseid = $this->courseid; $eventdata->userid = $this->userid; @@ -111,7 +111,7 @@ class assessable_uploaded extends \core\event\assessable_uploaded { */ public function get_url() { return new \moodle_url('/mod/workshop/submission.php', - array('cmid' => $this->context->instanceid, 'id' => $this->objectid)); + array('cmid' => $this->contextinstanceid, 'id' => $this->objectid)); } /** diff --git a/mod/workshop/classes/event/course_module_viewed.php b/mod/workshop/classes/event/course_module_viewed.php index b1870d07ccb..c5b8d51a849 100644 --- a/mod/workshop/classes/event/course_module_viewed.php +++ b/mod/workshop/classes/event/course_module_viewed.php @@ -62,7 +62,7 @@ class course_module_viewed extends \core\event\course_module_viewed { $workshop = $this->get_record_snapshot('workshop', $this->objectid); $course = $this->get_record_snapshot('course', $this->courseid); - $cm = $this->get_record_snapshot('course_modules', $this->context->instanceid); + $cm = $this->get_record_snapshot('course_modules', $this->contextinstanceid); $workshop = new \workshop($workshop, $cm, $course); return (object)array('workshop' => $workshop, 'user' => $USER); }