MDL-43557 events: fixed minor issues in existing events
authorMark Nelson <markn@moodle.com>
Thu, 24 Apr 2014 00:41:12 +0000 (17:41 -0700)
committerMark Nelson <markn@moodle.com>
Wed, 30 Apr 2014 02:16:11 +0000 (19:16 -0700)
319 files changed:
admin/tool/capability/classes/event/report_viewed.php
badges/classes/observer.php
blog/tests/bloglib_test.php
calendar/tests/events_test.php [moved from calendar/tests/event_test.php with 93% similarity]
completion/completion_completion.php
course/tests/courselib_test.php
lib/accesslib.php
lib/classes/event/assessable_submitted.php
lib/classes/event/assessable_uploaded.php
lib/classes/event/blog_association_created.php
lib/classes/event/blog_comment_created.php
lib/classes/event/blog_comment_deleted.php
lib/classes/event/blog_entries_viewed.php
lib/classes/event/blog_entry_created.php
lib/classes/event/blog_entry_deleted.php
lib/classes/event/blog_entry_updated.php
lib/classes/event/calendar_event_created.php
lib/classes/event/calendar_event_deleted.php
lib/classes/event/calendar_event_updated.php
lib/classes/event/cohort_created.php
lib/classes/event/cohort_deleted.php
lib/classes/event/cohort_member_added.php
lib/classes/event/cohort_member_removed.php
lib/classes/event/cohort_updated.php
lib/classes/event/comment_created.php
lib/classes/event/comment_deleted.php
lib/classes/event/comments_viewed.php
lib/classes/event/content_viewed.php
lib/classes/event/course_category_created.php
lib/classes/event/course_category_deleted.php
lib/classes/event/course_category_updated.php
lib/classes/event/course_completed.php
lib/classes/event/course_completion_updated.php
lib/classes/event/course_content_deleted.php
lib/classes/event/course_created.php
lib/classes/event/course_deleted.php
lib/classes/event/course_module_completion_updated.php
lib/classes/event/course_module_created.php
lib/classes/event/course_module_deleted.php
lib/classes/event/course_module_instance_list_viewed.php
lib/classes/event/course_module_updated.php
lib/classes/event/course_module_viewed.php
lib/classes/event/course_reset_ended.php
lib/classes/event/course_reset_started.php
lib/classes/event/course_resources_list_viewed.php
lib/classes/event/course_restored.php
lib/classes/event/course_section_updated.php
lib/classes/event/course_updated.php
lib/classes/event/course_user_report_viewed.php
lib/classes/event/course_viewed.php
lib/classes/event/email_failed.php
lib/classes/event/group_created.php
lib/classes/event/group_deleted.php
lib/classes/event/group_member_added.php
lib/classes/event/group_member_removed.php
lib/classes/event/group_updated.php
lib/classes/event/grouping_created.php
lib/classes/event/grouping_deleted.php
lib/classes/event/grouping_updated.php
lib/classes/event/message_contact_added.php
lib/classes/event/message_contact_blocked.php
lib/classes/event/message_contact_removed.php
lib/classes/event/message_contact_unblocked.php
lib/classes/event/message_sent.php
lib/classes/event/message_viewed.php
lib/classes/event/mnet_access_control_created.php
lib/classes/event/mnet_access_control_updated.php
lib/classes/event/note_created.php
lib/classes/event/note_deleted.php
lib/classes/event/note_updated.php
lib/classes/event/notes_viewed.php
lib/classes/event/question_category_created.php
lib/classes/event/recent_activity_viewed.php
lib/classes/event/role_allow_assign_updated.php
lib/classes/event/role_allow_override_updated.php
lib/classes/event/role_allow_switch_updated.php
lib/classes/event/role_assigned.php
lib/classes/event/role_capabilities_updated.php
lib/classes/event/role_deleted.php
lib/classes/event/role_unassigned.php
lib/classes/event/tag_added.php
lib/classes/event/tag_created.php
lib/classes/event/tag_deleted.php
lib/classes/event/tag_flagged.php
lib/classes/event/tag_removed.php
lib/classes/event/tag_unflagged.php
lib/classes/event/tag_updated.php
lib/classes/event/unknown_logged.php
lib/classes/event/user_created.php
lib/classes/event/user_deleted.php
lib/classes/event/user_enrolment_created.php
lib/classes/event/user_enrolment_deleted.php
lib/classes/event/user_enrolment_updated.php
lib/classes/event/user_graded.php
lib/classes/event/user_list_viewed.php
lib/classes/event/user_loggedin.php
lib/classes/event/user_loggedinas.php
lib/classes/event/user_loggedout.php
lib/classes/event/user_login_failed.php
lib/classes/event/user_password_updated.php
lib/classes/event/user_profile_viewed.php
lib/classes/event/user_updated.php
lib/classes/event/webservice_function_called.php
lib/classes/event/webservice_login_failed.php
lib/classes/event/webservice_service_created.php
lib/classes/event/webservice_service_deleted.php
lib/classes/event/webservice_service_updated.php
lib/classes/event/webservice_service_user_added.php
lib/classes/event/webservice_service_user_removed.php
lib/classes/event/webservice_token_created.php
lib/classes/event/webservice_token_sent.php
lib/completionlib.php
lib/tests/authlib_test.php
lib/tests/completionlib_test.php
lib/tests/fixtures/event_fixtures.php
mod/assign/classes/event/all_submissions_downloaded.php
mod/assign/classes/event/assessable_submitted.php
mod/assign/classes/event/base.php
mod/assign/classes/event/batch_set_marker_allocation_viewed.php
mod/assign/classes/event/batch_set_workflow_state_viewed.php
mod/assign/classes/event/course_module_instance_list_viewed.php
mod/assign/classes/event/extension_granted.php
mod/assign/classes/event/feedback_viewed.php
mod/assign/classes/event/grading_form_viewed.php
mod/assign/classes/event/grading_table_viewed.php
mod/assign/classes/event/identities_revealed.php
mod/assign/classes/event/marker_updated.php
mod/assign/classes/event/reveal_identities_confirmation_page_viewed.php
mod/assign/classes/event/statement_accepted.php
mod/assign/classes/event/submission_confirmation_form_viewed.php
mod/assign/classes/event/submission_created.php
mod/assign/classes/event/submission_duplicated.php
mod/assign/classes/event/submission_form_viewed.php
mod/assign/classes/event/submission_graded.php
mod/assign/classes/event/submission_locked.php
mod/assign/classes/event/submission_status_updated.php
mod/assign/classes/event/submission_status_viewed.php
mod/assign/classes/event/submission_unlocked.php
mod/assign/classes/event/submission_updated.php
mod/assign/classes/event/submission_viewed.php
mod/assign/classes/event/workflow_state_updated.php
mod/assign/submission/comments/classes/event/comment_created.php
mod/assign/submission/comments/classes/event/comment_deleted.php
mod/assign/submission/file/classes/event/assessable_uploaded.php
mod/assign/submission/file/classes/event/submission_created.php
mod/assign/submission/file/classes/event/submission_updated.php
mod/assign/submission/onlinetext/classes/event/assessable_uploaded.php
mod/assign/submission/onlinetext/classes/event/submission_created.php
mod/assign/submission/onlinetext/classes/event/submission_updated.php
mod/book/classes/event/chapter_created.php
mod/book/classes/event/chapter_deleted.php
mod/book/classes/event/chapter_updated.php
mod/book/classes/event/chapter_viewed.php
mod/book/classes/event/course_module_instance_list_viewed.php
mod/book/classes/event/course_module_viewed.php
mod/book/tool/exportimscp/classes/event/book_exported.php
mod/book/tool/print/classes/event/book_printed.php
mod/book/tool/print/classes/event/chapter_printed.php
mod/chat/classes/event/course_module_instance_list_viewed.php
mod/chat/classes/event/course_module_viewed.php
mod/chat/classes/event/message_sent.php
mod/chat/classes/event/sessions_viewed.php
mod/choice/classes/event/answer_submitted.php
mod/choice/classes/event/answer_updated.php
mod/choice/classes/event/course_module_instance_list_viewed.php
mod/choice/classes/event/course_module_viewed.php
mod/choice/classes/event/report_viewed.php
mod/data/classes/event/comment_created.php
mod/data/classes/event/comment_deleted.php
mod/data/classes/event/course_module_instance_list_viewed.php
mod/data/classes/event/course_module_viewed.php
mod/data/classes/event/field_created.php
mod/data/classes/event/field_deleted.php
mod/data/classes/event/field_updated.php
mod/data/classes/event/record_created.php
mod/data/classes/event/record_deleted.php
mod/data/classes/event/record_updated.php
mod/data/classes/event/template_updated.php
mod/data/classes/event/template_viewed.php
mod/feedback/classes/event/course_module_instance_list_viewed.php
mod/feedback/classes/event/course_module_viewed.php
mod/feedback/classes/event/response_deleted.php
mod/feedback/classes/event/response_submitted.php
mod/feedback/tests/events_test.php
mod/folder/classes/event/course_module_instance_list_viewed.php
mod/folder/classes/event/course_module_viewed.php
mod/folder/classes/event/folder_updated.php
mod/forum/classes/event/assessable_uploaded.php
mod/forum/classes/event/course_module_instance_list_viewed.php
mod/forum/classes/event/course_module_viewed.php
mod/forum/classes/event/course_searched.php
mod/forum/classes/event/discussion_created.php
mod/forum/classes/event/discussion_deleted.php
mod/forum/classes/event/discussion_moved.php
mod/forum/classes/event/discussion_updated.php
mod/forum/classes/event/discussion_viewed.php
mod/forum/classes/event/post_created.php
mod/forum/classes/event/post_deleted.php
mod/forum/classes/event/post_updated.php
mod/forum/classes/event/readtracking_disabled.php
mod/forum/classes/event/readtracking_enabled.php
mod/forum/classes/event/subscribers_viewed.php
mod/forum/classes/event/subscription_created.php
mod/forum/classes/event/subscription_deleted.php
mod/forum/classes/event/user_report_viewed.php
mod/forum/lib.php
mod/forum/tests/events_test.php
mod/glossary/classes/event/category_created.php
mod/glossary/classes/event/category_deleted.php
mod/glossary/classes/event/category_updated.php
mod/glossary/classes/event/comment_created.php
mod/glossary/classes/event/comment_deleted.php
mod/glossary/classes/event/course_module_instance_list_viewed.php
mod/glossary/classes/event/course_module_viewed.php
mod/glossary/classes/event/entry_approved.php
mod/glossary/classes/event/entry_created.php
mod/glossary/classes/event/entry_deleted.php
mod/glossary/classes/event/entry_disapproved.php
mod/glossary/classes/event/entry_updated.php
mod/glossary/classes/event/entry_viewed.php
mod/imscp/classes/event/course_module_instance_list_viewed.php
mod/imscp/classes/event/course_module_viewed.php
mod/lesson/classes/event/course_module_instance_list_viewed.php
mod/lesson/classes/event/course_module_viewed.php
mod/lesson/classes/event/essay_assessed.php
mod/lesson/classes/event/essay_attempt_viewed.php
mod/lesson/classes/event/highscore_added.php
mod/lesson/classes/event/highscores_viewed.php
mod/lesson/classes/event/lesson_ended.php
mod/lesson/classes/event/lesson_started.php
mod/lti/classes/event/course_module_instance_list_viewed.php
mod/lti/classes/event/course_module_viewed.php
mod/lti/classes/event/unknown_service_api_called.php
mod/page/classes/event/course_module_instance_list_viewed.php
mod/page/classes/event/course_module_viewed.php
mod/quiz/classes/event/attempt_abandoned.php
mod/quiz/classes/event/attempt_becameoverdue.php
mod/quiz/classes/event/attempt_deleted.php
mod/quiz/classes/event/attempt_preview_started.php
mod/quiz/classes/event/attempt_reviewed.php
mod/quiz/classes/event/attempt_started.php
mod/quiz/classes/event/attempt_submitted.php
mod/quiz/classes/event/attempt_summary_viewed.php
mod/quiz/classes/event/attempt_viewed.php
mod/quiz/classes/event/course_module_instance_list_viewed.php
mod/quiz/classes/event/course_module_viewed.php
mod/quiz/classes/event/edit_page_viewed.php
mod/quiz/classes/event/group_override_created.php
mod/quiz/classes/event/group_override_deleted.php
mod/quiz/classes/event/group_override_updated.php
mod/quiz/classes/event/question_manually_graded.php
mod/quiz/classes/event/report_viewed.php
mod/quiz/classes/event/user_override_created.php
mod/quiz/classes/event/user_override_deleted.php
mod/quiz/classes/event/user_override_updated.php
mod/resource/classes/event/course_module_instance_list_viewed.php
mod/resource/classes/event/course_module_viewed.php
mod/scorm/classes/event/attempt_deleted.php
mod/scorm/classes/event/course_module_instance_list_viewed.php
mod/scorm/classes/event/course_module_viewed.php
mod/scorm/classes/event/interactions_viewed.php
mod/scorm/classes/event/report_viewed.php
mod/scorm/classes/event/sco_launched.php
mod/scorm/classes/event/tracks_viewed.php
mod/scorm/classes/event/user_report_viewed.php
mod/scorm/report.php
mod/scorm/tests/events_test.php [moved from mod/scorm/tests/event_test.php with 96% similarity]
mod/survey/classes/event/course_module_instance_list_viewed.php
mod/survey/classes/event/course_module_viewed.php
mod/survey/classes/event/report_downloaded.php
mod/survey/classes/event/report_viewed.php
mod/survey/classes/event/response_submitted.php
mod/url/classes/event/course_module_instance_list_viewed.php
mod/url/classes/event/course_module_viewed.php
mod/wiki/classes/event/comment_created.php
mod/wiki/classes/event/comment_deleted.php
mod/wiki/classes/event/comments_viewed.php
mod/wiki/classes/event/course_module_instance_list_viewed.php
mod/wiki/classes/event/course_module_viewed.php
mod/wiki/classes/event/page_created.php
mod/wiki/classes/event/page_deleted.php
mod/wiki/classes/event/page_diff_viewed.php
mod/wiki/classes/event/page_history_viewed.php
mod/wiki/classes/event/page_locks_deleted.php
mod/wiki/classes/event/page_map_viewed.php
mod/wiki/classes/event/page_updated.php
mod/wiki/classes/event/page_version_deleted.php
mod/wiki/classes/event/page_version_restored.php
mod/wiki/classes/event/page_version_viewed.php
mod/wiki/classes/event/page_viewed.php
mod/workshop/assessment.php
mod/workshop/classes/event/assessable_uploaded.php
mod/workshop/classes/event/assessment_evaluated.php
mod/workshop/classes/event/assessment_evaluations_reset.php
mod/workshop/classes/event/assessment_reevaluated.php
mod/workshop/classes/event/assessments_reset.php
mod/workshop/classes/event/course_module_instance_list_viewed.php
mod/workshop/classes/event/course_module_viewed.php
mod/workshop/classes/event/phase_switched.php
mod/workshop/classes/event/submission_assessed.php
mod/workshop/classes/event/submission_created.php
mod/workshop/classes/event/submission_reassessed.php
mod/workshop/classes/event/submission_updated.php
mod/workshop/classes/event/submission_viewed.php
mod/workshop/locallib.php
mod/workshop/tests/events_test.php
mod/workshop/toolbox.php
report/completion/classes/event/report_viewed.php
report/completion/classes/event/user_report_viewed.php
report/log/classes/event/report_viewed.php
report/log/classes/event/user_report_viewed.php
report/loglive/classes/event/report_viewed.php
report/outline/classes/event/activity_report_viewed.php
report/outline/classes/event/report_viewed.php
report/participation/classes/event/report_viewed.php
report/questioninstances/classes/event/report_viewed.php
report/stats/classes/event/report_viewed.php
report/stats/classes/event/user_report_viewed.php
user/index.php

index 0287dc7..e0f65f3 100644 (file)
@@ -15,7 +15,7 @@
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
- * Event for when capability report is viewed.
+ * The tool_capability report viewed event.
  *
  * @package    tool_capability
  * @copyright  2014 Petr Skoda
@@ -24,7 +24,7 @@
 namespace tool_capability\event;
 
 /**
- * Event triggered, when capability report is viewed.
+ * The tool_capability report viewed event class.
  *
  * @package    tool_capability
  * @since      Moodle 2.7
@@ -59,7 +59,7 @@ class report_viewed extends \core\event\base {
      * @return string
      */
     public function get_description() {
-        return "The user with id " . $this->userid . " viewed capability overview report";
+        return "The user with the id '$this->userid' viewed the capability overview report.";
     }
 
     /**
index a2859e4..34cf105 100644 (file)
@@ -81,7 +81,7 @@ class core_badges_observer {
             require_once($CFG->dirroot.'/lib/badgeslib.php');
 
             $eventdata = $event->get_record_snapshot('course_completions', $event->objectid);
-            $userid = $event->other['relateduserid'];
+            $userid = $event->relateduserid;
             $courseid = $event->courseid;
 
             // Need to take into account that course can be a part of course_completion and courseset_completion criteria.
index 87c78bb..cf1c1de 100644 (file)
@@ -328,7 +328,7 @@ class core_bloglib_testcase extends advanced_testcase {
                 'objectid' => 3,
                 'other' => array('associateid' => 2 , 'blogid' => 3, 'subject' => 'blog subject')));
         } catch (coding_exception $e) {
-            $this->assertContains('Invalid associatetype', $e->getMessage());
+            $this->assertContains('The \'associatetype\' value must be set in other and be a valid type.', $e->getMessage());
         }
         try {
             \core\event\blog_association_created::create(array(
@@ -336,7 +336,7 @@ class core_bloglib_testcase extends advanced_testcase {
                 'objectid' => 3,
                 'other' => array('associateid' => 2 , 'blogid' => 3, 'associatetype' => 'random', 'subject' => 'blog subject')));
         } catch (coding_exception $e) {
-            $this->assertContains('Invalid associatetype', $e->getMessage());
+            $this->assertContains('The \'associatetype\' value must be set in other and be a valid type.', $e->getMessage());
         }
         // Make sure associateid validations work.
         try {
@@ -345,7 +345,7 @@ class core_bloglib_testcase extends advanced_testcase {
                 'objectid' => 3,
                 'other' => array('blogid' => 3, 'associatetype' => 'course', 'subject' => 'blog subject')));
         } catch (coding_exception $e) {
-            $this->assertContains('Associate id must be set', $e->getMessage());
+            $this->assertContains('The \'associateid\' value must be set in other.', $e->getMessage());
         }
         // Make sure blogid validations work.
         try {
@@ -354,7 +354,7 @@ class core_bloglib_testcase extends advanced_testcase {
                 'objectid' => 3,
                 'other' => array('associateid' => 3, 'associatetype' => 'course', 'subject' => 'blog subject')));
         } catch (coding_exception $e) {
-            $this->assertContains('Blog id must be set', $e->getMessage());
+            $this->assertContains('The \'blogid\' value must be set in other.', $e->getMessage());
         }
         // Make sure blogid validations work.
         try {
@@ -363,7 +363,7 @@ class core_bloglib_testcase extends advanced_testcase {
                 'objectid' => 3,
                 'other' => array('blogid' => 3, 'associateid' => 3, 'associatetype' => 'course')));
         } catch (coding_exception $e) {
-            $this->assertContains('Subject must be set', $e->getMessage());
+            $this->assertContains('The \'subject\' value must be set in other.', $e->getMessage());
         }
     }
 
similarity index 93%
rename from calendar/tests/event_test.php
rename to calendar/tests/events_test.php
index d145d29..a0b3968 100644 (file)
@@ -33,7 +33,7 @@ require_once($CFG->dirroot . '/calendar/tests/externallib_test.php');
  * @copyright 2014 Ankit Agarwal <ankit.agrr@gmail.com>
  * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-class core_calendar_event_testcase extends advanced_testcase {
+class core_calendar_events_testcase extends advanced_testcase {
 
     /**
      * The test user.
@@ -126,7 +126,7 @@ class core_calendar_event_testcase extends advanced_testcase {
             $this->fail("Event validation should not allow \\core\\event\\calendar_event_created to be triggered without
                     other['repeatid']");
         } catch (coding_exception $e) {
-            $this->assertContains("Field other['repeatid'] must be set", $e->getMessage());
+            $this->assertContains('The \'repeatid\' value must be set in other.', $e->getMessage());
         }
 
         // Test not setting other['name'].
@@ -142,7 +142,7 @@ class core_calendar_event_testcase extends advanced_testcase {
             $this->fail("Event validation should not allow \\core\\event\\calendar_event_created to be triggered without
                     other['name']");
         } catch (coding_exception $e) {
-            $this->assertContains("Field other['name'] cannot be empty", $e->getMessage());
+            $this->assertContains('The \'name\' value must be set in other.', $e->getMessage());
         }
 
         // Test not setting other['timestart'].
@@ -158,7 +158,7 @@ class core_calendar_event_testcase extends advanced_testcase {
             $this->fail("Event validation should not allow \\core\\event\\calendar_event_deleted to be triggered without
                     other['timestart']");
         } catch (coding_exception $e) {
-            $this->assertContains("Field other['timestart'] cannot be empty", $e->getMessage());
+            $this->assertContains('The \'timestart\' value must be set in other.', $e->getMessage());
         }
     }
 
@@ -239,7 +239,7 @@ class core_calendar_event_testcase extends advanced_testcase {
             $this->fail("Event validation should not allow \\core\\event\\calendar_event_updated to be triggered without
                     other['repeatid']");
         } catch (coding_exception $e) {
-            $this->assertContains("Field other['repeatid'] must be set", $e->getMessage());
+            $this->assertContains('The \'repeatid\' value must be set in other.', $e->getMessage());
         }
 
         // Test not setting other['name'].
@@ -255,7 +255,7 @@ class core_calendar_event_testcase extends advanced_testcase {
             $this->fail("Event validation should not allow \\core\\event\\calendar_event_updated to be triggered without
                     other['name']");
         } catch (coding_exception $e) {
-            $this->assertContains("Field other['name'] cannot be empty", $e->getMessage());
+            $this->assertContains('The \'name\' value must be set in other.', $e->getMessage());
         }
 
         // Test not setting other['timestart'].
@@ -271,7 +271,7 @@ class core_calendar_event_testcase extends advanced_testcase {
             $this->fail("Event validation should not allow \\core\\event\\calendar_event_deleted to be triggered without
                     other['timestart']");
         } catch (coding_exception $e) {
-            $this->assertContains("Field other['timestart'] cannot be empty", $e->getMessage());
+            $this->assertContains('The \'timestart\' value must be set in other.', $e->getMessage());
         }
     }
 
@@ -351,7 +351,7 @@ class core_calendar_event_testcase extends advanced_testcase {
             $this->fail("Event validation should not allow \\core\\event\\calendar_event_deleted to be triggered without
                     other['repeatid']");
         } catch (coding_exception $e) {
-            $this->assertContains("Field other['repeatid'] must be set", $e->getMessage());
+            $this->assertContains('The \'repeatid\' value must be set in other.', $e->getMessage());
         }
 
         // Test not setting other['name'].
@@ -367,7 +367,7 @@ class core_calendar_event_testcase extends advanced_testcase {
             $this->fail("Event validation should not allow \\core\\event\\calendar_event_deleted to be triggered without
                     other['name']");
         } catch (coding_exception $e) {
-            $this->assertContains("Field other['name'] cannot be empty", $e->getMessage());
+            $this->assertContains('The \'name\' value must be set in other.', $e->getMessage());
         }
 
         // Test not setting other['timestart'].
@@ -383,7 +383,7 @@ class core_calendar_event_testcase extends advanced_testcase {
             $this->fail("Event validation should not allow \\core\\event\\calendar_event_deleted to be triggered without
                     other['timestart']");
         } catch (coding_exception $e) {
-            $this->assertContains("Field other['timestart'] cannot be empty", $e->getMessage());
+            $this->assertContains('The \'timestart\' value must be set in other.', $e->getMessage());
         }
     }
 }
index 52619b2..18c78dc 100644 (file)
@@ -165,9 +165,9 @@ class completion_completion extends data_object {
                 array(
                     'objectid' => $data->id,
                     'userid' => $USER->id,
+                    'relateduserid' => $data->userid,
                     'context' => context_course::instance($data->course),
-                    'courseid' => $data->course,
-                    'other' => array('relateduserid' => $data->userid)
+                    'courseid' => $data->course
                     )
                 );
             $event->add_record_snapshot('course_completions', $data);
index 12c9c43..fac80f9 100644 (file)
@@ -2014,7 +2014,7 @@ class core_course_courselib_testcase extends advanced_testcase {
             $this->fail("Event validation should not allow \\core\\event\\course_module_created to be triggered without
                     other['instanceid']");
         } catch (coding_exception $e) {
-            $this->assertContains("Field other['instanceid'] cannot be empty", $e->getMessage());
+            $this->assertContains("The 'instanceid' value must be set in other.", $e->getMessage());
         }
 
         // Test not setting modulename.
@@ -2031,7 +2031,7 @@ class core_course_courselib_testcase extends advanced_testcase {
             $this->fail("Event validation should not allow \\core\\event\\course_module_created to be triggered without
                     other['modulename']");
         } catch (coding_exception $e) {
-            $this->assertContains("Field other['modulename'] cannot be empty", $e->getMessage());
+            $this->assertContains("The 'modulename' value must be set in other.", $e->getMessage());
         }
 
         // Test not setting name.
@@ -2049,7 +2049,7 @@ class core_course_courselib_testcase extends advanced_testcase {
             $this->fail("Event validation should not allow \\core\\event\\course_module_created to be triggered without
                     other['name']");
         } catch (coding_exception $e) {
-            $this->assertContains("Field other['name'] cannot be empty", $e->getMessage());
+            $this->assertContains("The 'name' value must be set in other.", $e->getMessage());
         }
 
     }
@@ -2166,7 +2166,7 @@ class core_course_courselib_testcase extends advanced_testcase {
             $this->fail("Event validation should not allow \\core\\event\\course_module_updated to be triggered without
                     other['instanceid']");
         } catch (coding_exception $e) {
-            $this->assertContains("Field other['instanceid'] cannot be empty", $e->getMessage());
+            $this->assertContains("The 'instanceid' value must be set in other.", $e->getMessage());
         }
 
         // Test not setting modulename.
@@ -2183,7 +2183,7 @@ class core_course_courselib_testcase extends advanced_testcase {
             $this->fail("Event validation should not allow \\core\\event\\course_module_updated to be triggered without
                     other['modulename']");
         } catch (coding_exception $e) {
-            $this->assertContains("Field other['modulename'] cannot be empty", $e->getMessage());
+            $this->assertContains("The 'modulename' value must be set in other.", $e->getMessage());
         }
 
         // Test not setting name.
@@ -2201,7 +2201,7 @@ class core_course_courselib_testcase extends advanced_testcase {
             $this->fail("Event validation should not allow \\core\\event\\course_module_updated to be triggered without
                     other['name']");
         } catch (coding_exception $e) {
-            $this->assertContains("Field other['name'] cannot be empty", $e->getMessage());
+            $this->assertContains("The 'name' value must be set in other.", $e->getMessage());
         }
 
     }
@@ -2269,7 +2269,7 @@ class core_course_courselib_testcase extends advanced_testcase {
             $this->fail("Event validation should not allow \\core\\event\\course_module_deleted to be triggered without
                     other['instanceid']");
         } catch (coding_exception $e) {
-            $this->assertContains("Field other['instanceid'] cannot be empty", $e->getMessage());
+            $this->assertContains("The 'instanceid' value must be set in other.", $e->getMessage());
         }
 
         // Test not setting modulename.
@@ -2286,7 +2286,7 @@ class core_course_courselib_testcase extends advanced_testcase {
             $this->fail("Event validation should not allow \\core\\event\\course_module_deleted to be triggered without
                     other['modulename']");
         } catch (coding_exception $e) {
-            $this->assertContains("Field other['modulename'] cannot be empty", $e->getMessage());
+            $this->assertContains("The 'modulename' value must be set in other.", $e->getMessage());
         }
     }
 
@@ -2468,8 +2468,6 @@ class core_course_courselib_testcase extends advanced_testcase {
         $this->assertEquals(null, $event->objectid);
         $this->assertEquals($course->id, $event->courseid);
         $this->assertEquals($coursecontext->id, $event->contextid);
-        $expecteddesc = "User with id '$event->userid' viewed list of resources in course with id '$event->courseid'";
-        $this->assertEquals($expecteddesc, $event->get_description());
         $expectedlegacydata = array(
             array($course->id, "book", "view all", 'index.php?id=' . $course->id, ''),
             array($course->id, "page", "view all", 'index.php?id=' . $course->id, ''),
index d869d74..7d316c4 100644 (file)
@@ -1756,9 +1756,16 @@ function role_assign($roleid, $userid, $contextid, $component = '', $itemid = 0,
         reload_all_capabilities();
     }
 
-    $event = \core\event\role_assigned::create(
-        array('context'=>$context, 'objectid'=>$ra->roleid, 'relateduserid'=>$ra->userid,
-            'other'=>array('id'=>$ra->id, 'component'=>$ra->component, 'itemid'=>$ra->itemid)));
+    $event = \core\event\role_assigned::create(array(
+        'context' => $context,
+        'objectid' => $ra->roleid,
+        'relateduserid' => $ra->userid,
+        'other' => array(
+            'id' => $ra->id,
+            'component' => $ra->component,
+            'itemid' => $ra->itemid
+        )
+    ));
     $event->add_record_snapshot('role_assignments', $ra);
     $event->trigger();
 
@@ -1844,9 +1851,16 @@ function role_unassign_all(array $params, $subcontexts = false, $includemanual =
             if (!empty($USER->id) && $USER->id == $ra->userid) {
                 reload_all_capabilities();
             }
-            $event = \core\event\role_unassigned::create(
-                array('context'=>$context, 'objectid'=>$ra->roleid, 'relateduserid'=>$ra->userid,
-                    'other'=>array('id'=>$ra->id, 'component'=>$ra->component, 'itemid'=>$ra->itemid)));
+            $event = \core\event\role_unassigned::create(array(
+                'context' => $context,
+                'objectid' => $ra->roleid,
+                'relateduserid' => $ra->userid,
+                'other' => array(
+                    'id' => $ra->id,
+                    'component' => $ra->component,
+                    'itemid' => $ra->itemid
+                )
+            ));
             $event->add_record_snapshot('role_assignments', $ra);
             $event->trigger();
         }
index 62752af..95c3caa 100644 (file)
@@ -41,7 +41,7 @@ defined('MOODLE_INTERNAL') || die();
  * @copyright  2013 Frédéric Massart
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-abstract class assessable_submitted extends \core\event\base {
+abstract class assessable_submitted extends base {
 
     /**
      * Init method.
index 64fdabe..6c1a50c 100644 (file)
@@ -39,8 +39,8 @@ defined('MOODLE_INTERNAL') || die();
  * @property-read array $other {
  *      Extra information about event.
  *
- *      @type array pathnamehashes uploaded files path name hashes.
- *      @type string content string.
+ *      - array pathnamehashes: uploaded files path name hashes.
+ *      - string content: the content.
  * }
  *
  * @package    core
@@ -48,7 +48,7 @@ defined('MOODLE_INTERNAL') || die();
  * @copyright  2013 Frédéric Massart
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-abstract class assessable_uploaded extends \core\event\base {
+abstract class assessable_uploaded extends base {
 
     /**
      * Init method.
@@ -69,11 +69,11 @@ abstract class assessable_uploaded extends \core\event\base {
     protected function validate_data() {
         parent::validate_data();
         if ($this->contextlevel != CONTEXT_MODULE) {
-            throw new \coding_exception('Context passed must be module context.');
+            throw new \coding_exception('Context 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.');
+            throw new \coding_exception('The \'pathnamehashes\' value must be set in other and must be an array.');
         } else if (!isset($this->other['content']) || !is_string($this->other['content'])) {
-            throw new \coding_exception('content must be set in $other and must be a string.');
+            throw new \coding_exception('The \'content\' value must be set in other and must be a string.');
         }
     }
 
index 495a643..cf65eaa 100644 (file)
@@ -32,10 +32,10 @@ defined('MOODLE_INTERNAL') || die();
  * @property-read array $other {
  *      Extra information about event.
  *
- *      @type string associatetype type of blog association, course/coursemodule.
- *      @type int blogid id of blog.
- *      @type int associateid id of associate.
- *      @type string subject blog subject.
+ *      - string associatetype: type of blog association, course/coursemodule.
+ *      - int blogid: id of blog.
+ *      - int associateid: id of associate.
+ *      - string subject: blog subject.
  * }
  *
  * @package    core
@@ -43,7 +43,7 @@ defined('MOODLE_INTERNAL') || die();
  * @copyright  2013 onwards Ankit Agarwal
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-class blog_association_created extends \core\event\base {
+class blog_association_created extends base {
 
     /**
      * Set basic properties for the event.
@@ -70,8 +70,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 "The blog entry with the id '{$this->other['blogid']}' was associated with the context '{$this->other['associatetype']}' with " .
+            "the id '{$this->other['associateid']}' by the user with the id '$this->userid'.";
     }
 
     /**
@@ -91,10 +91,10 @@ class blog_association_created extends \core\event\base {
         if ($this->other['associatetype'] === 'course') {
             return array (SITEID, 'blog', 'add association', 'index.php?userid=' . $this->relateduserid. '&entryid=' .
                     $this->other['blogid'], $this->other['subject'], 0, $this->relateduserid);
-        } else {
-            return array (SITEID, 'blog', 'add association', 'index.php?userid=' . $this->relateduserid. '&entryid=' .
-                    $this->other['blogid'], $this->other['subject'], $this->other['associateid'], $this->relateduserid);
         }
+
+        return array (SITEID, 'blog', 'add association', 'index.php?userid=' . $this->relateduserid. '&entryid=' .
+                $this->other['blogid'], $this->other['subject'], $this->other['associateid'], $this->relateduserid);
     }
 
     /**
@@ -105,15 +105,16 @@ class blog_association_created extends \core\event\base {
      */
     protected function validate_data() {
         parent::validate_data();
+
         if (empty($this->other['associatetype']) || ($this->other['associatetype'] !== 'course'
                 && $this->other['associatetype'] !== 'coursemodule')) {
-            throw new \coding_exception('Invalid associatetype in event blog_association_created.');
+            throw new \coding_exception('The \'associatetype\' value must be set in other and be a valid type.');
         } else if (!isset($this->other['blogid'])) {
-            throw new \coding_exception('Blog id must be set in event blog_association_created.');
+            throw new \coding_exception('The \'blogid\' value must be set in other.');
         } else if (!isset($this->other['associateid'])) {
-            throw new \coding_exception('Associate id must be set in event blog_association_created.');
+            throw new \coding_exception('The \'associateid\' value must be set in other.');
         } else if (!isset($this->other['subject'])) {
-            throw new \coding_exception('Subject must be set in event blog_association_created.');
+            throw new \coding_exception('The \'subject\' value must be set in other.');
         }
     }
 }
index 3bd1005..b15e118 100644 (file)
@@ -15,7 +15,7 @@
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
- * blog comment created event.
+ * The blog comment created event.
  *
  * @package    core
  * @copyright  2013 Rajesh Taneja <rajesh@moodle.com>
@@ -26,14 +26,15 @@ namespace core\event;
 defined('MOODLE_INTERNAL') || die();
 
 /**
- * blog comment created event.
+ * The blog comment created event.
  *
  * @package    core
  * @since      Moodle 2.7
  * @copyright  2013 Rajesh Taneja <rajesh@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-class blog_comment_created extends \core\event\comment_created {
+class blog_comment_created extends comment_created {
+
     /**
      * Get URL related to the action.
      *
@@ -49,6 +50,6 @@ class blog_comment_created extends \core\event\comment_created {
      * @return string
      */
     public function get_description() {
-        return 'User with id ' . $this->userid . ' added comment for blog with id ' . $this->other['itemid'];
+        return "The user with the id '$this->userid' added a comment to the blog with the id '{$this->other['itemid']}'.";
     }
 }
index 4e07272..068ab77 100644 (file)
@@ -15,7 +15,7 @@
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
- * blog comment deleted event.
+ * The blog comment deleted event.
  *
  * @package    core
  * @copyright  2013 Rajesh Taneja <rajesh@moodle.com>
@@ -26,14 +26,15 @@ namespace core\event;
 defined('MOODLE_INTERNAL') || die();
 
 /**
- * blog comment deleted event.
+ * The blog comment deleted event.
  *
  * @package    core
  * @since      Moodle 2.7
  * @copyright  2013 Rajesh Taneja <rajesh@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-class blog_comment_deleted extends \core\event\comment_deleted {
+class blog_comment_deleted extends comment_deleted {
+
     /**
      * Get URL related to the action.
      *
@@ -49,6 +50,6 @@ class blog_comment_deleted extends \core\event\comment_deleted {
      * @return string
      */
     public function get_description() {
-        return 'User with id ' . $this->userid . ' deleted comment for blog with id ' . $this->other['itemid'];
+        return "The user with the id '$this->userid' deleted comment for the blog with the id '{$this->other['itemid']}'.";
     }
 }
index a22092d..816a31b 100644 (file)
@@ -25,14 +25,12 @@ namespace core\event;
 defined('MOODLE_INTERNAL') || die();
 
 /**
- * blog_entries_viewed
- *
  * Class for event to be triggered when blog entries are viewed.
  *
  * @property-read array $other {
  *      Extra information about event.
  *
- *      @type int courseid id of associated course.
+ *      - int courseid: id of associated course.
  * }
  *
  * @package    core
index c476189..5aa5e5d 100644 (file)
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
-namespace core\event;
-
-defined('MOODLE_INTERNAL') || die();
-
 /**
  * Event for when a new blog entry is added..
  *
@@ -26,6 +22,10 @@ defined('MOODLE_INTERNAL') || die();
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 
+namespace core\event;
+
+defined('MOODLE_INTERNAL') || die();
+
 /**
  * Class blog_entry_created
  *
@@ -36,7 +36,7 @@ defined('MOODLE_INTERNAL') || die();
  * @copyright  2013 Ankit Agarwal
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-class blog_entry_created extends \core\event\base {
+class blog_entry_created extends base {
 
     /** @var \blog_entry A reference to the active blog_entry object. */
     protected $blogentry;
@@ -54,7 +54,7 @@ class blog_entry_created extends \core\event\base {
     /**
      * Set blog_entry object to be used by observers.
      *
-     * @param \blog_entry $data A reference to the active blog_entry object.
+     * @param \blog_entry $blogentry A reference to the active blog_entry object.
      */
     public function set_blog_entry(\blog_entry $blogentry) {
         $this->blogentry = $blogentry;
@@ -63,6 +63,7 @@ class blog_entry_created extends \core\event\base {
     /**
      * Returns created blog_entry object for event observers.
      *
+     * @throws \coding_exception
      * @return \blog_entry
      */
     public function get_blog_entry() {
@@ -78,7 +79,7 @@ class blog_entry_created extends \core\event\base {
      * @return string
      */
     public static function get_name() {
-        return get_string("evententryadded", "core_blog");
+        return get_string('evententryadded', 'core_blog');
     }
 
     /**
@@ -87,7 +88,7 @@ class blog_entry_created extends \core\event\base {
      * @return string
      */
     public function get_description() {
-        return 'Blog entry id '. $this->objectid. ' was created by userid '. $this->userid;
+        return "The blog entry with the id '$this->objectid' was created by the user with the id '$this->userid'.";
     }
 
     /**
@@ -117,12 +118,12 @@ class blog_entry_created extends \core\event\base {
     }
 
     /**
-     * replace add_to_log() statement.
+     * Replace add_to_log() statement.
      *
      * @return array of parameters to be passed to legacy add_to_log() function.
      */
     protected function get_legacy_logdata() {
         return array (SITEID, 'blog', 'add', 'index.php?userid=' . $this->relateduserid . '&entryid=' . $this->objectid,
-                $this->blogentry->subject);
+            $this->blogentry->subject);
     }
 }
index e2acde8..bdf2342 100644 (file)
@@ -25,7 +25,7 @@ namespace core\event;
 defined('MOODLE_INTERNAL') || die();
 
 /**
- * class blog_entry_deleted
+ * Class blog_entry_deleted
  *
  * Event for when a new blog entry is deleted.
  *
@@ -35,9 +35,9 @@ defined('MOODLE_INTERNAL') || die();
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 
-class blog_entry_deleted extends \core\event\base {
+class blog_entry_deleted extends base {
 
-    /** @var  \blog_entry A reference to the active blog_entry object. */
+    /** @var \blog_entry A reference to the active blog_entry object. */
     protected $blogentry;
 
     /**
@@ -62,7 +62,7 @@ class blog_entry_deleted extends \core\event\base {
     /**
      * Sets blog_entry object to be used by observers.
      *
-     * @param \blog_entry $data A reference to the active blog_entry object.
+     * @param \blog_entry $blogentry A reference to the active blog_entry object.
      */
     public function set_blog_entry(\blog_entry $blogentry) {
         $this->blogentry = $blogentry;
@@ -71,6 +71,7 @@ class blog_entry_deleted extends \core\event\base {
     /**
      * Returns deleted blog entry for event observers.
      *
+     * @throws \coding_exception
      * @return \blog_entry
      */
     public function get_blog_entry() {
@@ -86,7 +87,7 @@ class blog_entry_deleted extends \core\event\base {
      * @return string
      */
     public function get_description() {
-        return 'Blog entry id '. $this->objectid. ' was deleted by userid '. $this->userid;
+        return "The blog entry with the id '$this->objectid' was deleted by user with the id '$this->userid'.";
     }
 
     /**
index dcfec20..dc3dd4e 100644 (file)
@@ -52,7 +52,7 @@ class blog_entry_updated extends base {
     /**
      * Sets blog_entry object to be used by observers.
      *
-     * @param \blog_entry $data A reference to the active blog_entry object.
+     * @param \blog_entry $blogentry A reference to the active blog_entry object.
      */
     public function set_blog_entry(\blog_entry $blogentry) {
         $this->blogentry = $blogentry;
@@ -61,6 +61,7 @@ class blog_entry_updated extends base {
     /**
      * Returns updated blog entry for event observers.
      *
+     * @throws \coding_exception
      * @return \blog_entry
      */
     public function get_blog_entry() {
@@ -85,7 +86,7 @@ class blog_entry_updated extends base {
      * @return string
      */
     public function get_description() {
-        return 'Blog entry id '. $this->objectid. ' was updated by userid '. $this->userid;
+        return "The blog entry with the id '$this->objectid' was updated by the user with the id '$this->userid'.";
     }
 
     /**
index 9dceaca..0046cb3 100644 (file)
@@ -29,10 +29,13 @@ defined('MOODLE_INTERNAL') || die();
 /**
  * Calendar event created event.
  *
- * @property-read array $other Extra information about the event.
- *     -int timestart: timestamp for event time start.
- *     -string name: Name of the event.
- *     -int repeatid: Id of the parent event if present, else 0.
+ * @property-read array $other {
+ *      Extra information about the event.
+ *
+ *      - int repeatid: id of the parent event if present, else 0.
+ *      - int timestart: timestamp for event time start.
+ *      - string name: name of the event.
+ * }
  *
  * @package    core
  * @since      Moodle 2.7
@@ -67,7 +70,7 @@ class calendar_event_created extends base {
      * @return string
      */
     public function get_description() {
-        return "An event '" . s($this->other['name']) . "' was created by user with id {$this->userid}";
+        return "The event '" . s($this->other['name']) . "' was created by user with the id '$this->userid'.";
     }
 
     /**
@@ -90,21 +93,21 @@ class calendar_event_created extends base {
     }
 
     /**
-     * custom validations
+     * Custom validation.
      *
      * Throw \coding_exception notice in case of any problems.
      */
     protected function validate_data() {
+        parent::validate_data();
+
         if (!isset($this->other['repeatid'])) {
-            throw new \coding_exception("Field other['repeatid'] must be set");
+            throw new \coding_exception('The \'repeatid\' value must be set in other.');
         }
         if (empty($this->other['name'])) {
-            throw new \coding_exception("Field other['name'] cannot be empty");
+            throw new \coding_exception('The \'name\' value must be set in other.');
         }
         if (empty($this->other['timestart'])) {
-            throw new \coding_exception("Field other['timestart'] cannot be empty");
+            throw new \coding_exception('The \'timestart\' value must be set in other.');
         }
-
-        parent::validate_data();
     }
 }
index 296ad68..02df261 100644 (file)
@@ -29,10 +29,13 @@ defined('MOODLE_INTERNAL') || die();
 /**
  * Calendar event deleted event.
  *
- * @property-read array $other Extra information about the event.
- *     -int timestart: timestamp for event time start.
- *     -string name: Name of the event.
- *     -int repeatid: Id of the parent event if present, else 0.
+ * @property-read array $other {
+ *      Extra information about the event.
+ *
+ *      - int repeatid: id of the parent event if present, else 0.
+ *      - int timestart: timestamp for event time start.
+ *      - string name: name of the event.
+ * }
  *
  * @package    core
  * @since      Moodle 2.7
@@ -67,25 +70,25 @@ class calendar_event_deleted extends base {
      * @return string
      */
     public function get_description() {
-        return "An event '" . s($this->other['name']) . "' was deleted by user with id {$this->userid}";
+        return "The event '" . s($this->other['name']) . "' was deleted by the user with the id '{$this->userid}'.";
     }
 
     /**
-     * custom validations
+     * Custom validation.
      *
      * Throw \coding_exception notice in case of any problems.
      */
     protected function validate_data() {
+        parent::validate_data();
+
         if (!isset($this->other['repeatid'])) {
-            throw new \coding_exception("Field other['repeatid'] must be set");
+            throw new \coding_exception('The \'repeatid\' value must be set in other.');
         }
         if (empty($this->other['name'])) {
-            throw new \coding_exception("Field other['name'] cannot be empty");
+            throw new \coding_exception('The \'name\' value must be set in other.');
         }
         if (empty($this->other['timestart'])) {
-            throw new \coding_exception("Field other['timestart'] cannot be empty");
+            throw new \coding_exception('The \'timestart\' value must be set in other.');
         }
-
-        parent::validate_data();
     }
 }
index 6226502..97d1307 100644 (file)
@@ -29,10 +29,13 @@ defined('MOODLE_INTERNAL') || die();
 /**
  * Calendar event updated event.
  *
- * @property-read array $other Extra information about the event.
- *     -int timestart: timestamp for event time start.
- *     -string name: Name of the event.
- *     -int repeatid: Id of the parent event if present, else 0.
+ * @property-read array $other {
+ *      Extra information about the event.
+ *
+ *      - int repeatid: id of the parent event if present, else 0.
+ *      - int timestart: timestamp for event time start.
+ *      - string name: name of the event.
+ * }
  *
  * @package    core
  * @since      Moodle 2.7
@@ -67,7 +70,7 @@ class calendar_event_updated extends base {
      * @return string
      */
     public function get_description() {
-        return "An event '" . s($this->other['name']) . "' was updated by user with id {$this->userid}";
+        return "The event '" . s($this->other['name']) . "' was updated by the user with the id '{$this->userid}'.";
     }
 
     /**
@@ -85,26 +88,25 @@ class calendar_event_updated extends base {
      * @return array of parameters to be passed to legacy add_to_log() function.
      */
     protected function get_legacy_logdata() {
-        return array($this->courseid, 'calendar', 'edit', 'event.php?action=edit&amp;id=' . $this->objectid ,
-                $this->other['name']);
+        return array($this->courseid, 'calendar', 'edit', 'event.php?action=edit&amp;id=' . $this->objectid, $this->other['name']);
     }
 
     /**
-     * custom validations
+     * Custom validation.
      *
      * Throw \coding_exception notice in case of any problems.
      */
     protected function validate_data() {
+        parent::validate_data();
+
         if (!isset($this->other['repeatid'])) {
-            throw new \coding_exception("Field other['repeatid'] must be set");
+            throw new \coding_exception('The \'repeatid\' value must be set in other.');
         }
         if (empty($this->other['name'])) {
-            throw new \coding_exception("Field other['name'] cannot be empty");
+            throw new \coding_exception('The \'name\' value must be set in other.');
         }
         if (empty($this->other['timestart'])) {
-            throw new \coding_exception("Field other['timestart'] cannot be empty");
+            throw new \coding_exception('The \'timestart\' value must be set in other.');
         }
-
-        parent::validate_data();
     }
 }
index 743fb6b..2f5c2ac 100644 (file)
@@ -61,7 +61,7 @@ class cohort_created extends base {
      * @return string
      */
     public function get_description() {
-        return 'Cohort '.$this->objectid.' was created by '.$this->userid.' at context '.$this->contextid;
+        return "The cohort with the id '$this->objectid' was created by the user with the id '$this->userid'.";
     }
 
     /**
index 570db4a..f3b5d34 100644 (file)
@@ -61,7 +61,7 @@ class cohort_deleted extends base {
      * @return string
      */
     public function get_description() {
-        return 'Cohort '.$this->objectid.' was deleted by '.$this->userid.' from context '.$this->contextid;
+        return "The cohort with the id '$this->objectid' was deleted by the user with the id '$this->userid'.";
     }
 
     /**
index 7252c77..628b1b7 100644 (file)
@@ -61,7 +61,8 @@ class cohort_member_added extends base {
      * @return string
      */
     public function get_description() {
-        return 'User '.$this->relateduserid.' was added to cohort '.$this->objectid.' by user '.$this->userid;
+        return "The user with the id '$this->relateduserid' was added to the cohort with the id '$this->objectid' by the " .
+            "user with the id '$this->userid'.";
     }
 
     /**
index 1fc7046..ee1d493 100644 (file)
@@ -62,7 +62,8 @@ class cohort_member_removed extends base {
      * @return string
      */
     public function get_description() {
-        return 'User '.$this->relateduserid.' was removed from cohort '.$this->objectid.' by user '.$this->userid;
+        return "The user with the id '$this->relateduserid' was removed from the cohort with the id '$this->objectid' by the " .
+            "user with the id '$this->userid'.";
     }
 
     /**
index 29fa2dd..142fb60 100644 (file)
@@ -61,7 +61,7 @@ class cohort_updated extends base {
      * @return string
      */
     public function get_description() {
-        return 'Cohort '.$this->objectid.' was updated by '.$this->userid.' at context '.$this->contextid;
+        return "The cohort with the id '$this->objectid' was updated by the user with the id '$this->userid'.";
     }
 
     /**
index 539bfc4..3ab9474 100644 (file)
@@ -34,7 +34,7 @@ defined('MOODLE_INTERNAL') || die();
  * @property-read array $other {
  *      Extra information about event.
  *
- *      @type int itemid id of item for which comment is added.
+ *      - int itemid: id of item for which comment is added.
  * }
  *
  * @package    core
@@ -42,7 +42,7 @@ defined('MOODLE_INTERNAL') || die();
  * @copyright  2013 Rajesh Taneja <rajesh@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-abstract class comment_created extends \core\event\base {
+abstract class comment_created extends base {
 
     /**
      * Init method.
@@ -70,8 +70,8 @@ abstract class comment_created extends \core\event\base {
      * @return string
      */
     public function get_description() {
-        return 'User with id ' . $this->userid . ' added comment for ' . $this->component . ' with instance id ' .
-                $this->contextinstanceid;
+        return "The user with the id '$this->userid' added the comment with the id '$this->objectid' for '$this->component' " .
+            "with the course module id '$this->contextinstanceid'.";
     }
 
     /**
@@ -97,7 +97,7 @@ abstract class comment_created extends \core\event\base {
     protected function validate_data() {
         parent::validate_data();
         if (!isset($this->other['itemid'])) {
-            throw new \coding_exception('The itemid needs to be set in $other');
+            throw new \coding_exception('The \'itemid\' value must be set in other.');
         }
     }
 }
index de7829f..4d34b2e 100644 (file)
@@ -34,7 +34,7 @@ defined('MOODLE_INTERNAL') || die();
  * @property-read array $other {
  *      Extra information about event.
  *
- *      @type int itemid id of item for which comment is deleted.
+ *      - int itemid: id of item for which comment is deleted.
  * }
  *
  * @package    core
@@ -42,7 +42,7 @@ defined('MOODLE_INTERNAL') || die();
  * @copyright  2013 Rajesh Taneja <rajesh@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-abstract class comment_deleted extends \core\event\base {
+abstract class comment_deleted extends base {
 
     /**
      * Init method.
@@ -70,8 +70,8 @@ abstract class comment_deleted extends \core\event\base {
      * @return string
      */
     public function get_description() {
-        return 'User with id ' . $this->userid . ' deleted comment for ' . $this->component . ' with instance id ' .
-                $this->contextinstanceid;
+        return "The user with the id '$this->userid' deleted the comment with the id '$this->objectid' for '$this->component' " .
+            "with instance id '$this->contextinstanceid'.";
     }
 
     /**
@@ -97,7 +97,7 @@ abstract class comment_deleted extends \core\event\base {
     protected function validate_data() {
         parent::validate_data();
         if (!isset($this->other['itemid'])) {
-            throw new \coding_exception('The itemid needs to be set in $other');
+            throw new \coding_exception('The \'itemid\' value must be set in other.');
         }
     }
 }
index 4964ee4..d250f90 100644 (file)
@@ -29,14 +29,14 @@ defined('MOODLE_INTERNAL') || die();
 /**
  * Abstract comments viewed event class.
  *
- * This class has to be extended by any event which is triggred while viewing comment.
+ * This class has to be extended by any event which is triggered while viewing comment.
  *
  * @package    core
  * @since      Moodle 2.7
  * @copyright  2013 Rajesh Taneja <rajesh@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-abstract class comments_viewed extends \core\event\base {
+abstract class comments_viewed extends base {
 
     /**
      * Init method.
@@ -63,8 +63,7 @@ abstract class comments_viewed extends \core\event\base {
      * @return string
      */
     public function get_description() {
-        return 'User with id '. $this->userid . ' viewed comments for ' . $this->component . ' with instance id ' .
-                $this->objectid;
+        return "The user with the id '$this->userid' viewed the comments for '$this->component' with instance id '$this->objectid'.";
     }
 
     /**
index 9f7ab5f..86fe52f 100644 (file)
@@ -86,7 +86,7 @@ abstract class content_viewed extends base {
      * @return string
      */
     public function get_description() {
-        return 'User with id ' . $this->userid . ' viewed content';
+        return "The user with the id '$this->userid' viewed content.";
     }
 
     /**
@@ -117,7 +117,7 @@ abstract class content_viewed extends base {
         parent::validate_data();
         // Make sure this class is never used without a content identifier.
         if (empty($this->other['content'])) {
-            throw new \coding_exception('content_viewed event must define content identifier.');
+            throw new \coding_exception('The \'content\' value must be set in other.');
         }
     }
 }
index 4e60ffc..8088874 100644 (file)
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
+/**
+ * Course category created event.
+ *
+ * @package    core
+ * @copyright  2014 Mark Nelson <markn@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
 namespace core\event;
 
 defined('MOODLE_INTERNAL') || die();
 
 /**
- * Course category created event.
+ * Course category created event class.
  *
  * @package    core
  * @since      Moodle 2.7
@@ -61,8 +69,7 @@ class course_category_created extends base {
      * @return string
      */
     public function get_description() {
-        return 'The course category with the id ' . $this->objectid . ' was created by the user with the id ' .
-            $this->userid;
+        return "The course category with the id '$this->objectid' was created by the user with the id '$this->userid'.";
     }
 
     /**
index e14dc68..8b27f12 100644 (file)
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
+/**
+ * Category deleted event.
+ *
+ * @package    core
+ * @copyright  2013 Mark Nelson <markn@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
 namespace core\event;
 
 defined('MOODLE_INTERNAL') || die();
 
 /**
- * Category deleted event.
+ * Category deleted event class.
  *
  * @property-read array $other {
  *      Extra information about event.
  *
- *      @type string name category name.
+ *      - string name: category name.
  * }
  *
  * @package    core
@@ -63,7 +71,7 @@ class course_category_deleted extends base {
      * @return string
      */
     public function get_description() {
-        return "Category {$this->objectid} was deleted by user {$this->userid}";
+        return "The category with the id '$this->objectid' was deleted by the user with the id '$this->userid'.";
     }
 
     /**
@@ -96,6 +104,7 @@ class course_category_deleted extends base {
     /**
      * Returns deleted coursecat for event observers.
      *
+     * @throws \coding_exception
      * @return \coursecat
      */
     public function get_coursecat() {
index d12bbaa..c251e13 100644 (file)
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
+/**
+ * Course category updated event.
+ *
+ * @package    core
+ * @copyright  2014 Mark Nelson <markn@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
 namespace core\event;
 
 defined('MOODLE_INTERNAL') || die();
 
 /**
- * Course category updated event.
+ * Course category updated event class.
  *
  * @package    core
  * @since      Moodle 2.7
@@ -64,8 +72,7 @@ class course_category_updated extends base {
      * @return string
      */
     public function get_description() {
-        return 'The course category with the id ' . $this->objectid . ' was updated by the user with the id ' .
-            $this->userid;
+        return "The course category with the id '$this->objectid' was updated by the user with the id '$this->userid'.";
     }
 
     /**
index 05a43ee..32e129e 100644 (file)
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
+/**
+ * Course completed event.
+ *
+ * @package    core
+ * @copyright  2013 Rajesh Taneja <rajesh@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
 namespace core\event;
 
 defined('MOODLE_INTERNAL') || die();
 
 /**
- * Event when course completed.
+ * Course completed event class.
  *
  * @package    core
  * @since      Moodle 2.6
@@ -52,7 +60,7 @@ class course_completed extends base {
      * @return string
      */
     public function get_description() {
-        return 'Course completed by user '.$this->userid;
+        return "The course with the id '$this->courseid' was completed by the user with the id '$this->userid'.";
     }
 
     /**
@@ -81,5 +89,4 @@ class course_completed extends base {
     protected function get_legacy_eventdata() {
         return $this->get_record_snapshot('course_completions', $this->objectid);
     }
-
 }
index d687080..dc40b14 100644 (file)
@@ -15,7 +15,7 @@
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
- * Event when course module completion is updated.
+ * Course module completion updated event.
  *
  * @package    core
  * @copyright  2013 Rajesh Taneja <rajesh@moodle.com>
@@ -27,7 +27,7 @@ namespace core\event;
 defined('MOODLE_INTERNAL') || die();
 
 /**
- * Event when course module completion is updated.
+ * Course module completion updated event class.
  *
  * @package    core
  * @since      Moodle 2.6
@@ -59,7 +59,7 @@ class course_completion_updated extends base {
      * @return string
      */
     public function get_description() {
-        return 'Course completion for course' . $this->courseid . ' is updated by user ' . $this->userid;
+        return "The requirements to complete the course with the id '$this->courseid' was updated by the user with the id '$this->userid'.";
     }
 
     /**
index fe64a58..ac097e7 100644 (file)
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
+/**
+ * Course content_deleted event class.
+ *
+ * @package    core
+ * @copyright  2013 Mark Nelson <markn@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
 namespace core\event;
 
 defined('MOODLE_INTERNAL') || die();
 
 /**
- * Course content_deleted event.
+ * Course content_deleted event class.
  *
  * @property-read array $other {
  *      Extra information about event.
  *
- *      @type array options list of options which were skipped while deleting course content.
+ *      - array options: list of options which were skipped while deleting course content.
  * }
  *
  * @package    core
@@ -58,7 +66,7 @@ class course_content_deleted extends base {
      * @return string
      */
     public function get_description() {
-        return "Course content was deleted by user {$this->userid}";
+        return "The course with the id '$this->courseid' had content deleted by the user with the id '$this->userid'.";
     }
 
     /**
index 16fee48..58cf285 100644 (file)
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
+/**
+ * Course created event.
+ *
+ * @package    core
+ * @copyright  2013 Mark Nelson <markn@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
 namespace core\event;
 
 defined('MOODLE_INTERNAL') || die();
 
 /**
- * Course created event.
+ * Course created event class.
  *
  * @property-read array $other {
  *      Extra information about event.
  *
- *      @type string shortname shortname of course.
- *      @type string fullname fullname of course.
+ *      - string shortname: shortname of course.
+ *      - string fullname: fullname of course.
  * }
  *
  * @package    core
@@ -59,7 +67,7 @@ class course_created extends base {
      * @return string
      */
     public function get_description() {
-        return "Course {$this->objectid} was created by user {$this->userid}";
+        return "The course with the id '$this->objectid' was created by the user with the id '$this->userid'.";
     }
 
     /**
index fc999d5..17da551 100644 (file)
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
+/**
+ * Course deleted event.
+ *
+ * @package    core
+ * @copyright  2013 Mark Nelson <markn@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
 namespace core\event;
 
 defined('MOODLE_INTERNAL') || die();
 
 /**
- * Course deleted event.
+ * Course deleted event class.
  *
  * @property-read array $other {
  *      Extra information about event.
  *
- *      @type string shortname shortname of course.
- *      @type string fullname fullname of course.
- *      @type string idnumber id number of course.
+ *      - string shortname: shortname of course.
+ *      - string fullname: fullname of course.
+ *      - string idnumber: id number of course.
  * }
  *
  * @package    core
@@ -60,7 +68,7 @@ class course_deleted extends base {
      * @return string
      */
     public function get_description() {
-        return "Course {$this->courseid} was deleted by user {$this->userid}";
+        return "The course with the id '$this->courseid' was deleted by the user with the id '$this->userid'.";
     }
 
     /**
index 88d8067..af8ed55 100644 (file)
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
+/**
+ * Course module completion event.
+ *
+ * @package    core
+ * @copyright  2013 Rajesh Taneja <rajesh@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
 namespace core\event;
 
 defined('MOODLE_INTERNAL') || die();
 
 /**
- * Event when course module completion is updated.
+ * Course module completion event class.
  *
  * @package    core
  * @since      Moodle 2.6
@@ -52,7 +60,8 @@ class course_module_completion_updated extends base {
      * @return string
      */
     public function get_description() {
-        return 'Course module completion updated for user ' . $this->userid;
+        return "The course module completion requirements were updated by the user with the id '$this->userid' for the user " .
+            "with the id '$this->relateduserid'.";
     }
 
     /**
@@ -91,10 +100,11 @@ class course_module_completion_updated extends base {
         parent::validate_data();
         // Make sure the context level is set to module.
         if ($this->contextlevel !== CONTEXT_MODULE) {
-            throw new \coding_exception('Context passed must be module context.');
+            throw new \coding_exception('Context level must be CONTEXT_MODULE.');
         }
+
         if (!isset($this->relateduserid)) {
-            throw new \coding_exception('relateduserid must be set');
+            throw new \coding_exception('The \'relateduserid\' must be set.');
         }
     }
 }
index fd0aebb..fe93af0 100644 (file)
 /**
  * Event to be triggered when a new course module is created.
  *
- * @property-read array $other {
- *      Extra information about event.
- *
- *      @type string modulename name of module created.
- *      @type string name title of module.
- *      @type string instanceid id of module instance.
- * }
- *
  * @package    core
  * @copyright  2013 Ankit Agarwal
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
@@ -38,6 +30,14 @@ defined('MOODLE_INTERNAL') || die();
  *
  * Class for event to be triggered when a new course module is created.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      - string modulename: name of module created.
+ *      - string name: title of module.
+ *      - string instanceid: id of module instance.
+ * }
+ *
  * @package    core
  * @since      Moodle 2.6
  * @copyright  2013 Ankit Agarwal
@@ -69,8 +69,8 @@ class course_module_created extends base {
      * @return string
      */
     public function get_description() {
-        return 'The '. $this->other['modulename'] . ' module with instance id ' . $this->other['instanceid'] .
-                ' was created by user with id ' . $this->userid;
+        return "The user with the id '$this->userid' created the '{$this->other['modulename']}' activity with the " .
+            "course module id '$this->contextinstanceid'.";
     }
 
     /**
@@ -120,20 +120,20 @@ class course_module_created extends base {
     }
 
     /**
-     * custom validations
+     * Custom validation.
      *
-     * Throw \coding_exception notice in case of any problems.
+     * @throw \coding_exception
      */
     protected function validate_data() {
         parent::validate_data();
         if (!isset($this->other['modulename'])) {
-            throw new \coding_exception("Field other['modulename'] cannot be empty");
+            throw new \coding_exception('The \'modulename\' value must be set in other.');
         }
         if (!isset($this->other['instanceid'])) {
-            throw new \coding_exception("Field other['instanceid'] cannot be empty");
+            throw new \coding_exception('The \'instanceid\' value must be set in other.');
         }
         if (!isset($this->other['name'])) {
-            throw new \coding_exception("Field other['name'] cannot be empty");
+            throw new \coding_exception('The \'name\' value must be set in other.');
         }
     }
 }
index fa539d6..4581dd1 100644 (file)
@@ -33,8 +33,8 @@ defined('MOODLE_INTERNAL') || die();
  * @property-read array $other {
  *      Extra information about event.
  *
- *      @type string modulename name of module deleted.
- *      @type string instanceid id of module instance.
+ *      - string modulename: name of module deleted.
+ *      - string instanceid: id of module instance.
  * }
  *
  * @package    core
@@ -68,8 +68,8 @@ class course_module_deleted extends base {
      * @return string
      */
     public function get_description() {
-        return 'The module ' . $this->other['modulename'] . ' with instance id ' . $this->other['instanceid']. ' was deleted by
-                user with id ' . $this->userid;
+        return "The user with the id '$this->userid' deleted the '{$this->other['modulename']}' activity with the " .
+            "course module id '$this->contextinstanceid'.";
     }
 
     /**
@@ -113,10 +113,10 @@ class course_module_deleted extends base {
     protected function validate_data() {
         parent::validate_data();
         if (!isset($this->other['modulename'])) {
-            throw new \coding_exception("Field other['modulename'] cannot be empty");
+            throw new \coding_exception('The \'modulename\' value must be set in other.');
         }
         if (!isset($this->other['instanceid'])) {
-            throw new \coding_exception("Field other['instanceid'] cannot be empty");
+            throw new \coding_exception('The \'instanceid\' value must be set in other.');
         }
     }
 }
index f4a5782..45fab50 100644 (file)
@@ -49,6 +49,7 @@ abstract class course_module_instance_list_viewed extends base{
     /**
      * Init method.
      *
+     * @throws \coding_exception
      * @return void
      */
     protected function init() {
@@ -67,8 +68,8 @@ abstract class course_module_instance_list_viewed extends base{
      * @return string
      */
     public function get_description() {
-        return "User with id '$this->userid' viewed instance list for module '$this->modname' in course with id
-                '$this->courseid'";
+        return "The user with the id '$this->userid' viewed the instance list for the module '$this->modname' in the course " .
+            "with the id '$this->courseid'.";
     }
 
     /**
@@ -108,8 +109,7 @@ abstract class course_module_instance_list_viewed extends base{
     protected function validate_data() {
         parent::validate_data();
         if ($this->contextlevel != CONTEXT_COURSE) {
-            throw new \coding_exception('Context passed must be course context.');
+            throw new \coding_exception('Context level must be CONTEXT_COURSE.');
         }
     }
-
 }
index 7aaaa0b..022a192 100644 (file)
@@ -33,9 +33,9 @@ defined('MOODLE_INTERNAL') || die();
  * @property-read array $other {
  *      Extra information about event.
  *
- *      @type string modulename name of module updated.
- *      @type string name title of module.
- *      @type string instanceid id of module instance.
+ *      - string modulename: name of module updated.
+ *      - string name: title of module.
+ *      - string instanceid: id of module instance.
  * }
  *
  * @package    core
@@ -69,8 +69,8 @@ class course_module_updated extends base {
      * @return string
      */
     public function get_description() {
-        return 'The ' . $this->other['modulename'] . ' module with instance id ' . $this->other['instanceid'] .
-                ' was updated by user with id ' . $this->userid;
+        return "The user with the id '$this->userid' updated the '{$this->other['modulename']}' activity with the " .
+            "course module id '$this->contextinstanceid'.";
     }
 
     /**
@@ -127,13 +127,13 @@ class course_module_updated extends base {
     protected function validate_data() {
         parent::validate_data();
         if (!isset($this->other['modulename'])) {
-            throw new \coding_exception("Field other['modulename'] cannot be empty");
+            throw new \coding_exception('The \'modulename\' value must be set in other.');
         }
         if (!isset($this->other['instanceid'])) {
-            throw new \coding_exception("Field other['instanceid'] cannot be empty");
+            throw new \coding_exception('The \'instanceid\' value must be set in other.');
         }
         if (!isset($this->other['name'])) {
-            throw new \coding_exception("Field other['name'] cannot be empty");
+            throw new \coding_exception('The \'name\' value must be set in other.');
         }
     }
 
index 4c88c4b..3ee5a69 100644 (file)
@@ -55,7 +55,8 @@ abstract class course_module_viewed extends base {
      * @return string
      */
     public function get_description() {
-        return "User with id '$this->userid' viewed course module '$this->objecttable' with instance id '$this->objectid'";
+        return "The user with the id '$this->userid' viewed the '{$this->objecttable}' activity with the " .
+            "course module id '$this->contextinstanceid'.";
     }
 
     /**
@@ -96,12 +97,11 @@ abstract class course_module_viewed extends base {
         parent::validate_data();
         // Make sure this class is never used without proper object details.
         if (empty($this->objectid) || empty($this->objecttable)) {
-            throw new \coding_exception('course_module_viewed event must define objectid and object table.');
+            throw new \coding_exception('The course_module_viewed event must define objectid and object table.');
         }
         // Make sure the context level is set to module.
         if ($this->contextlevel != CONTEXT_MODULE) {
-            throw new \coding_exception('Context passed must be module context.');
+            throw new \coding_exception('Context level must be CONTEXT_MODULE.');
         }
     }
-
 }
index f3191d2..c7cad3d 100644 (file)
@@ -15,7 +15,7 @@
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
- * core course reset ended event.
+ * The course reset ended event.
  *
  * @package    core
  * @copyright  2013 Frédéric Massart
@@ -26,12 +26,12 @@ namespace core\event;
 defined('MOODLE_INTERNAL') || die();
 
 /**
- * core course reset ended event class.
+ * The course reset ended event class.
  *
  * @property-read array $other {
  *      Extra information about event.
  *
- *      @type array reset_options all reset options settings including courseid.
+ *      - array reset_options: all reset options settings including courseid.
  * }
  *
  * @package    core
@@ -39,7 +39,7 @@ defined('MOODLE_INTERNAL') || die();
  * @copyright  2013 Frédéric Massart
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-class course_reset_ended extends \core\event\base {
+class course_reset_ended extends base {
 
     /**
      * Returns description of what happened.
@@ -47,7 +47,7 @@ class course_reset_ended extends \core\event\base {
      * @return string
      */
     public function get_description() {
-        return "The reset of course $this->courseid has ended.";
+        return "The reset of the course with the id '$this->courseid' has ended.";
     }
 
     /**
@@ -87,8 +87,7 @@ class course_reset_ended extends \core\event\base {
     protected function validate_data() {
         parent::validate_data();
         if (!isset($this->other['reset_options'])) {
-           throw new \coding_exception('The key reset_options must be set in $other.');
+           throw new \coding_exception('The \'reset_options\' value must be set in other.');
         }
     }
-
 }
index 59c6abe..dd043de 100644 (file)
@@ -31,7 +31,7 @@ defined('MOODLE_INTERNAL') || die();
  * @property-read array $other {
  *      Extra information about event.
  *
- *      @type array reset_options all reset options settings including courseid.
+ *      - array reset_options: all reset options settings including courseid.
  * }
  *
  * @package    core
@@ -39,7 +39,7 @@ defined('MOODLE_INTERNAL') || die();
  * @copyright  2013 Frédéric Massart
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-class course_reset_started extends \core\event\base {
+class course_reset_started extends base {
 
     /**
      * Returns description of what happened.
@@ -47,7 +47,7 @@ class course_reset_started extends \core\event\base {
      * @return string
      */
     public function get_description() {
-        return "The user $this->userid has started the reset of course $this->courseid.";
+        return "The user with the id '$this->userid' has started the reset of course '$this->courseid''.";
     }
 
     /**
@@ -87,8 +87,7 @@ class course_reset_started extends \core\event\base {
     protected function validate_data() {
         parent::validate_data();
         if (!isset($this->other['reset_options'])) {
-           throw new \coding_exception('The key reset_options must be set in $other.');
+            throw new \coding_exception('The \'reset_options\' value must be set in other.');
         }
     }
-
 }
index cae5e3a..a93dfca 100644 (file)
@@ -54,7 +54,7 @@ class course_resources_list_viewed extends base {
      * @return string
      */
     public function get_description() {
-        return "User with id '$this->userid' viewed list of resources in course with id '$this->courseid'";
+        return "The user with the id '$this->userid' viewed the list of resources in the course with the id '$this->courseid'.";
     }
 
     /**
@@ -104,7 +104,6 @@ class course_resources_list_viewed extends base {
         return $logs;
     }
 
-
     /**
      * Custom validation.
      *
@@ -116,5 +115,4 @@ class course_resources_list_viewed extends base {
             throw new \coding_exception('Context passed must be course context.');
         }
     }
-
 }
index 8858f4b..6ca02ae 100644 (file)
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
+/**
+ * Course restored event.
+ *
+ * @package    core
+ * @copyright  2013 Mark Nelson <markn@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
 namespace core\event;
 
 defined('MOODLE_INTERNAL') || die();
 
 /**
- * Course restored event.
+ * Course restored event class.
  *
  * @property-read array $other {
  *      Extra information about event.
  *
- *      @type string type restore type, activity, course or section.
- *      @type int target where restored (new/existing/current/adding/deleting)
- *      @type int mode execution mode
- *      @type string opertaion restore
- *      @type boolean samesite true is restored to same site.
+ *      - string type: restore type, activity, course or section.
+ *      - int target: where restored (new/existing/current/adding/deleting).
+ *      - int mode: execution mode.
+ *      - string operation: what operation are we performing?
+ *      - boolean samesite: true if restoring to same site.
  * }
  *
  * @package    core
@@ -62,7 +70,7 @@ class course_restored extends base {
      * @return string
      */
     public function get_description() {
-        return "Course {$this->objectid} was restored by user {$this->userid}";
+        return "The course with the id '$this->objectid' was restored by the user with the id '$this->userid'.";
     }
 
     /**
index c1f8096..c095393 100644 (file)
@@ -15,7 +15,7 @@
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
- * Course section updated.
+ * Course section updated event.
  *
  * @package    core
  * @copyright  2013 Rajesh Taneja <rajesh@moodle.com>
@@ -27,12 +27,12 @@ namespace core\event;
 defined('MOODLE_INTERNAL') || die();
 
 /**
- * Course section updated.
+ * Course section updated event class.
  *
  * @property-read array $other {
  *      Extra information about event.
  *
- *      @type int sectionnum section number.
+ *      - int sectionnum: section number.
  * }
  *
  * @package    core
@@ -68,7 +68,8 @@ class course_section_updated extends base {
      * @return string
      */
     public function get_description() {
-        return 'Course ' . $this->courseid . ' section ' . $this->other['sectionnum'] . ' updated by user ' . $this->userid;
+        return "The user with the id '$this->userid' updated the section with the number '{$this->other['sectionnum']}' for the " .
+            "course with the id '$this->courseid'";
     }
 
     /**
@@ -98,8 +99,9 @@ class course_section_updated extends base {
      */
     protected function validate_data() {
         parent::validate_data();
+
         if (!isset($this->other['sectionnum'])) {
-            throw new \coding_exception('The sectionnum must be set in $other');
+            throw new \coding_exception('The \'sectionnum\' value must be set in other.');
         }
     }
 }
index 9d3be66..b36d251 100644 (file)
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
+/**
+ * Course updated event.
+ *
+ * @package    core
+ * @copyright  2013 Mark Nelson <markn@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
 namespace core\event;
 
 defined('MOODLE_INTERNAL') || die();
 
 /**
- * Course updated event.
+ * Course updated event class.
  *
  * @property-read array $other {
  *      Extra information about event.
  *
- *      @type string shortname shortname of course.
- *      @type string fullname fullname of course.
+ *      - string shortname: shortname of course.
+ *      - string fullname: fullname of course.
  * }
  *
  * @package    core
@@ -62,7 +70,7 @@ class course_updated extends base {
      * @return string
      */
     public function get_description() {
-        return "Course {$this->courseid} was updated by user {$this->userid}";
+        return "The course with the id '$this->courseid' was updated by the user with the id '$this->userid'.";
     }
 
     /**
index c107e12..6918638 100644 (file)
@@ -29,8 +29,12 @@ defined('MOODLE_INTERNAL') || die();
  * Course user report viewed event class.
  *
  * Class for event to be triggered when a course user report is viewed.
- * @property-read array $other Extra information about the event.
- *     -string mode: Mode is used to show the user different data.
+ *
+ * @property-read array $other {
+ *      Extra information about the event.
+ *
+ *      - string mode: Mode is used to show the user different data.
+ * }
  *
  * @package    core
  * @since      Moodle 2.7
@@ -55,7 +59,8 @@ class course_user_report_viewed extends \core\event\base {
      * @return string
      */
     public function get_description() {
-        return "A user with the id '$this->userid' viewed the user report in the course '$this->courseid' for user '$this->relateduserid'";
+        return "The user with the id '$this->userid' viewed the user report for the course with the id '$this->courseid' " .
+            "for user with the id '$this->relateduserid'.";
     }
 
     /**
index c0a009c..f4e17c4 100644 (file)
@@ -29,8 +29,12 @@ defined('MOODLE_INTERNAL') || die();
  * Course viewed event class.
  *
  * Class for event to be triggered when a course is viewed.
- * @property-read array $other Extra information about the event.
- *     -int coursesectionid: The course section ID (Optional!).
+ *
+ * @property-read array $other {
+ *      Extra information about the event.
+ *
+ *      - int coursesectionid: (optional) The course section ID.
+ * }
  *
  * @package    core
  * @since      Moodle 2.7
@@ -55,7 +59,7 @@ class course_viewed extends \core\event\base {
      * @return string
      */
     public function get_description() {
-        return "A user with the id '$this->userid' viewed the course '$this->courseid'";
+        return "The user with the id '$this->userid' viewed the course with the id '$this->courseid'.";
     }
 
     /**
@@ -114,7 +118,7 @@ class course_viewed extends \core\event\base {
         parent::validate_data();
 
         if ($this->contextlevel != CONTEXT_COURSE) {
-            throw new \coding_exception('Context passed must be course context.');
+            throw new \coding_exception('Context level must be CONTEXT_COURSE.');
         }
     }
 }
index 90830ab..68966c2 100644 (file)
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
+/**
+ * Email failed event.
+ *
+ * @package    core
+ * @since      Moodle 2.7
+ * @copyright  2013 Mark Nelson <markn@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
 namespace core\event;
 
 defined('MOODLE_INTERNAL') || die();
 
 /**
- * Email failed event.
+ * Email failed event class.
  *
  * @package    core
  * @since      Moodle 2.7
@@ -51,8 +60,8 @@ class email_failed extends base {
      * @return string
      */
     public function get_description() {
-        return 'Failed to send an email from the user with the id ' . $this->userid . ' to the user with the id ' .
-            $this->relateduserid . ' due to the following error: \'' . $this->other['errorinfo'] . '\'';
+        return "Failed to send an email from the user with the id '$this->userid' to the user with the id '$this->relateduserid'
+            due to the following error: \"{$this->other['errorinfo']}\".";
     }
 
     /**
index d9dab71..962b671 100644 (file)
@@ -33,7 +33,7 @@ defined('MOODLE_INTERNAL') || die();
  * @copyright  2013 Frédéric Massart
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-class group_created extends \core\event\base {
+class group_created extends base {
 
     /**
      * Returns description of what happened.
@@ -41,7 +41,7 @@ class group_created extends \core\event\base {
      * @return string
      */
     public function get_description() {
-        return "User {$this->userid} created the group {$this->objectid}.";
+        return "The user with the id '$this->userid' created the group with the id '$this->objectid'.";
     }
 
     /**
@@ -90,5 +90,4 @@ class group_created extends \core\event\base {
         $this->data['edulevel'] = self::LEVEL_OTHER;
         $this->data['objecttable'] = 'groups';
     }
-
 }
index 41b1d7a..fccf70c 100644 (file)
@@ -33,7 +33,7 @@ defined('MOODLE_INTERNAL') || die();
  * @copyright  2013 Frédéric Massart
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-class group_deleted extends \core\event\base {
+class group_deleted extends base {
 
     /**
      * Returns description of what happened.
@@ -41,7 +41,7 @@ class group_deleted extends \core\event\base {
      * @return string
      */
     public function get_description() {
-        return "User {$this->userid} deleted the group {$this->objectid}.";
+        return "The user with the id '$this->userid' deleted the group with the id '$this->objectid'.";
     }
 
     /**
index 4e6bbfc..9570156 100644 (file)
@@ -31,8 +31,8 @@ defined('MOODLE_INTERNAL') || die();
  * @property-read array $other {
  *      Extra information about event.
  *
- *      @type string component name of component
- *      @type int itemid id of item.
+ *      - string component: name of component
+ *      - int itemid: id of item.
  * }
  *
  * @package    core
@@ -40,7 +40,7 @@ defined('MOODLE_INTERNAL') || die();
  * @copyright  2013 Frédéric Massart
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-class group_member_added extends \core\event\base {
+class group_member_added extends base {
 
     /**
      * Returns description of what happened.
@@ -48,7 +48,8 @@ class group_member_added extends \core\event\base {
      * @return string
      */
     public function get_description() {
-        return "User {$this->userid} added user {$this->relateduserid} to group {$this->objectid}.";
+        return "The user with the id '$this->userid' added the user with the id '$this->relateduserid' to the group with " .
+            "the id '$this->objectid'.";
     }
 
     /**
@@ -110,10 +111,14 @@ class group_member_added extends \core\event\base {
      * @return void
      */
     protected function validate_data() {
-        if (!isset($this->other['component']) || !isset($this->other['itemid'])) {
-            throw new \coding_exception('The component and itemid need to be set in $other, even if empty.');
-        }
         parent::validate_data();
-    }
 
+        if (!isset($this->other['component'])) {
+            throw new \coding_exception('The \'component\' value must be set in other, even if empty.');
+        }
+
+        if (!isset($this->other['itemid'])) {
+            throw new \coding_exception('The \'itemid\' value must be set in other, even if empty.');
+        }
+    }
 }
index 87336a8..bb9c7e9 100644 (file)
@@ -33,7 +33,7 @@ defined('MOODLE_INTERNAL') || die();
  * @copyright  2013 Frédéric Massart
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-class group_member_removed extends \core\event\base {
+class group_member_removed extends base {
 
     /**
      * Returns description of what happened.
@@ -41,7 +41,8 @@ class group_member_removed extends \core\event\base {
      * @return string
      */
     public function get_description() {
-        return "User {$this->userid} removed user {$this->relateduserid} from group {$this->objectid}.";
+        return "The user with the id '$this->userid' removed the user with the id '$this->relateduserid' to the group with " .
+            "the id '$this->objectid'.";
     }
 
     /**
@@ -93,5 +94,4 @@ class group_member_removed extends \core\event\base {
         $this->data['edulevel'] = self::LEVEL_OTHER;
         $this->data['objecttable'] = 'groups';
     }
-
 }
index 518c139..598c1e4 100644 (file)
@@ -33,7 +33,7 @@ defined('MOODLE_INTERNAL') || die();
  * @copyright  2013 Frédéric Massart
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-class group_updated extends \core\event\base {
+class group_updated extends base {
 
     /**
      * Returns description of what happened.
@@ -41,7 +41,7 @@ class group_updated extends \core\event\base {
      * @return string
      */
     public function get_description() {
-        return "User {$this->userid} updated the group {$this->objectid}.";
+        return "The user with the id '$this->userid' updated the group with the id '$this->objectid'.";
     }
 
     /**
@@ -90,5 +90,4 @@ class group_updated extends \core\event\base {
         $this->data['edulevel'] = self::LEVEL_OTHER;
         $this->data['objecttable'] = 'groups';
     }
-
 }
index 91960e4..549d91e 100644 (file)
@@ -33,7 +33,7 @@ defined('MOODLE_INTERNAL') || die();
  * @copyright  2013 Frédéric Massart
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-class grouping_created extends \core\event\base {
+class grouping_created extends base {
 
     /**
      * Returns description of what happened.
@@ -41,7 +41,7 @@ class grouping_created extends \core\event\base {
      * @return string
      */
     public function get_description() {
-        return "User {$this->userid} created the grouping {$this->objectid}.";
+        return "The user with the id '$this->userid' created the grouping with the id '$this->objectid'.";
     }
 
     /**
index 1707974..75213b1 100644 (file)
@@ -33,7 +33,7 @@ defined('MOODLE_INTERNAL') || die();
  * @copyright  2013 Frédéric Massart
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-class grouping_deleted extends \core\event\base {
+class grouping_deleted extends base {
 
     /**
      * Legacy data.
@@ -48,7 +48,7 @@ class grouping_deleted extends \core\event\base {
      * @return string
      */
     public function get_description() {
-        return "User {$this->userid} deleted the grouping {$this->objectid}.";
+        return "The user with the id '$this->userid' deleted the grouping with the id '$this->objectid'.";
     }
 
     /**
index da21bb3..67c8e19 100644 (file)
@@ -33,7 +33,7 @@ defined('MOODLE_INTERNAL') || die();
  * @copyright  2013 Frédéric Massart
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-class grouping_updated extends \core\event\base {
+class grouping_updated extends base {
 
     /**
      * Returns description of what happened.
@@ -41,13 +41,13 @@ class grouping_updated extends \core\event\base {
      * @return string
      */
     public function get_description() {
-        return "User {$this->userid} updated the grouping {$this->objectid}.";
+        return "The user with the id '$this->userid' updated the grouping with the id '$this->objectid'.";
     }
 
     /**
      * Legacy event data if get_legacy_eventname() is not empty.
      *
-     * @return stdClass
+     * @return \stdClass
      */
     protected function get_legacy_eventdata() {
         return $this->get_record_snapshot('groupings', $this->objectid);
index 5d2c94e..467334a 100644 (file)
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
- * Message contact added event class.
+ * Message contact added event.
  *
  * @package    core
- * @since      Moodle 2.7
  * @copyright  2014 Mark Nelson <markn@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
+
 namespace core\event;
 
 defined('MOODLE_INTERNAL') || die();
 
+/**
+ * Message contact added event class.
+ *
+ * @package    core
+ * @since      Moodle 2.7
+ * @copyright  2014 Mark Nelson <markn@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 class message_contact_added extends base {
 
     /**
@@ -61,8 +69,7 @@ class message_contact_added extends base {
      * @return string
      */
     public function get_description() {
-        return 'The user with the id \'' . $this->userid . '\' added the user with the id  \'' .
-            $this->relateduserid . '\' to their contact list.';
+        return "The user with the id '$this->userid' added the user with the id '$this->relateduserid' to their contact list.";
     }
 
     /**
index 6b1cdf6..8d73ab2 100644 (file)
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
- * Message contact blocked event class.
+ * Message contact blocked event.
  *
  * @package    core
- * @since      Moodle 2.7
  * @copyright  2014 Mark Nelson <markn@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
+
 namespace core\event;
 
 defined('MOODLE_INTERNAL') || die();
 
+/**
+ * Message contact blocked event class.
+ *
+ * @package    core
+ * @since      Moodle 2.7
+ * @copyright  2014 Mark Nelson <markn@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 class message_contact_blocked extends base {
 
     /**
@@ -61,8 +69,7 @@ class message_contact_blocked extends base {
      * @return string
      */
     public function get_description() {
-        return 'The user with the id \'' . $this->userid . '\' blocked the user with the id  \'' .
-            $this->relateduserid . '\' on their contact list.';
+        return "The user with the id '$this->userid' blocked the user with the id '$this->relateduserid' on their contact list.";
     }
 
     /**
index 2ca36ea..f0715ff 100644 (file)
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
- * Message contact removed event class.
+ * Message contact removed event.
  *
  * @package    core
- * @since      Moodle 2.7
  * @copyright  2014 Mark Nelson <markn@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
+
 namespace core\event;
 
 defined('MOODLE_INTERNAL') || die();
 
+/**
+ * Message contact removed event class.
+ *
+ * @package    core
+ * @since      Moodle 2.7
+ * @copyright  2014 Mark Nelson <markn@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 class message_contact_removed extends base {
 
     /**
@@ -61,8 +69,7 @@ class message_contact_removed extends base {
      * @return string
      */
     public function get_description() {
-        return 'The user with the id \'' . $this->userid . '\' removed the user with the id  \'' .
-            $this->relateduserid . '\' from their contact list.';
+        return "The user with the id '$this->userid' removed the user with the id '$this->relateduserid' from their contact list.";
     }
 
     /**
index c931462..ee5788e 100644 (file)
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
- * Message contact unblocked event class.
+ * Message contact unblocked event.
  *
  * @package    core
- * @since      Moodle 2.7
  * @copyright  2014 Mark Nelson <markn@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
+
 namespace core\event;
 
 defined('MOODLE_INTERNAL') || die();
 
+/**
+ * Message contact unblocked event class.
+ *
+ * @package    core
+ * @since      Moodle 2.7
+ * @copyright  2014 Mark Nelson <markn@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 class message_contact_unblocked extends base {
 
     /**
@@ -61,8 +69,7 @@ class message_contact_unblocked extends base {
      * @return string
      */
     public function get_description() {
-        return 'The user with the id \'' . $this->userid . '\' unblocked the user with the id  \'' .
-            $this->relateduserid . '\' on their contact list.';
+        return "The user with the id '$this->userid' unblocked the user with the id '$this->relateduserid' on their contact list.";
     }
 
     /**
index 2240fcf..8fdecc5 100644 (file)
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
+/**
+ * Message sent event.
+ *
+ * @package    core
+ * @copyright  2014 Mark Nelson <markn@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+namespace core\event;
+
+defined('MOODLE_INTERNAL') || die();
+
 /**
  * Message sent event class.
  *
  * @copyright  2014 Mark Nelson <markn@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-namespace core\event;
-
-defined('MOODLE_INTERNAL') || die();
-
 class message_sent extends base {
 
     /**
@@ -68,11 +76,10 @@ class message_sent extends base {
     public function get_description() {
         // Check if we are sending from a valid user.
         if (\core_user::is_real_user($this->userid)) {
-            return 'The user with the id \'' . $this->userid . '\' sent a message to the user with the id \'' .
-                $this->relateduserid . '\'.';
+            return "The user with the id '$this->objectid' sent a message to the user with the id '$this->relateduserid'.";
         }
 
-        return 'A message was sent by the system to the user with the id \'' . $this->relateduserid . '\'.';
+        return "A message was sent by the system to the user with the id '$this->relateduserid'.";
     }
 
     /**
@@ -105,7 +112,7 @@ class message_sent extends base {
         }
 
         if (!isset($this->other['messageid'])) {
-            throw new \coding_exception('The \'messageid\' needs to be set in $other.');
+            throw new \coding_exception('The \'messageid\' value must be set in other.');
         }
     }
 }
index 904b394..2d45346 100644 (file)
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
+/**
+ * Message viewed event.
+ *
+ * @package    core
+ * @copyright  2014 Mark Nelson <markn@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+namespace core\event;
+
+defined('MOODLE_INTERNAL') || die();
+
 /**
  * Message viewed event class.
  *
  * @copyright  2014 Mark Nelson <markn@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-namespace core\event;
-
-defined('MOODLE_INTERNAL') || die();
-
 class message_viewed extends base {
 
     /**
@@ -67,8 +75,7 @@ class message_viewed extends base {
      * @return string
      */
     public function get_description() {
-        return 'The user with the id \'' . $this->relateduserid . '\' read a message from the user with the id  \'' .
-            $this->userid . '\'.';
+        return "The user with the id '$this->relateduserid' read a message from the user with the id '$this->userid'.";
     }
 
     /**
@@ -85,7 +92,7 @@ class message_viewed extends base {
         }
 
         if (!isset($this->other['messageid'])) {
-            throw new \coding_exception('The \'messageid\' needs to be set in $other.');
+            throw new \coding_exception('The \'messageid\' value must be set in other.');
         }
     }
 }
index 56b70c4..c3ec1dd 100644 (file)
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
- * Mnet access control created event class.
+ * Mnet access control created event.
  *
  * @package    core
  * @since      Moodle 2.7
  * @copyright  2013 Mark Nelson <markn@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
+
 namespace core\event;
 
 defined('MOODLE_INTERNAL') || die();
 
+/**
+ * Mnet access control created event class.
+ *
+ * @package    core
+ * @since      Moodle 2.7
+ * @copyright  2013 Mark Nelson <markn@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 class mnet_access_control_created extends base {
 
     /**
@@ -61,8 +70,8 @@ class mnet_access_control_created extends base {
      * @return string
      */
     public function get_description() {
-        return 'Access control created for the user with the username \'' . $this->other['username'] . '\' belonging
-            to the mnet host \'' . $this->other['hostname'] . '\'';
+        return "Access control created for the user with the username '{$this->other['username']}' belonging to the mnet " .
+            "host '{$this->other['hostname']}'.";
     }
 
     /**
@@ -85,15 +94,15 @@ class mnet_access_control_created extends base {
         parent::validate_data();
 
         if (!isset($this->other['username'])) {
-            throw new \coding_exception('The \'username\' must be set in other.');
+            throw new \coding_exception('The \'username\' value must be set in other.');
         }
 
         if (!isset($this->other['hostname'])) {
-            throw new \coding_exception('The \'hostname\' must be set in other.');
+            throw new \coding_exception('The \'hostname\' value must be set in other.');
         }
 
         if (!isset($this->other['accessctrl'])) {
-            throw new \coding_exception('The \'accessctrl\' must be set in other.');
+            throw new \coding_exception('The \'accessctrl\' value must be set in other.');
         }
     }
 }
index b2badfa..84c6bac 100644 (file)
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
- * Mnet access control updated event class.
+ * Mnet access control updated event.
  *
  * @package    core
  * @since      Moodle 2.7
  * @copyright  2013 Mark Nelson <markn@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
+
 namespace core\event;
 
 defined('MOODLE_INTERNAL') || die();
 
+/**
+ * Mnet access control updated event class.
+ *
+ * @package    core
+ * @since      Moodle 2.7
+ * @copyright  2013 Mark Nelson <markn@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 class mnet_access_control_updated extends base {
 
     /**
@@ -61,8 +70,8 @@ class mnet_access_control_updated extends base {
      * @return string
      */
     public function get_description() {
-        return 'Access control created for the user with the username \'' . $this->other['username'] . '\' belonging
-            to the mnet host \'' . $this->other['hostname'] . '\'';
+        return "Access control updated for the user with the username '{$this->other['username']}' belonging to the mnet " .
+            "host '{$this->other['hostname']}'.";
     }
 
     /**
@@ -85,15 +94,15 @@ class mnet_access_control_updated extends base {
         parent::validate_data();
 
         if (!isset($this->other['username'])) {
-            throw new \coding_exception('The \'username\' must be set in other.');
+            throw new \coding_exception('The \'username\' value must be set in other.');
         }
 
         if (!isset($this->other['hostname'])) {
-            throw new \coding_exception('The \'hostname\' must be set in other.');
+            throw new \coding_exception('The \'hostname\' value must be set in other.');
         }
 
         if (!isset($this->other['accessctrl'])) {
-            throw new \coding_exception('The \'accessctrl\' must be set in other.');
+            throw new \coding_exception('The \'accessctrl\' value must be set in other.');
         }
     }
 }
index fe2f208..9985e5e 100644 (file)
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
-namespace core\event;
-
-defined('MOODLE_INTERNAL') || die();
-
 /**
  * Event for when a new note entry is added.
  *
@@ -26,6 +22,10 @@ defined('MOODLE_INTERNAL') || die();
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 
+namespace core\event;
+
+defined('MOODLE_INTERNAL') || die();
+
 /**
  * Class note_created
  *
@@ -34,7 +34,7 @@ defined('MOODLE_INTERNAL') || die();
  * @property-read array $other {
  *      Extra information about event.
  *
- *      @type string publishstate publish state.
+ *      - string publishstate: the publish state.
  * }
  *
  * @package    core
@@ -42,7 +42,7 @@ defined('MOODLE_INTERNAL') || die();
  * @copyright  2013 Ankit Agarwal
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-class note_created extends \core\event\base {
+class note_created extends base {
 
     /**
      * Set basic properties for the event.
@@ -68,7 +68,8 @@ class note_created extends \core\event\base {
      * @return string
      */
     public function get_description() {
-        return 'Note for user with id "'. $this->relateduserid . '" was created by user with id "' . $this->userid . '"';
+        return "The note with the id '$this->objectid' for the user with the id '$this->relateduserid' was created by the user " .
+            "with the id '$this->userid'.";
     }
 
     /**
index 53403b7..7fbe36c 100644 (file)
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
-namespace core\event;
-
-defined('MOODLE_INTERNAL') || die();
-
 /**
  * Event for when a new note entry deleted.
  *
@@ -26,6 +22,10 @@ defined('MOODLE_INTERNAL') || die();
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 
+namespace core\event;
+
+defined('MOODLE_INTERNAL') || die();
+
 /**
  * Class note_deleted
  *
@@ -34,7 +34,7 @@ defined('MOODLE_INTERNAL') || die();
  * @property-read array $other {
  *      Extra information about event.
  *
- *      @type string publishstate publish state
+ *      - string publishstate: the publish state.
  * }
  *
  * @package    core
@@ -42,7 +42,7 @@ defined('MOODLE_INTERNAL') || die();
  * @copyright  2013 Ankit Agarwal
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-class note_deleted extends \core\event\base {
+class note_deleted extends base {
 
     /**
      * Set basic properties for the event.
@@ -68,7 +68,8 @@ class note_deleted extends \core\event\base {
      * @return string
      */
     public function get_description() {
-        return 'Note for user with id "'. $this->relateduserid . '" was deleted by user with id "' . $this->userid . '"';
+        return "The note with the id '$this->objectid' for the user with the id '$this->relateduserid' was deleted by the user " .
+            "with the id '$this->userid'.";
     }
 
     /**
index 79cc5aa..1fe138d 100644 (file)
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
-namespace core\event;
-
-defined('MOODLE_INTERNAL') || die();
-
 /**
  * Event for when a new note entry is updated.
  *
@@ -26,6 +22,10 @@ defined('MOODLE_INTERNAL') || die();
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 
+namespace core\event;
+
+defined('MOODLE_INTERNAL') || die();
+
 /**
  * Class note_updated
  *
@@ -34,7 +34,7 @@ defined('MOODLE_INTERNAL') || die();
  * @property-read array $other {
  *      Extra information about event.
  *
- *      @type string publishstate publish state.
+ *      - string publishstate: the publish state.
  * }
  *
  * @package    core
@@ -42,7 +42,7 @@ defined('MOODLE_INTERNAL') || die();
  * @copyright  2013 Ankit Agarwal
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-class note_updated extends \core\event\base {
+class note_updated extends base {
 
     /**
      * Set basic properties for the event.
@@ -68,7 +68,8 @@ class note_updated extends \core\event\base {
      * @return string
      */
     public function get_description() {
-        return 'Note for user with id "'. $this->relateduserid . '" was updated by user with id "'. $this->userid . '"';
+        return "The note with the id '$this->objectid' for the user with the id '$this->relateduserid' was updated by the user " .
+            "with the id '$this->userid'.";
     }
 
     /**
index 58a688e..470136b 100644 (file)
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
-namespace core\event;
-
-defined('MOODLE_INTERNAL') || die();
-
 /**
  * Event for when a new note entry viewed.
  *
@@ -26,6 +22,10 @@ defined('MOODLE_INTERNAL') || die();
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 
+namespace core\event;
+
+defined('MOODLE_INTERNAL') || die();
+
 /**
  * Class note_viewed
  *
@@ -36,7 +36,7 @@ defined('MOODLE_INTERNAL') || die();
  * @copyright  2013 Ankit Agarwal
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-class notes_viewed extends \core\event\base {
+class notes_viewed extends base {
 
     /**
      * Set basic properties for the event.
@@ -62,10 +62,10 @@ class notes_viewed extends \core\event\base {
      */
     public function get_description() {
         if (!empty($this->relateduserid)) {
-            return 'Note for user with id "'. $this->relateduserid . '" was viewed by user with id "'. $this->userid . '"';
-        } else {
-            return 'Note for course with id "'. $this->courseid . '" was viewed by user with id "'. $this->userid . '"';
+            return "The user with the id '$this->userid' viewed the notes for the user with the id '$this->relateduserid'.";
         }
+
+        return "The user with the id '$this->userid' viewed the notes for the course with the id '$this->courseid'.";
     }
 
     /**
index 1aba878..b459877 100644 (file)
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
- * Question category created event class.
+ * Question category created event.
  *
  * @package    core
- * @since      Moodle 2.7
  * @copyright  2014 Mark Nelson <markn@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
+
 namespace core\event;
 
 defined('MOODLE_INTERNAL') || die();
 
+/**
+ * Question category created event class.
+ *
+ * @package    core
+ * @since      Moodle 2.7
+ * @copyright  2014 Mark Nelson <markn@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 class question_category_created extends base {
 
     /**
@@ -52,7 +60,7 @@ class question_category_created extends base {
      * @return string
      */
     public function get_description() {
-        return 'A question category with the id of ' . $this->objectid . ' was created by a user with the id ' . $this->userid;
+        return "A question category with the id of '$this->objectid' was created by the user with the id '$this->userid'.";
     }
 
     /**
index 9c88a93..752a7a2 100644 (file)
  * @copyright  2014 Petr Skoda
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
+
 namespace core\event;
 
+defined('MOODLE_INTERNAL') || die();
+
 /**
  * Event for recent activity page.
  *
@@ -58,7 +61,7 @@ class recent_activity_viewed extends \core\event\base {
      * @return string
      */
     public function get_description() {
-        return "The user with id " . $this->userid . " viewed recent activity report in course " . $this->courseid;
+        return "The user with the id '$this->userid' viewed the recent activity report in the course with the id '$this->courseid'.";
     }
 
     /**
@@ -88,7 +91,7 @@ class recent_activity_viewed extends \core\event\base {
         parent::validate_data();
 
         if ($this->contextlevel != CONTEXT_COURSE) {
-            throw new \coding_exception('recent_activity_viewed event expects only course contexts.');
+            throw new \coding_exception('Context level must be CONTEXT_COURSE.');
         }
     }
 }
index 50b9475..3a194c1 100644 (file)
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
+/**
+ * Role assignments updated event.
+ *
+ * @package    core
+ * @since      Moodle 2.6
+ * @copyright  2013 Rajesh Taneja <rajesh@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
 namespace core\event;
 
 defined('MOODLE_INTERNAL') || die();
 
 /**
- * Event when role allow assignments is updated.
+ * Role assignments updated event class.
  *
  * @package    core
  * @since      Moodle 2.6
  * @copyright  2013 Rajesh Taneja <rajesh@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-
 class role_allow_assign_updated extends base {
     /**
      * Initialise event parameters.
@@ -51,7 +59,7 @@ class role_allow_assign_updated extends base {
      * @return string
      */
     public function get_description() {
-        return 'Allow role assignments updated by user ' . $this->userid;
+        return "Allow role assignments updated by the user with the id '$this->userid'.";
     }
 
     /**
index 3e3c6ac..79aa2e4 100644 (file)
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
+/**
+ * Role allow override updated event.
+ *
+ * @package    core
+ * @since      Moodle 2.6
+ * @copyright  2013 Rajesh Taneja <rajesh@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
 namespace core\event;
 
 defined('MOODLE_INTERNAL') || die();
 
 /**
- * Event when role allow override is updated.
+ * Role allow override updated event class.
  *
  * @package    core
  * @since      Moodle 2.6
  * @copyright  2013 Rajesh Taneja <rajesh@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-
 class role_allow_override_updated extends base {
     /**
      * Initialise event parameters.
@@ -51,7 +59,7 @@ class role_allow_override_updated extends base {
      * @return string
      */
     public function get_description() {
-        return 'Allow role override updated by user ' . $this->userid;
+        return "Allow role override updated by the user with the id '$this->userid'.";
     }
 
     /**
index 0d03614..d3551c9 100644 (file)
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
+/**
+ * Role allow switch updated event.
+ *
+ * @package    core
+ * @since      Moodle 2.6
+ * @copyright  2013 Rajesh Taneja <rajesh@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
 namespace core\event;
 
 defined('MOODLE_INTERNAL') || die();
 
 /**
- * Event when role allow switch is updated.
+ * Role allow switch updated event class.
  *
  * @package    core
  * @since      Moodle 2.6
  * @copyright  2013 Rajesh Taneja <rajesh@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-
 class role_allow_switch_updated extends base {
     /**
      * Initialise event parameters.
@@ -51,7 +59,7 @@ class role_allow_switch_updated extends base {
      * @return string
      */
     public function get_description() {
-        return 'Allow role switch updated by user ' . $this->userid;
+        return "Allow role switch updated by the user with the id '$this->userid'.";
     }
 
     /**
index 79b5639..1722732 100644 (file)
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
+/**
+ * Role assigned event.
+ *
+ * @package    core
+ * @copyright  2013 Petr Skoda {@link http://skodak.org}
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
 namespace core\event;
 
 defined('MOODLE_INTERNAL') || die();
@@ -24,9 +32,9 @@ defined('MOODLE_INTERNAL') || die();
  * @property-read array $other {
  *      Extra information about event.
  *
- *      @type int id role assigned id.
- *      @type string component name of component.
- *      @type int itemid id of item.
+ *      - int id: role assigned id.
+ *      - string component: name of component.
+ *      - int itemid: id of the item.
  * }
  *
  * @package    core
@@ -34,8 +42,11 @@ defined('MOODLE_INTERNAL') || die();
  * @copyright  2013 Petr Skoda {@link http://skodak.org}
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-
 class role_assigned extends base {
+
+    /**
+     * Set basic properties for the event.
+     */
     protected function init() {
         $this->data['objecttable'] = 'role';
         $this->data['crud'] = 'c';
@@ -57,7 +68,8 @@ class role_assigned extends base {
      * @return string
      */
     public function get_description() {
-        return 'Role '.$this->objectid.' was assigned to user '.$this->relateduserid.' in context '.$this->contextid;
+        return "The role with the id '$this->objectid' was assigned to the user with the id '$this->relateduserid' " .
+            "by the user with the id '$this->userid'.";
     }
 
     /**
@@ -83,7 +95,7 @@ class role_assigned extends base {
      * @return mixed
      */
     protected function get_legacy_eventdata() {
-        return $this->get_record_snapshot('role_assignments', $this->data['other']['id']);
+        return $this->get_record_snapshot('role_assignments', $this->other['id']);
     }
 
     /**
index 5c65f95..9cc28f4 100644 (file)
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
+/**
+ * Role updated event.
+ *
+ * @package    core
+ * @since      Moodle 2.6
+ * @copyright  2013 Rajesh Taneja <rajesh@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
 namespace core\event;
 
 defined('MOODLE_INTERNAL') || die();
 
 /**
- * Role updated event.
+ * Role updated event class.
  *
  * @package    core
  * @since      Moodle 2.6
  * @copyright  2013 Rajesh Taneja <rajesh@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-
 class role_capabilities_updated extends base {
     /** @var array Legacy log data */
     protected $legacylogdata = null;
@@ -55,7 +63,7 @@ class role_capabilities_updated extends base {
      * @return string
      */
     public function get_description() {
-        return 'Capabilities for role ' . $this->objectid . ' are updated by user ' . $this->userid;
+        return "The capabilities for the role with the id '$this->objectid' were updated by the user with the id '$this->userid'.";
     }
 
     /**
index 9a52582..27a1982 100644 (file)
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
+/**
+ * Role assigned event.
+ *
+ * @package    core
+ * @copyright  2013 Rajesh Taneja <rajesh@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
 namespace core\event;
 
 defined('MOODLE_INTERNAL') || die();
 
 /**
- * Role assigned event.
+ * Role assigned event class.
  *
  * @property-read array $other {
  *      Extra information about event.
  *
- *      @type string shortname shortname of role.
- *      @type string description role description.
- *      @type string archetype role type.
+ *      - string shortname: shortname of role.
+ *      - string description: role description.
+ *      - string archetype: role type.
  * }
  *
  * @package    core
@@ -34,7 +42,6 @@ defined('MOODLE_INTERNAL') || die();
  * @copyright  2013 Rajesh Taneja <rajesh@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-
 class role_deleted extends base {
     /**
      * Initialise event parameters.
@@ -60,7 +67,7 @@ class role_deleted extends base {
      * @return string
      */
     public function get_description() {
-        return 'Role ' . $this->objectid . ' is deleted by user ' . $this->userid;
+        return "The role with the id '$this->objectid' was deleted by the user with the id '$this->userid'.";
     }
 
     /**
index 4a0908f..8de2c00 100644 (file)
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
+/**
+ * Role unassigned event.
+ *
+ * @package    core
+ * @since      Moodle 2.6
+ * @copyright  2013 Petr Skoda {@link http://skodak.org}
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
 namespace core\event;
 
 defined('MOODLE_INTERNAL') || die();
 
 /**
- * Role unassigned event.
+ * Role unassigned event class.
  *
  * @property-read array $other {
  *      Extra information about event.
  *
- *      @type int id role assigned id.
- *      @type string component name of component.
- *      @type int itemid id of item.
+ *      - int id: role assigned id.
+ *      - string component: name of component.
+ *      - int itemid: id of item.
  * }
  *
  * @package    core
@@ -34,7 +43,6 @@ defined('MOODLE_INTERNAL') || die();
  * @copyright  2013 Petr Skoda {@link http://skodak.org}
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-
 class role_unassigned extends base {
     protected function init() {
         $this->data['objecttable'] = 'role';
@@ -57,7 +65,8 @@ class role_unassigned extends base {
      * @return string
      */
     public function get_description() {
-        return 'Role '.$this->objectid.' was unassigned from user '.$this->relateduserid.' in context '.$this->contextid;
+        return "The role with the id '$this->objectid' was unassigned from the user with the id '$this->relateduserid' " .
+            "by the user with the id '$this->userid'.";
     }
 
     /**
@@ -83,7 +92,7 @@ class role_unassigned extends base {
      * @return mixed
      */
     protected function get_legacy_eventdata() {
-        return $this->get_record_snapshot('role_assignments', $this->data['other']['id']);
+        return $this->get_record_snapshot('role_assignments', $this->other['id']);
     }
 
     /**
index bad019b..d7e6892 100644 (file)
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
- * Event for when a tag has been added to an item.
+ * The tag added event.
+ *
+ * @package    core
+ * @copyright  2014 Mark Nelson <markn@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+namespace core\event;
+
+defined('MOODLE_INTERNAL') || die();
+
+/**
+ * Event class for when a tag has been added to an item.
  *
  * @property-read array $other {
  *      Extra information about event.
  * @copyright  2014 Mark Nelson <markn@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-
-namespace core\event;
-
-defined('MOODLE_INTERNAL') || die();
-
 class tag_added extends base {
 
     /**
@@ -63,8 +70,8 @@ class tag_added extends base {
      * @return string
      */
     public function get_description() {
-        return 'The tag with the id ' . $this->other['tagid'] . ' was added to the item type \'' . s($this->other['itemtype']) .
-            '\' with the id ' . $this->other['itemid'] . ' by the user with the id ' . $this->userid;
+        return "The user with the id '$this->userid' added the tag with the id '{$this->other['tagid']}' to the item type '" .
+            s($this->other['itemtype']) . "' with the id '{$this->other['itemid']}'.";
     }
 
     /**
@@ -91,23 +98,23 @@ class tag_added extends base {
         parent::validate_data();
 
         if (!isset($this->other['tagid'])) {
-            throw new \coding_exception('The tagid must be set in $other.');
+            throw new \coding_exception('The \'tagid\' value must be set in other.');
         }
 
         if (!isset($this->other['itemid'])) {
-            throw new \coding_exception('The itemid must be set in $other.');
+            throw new \coding_exception('The \'itemid\' value must be set in other.');
         }
 
         if (!isset($this->other['itemtype'])) {
-            throw new \coding_exception('The itemtype must be set in $other.');
+            throw new \coding_exception('The \'itemtype\' value must be set in other.');
         }
 
         if (!isset($this->other['tagname'])) {
-            throw new \coding_exception('The tagname must be set in $other.');
+            throw new \coding_exception('The \'tagname\' value must be set in other.');
         }
 
         if (!isset($this->other['tagrawname'])) {
-            throw new \coding_exception('The tagrawname must be set in $other.');
+            throw new \coding_exception('The \'tagrawname\' value must be set in other.');
         }
     }
 }
index a94c78b..9edb3c7 100644 (file)
 /**
  * Tag created event.
  *
+ * @package    core
+ * @copyright  2014 Mark Nelson <markn@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+namespace core\event;
+
+defined('MOODLE_INTERNAL') || die();
+
+/**
+ * Tag created event class.
+ *
  * @property-read array $other {
  *      Extra information about event.
  *
  * @copyright  2014 Mark Nelson <markn@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-
-namespace core\event;
-
-defined('MOODLE_INTERNAL') || die();
-
 class tag_created extends base {
 
     /**
@@ -60,7 +67,7 @@ class tag_created extends base {
      * @return string
      */
     public function get_description() {
-        return 'The tag with the id ' . $this->objectid . ' was created by the user with the id ' . $this->userid;
+        return "The user with the id '$this->userid' created the tag with the id '$this->objectid'.";
     }
 
     /**
@@ -73,11 +80,11 @@ class tag_created extends base {
         parent::validate_data();
 
         if (!isset($this->other['name'])) {
-            throw new \coding_exception('The name must be set in $other.');
+            throw new \coding_exception('The \'name\' value must be set in other.');
         }
 
         if (!isset($this->other['rawname'])) {
-            throw new \coding_exception('The rawname must be set in $other.');
+            throw new \coding_exception('The \'rawname\' value must be set in other.');
         }
     }
 }
index 6077b8a..1225389 100644 (file)
 /**
  * Tag deleted event.
  *
+ * @package    core
+ * @copyright  2014 Mark Nelson <markn@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+namespace core\event;
+
+defined('MOODLE_INTERNAL') || die();
+
+/**
+ * Tag deleted event class.
+ *
  * @property-read array $other {
  *      Extra information about event.
  *
  * @copyright  2014 Mark Nelson <markn@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-
-namespace core\event;
-
-defined('MOODLE_INTERNAL') || die();
-
 class tag_deleted extends base {
 
     /**
@@ -60,7 +67,7 @@ class tag_deleted extends base {
      * @return string
      */
     public function get_description() {
-        return 'The tag with the id ' . $this->objectid . ' was deleted by the user with the id ' . $this->userid;
+        return "The user with the id '$this->userid' deleted the tag with the id '$this->objectid'.";
     }
 
     /**
@@ -73,11 +80,11 @@ class tag_deleted extends base {
         parent::validate_data();
 
         if (!isset($this->other['name'])) {
-            throw new \coding_exception('The name must be set in $other.');
+            throw new \coding_exception('The \'name\' value must be set in other.');
         }
 
         if (!isset($this->other['rawname'])) {
-            throw new \coding_exception('The rawname must be set in $other.');
+            throw new \coding_exception('The \'rawname\' value must be set in other.');
         }
     }
 }
index 5c4b8fc..f6c4c63 100644 (file)
 /**
  * Tag flagged event.
  *
+ * @package    core
+ * @copyright  2014 Mark Nelson <markn@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+namespace core\event;
+
+defined('MOODLE_INTERNAL') || die();
+
+/**
+ * Tag flagged event class.
+ *
  * @property-read array $other {
  *      Extra information about event.
  *
  * @copyright  2014 Mark Nelson <markn@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-
-namespace core\event;
-
-defined('MOODLE_INTERNAL') || die();
-
 class tag_flagged extends base {
 
     /**
@@ -60,7 +67,7 @@ class tag_flagged extends base {
      * @return string
      */
     public function get_description() {
-        return 'The tag with the id ' . $this->objectid . ' was flagged by the user with the id ' . $this->userid;
+        return "The tag with the id '$this->objectid' was flagged by the user with the id '$this->userid'.";
     }
 
     /**
@@ -82,11 +89,11 @@ class tag_flagged extends base {
         parent::validate_data();
 
         if (!isset($this->other['name'])) {
-            throw new \coding_exception('The name must be set in $other.');
+            throw new \coding_exception('The \'name\' value must be set in other.');
         }
 
         if (!isset($this->other['rawname'])) {
-            throw new \coding_exception('The rawname must be set in $other.');
+            throw new \coding_exception('The \'rawname\' value must be set in other.');
         }
     }
 }
index 2ac4523..518fcfe 100644 (file)
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
- * Event for when a tag has been removed from an item.
+ * The tag removed event.
+ *
+ * @package    core
+ * @copyright  2014 Mark Nelson <markn@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+namespace core\event;
+
+defined('MOODLE_INTERNAL') || die();
+
+/**
+ * Event class for when a tag has been removed from an item.
  *
  * @property-read array $other {
  *      Extra information about event.
  * @copyright  2014 Mark Nelson <markn@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-
-namespace core\event;
-
-defined('MOODLE_INTERNAL') || die();
-
 class tag_removed extends base {
 
     /**
@@ -63,8 +70,8 @@ class tag_removed extends base {
      * @return string
      */
     public function get_description() {
-        return 'The tag with the id ' . $this->other['tagid'] . ' was removed from the item type \'' . s($this->other['itemtype']) .
-            '\' with the id ' . $this->other['itemid'] . ' by the user with the id ' . $this->userid;
+        return "The user with the id '$this->userid' removed the tag with the id '{$this->other['tagid']}' to the item type '" .
+            s($this->other['itemtype']) . "' with the id '{$this->other['itemid']}'.";
     }
 
     /**
@@ -77,23 +84,23 @@ class tag_removed extends base {
         parent::validate_data();
 
         if (!isset($this->other['tagid'])) {
-            throw new \coding_exception('The tagid must be set in $other.');
+            throw new \coding_exception('The \'tagid\' value must be set in other.');
         }
 
         if (!isset($this->other['itemid'])) {
-            throw new \coding_exception('The itemid must be set in $other.');
+            throw new \coding_exception('The \'itemid\' value must be set in other.');
         }
 
         if (!isset($this->other['itemtype'])) {
-            throw new \coding_exception('The itemtype must be set in $other.');
+            throw new \coding_exception('The \'itemtype\' value must be set in other.');
         }
 
         if (!isset($this->other['tagname'])) {
-            throw new \coding_exception('The tagname must be set in $other.');
+            throw new \coding_exception('The \'tagname\' value must be set in other.');
         }
 
         if (!isset($this->other['tagrawname'])) {
-            throw new \coding_exception('The tagrawname must be set in $other.');
+            throw new \coding_exception('The \'tagrawname\' value must be set in other.');
         }
     }
 }
index 70e2518..86c3833 100644 (file)
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
+/**
+ * Tag unflagged event.
+ *
+ * @package    core
+ * @copyright  2014 Mark Nelson <markn@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+namespace core\event;
+
+defined('MOODLE_INTERNAL') || die();
+
 /**
  * Tag unflagged event.
  *
  * @copyright  2014 Mark Nelson <markn@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-
-namespace core\event;
-
-defined('MOODLE_INTERNAL') || die();
-
 class tag_unflagged extends base {
 
     /**
@@ -60,7 +67,7 @@ class tag_unflagged extends base {
      * @return string
      */
     public function get_description() {
-        return 'The tag with the id ' . $this->objectid . ' was unflagged by the user with the id ' . $this->userid;
+        return "The tag with the id '$this->objectid' was unflagged by the user with the id '$this->userid'.";
     }
 
     /**
@@ -73,11 +80,11 @@ class tag_unflagged extends base {
         parent::validate_data();
 
         if (!isset($this->other['name'])) {
-            throw new \coding_exception('The name must be set in $other.');
+            throw new \coding_exception('The \'name\' value must be set in other.');
         }
 
         if (!isset($this->other['rawname'])) {
-            throw new \coding_exception('The rawname must be set in $other.');
+            throw new \coding_exception('The \'rawname\' value must be set in other.');
         }
     }
 }
index a2059a5..f9c2660 100644 (file)
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
+/**
+ * Tag updated event.
+ *
+ * @package    core
+ * @copyright  2014 Mark Nelson <markn@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+namespace core\event;
+
+defined('MOODLE_INTERNAL') || die();
+
 /**
  * Tag updated event.
  *
  * @copyright  2014 Mark Nelson <markn@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-
-namespace core\event;
-
-defined('MOODLE_INTERNAL') || die();
-
 class tag_updated extends base {
 
     /** @var array The legacy log data. */
@@ -63,7 +70,7 @@ class tag_updated extends base {
      * @return string
      */
     public function get_description() {
-        return 'The tag with the id ' . $this->objectid . ' was updated by the user with the id ' . $this->userid;
+        return "The tag with the id '$this->objectid' was updated by the user with the id '$this->userid'.";
     }
 
     /**
@@ -98,11 +105,11 @@ class tag_updated extends base {
         parent::validate_data();
 
         if (!isset($this->other['name'])) {
-            throw new \coding_exception('The name must be set in $other.');
+            throw new \coding_exception('The \'name\' value must be set in other.');
         }
 
         if (!isset($this->other['rawname'])) {
-            throw new \coding_exception('The rawname must be set in $other.');
+            throw new \coding_exception('The \'rawname\' value must be set in other.');
         }
     }
 }
index a0e7544..b13eb70 100644 (file)
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
+/**
+ * Unknown event.
+ *
+ * @package    core
+ * @since      Moodle 2.7
+ * @copyright  2014 Petr Skoda
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
 namespace core\event;
 
 defined('MOODLE_INTERNAL') || die();
index 88ce8ca..e0738ee 100644 (file)
@@ -21,6 +21,7 @@
  * @copyright  2013 Rajesh Taneja <rajesh@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
+
 namespace core\event;
 
 defined('MOODLE_INTERNAL') || die();
@@ -59,7 +60,7 @@ class user_created extends base {
      * @return string
      */
     public function get_description() {
-        return 'Profile created for user '.$this->objectid;
+        return "The user with the id '$this->objectid' was created.";
     }
 
     /**
index dcfdddb..79d9cec 100644 (file)
@@ -69,7 +69,7 @@ class user_deleted extends base {
      * @return string
      */
     public function get_description() {
-        return 'User profile deleted for the user with the id ' . $this->objectid;
+        return "The user with the id '$this->objectid' was deleted.";
     }
 
     /**
index 5338cd6..8f5b2e7 100644 (file)
@@ -26,12 +26,12 @@ namespace core\event;
 defined('MOODLE_INTERNAL') || die();
 
 /**
- * Event when user is enrolled in a course.
+ * Event class for when user is enrolled in a course.
  *
  * @property-read array $other {
  *      Extra information about event.
  *
- *      @type string enrol name of enrolment instance.
+ *      - string enrol: name of enrolment instance.
  * }
  *
  * @package    core
@@ -65,7 +65,8 @@ class user_enrolment_created extends base {
      * @return string
      */
     public function get_description() {
-        return 'User '.$this->relateduserid. ' is enrolled in course '.$this->courseid.' by user '.$this->userid;
+        return "The user with the id '$this->relateduserid' was enrolled in the course with the id '$this->courseid' by the " .
+            "user with the id '$this->userid'.";
     }
 
     /**
@@ -115,11 +116,13 @@ class user_enrolment_created extends base {
      */
     protected function validate_data() {
         parent::validate_data();
-        if (!isset($this->other['enrol'])) {
-            throw new \coding_exception('Enrolment plugin name must be set in $other.');
-        }
+
         if (!isset($this->relateduserid)) {
-            throw new \coding_exception('Related user id must be set.');
+            throw new \coding_exception('The \'relateduserid\' must be set.');
+        }
+
+        if (!isset($this->other['enrol'])) {
+            throw new \coding_exception('The \'enrol\' value must be set in $other.');
         }
     }
 }
index 7339566..8fc8daa 100644 (file)
 /**
  * User enrolment deleted event.
  *
- * @property-read array $other {
- *      Extra information about event.
- *
- *      @type string enrol name of enrolment instance.
- *      @type array userenrolment user_enrolment record.
- * }
- *
  * @package    core
  * @copyright  2013 Rajesh Taneja <rajesh@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
@@ -33,7 +26,14 @@ namespace core\event;
 defined('MOODLE_INTERNAL') || die();
 
 /**
- * Event when user is unenrolled from a course.
+ * Event class for when user is unenrolled from a course.
+ *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      - string enrol: name of enrolment instance.
+ *      - array userenrolment: user_enrolment record.
+ * }
  *
  * @package    core
  * @since      Moodle 2.6
@@ -66,7 +66,8 @@ class user_enrolment_deleted extends base {
      * @return string
      */
     public function get_description() {
-        return 'User '.$this->relateduserid. ' is enrolled in course '.$this->courseid.' by user '.$this->userid;
+        return "The user with the id '$this->relateduserid' was unenrolled in the course with the id '$this->courseid' by the " .
+            "user with the id '$this->userid'.";
     }
 
     /**
index 02c5c7c..995336c 100644 (file)
@@ -26,12 +26,12 @@ namespace core\event;
 defined('MOODLE_INTERNAL') || die();
 
 /**
- * Event when user enrolment is updated.
+ * Event class for when user enrolment is updated.
  *
  * @property-read array $other {
  *      Extra information about event.
  *
- *      @type string enrol name of enrolment instance.
+ *      - string enrol: name of enrolment instance.
  * }
  *
  * @package    core
@@ -65,7 +65,8 @@ class user_enrolment_updated extends base {
      * @return string
      */
     public function get_description() {
-        return 'User '.$this->relateduserid. ' has updated enrolment for user '.$this->userid.' in course '.$this->courseid;
+        return "The user with the id '$this->userid' updated the enrolment for the user with the id '$this->relateduserid' in " .
+            "the course with the id '$this->courseid'.";
     }
 
     /**
index ba3f374..8dfb934 100644 (file)
@@ -32,17 +32,20 @@ defined('MOODLE_INTERNAL') || die();
  * Note: use grade_grades_history table if you need to know
  *       the history of grades.
  *
- * @property-read array $other Extra information about the event.
- *     -int itemid: grade item id.
- *     -bool overridden: Is this grade override?
- *     -float finalgrade: the final grade value.
+ * @property-read array $other {
+ *      Extra information about the event.
+ *
+ *      - int itemid: grade item id.
+ *      - bool overridden: Is this grade override?
+ *      - float finalgrade: the final grade value.
+ * }
  *
  * @package    core
  * @since      Moodle 2.7
  * @copyright  2013 Petr Skoda
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-class user_graded extends \core\event\base {
+class user_graded extends base {
     /** @var \grade_grade $grade */
     protected $grade;
 
@@ -104,7 +107,8 @@ class user_graded extends \core\event\base {
      * @return string
      */
     public function get_description() {
-        return "User {$this->userid} edited grade of user {$this->objectid} for grade item " . $this->other['itemid'];
+        return "The user with the id '$this->userid' updated the grade with the id {$this->objectid} for the user with the " .
+            "id '$this->relateduserid' for the grade item with the id '{$this->other['itemid']}'.";
     }
 
     /**
index 6cb6210..f753285 100644 (file)
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
+/**
+ * Defines the user list viewed event.
+ *
+ * @package    core
+ * @copyright  2013 Mark Nelson <markn@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+namespace core\event;
+
+defined('MOODLE_INTERNAL') || die();
+
 /**
  * Defines the user list viewed event.
  *
  * @property-read array $other {
  *      Extra information about event.
  *
- *      @type int courseid id of course.
- *      @type string courseshortname short name of course.
- *      @type string coursefullname full name of course.
+ *      - string courseshortname: the short name of course.
+ *      - string coursefullname: the full name of course.
  * }
  *
  * @package    core
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 
-namespace core\event;
-
-defined('MOODLE_INTERNAL') || die();
-
-class user_list_viewed extends \core\event\base {
+class user_list_viewed extends base {
 
     /**
      * Initialise required event data properties.
@@ -61,7 +68,7 @@ class user_list_viewed extends \core\event\base {
      * @return string
      */
     public function get_description() {
-        return 'User ' . $this->userid . ' viewed the list of users in the course ' . $this->other['courseid'];
+        return "The user with the id '$this->userid' viewed the list of users in the course with the id '$this->courseid'.";
     }
 
     /**
@@ -70,7 +77,7 @@ class user_list_viewed extends \core\event\base {
      * @return \moodle_url
      */
     public function get_url() {
-        return new \moodle_url('/user/index.php', array('id' => $this->other['courseid']));
+        return new \moodle_url('/user/index.php', array('id' => $this->courseid));
     }
 
     /**
@@ -79,7 +86,6 @@ class user_list_viewed extends \core\event\base {
      * @return array
      */
     protected function get_legacy_logdata() {
-        return array($this->other['courseid'], 'user', 'view all', 'index.php?id=' . $this->other['courseid'], '');
+        return array($this->courseid, 'user', 'view all', 'index.php?id=' . $this->courseid, '');
     }
-
 }
index 772c4f9..e16b557 100644 (file)
@@ -18,7 +18,6 @@
  * User login event.
  *
  * @package    core
- * @since      Moodle 2.6
  * @copyright  2013 Frédéric Massart
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
@@ -33,14 +32,15 @@ defined('MOODLE_INTERNAL') || die();
  * @property-read array $other {
  *      Extra information about event.
  *
- *      @type string username name of user.
+ *      - string username: name of user.
  * }
  *
  * @package    core
+ * @since      Moodle 2.6
  * @copyright  2013 Frédéric Massart
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-class user_loggedin extends \core\event\base {
+class user_loggedin extends base {
 
     /**
      * Returns non-localised event description with id's for admin use only.
@@ -48,7 +48,7 @@ class user_loggedin extends \core\event\base {
      * @return string
      */
     public function get_description() {
-        return 'Userid ' . $this->userid . ' has logged in';
+        return "The user with the id '$this->userid' has logged in.";
     }
 
     /**
@@ -85,7 +85,7 @@ class user_loggedin extends \core\event\base {
      * @return string
      */
     public function get_username() {
-        return $this->data['other']['username'];
+        return $this->other['username'];
     }
 
     /**
@@ -108,10 +108,9 @@ class user_loggedin extends \core\event\base {
      */
     protected function validate_data() {
         parent::validate_data();
-        if (!isset($this->data['objectid'])) {
-            throw new \coding_exception("objectid has to be specified.");
-        } else if (!isset($this->data['other']['username'])) {
-            throw new \coding_exception("other['username'] has to be specified.");
+
+        if (!isset($this->other['username'])) {
+            throw new \coding_exception('The \'username\' value must be set in other.');
         }
     }
 }
index b292c58..eb19435 100644 (file)
@@ -32,8 +32,8 @@ defined('MOODLE_INTERNAL') || die();
  * @property-read array $other {
  *      Extra information about event.
  *
- *      @type string originalusername original username.
- *      @type string loggedinasusername username of logged in as user.
+ *      - string originalusername: original username.
+ *      - string loggedinasusername: username of logged in as user.
  * }
  *
  * @package    core
@@ -69,7 +69,7 @@ class user_loggedinas extends base {
      * @return string
      */
     public function get_description() {
-        return 'Userid ' . $this->userid . ' has logged in as '. $this->relateduserid;
+        return "The user with the id '$this->userid' has logged in as the user with the id '$this->relateduserid'.";
     }
 
     /**
index 310e5e6..048cf6d 100644 (file)
@@ -31,7 +31,7 @@ defined('MOODLE_INTERNAL') || die();
  * @property-read array $other {
  *      Extra information about event.
  *
- *      @type string sessionid session id.
+ *      - string sessionid: session id.
  * }
  *
  * @package    core
@@ -66,7 +66,7 @@ class user_loggedout extends base {
      * @return string
      */
     public function get_description() {
-        return 'User '.$this->objectid.' logged out.';
+        return "The user with the id '$this->objectid' has logged out.";
     }
 
     /**
index c671792..6a05fed 100644 (file)
@@ -32,8 +32,8 @@ defined('MOODLE_INTERNAL') || die();
  * @property-read array $other {
  *      Extra information about event.
  *
- *      @type string username name of user.
- *      @type int reason failure reason.
+ *      - string username name of user.
+ *      - int reason failure reason.
  * }
  *
  * @package    core
@@ -41,7 +41,7 @@ defined('MOODLE_INTERNAL') || die();
  * @copyright  2014 Rajesh Taneja <rajesh@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-class user_login_failed extends \core\event\base {
+class user_login_failed extends base {
     /**
      * Init method.
      *
@@ -68,7 +68,7 @@ class user_login_failed extends \core\event\base {
      * @return string
      */
     public function get_description() {
-        return 'Login failed for user "' . $this->other['username'] . '" for reason id: ' . $this->other['reason'];
+        return "Login failed for the username '{$this->other['username']}' for the reason with the id '{$this->other['reason']}'.";
     }
 
     /**
@@ -101,10 +101,13 @@ class user_login_failed extends \core\event\base {
      */
     protected function validate_data() {
         parent::validate_data();
+
         if (!isset($this->other['reason'])) {
-            throw new \coding_exception("other['reason'] has to be specified.");
-        } else if (!isset($this->other['username'])) {
-            throw new \coding_exception("other['username'] has to be specified.");
+            throw new \coding_exception('The \'reason\' value must be set in other.');
+        }
+
+        if (!isset($this->other['username'])) {
+            throw new \coding_exception('The \'username\' value must be set in other.');
         }
     }
 
index c0915ca..aea7bb9 100644 (file)
@@ -21,6 +21,7 @@
  * @copyright  2014 Petr Skoda
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
+
 namespace core\event;
 
 defined('MOODLE_INTERNAL') || die();
index 7bc8ba8..c031842 100644 (file)
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
- * Defines the user profile viewed event.
+ * The user profile viewed event.
+ *
+ * @package    core
+ * @copyright  2013 Mark Nelson <markn@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+namespace core\event;
+
+defined('MOODLE_INTERNAL') || die();
+
+/**
+ * The user profile viewed event class.
  *
  * @property-read array $other {
  *      Extra information about event.
  *
- *      @type int courseid id of course.
- *      @type string courseshortname short name of course.
- *      @type string coursefullname fullname of course.
+ *      - int courseid: id of course.
+ *      - string courseshortname: short name of course.
+ *      - string coursefullname: fullname of course.
  * }
  *
  * @package    core
  * @copyright  2013 Mark Nelson <markn@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-
-namespace core\event;
-
-defined('MOODLE_INTERNAL') || die();
-
 class user_profile_viewed extends base {
 
     /**
@@ -61,7 +68,7 @@ class user_profile_viewed extends base {
      * @return string
      */
     public function get_description() {
-        return 'User ' . $this->userid . ' viewed the profile for user ' . $this->relateduserid . ' in the course ' .
+        return 'The user ' . $this->userid . ' viewed the profile for user ' . $this->relateduserid . ' in the course ' .
             $this->other['courseid'];
     }
 
index 69e36c5..54dc983 100644 (file)
@@ -21,6 +21,7 @@
  * @copyright  2013 Rajesh Taneja <rajesh@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
+
 namespace core\event;
 
 defined('MOODLE_INTERNAL') || die();
index ad7e3e7..64ac2be 100644 (file)
@@ -15,7 +15,7 @@
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
- * core webservice function_called event.
+ * Web service function called event.
  *
  * @package    core
  * @copyright  2013 Frédéric Massart
@@ -26,12 +26,12 @@ namespace core\event;
 defined('MOODLE_INTERNAL') || die();
 
 /**
- * core webservice function_called event class.
+ * Web service function called event class.
  *
  * @property-read array $other {
  *      Extra information about event.
  *
- *      @type string function name of the function.
+ *      - string function: name of the function.
  * }
  *
  * @package    core
@@ -39,7 +39,7 @@ defined('MOODLE_INTERNAL') || die();
  * @copyright  2013 Frédéric Massart
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-class webservice_function_called extends \core\event\base {
+class webservice_function_called extends base {
 
     /**
      * Legacy log data.
@@ -87,7 +87,7 @@ class webservice_function_called extends \core\event\base {
     /**
      * Return the legacy event log data.
      *
-     * @return void
+     * @param array $legacydata the legacy data to set
      */
     public function set_legacy_logdata($legacydata) {
         $this->legacylogdata = $legacydata;
@@ -102,7 +102,7 @@ class webservice_function_called extends \core\event\base {
     protected function validate_data() {
         parent::validate_data();
         if (!isset($this->other['function'])) {
-           throw new \coding_exception('The key \'function\' needs to be set in $other.');
+           throw new \coding_exception('The \'function\' value must be set in other.');
         }
     }
 
index b7e3025..07781af 100644 (file)
@@ -15,7 +15,7 @@
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
- * core web service login failed event.
+ * Web service login failed event.
  *
  * @package    core
  * @copyright  2013 Frédéric Massart
@@ -26,14 +26,14 @@ namespace core\event;
 defined('MOODLE_INTERNAL') || die();
 
 /**
- * core web service login_failed event class.
+ * Web service login failed event class.
  *
  * @property-read array $other {
  *      Extra information about event.
  *
- *      @type string method authentication method.
- *      @type string reason failure reason.
- *      @type string tokenid id of token.
+ *      - string method: authentication method.
+ *      - string reason: failure reason.
+ *      - string tokenid: id of token.
  * }
  *
  * @package    core
@@ -41,7 +41,7 @@ defined('MOODLE_INTERNAL') || die();
  * @copyright  2013 Frédéric Massart
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-class webservice_login_failed extends \core\event\base {
+class webservice_login_failed extends base {
 
     /**
      * Legacy log data.
@@ -56,7 +56,7 @@ class webservice_login_failed extends \core\event\base {
      * @return string
      */
     public function get_description() {
-        return "Web service authentication failed with code: {$this->other['reason']}.";
+        return "Web service authentication failed with code: \"{$this->other['reason']}\".";
     }
 
     /**
@@ -116,9 +116,9 @@ class webservice_login_failed extends \core\event\base {
     protected function validate_data() {
         parent::validate_data();
         if (!isset($this->other['reason'])) {
-           throw new \coding_exception('The key \'reason\' needs to be set in $other.');
+           throw new \coding_exception('The \'reason\' value must be set in other.');
         } else if (!isset($this->other['method'])) {
-           throw new \coding_exception('The key \'method\' needs to be set in $other.');
+           throw new \coding_exception('The \'method\' value must be set in other.');
         } else if (isset($this->other['token'])) {
            throw new \coding_exception('The token cannot be set in $other.');
         }
index f906d95..c23101e 100644 (file)
@@ -15,7 +15,7 @@
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
- * core webservice service created event.
+ * Web service service created event.
  *
  * @package    core
  * @copyright  2013 Frédéric Massart
@@ -26,12 +26,12 @@ namespace core\event;
 defined('MOODLE_INTERNAL') || die();
 
 /**
- * core webservice service created event class.
+ * Web service service created event class.
  *
  * @property-read array $other {
  *      Extra information about event.
  *
- *      @type string sessionid session id.
+ *      - string: sessionid session id.
  * }
  *
  * @package    core
@@ -39,7 +39,7 @@ defined('MOODLE_INTERNAL') || die();
  * @copyright  2013 Frédéric Massart
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-class webservice_service_created extends \core\event\base {
+class webservice_service_created extends base {
 
     /**
      * Returns description of what happened.
index 41fdf3c..170c89e 100644 (file)
@@ -15,7 +15,7 @@
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
- * core webservice service deleted event.
+ * Web service service deleted event.
  *
  * @package    core
  * @copyright  2013 Frédéric Massart
@@ -26,14 +26,14 @@ namespace core\event;
 defined('MOODLE_INTERNAL') || die();
 
 /**
- * core webservice service deleted event class.
+ * Web service service deleted event class.
  *
  * @package    core
  * @since      Moodle 2.6
  * @copyright  2013 Frédéric Massart
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-class webservice_service_deleted extends \core\event\base {
+class webservice_service_deleted extends base {
 
     /**
      * Returns description of what happened.
index 36355eb..e8d44a7 100644 (file)
@@ -15,7 +15,7 @@
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
- * core webservice service updated event.
+ * Web service service updated event.
  *
  * @package    core
  * @copyright  2013 Frédéric Massart
@@ -26,14 +26,14 @@ namespace core\event;
 defined('MOODLE_INTERNAL') || die();
 
 /**
- * core webservice service updated event class.
+ * Web service service updated event class.
  *
  * @package    core
  * @since      Moodle 2.6
  * @copyright  2013 Frédéric Massart
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-class webservice_service_updated extends \core\event\base {
+class webservice_service_updated extends base {
 
     /**
      * Returns description of what happened.
index 8e775b7..1bea51b 100644 (file)
@@ -15,7 +15,7 @@
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
- * core webservice service user added event.
+ * Web service service user added event.
  *
  * @package    core
  * @copyright  2013 Frédéric Massart
@@ -26,14 +26,14 @@ namespace core\event;
 defined('MOODLE_INTERNAL') || die();
 
 /**
- * core webservice service user added event class.
+ * Web service service user added event class.
  *
  * @package    core
  * @since      Moodle 2.6
  * @copyright  2013 Frédéric Massart
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-class webservice_service_user_added extends \core\event\base {
+class webservice_service_user_added extends base {
 
     /**
      * Returns description of what happened.
index c421e46..ca4d6ee 100644 (file)
@@ -15,7 +15,7 @@
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
- * core webservice service user removed event.
+ * Web service service user removed event.
  *
  * @package    core
  * @copyright  2013 Frédéric Massart
@@ -26,14 +26,14 @@ namespace core\event;
 defined('MOODLE_INTERNAL') || die();
 
 /**
- * core webservice service user removed event class.
+ * Web service service user removed event class.
  *
  * @package    core
  * @since      Moodle 2.6
  * @copyright  2013 Frédéric Massart
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-class webservice_service_user_removed extends \core\event\base {
+class webservice_service_user_removed extends base {
 
     /**
      * Returns description of what happened.
index 7368041..a9c4f27 100644 (file)
@@ -15,7 +15,7 @@
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
- * core webservice token_created event.
+ * Web service token created event.
  *
  * @package    core
  * @copyright  2013 Frédéric Massart
@@ -26,12 +26,12 @@ namespace core\event;
 defined('MOODLE_INTERNAL') || die();
 
 /**
- * core webservice token_created event class.
+ * Web service token created event class.
  *
  * @property-read array $other {
  *      Extra information about event.
  *
- *      @type bool auto automatically created.
+ *      - bool auto: true if it was automatically created.
  * }
  *
  * @package    core
@@ -39,7 +39,7 @@ defined('MOODLE_INTERNAL') || die();
  * @copyright  2013 Frédéric Massart
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-class webservice_token_created extends \core\event\base {
+class webservice_token_created extends base {
 
     /**
      * Returns description of what happened.
@@ -101,8 +101,7 @@ class webservice_token_created extends \core\event\base {
     protected function validate_data() {
         parent::validate_data();
         if (!isset($this->relateduserid)) {
-           throw new \coding_exception('The property \'relateduserid\' must be set.');
+           throw new \coding_exception('The \'relateduserid\' must be set.');
         }
     }
-
 }
index a43bdc1..be2c2a2 100644 (file)
@@ -15,7 +15,7 @@
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
- * core webservice token_sent event.
+ * Webservice token_sent event.
  *
  * @package    core
  * @copyright  2013 Frédéric Massart
@@ -26,14 +26,14 @@ namespace core\event;
 defined('MOODLE_INTERNAL') || die();
 
 /**
- * core webservice token sent event class.
+ * Webservice token sent event class.
  *
  * @package    core
  * @since      Moodle 2.6
  * @copyright  2013 Frédéric Massart
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-class webservice_token_sent extends \core\event\base {
+class webservice_token_sent extends base {
 
     /**
      * Returns description of what happened.
index 96c3f6a..3ff0c28 100644 (file)
@@ -1040,13 +1040,14 @@ class completion_info {
         $coursecontext = $cmcontext->get_parent_context();
 
         // Trigger an event for course module completion changed.
-        $event = \core\event\course_module_completion_updated::create(
-            array('objectid' => $data->id,
-                'context' => $cmcontext,
-                'relateduserid' => $data->userid,
-                'other' => array('relateduserid' => $data->userid)
-                )
-            );
+        $event = \core\event\course_module_completion_updated::create(array(
+            'objectid' => $data->id,
+            'context' => $cmcontext,
+            'relateduserid' => $data->userid,
+            'other' => array(
+                'relateduserid' => $data->userid
+            )
+        ));
         $event->add_record_snapshot('course_modules_completion', $data);
         $event->trigger();
 
index 468b327..53ad307 100644 (file)
@@ -291,13 +291,5 @@ class core_authlib_testcase extends advanced_testcase {
         } catch(Exception $e) {
             $this->assertInstanceOf('coding_exception', $e);
         }
-
-        try {
-            $event = \core\event\user_loggedin::create(array('other' => array('username' => 'test')));
-            $this->fail('\core\event\user_loggedin requires objectid');
-        } catch(Exception $e) {
-            $this->assertInstanceOf('coding_exception', $e);
-        }
     }
-
 }
index 5062e3b..150bafc 100644 (file)
@@ -817,7 +817,7 @@ class core_completionlib_testcase extends advanced_testcase {
         $this->assertEquals($current, $event->get_record_snapshot('course_modules_completion', $event->objectid));
         $this->assertEquals(context_module::instance($forum->cmid), $event->get_context());
         $this->assertEquals($USER->id, $event->userid);
-        $this->assertEquals($this->user->id, $event->other['relateduserid']);
+        $this->assertEquals($this->user->id, $event->relateduserid);
         $this->assertInstanceOf('moodle_url', $event->get_url());
         $this->assertEventLegacyData($current, $event);
     }
@@ -844,7 +844,7 @@ class core_completionlib_testcase extends advanced_testcase {
         $this->assertEquals($this->course->id, $event->get_record_snapshot('course_completions', $event->objectid)->course);
         $this->assertEquals($this->course->id, $event->courseid);
         $this->assertEquals($USER->id, $event->userid);
-        $this->assertEquals($this->user->id, $event->other['relateduserid']);
+        $this->assertEquals($this->user->id, $event->relateduserid);
         $this->assertEquals(context_course::instance($this->course->id), $event->get_context());
         $this->assertInstanceOf('moodle_url', $event->get_url());
         $data = $ccompletion->get_record_data();
index cc8de0b..58cf2ab 100644 (file)
@@ -314,10 +314,13 @@ class docblock_test2 extends \core\event\base {
 /**
  * Calendar event created event.
  *
- * @property-read array $other Extra information about the event.
- *     -int timestart: timestamp for event time start.
- *     -string name: Name of the event.
- *     -int repeatid: Id of the parent event if present, else 0.
+ * @property-read array $other {
+ *      Extra information about the event.
+ *
+ *      - int timestart: timestamp for event time start.
+ *      - string name: Name of the event.
+ *      - int repeatid: Id of the parent event if present, else 0.
+ * }
  *
  * @package    core
  * @since      Moodle 2.7
index 176c734..2f24926 100644 (file)
@@ -15,7 +15,7 @@
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
- * mod_assign all submissions downloaded event.
+ * The mod_assign all submissions downloaded event.
  *
  * @package    mod_assign
  * @copyright  2013 Frédéric Massart
@@ -27,7 +27,7 @@ namespace mod_assign\event;
 defined('MOODLE_INTERNAL') || die();
 
 /**
- * mod_assign all submissions downloaded event class.
+ * The mod_assign all submissions downloaded event class.
  *
  * @package    mod_assign
  * @since      Moodle 2.6
@@ -68,7 +68,8 @@ class all_submissions_downloaded extends base {
      * @return string
      */
     public function get_description() {
-        return "User {$this->userid} has downloaded all the submissions.";
+        return "The user with the id '$this->userid' has downloaded all the submissions for the assignment " .
+            "with the course module id '$this->contextinstanceid'.";
     }
 
     /**
index 2ea5a23..4a49433 100644 (file)
@@ -15,7 +15,7 @@
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
- * mod_assign assessable submitted event.
+ * The mod_assign assessable submitted event.
  *
  * @package    mod_assign
  * @copyright  2013 Frédéric Massart
@@ -27,12 +27,12 @@ namespace mod_assign\event;
 defined('