diff --git a/admin/tool/capability/classes/event/report_viewed.php b/admin/tool/capability/classes/event/report_viewed.php index 0287dc75a13..e0f65f389b5 100644 --- a/admin/tool/capability/classes/event/report_viewed.php +++ b/admin/tool/capability/classes/event/report_viewed.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * 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."; } /** diff --git a/badges/classes/observer.php b/badges/classes/observer.php index a2859e417b9..34cf105b9dc 100644 --- a/badges/classes/observer.php +++ b/badges/classes/observer.php @@ -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. diff --git a/blog/tests/bloglib_test.php b/blog/tests/bloglib_test.php index 87c78bb8db1..cf1c1dec599 100644 --- a/blog/tests/bloglib_test.php +++ b/blog/tests/bloglib_test.php @@ -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()); } } diff --git a/calendar/tests/event_test.php b/calendar/tests/events_test.php similarity index 93% rename from calendar/tests/event_test.php rename to calendar/tests/events_test.php index d145d29d95a..a0b39680569 100644 --- a/calendar/tests/event_test.php +++ b/calendar/tests/events_test.php @@ -33,7 +33,7 @@ require_once($CFG->dirroot . '/calendar/tests/externallib_test.php'); * @copyright 2014 Ankit Agarwal * @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()); } } } diff --git a/completion/completion_completion.php b/completion/completion_completion.php index 52619b2faaf..18c78dceb8a 100644 --- a/completion/completion_completion.php +++ b/completion/completion_completion.php @@ -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); diff --git a/course/tests/courselib_test.php b/course/tests/courselib_test.php index 12c9c432e03..fac80f951d9 100644 --- a/course/tests/courselib_test.php +++ b/course/tests/courselib_test.php @@ -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, ''), diff --git a/lib/accesslib.php b/lib/accesslib.php index d869d742e1c..7d316c498ef 100644 --- a/lib/accesslib.php +++ b/lib/accesslib.php @@ -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(); } diff --git a/lib/classes/event/assessable_submitted.php b/lib/classes/event/assessable_submitted.php index 62752af0dc1..95c3caa0f49 100644 --- a/lib/classes/event/assessable_submitted.php +++ b/lib/classes/event/assessable_submitted.php @@ -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. diff --git a/lib/classes/event/assessable_uploaded.php b/lib/classes/event/assessable_uploaded.php index 64fdabe0286..6c1a50cee9a 100644 --- a/lib/classes/event/assessable_uploaded.php +++ b/lib/classes/event/assessable_uploaded.php @@ -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.'); } } diff --git a/lib/classes/event/blog_association_created.php b/lib/classes/event/blog_association_created.php index 495a64388d8..cf65eaa526e 100644 --- a/lib/classes/event/blog_association_created.php +++ b/lib/classes/event/blog_association_created.php @@ -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.'); } } } diff --git a/lib/classes/event/blog_comment_created.php b/lib/classes/event/blog_comment_created.php index 3bd10055878..b15e118ba6b 100644 --- a/lib/classes/event/blog_comment_created.php +++ b/lib/classes/event/blog_comment_created.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * blog comment created event. + * The blog comment created event. * * @package core * @copyright 2013 Rajesh Taneja @@ -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 * @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']}'."; } } diff --git a/lib/classes/event/blog_comment_deleted.php b/lib/classes/event/blog_comment_deleted.php index 4e072727949..068ab777354 100644 --- a/lib/classes/event/blog_comment_deleted.php +++ b/lib/classes/event/blog_comment_deleted.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * blog comment deleted event. + * The blog comment deleted event. * * @package core * @copyright 2013 Rajesh Taneja @@ -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 * @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']}'."; } } diff --git a/lib/classes/event/blog_entries_viewed.php b/lib/classes/event/blog_entries_viewed.php index a22092d6f58..816a31bf5d4 100644 --- a/lib/classes/event/blog_entries_viewed.php +++ b/lib/classes/event/blog_entries_viewed.php @@ -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 diff --git a/lib/classes/event/blog_entry_created.php b/lib/classes/event/blog_entry_created.php index c47618973c8..5aa5e5dc782 100644 --- a/lib/classes/event/blog_entry_created.php +++ b/lib/classes/event/blog_entry_created.php @@ -14,10 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -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); } } diff --git a/lib/classes/event/blog_entry_deleted.php b/lib/classes/event/blog_entry_deleted.php index e2acde80bb4..bdf2342e453 100644 --- a/lib/classes/event/blog_entry_deleted.php +++ b/lib/classes/event/blog_entry_deleted.php @@ -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'."; } /** diff --git a/lib/classes/event/blog_entry_updated.php b/lib/classes/event/blog_entry_updated.php index dcfec20b9b6..dc3dd4e7443 100644 --- a/lib/classes/event/blog_entry_updated.php +++ b/lib/classes/event/blog_entry_updated.php @@ -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'."; } /** diff --git a/lib/classes/event/calendar_event_created.php b/lib/classes/event/calendar_event_created.php index 9dceaca523e..0046cb31dfc 100644 --- a/lib/classes/event/calendar_event_created.php +++ b/lib/classes/event/calendar_event_created.php @@ -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(); } } diff --git a/lib/classes/event/calendar_event_deleted.php b/lib/classes/event/calendar_event_deleted.php index 296ad68f882..02df261aafb 100644 --- a/lib/classes/event/calendar_event_deleted.php +++ b/lib/classes/event/calendar_event_deleted.php @@ -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(); } } diff --git a/lib/classes/event/calendar_event_updated.php b/lib/classes/event/calendar_event_updated.php index 62265027218..97d1307766c 100644 --- a/lib/classes/event/calendar_event_updated.php +++ b/lib/classes/event/calendar_event_updated.php @@ -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&id=' . $this->objectid , - $this->other['name']); + return array($this->courseid, 'calendar', 'edit', 'event.php?action=edit&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(); } } diff --git a/lib/classes/event/cohort_created.php b/lib/classes/event/cohort_created.php index 743fb6bfd66..2f5c2ac2747 100644 --- a/lib/classes/event/cohort_created.php +++ b/lib/classes/event/cohort_created.php @@ -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'."; } /** diff --git a/lib/classes/event/cohort_deleted.php b/lib/classes/event/cohort_deleted.php index 570db4abe9f..f3b5d344556 100644 --- a/lib/classes/event/cohort_deleted.php +++ b/lib/classes/event/cohort_deleted.php @@ -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'."; } /** diff --git a/lib/classes/event/cohort_member_added.php b/lib/classes/event/cohort_member_added.php index 7252c77e2f9..628b1b78de1 100644 --- a/lib/classes/event/cohort_member_added.php +++ b/lib/classes/event/cohort_member_added.php @@ -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'."; } /** diff --git a/lib/classes/event/cohort_member_removed.php b/lib/classes/event/cohort_member_removed.php index 1fc7046823c..ee1d49309e4 100644 --- a/lib/classes/event/cohort_member_removed.php +++ b/lib/classes/event/cohort_member_removed.php @@ -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'."; } /** diff --git a/lib/classes/event/cohort_updated.php b/lib/classes/event/cohort_updated.php index 29fa2dda531..142fb606155 100644 --- a/lib/classes/event/cohort_updated.php +++ b/lib/classes/event/cohort_updated.php @@ -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'."; } /** diff --git a/lib/classes/event/comment_created.php b/lib/classes/event/comment_created.php index 539bfc41500..3ab94744b3c 100644 --- a/lib/classes/event/comment_created.php +++ b/lib/classes/event/comment_created.php @@ -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 * @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.'); } } } diff --git a/lib/classes/event/comment_deleted.php b/lib/classes/event/comment_deleted.php index de7829f7de0..4d34b2e36ad 100644 --- a/lib/classes/event/comment_deleted.php +++ b/lib/classes/event/comment_deleted.php @@ -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 * @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.'); } } } diff --git a/lib/classes/event/comments_viewed.php b/lib/classes/event/comments_viewed.php index 4964ee4f168..d250f904c02 100644 --- a/lib/classes/event/comments_viewed.php +++ b/lib/classes/event/comments_viewed.php @@ -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 * @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'."; } /** diff --git a/lib/classes/event/content_viewed.php b/lib/classes/event/content_viewed.php index 9f7ab5fac72..86fe52f98e4 100644 --- a/lib/classes/event/content_viewed.php +++ b/lib/classes/event/content_viewed.php @@ -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.'); } } } diff --git a/lib/classes/event/course_category_created.php b/lib/classes/event/course_category_created.php index 4e60ffca44a..808887468c7 100644 --- a/lib/classes/event/course_category_created.php +++ b/lib/classes/event/course_category_created.php @@ -14,12 +14,20 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . +/** + * Course category created event. + * + * @package core + * @copyright 2014 Mark Nelson + * @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'."; } /** diff --git a/lib/classes/event/course_category_deleted.php b/lib/classes/event/course_category_deleted.php index e14dc68a47a..8b27f12556d 100644 --- a/lib/classes/event/course_category_deleted.php +++ b/lib/classes/event/course_category_deleted.php @@ -14,17 +14,25 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . +/** + * Category deleted event. + * + * @package core + * @copyright 2013 Mark Nelson + * @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() { diff --git a/lib/classes/event/course_category_updated.php b/lib/classes/event/course_category_updated.php index d12bbaaade3..c251e138399 100644 --- a/lib/classes/event/course_category_updated.php +++ b/lib/classes/event/course_category_updated.php @@ -14,12 +14,20 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . +/** + * Course category updated event. + * + * @package core + * @copyright 2014 Mark Nelson + * @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'."; } /** diff --git a/lib/classes/event/course_completed.php b/lib/classes/event/course_completed.php index 05a43ee39d0..32e129ef618 100644 --- a/lib/classes/event/course_completed.php +++ b/lib/classes/event/course_completed.php @@ -14,12 +14,20 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . +/** + * Course completed event. + * + * @package core + * @copyright 2013 Rajesh Taneja + * @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); } - } diff --git a/lib/classes/event/course_completion_updated.php b/lib/classes/event/course_completion_updated.php index d687080bacb..dc40b144c2e 100644 --- a/lib/classes/event/course_completion_updated.php +++ b/lib/classes/event/course_completion_updated.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * Event when course module completion is updated. + * Course module completion updated event. * * @package core * @copyright 2013 Rajesh Taneja @@ -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'."; } /** diff --git a/lib/classes/event/course_content_deleted.php b/lib/classes/event/course_content_deleted.php index fe64a58d53a..ac097e7266a 100644 --- a/lib/classes/event/course_content_deleted.php +++ b/lib/classes/event/course_content_deleted.php @@ -14,17 +14,25 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . +/** + * Course content_deleted event class. + * + * @package core + * @copyright 2013 Mark Nelson + * @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'."; } /** diff --git a/lib/classes/event/course_created.php b/lib/classes/event/course_created.php index 16fee48c2ca..58cf28591e8 100644 --- a/lib/classes/event/course_created.php +++ b/lib/classes/event/course_created.php @@ -14,18 +14,26 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . +/** + * Course created event. + * + * @package core + * @copyright 2013 Mark Nelson + * @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'."; } /** diff --git a/lib/classes/event/course_deleted.php b/lib/classes/event/course_deleted.php index fc999d50b8f..17da551d9e8 100644 --- a/lib/classes/event/course_deleted.php +++ b/lib/classes/event/course_deleted.php @@ -14,19 +14,27 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . +/** + * Course deleted event. + * + * @package core + * @copyright 2013 Mark Nelson + * @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'."; } /** diff --git a/lib/classes/event/course_module_completion_updated.php b/lib/classes/event/course_module_completion_updated.php index 88d8067915b..af8ed557263 100644 --- a/lib/classes/event/course_module_completion_updated.php +++ b/lib/classes/event/course_module_completion_updated.php @@ -14,12 +14,20 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . +/** + * Course module completion event. + * + * @package core + * @copyright 2013 Rajesh Taneja + * @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.'); } } } diff --git a/lib/classes/event/course_module_created.php b/lib/classes/event/course_module_created.php index fd0aebb26fe..fe93af0ac3f 100644 --- a/lib/classes/event/course_module_created.php +++ b/lib/classes/event/course_module_created.php @@ -17,14 +17,6 @@ /** * 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.'); } } } diff --git a/lib/classes/event/course_module_deleted.php b/lib/classes/event/course_module_deleted.php index fa539d6861b..4581dd124cd 100644 --- a/lib/classes/event/course_module_deleted.php +++ b/lib/classes/event/course_module_deleted.php @@ -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.'); } } } diff --git a/lib/classes/event/course_module_instance_list_viewed.php b/lib/classes/event/course_module_instance_list_viewed.php index f4a5782915e..45fab501dc2 100644 --- a/lib/classes/event/course_module_instance_list_viewed.php +++ b/lib/classes/event/course_module_instance_list_viewed.php @@ -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.'); } } - } diff --git a/lib/classes/event/course_module_updated.php b/lib/classes/event/course_module_updated.php index 7aaaa0b6f7b..022a1927d01 100644 --- a/lib/classes/event/course_module_updated.php +++ b/lib/classes/event/course_module_updated.php @@ -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.'); } } diff --git a/lib/classes/event/course_module_viewed.php b/lib/classes/event/course_module_viewed.php index 4c88c4b49da..3ee5a695d0c 100644 --- a/lib/classes/event/course_module_viewed.php +++ b/lib/classes/event/course_module_viewed.php @@ -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.'); } } - } diff --git a/lib/classes/event/course_reset_ended.php b/lib/classes/event/course_reset_ended.php index f3191d25440..c7cad3d1f08 100644 --- a/lib/classes/event/course_reset_ended.php +++ b/lib/classes/event/course_reset_ended.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * 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.'); } } - } diff --git a/lib/classes/event/course_reset_started.php b/lib/classes/event/course_reset_started.php index 59c6abe23b1..dd043dee7cd 100644 --- a/lib/classes/event/course_reset_started.php +++ b/lib/classes/event/course_reset_started.php @@ -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.'); } } - } diff --git a/lib/classes/event/course_resources_list_viewed.php b/lib/classes/event/course_resources_list_viewed.php index cae5e3a90c6..a93dfcae1b7 100644 --- a/lib/classes/event/course_resources_list_viewed.php +++ b/lib/classes/event/course_resources_list_viewed.php @@ -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.'); } } - } diff --git a/lib/classes/event/course_restored.php b/lib/classes/event/course_restored.php index 8858f4b2f4e..6ca02ae912c 100644 --- a/lib/classes/event/course_restored.php +++ b/lib/classes/event/course_restored.php @@ -14,21 +14,29 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . +/** + * Course restored event. + * + * @package core + * @copyright 2013 Mark Nelson + * @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'."; } /** diff --git a/lib/classes/event/course_section_updated.php b/lib/classes/event/course_section_updated.php index c1f80961f1e..c0953932760 100644 --- a/lib/classes/event/course_section_updated.php +++ b/lib/classes/event/course_section_updated.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * Course section updated. + * Course section updated event. * * @package core * @copyright 2013 Rajesh Taneja @@ -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.'); } } } diff --git a/lib/classes/event/course_updated.php b/lib/classes/event/course_updated.php index 9d3be669d24..b36d251526c 100644 --- a/lib/classes/event/course_updated.php +++ b/lib/classes/event/course_updated.php @@ -14,18 +14,26 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . +/** + * Course updated event. + * + * @package core + * @copyright 2013 Mark Nelson + * @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'."; } /** diff --git a/lib/classes/event/course_user_report_viewed.php b/lib/classes/event/course_user_report_viewed.php index c107e1236fa..691863813c0 100644 --- a/lib/classes/event/course_user_report_viewed.php +++ b/lib/classes/event/course_user_report_viewed.php @@ -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'."; } /** diff --git a/lib/classes/event/course_viewed.php b/lib/classes/event/course_viewed.php index c0a009c2e17..f4e17c40291 100644 --- a/lib/classes/event/course_viewed.php +++ b/lib/classes/event/course_viewed.php @@ -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.'); } } } diff --git a/lib/classes/event/email_failed.php b/lib/classes/event/email_failed.php index 90830abb623..68966c2b3ec 100644 --- a/lib/classes/event/email_failed.php +++ b/lib/classes/event/email_failed.php @@ -14,12 +14,21 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . +/** + * Email failed event. + * + * @package core + * @since Moodle 2.7 + * @copyright 2013 Mark Nelson + * @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']}\"."; } /** diff --git a/lib/classes/event/group_created.php b/lib/classes/event/group_created.php index d9dab7126c0..962b671099a 100644 --- a/lib/classes/event/group_created.php +++ b/lib/classes/event/group_created.php @@ -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'; } - } diff --git a/lib/classes/event/group_deleted.php b/lib/classes/event/group_deleted.php index 41b1d7a06b6..fccf70ce074 100644 --- a/lib/classes/event/group_deleted.php +++ b/lib/classes/event/group_deleted.php @@ -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'."; } /** diff --git a/lib/classes/event/group_member_added.php b/lib/classes/event/group_member_added.php index 4e6bbfca7ad..9570156b514 100644 --- a/lib/classes/event/group_member_added.php +++ b/lib/classes/event/group_member_added.php @@ -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.'); + } + } } diff --git a/lib/classes/event/group_member_removed.php b/lib/classes/event/group_member_removed.php index 87336a8efeb..bb9c7e938ce 100644 --- a/lib/classes/event/group_member_removed.php +++ b/lib/classes/event/group_member_removed.php @@ -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'; } - } diff --git a/lib/classes/event/group_updated.php b/lib/classes/event/group_updated.php index 518c139fc8f..598c1e4e4b4 100644 --- a/lib/classes/event/group_updated.php +++ b/lib/classes/event/group_updated.php @@ -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'; } - } diff --git a/lib/classes/event/grouping_created.php b/lib/classes/event/grouping_created.php index 91960e43837..549d91e326f 100644 --- a/lib/classes/event/grouping_created.php +++ b/lib/classes/event/grouping_created.php @@ -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'."; } /** diff --git a/lib/classes/event/grouping_deleted.php b/lib/classes/event/grouping_deleted.php index 17079743a67..75213b18120 100644 --- a/lib/classes/event/grouping_deleted.php +++ b/lib/classes/event/grouping_deleted.php @@ -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'."; } /** diff --git a/lib/classes/event/grouping_updated.php b/lib/classes/event/grouping_updated.php index da21bb3208a..67c8e192583 100644 --- a/lib/classes/event/grouping_updated.php +++ b/lib/classes/event/grouping_updated.php @@ -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); diff --git a/lib/classes/event/message_contact_added.php b/lib/classes/event/message_contact_added.php index 5d2c94e1d7f..467334ad4f0 100644 --- a/lib/classes/event/message_contact_added.php +++ b/lib/classes/event/message_contact_added.php @@ -14,6 +14,18 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . +/** + * Message contact added event. + * + * @package core + * @copyright 2014 Mark Nelson + * @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. * @@ -22,10 +34,6 @@ * @copyright 2014 Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -namespace core\event; - -defined('MOODLE_INTERNAL') || die(); - 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."; } /** diff --git a/lib/classes/event/message_contact_blocked.php b/lib/classes/event/message_contact_blocked.php index 6b1cdf684b4..8d73ab28354 100644 --- a/lib/classes/event/message_contact_blocked.php +++ b/lib/classes/event/message_contact_blocked.php @@ -14,6 +14,18 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . +/** + * Message contact blocked event. + * + * @package core + * @copyright 2014 Mark Nelson + * @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. * @@ -22,10 +34,6 @@ * @copyright 2014 Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -namespace core\event; - -defined('MOODLE_INTERNAL') || die(); - 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."; } /** diff --git a/lib/classes/event/message_contact_removed.php b/lib/classes/event/message_contact_removed.php index 2ca36ea6515..f0715ff577b 100644 --- a/lib/classes/event/message_contact_removed.php +++ b/lib/classes/event/message_contact_removed.php @@ -14,6 +14,18 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . +/** + * Message contact removed event. + * + * @package core + * @copyright 2014 Mark Nelson + * @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. * @@ -22,10 +34,6 @@ * @copyright 2014 Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -namespace core\event; - -defined('MOODLE_INTERNAL') || die(); - 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."; } /** diff --git a/lib/classes/event/message_contact_unblocked.php b/lib/classes/event/message_contact_unblocked.php index c9314629501..ee5788e24ef 100644 --- a/lib/classes/event/message_contact_unblocked.php +++ b/lib/classes/event/message_contact_unblocked.php @@ -14,6 +14,18 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . +/** + * Message contact unblocked event. + * + * @package core + * @copyright 2014 Mark Nelson + * @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. * @@ -22,10 +34,6 @@ * @copyright 2014 Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -namespace core\event; - -defined('MOODLE_INTERNAL') || die(); - 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."; } /** diff --git a/lib/classes/event/message_sent.php b/lib/classes/event/message_sent.php index 2240fcfa00d..8fdecc57f1a 100644 --- a/lib/classes/event/message_sent.php +++ b/lib/classes/event/message_sent.php @@ -14,6 +14,18 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . +/** + * Message sent event. + * + * @package core + * @copyright 2014 Mark Nelson + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +namespace core\event; + +defined('MOODLE_INTERNAL') || die(); + /** * Message sent event class. * @@ -28,10 +40,6 @@ * @copyright 2014 Mark Nelson * @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.'); } } } diff --git a/lib/classes/event/message_viewed.php b/lib/classes/event/message_viewed.php index 904b3940a6e..2d453468eca 100644 --- a/lib/classes/event/message_viewed.php +++ b/lib/classes/event/message_viewed.php @@ -14,6 +14,18 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . +/** + * Message viewed event. + * + * @package core + * @copyright 2014 Mark Nelson + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +namespace core\event; + +defined('MOODLE_INTERNAL') || die(); + /** * Message viewed event class. * @@ -28,10 +40,6 @@ * @copyright 2014 Mark Nelson * @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.'); } } } diff --git a/lib/classes/event/mnet_access_control_created.php b/lib/classes/event/mnet_access_control_created.php index 56b70c40189..c3ec1dd2314 100644 --- a/lib/classes/event/mnet_access_control_created.php +++ b/lib/classes/event/mnet_access_control_created.php @@ -14,6 +14,19 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . +/** + * Mnet access control created event. + * + * @package core + * @since Moodle 2.7 + * @copyright 2013 Mark Nelson + * @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. * @@ -22,10 +35,6 @@ * @copyright 2013 Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -namespace core\event; - -defined('MOODLE_INTERNAL') || die(); - 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.'); } } } diff --git a/lib/classes/event/mnet_access_control_updated.php b/lib/classes/event/mnet_access_control_updated.php index b2badfa5199..84c6bac42eb 100644 --- a/lib/classes/event/mnet_access_control_updated.php +++ b/lib/classes/event/mnet_access_control_updated.php @@ -14,6 +14,19 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . +/** + * Mnet access control updated event. + * + * @package core + * @since Moodle 2.7 + * @copyright 2013 Mark Nelson + * @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. * @@ -22,10 +35,6 @@ * @copyright 2013 Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -namespace core\event; - -defined('MOODLE_INTERNAL') || die(); - 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.'); } } } diff --git a/lib/classes/event/note_created.php b/lib/classes/event/note_created.php index fe2f2087049..9985e5e81b8 100644 --- a/lib/classes/event/note_created.php +++ b/lib/classes/event/note_created.php @@ -14,10 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -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'."; } /** diff --git a/lib/classes/event/note_deleted.php b/lib/classes/event/note_deleted.php index 53403b73a96..7fbe36ce55c 100644 --- a/lib/classes/event/note_deleted.php +++ b/lib/classes/event/note_deleted.php @@ -14,10 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -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'."; } /** diff --git a/lib/classes/event/note_updated.php b/lib/classes/event/note_updated.php index 79cc5aadf99..1fe138d8f92 100644 --- a/lib/classes/event/note_updated.php +++ b/lib/classes/event/note_updated.php @@ -14,10 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -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'."; } /** diff --git a/lib/classes/event/notes_viewed.php b/lib/classes/event/notes_viewed.php index 58a688efe3e..470136b97cb 100644 --- a/lib/classes/event/notes_viewed.php +++ b/lib/classes/event/notes_viewed.php @@ -14,10 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -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'."; } /** diff --git a/lib/classes/event/question_category_created.php b/lib/classes/event/question_category_created.php index 1aba878322b..b4598776cd2 100644 --- a/lib/classes/event/question_category_created.php +++ b/lib/classes/event/question_category_created.php @@ -14,6 +14,18 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . +/** + * Question category created event. + * + * @package core + * @copyright 2014 Mark Nelson + * @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. * @@ -22,10 +34,6 @@ * @copyright 2014 Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -namespace core\event; - -defined('MOODLE_INTERNAL') || die(); - 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'."; } /** diff --git a/lib/classes/event/recent_activity_viewed.php b/lib/classes/event/recent_activity_viewed.php index 9c88a93c6cc..752a7a2d3b8 100644 --- a/lib/classes/event/recent_activity_viewed.php +++ b/lib/classes/event/recent_activity_viewed.php @@ -21,8 +21,11 @@ * @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.'); } } } diff --git a/lib/classes/event/role_allow_assign_updated.php b/lib/classes/event/role_allow_assign_updated.php index 50b94757de8..3a194c1a8d4 100644 --- a/lib/classes/event/role_allow_assign_updated.php +++ b/lib/classes/event/role_allow_assign_updated.php @@ -14,12 +14,8 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -namespace core\event; - -defined('MOODLE_INTERNAL') || die(); - /** - * Event when role allow assignments is updated. + * Role assignments updated event. * * @package core * @since Moodle 2.6 @@ -27,6 +23,18 @@ defined('MOODLE_INTERNAL') || die(); * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +namespace core\event; + +defined('MOODLE_INTERNAL') || die(); + +/** + * Role assignments updated event class. + * + * @package core + * @since Moodle 2.6 + * @copyright 2013 Rajesh Taneja + * @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'."; } /** diff --git a/lib/classes/event/role_allow_override_updated.php b/lib/classes/event/role_allow_override_updated.php index 3e3c6ac8c77..79aa2e4593b 100644 --- a/lib/classes/event/role_allow_override_updated.php +++ b/lib/classes/event/role_allow_override_updated.php @@ -14,12 +14,8 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -namespace core\event; - -defined('MOODLE_INTERNAL') || die(); - /** - * Event when role allow override is updated. + * Role allow override updated event. * * @package core * @since Moodle 2.6 @@ -27,6 +23,18 @@ defined('MOODLE_INTERNAL') || die(); * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +namespace core\event; + +defined('MOODLE_INTERNAL') || die(); + +/** + * Role allow override updated event class. + * + * @package core + * @since Moodle 2.6 + * @copyright 2013 Rajesh Taneja + * @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'."; } /** diff --git a/lib/classes/event/role_allow_switch_updated.php b/lib/classes/event/role_allow_switch_updated.php index 0d036142f4a..d3551c9c173 100644 --- a/lib/classes/event/role_allow_switch_updated.php +++ b/lib/classes/event/role_allow_switch_updated.php @@ -14,12 +14,8 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -namespace core\event; - -defined('MOODLE_INTERNAL') || die(); - /** - * Event when role allow switch is updated. + * Role allow switch updated event. * * @package core * @since Moodle 2.6 @@ -27,6 +23,18 @@ defined('MOODLE_INTERNAL') || die(); * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +namespace core\event; + +defined('MOODLE_INTERNAL') || die(); + +/** + * Role allow switch updated event class. + * + * @package core + * @since Moodle 2.6 + * @copyright 2013 Rajesh Taneja + * @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'."; } /** diff --git a/lib/classes/event/role_assigned.php b/lib/classes/event/role_assigned.php index 79b5639b690..172273283b3 100644 --- a/lib/classes/event/role_assigned.php +++ b/lib/classes/event/role_assigned.php @@ -14,6 +14,14 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . +/** + * 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']); } /** diff --git a/lib/classes/event/role_capabilities_updated.php b/lib/classes/event/role_capabilities_updated.php index 5c65f95c6f2..9cc28f41fd4 100644 --- a/lib/classes/event/role_capabilities_updated.php +++ b/lib/classes/event/role_capabilities_updated.php @@ -14,10 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -namespace core\event; - -defined('MOODLE_INTERNAL') || die(); - /** * Role updated event. * @@ -27,6 +23,18 @@ defined('MOODLE_INTERNAL') || die(); * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +namespace core\event; + +defined('MOODLE_INTERNAL') || die(); + +/** + * Role updated event class. + * + * @package core + * @since Moodle 2.6 + * @copyright 2013 Rajesh Taneja + * @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'."; } /** diff --git a/lib/classes/event/role_deleted.php b/lib/classes/event/role_deleted.php index 9a52582a87b..27a198236fe 100644 --- a/lib/classes/event/role_deleted.php +++ b/lib/classes/event/role_deleted.php @@ -14,19 +14,27 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . +/** + * Role assigned event. + * + * @package core + * @copyright 2013 Rajesh Taneja + * @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 * @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'."; } /** diff --git a/lib/classes/event/role_unassigned.php b/lib/classes/event/role_unassigned.php index 4a0908fdd38..8de2c004f7f 100644 --- a/lib/classes/event/role_unassigned.php +++ b/lib/classes/event/role_unassigned.php @@ -14,27 +14,35 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -namespace core\event; - -defined('MOODLE_INTERNAL') || die(); - /** * Role unassigned event. * - * @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. - * } - * * @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 class. + * + * @property-read array $other { + * Extra information about event. + * + * - int id: role assigned id. + * - string component: name of component. + * - int itemid: id of item. + * } + * + * @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 + */ 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']); } /** diff --git a/lib/classes/event/tag_added.php b/lib/classes/event/tag_added.php index bad019bb856..d7e6892fc64 100644 --- a/lib/classes/event/tag_added.php +++ b/lib/classes/event/tag_added.php @@ -15,7 +15,19 @@ // along with Moodle. If not, see . /** - * Event for when a tag has been added to an item. + * The tag added event. + * + * @package core + * @copyright 2014 Mark Nelson + * @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. @@ -32,11 +44,6 @@ * @copyright 2014 Mark Nelson * @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.'); } } } diff --git a/lib/classes/event/tag_created.php b/lib/classes/event/tag_created.php index a94c78b3b26..9edb3c786cd 100644 --- a/lib/classes/event/tag_created.php +++ b/lib/classes/event/tag_created.php @@ -17,6 +17,18 @@ /** * Tag created event. * + * @package core + * @copyright 2014 Mark Nelson + * @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. * @@ -29,11 +41,6 @@ * @copyright 2014 Mark Nelson * @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.'); } } } diff --git a/lib/classes/event/tag_deleted.php b/lib/classes/event/tag_deleted.php index 6077b8a1dd9..1225389b7fd 100644 --- a/lib/classes/event/tag_deleted.php +++ b/lib/classes/event/tag_deleted.php @@ -17,6 +17,18 @@ /** * Tag deleted event. * + * @package core + * @copyright 2014 Mark Nelson + * @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. * @@ -29,11 +41,6 @@ * @copyright 2014 Mark Nelson * @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.'); } } } diff --git a/lib/classes/event/tag_flagged.php b/lib/classes/event/tag_flagged.php index 5c4b8fc6df8..f6c4c63cb71 100644 --- a/lib/classes/event/tag_flagged.php +++ b/lib/classes/event/tag_flagged.php @@ -17,6 +17,18 @@ /** * Tag flagged event. * + * @package core + * @copyright 2014 Mark Nelson + * @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. * @@ -29,11 +41,6 @@ * @copyright 2014 Mark Nelson * @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.'); } } } diff --git a/lib/classes/event/tag_removed.php b/lib/classes/event/tag_removed.php index 2ac45231eca..518fcfe58be 100644 --- a/lib/classes/event/tag_removed.php +++ b/lib/classes/event/tag_removed.php @@ -15,7 +15,19 @@ // along with Moodle. If not, see . /** - * Event for when a tag has been removed from an item. + * The tag removed event. + * + * @package core + * @copyright 2014 Mark Nelson + * @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. @@ -32,11 +44,6 @@ * @copyright 2014 Mark Nelson * @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.'); } } } diff --git a/lib/classes/event/tag_unflagged.php b/lib/classes/event/tag_unflagged.php index 70e2518b263..86c383346f4 100644 --- a/lib/classes/event/tag_unflagged.php +++ b/lib/classes/event/tag_unflagged.php @@ -14,6 +14,18 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . +/** + * Tag unflagged event. + * + * @package core + * @copyright 2014 Mark Nelson + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +namespace core\event; + +defined('MOODLE_INTERNAL') || die(); + /** * Tag unflagged event. * @@ -29,11 +41,6 @@ * @copyright 2014 Mark Nelson * @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.'); } } } diff --git a/lib/classes/event/tag_updated.php b/lib/classes/event/tag_updated.php index a2059a5bec0..f9c2660e1a6 100644 --- a/lib/classes/event/tag_updated.php +++ b/lib/classes/event/tag_updated.php @@ -14,6 +14,18 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . +/** + * Tag updated event. + * + * @package core + * @copyright 2014 Mark Nelson + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +namespace core\event; + +defined('MOODLE_INTERNAL') || die(); + /** * Tag updated event. * @@ -29,11 +41,6 @@ * @copyright 2014 Mark Nelson * @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.'); } } } diff --git a/lib/classes/event/unknown_logged.php b/lib/classes/event/unknown_logged.php index a0e7544fb30..b13eb70ae63 100644 --- a/lib/classes/event/unknown_logged.php +++ b/lib/classes/event/unknown_logged.php @@ -14,6 +14,15 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . +/** + * 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(); diff --git a/lib/classes/event/user_created.php b/lib/classes/event/user_created.php index 88ce8ca6ed3..e0738eea156 100644 --- a/lib/classes/event/user_created.php +++ b/lib/classes/event/user_created.php @@ -21,6 +21,7 @@ * @copyright 2013 Rajesh Taneja * @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."; } /** diff --git a/lib/classes/event/user_deleted.php b/lib/classes/event/user_deleted.php index dcfdddbcfed..79d9cecf78f 100644 --- a/lib/classes/event/user_deleted.php +++ b/lib/classes/event/user_deleted.php @@ -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."; } /** diff --git a/lib/classes/event/user_enrolment_created.php b/lib/classes/event/user_enrolment_created.php index 5338cd6d7ea..8f5b2e70be2 100644 --- a/lib/classes/event/user_enrolment_created.php +++ b/lib/classes/event/user_enrolment_created.php @@ -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.'); } } } diff --git a/lib/classes/event/user_enrolment_deleted.php b/lib/classes/event/user_enrolment_deleted.php index 73395666ee1..8fc8daa6a5e 100644 --- a/lib/classes/event/user_enrolment_deleted.php +++ b/lib/classes/event/user_enrolment_deleted.php @@ -17,13 +17,6 @@ /** * 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 * @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'."; } /** diff --git a/lib/classes/event/user_enrolment_updated.php b/lib/classes/event/user_enrolment_updated.php index 02c5c7c478f..995336c4765 100644 --- a/lib/classes/event/user_enrolment_updated.php +++ b/lib/classes/event/user_enrolment_updated.php @@ -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'."; } /** diff --git a/lib/classes/event/user_graded.php b/lib/classes/event/user_graded.php index ba3f3749cb4..8dfb934f290 100644 --- a/lib/classes/event/user_graded.php +++ b/lib/classes/event/user_graded.php @@ -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']}'."; } /** diff --git a/lib/classes/event/user_list_viewed.php b/lib/classes/event/user_list_viewed.php index 6cb62102af7..f7532851fcb 100644 --- a/lib/classes/event/user_list_viewed.php +++ b/lib/classes/event/user_list_viewed.php @@ -17,16 +17,7 @@ /** * 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. - * } - * * @package core - * @since Moodle 2.6 * @copyright 2013 Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -35,7 +26,23 @@ namespace core\event; defined('MOODLE_INTERNAL') || die(); -class user_list_viewed extends \core\event\base { +/** + * Defines the user list viewed event. + * + * @property-read array $other { + * Extra information about event. + * + * - string courseshortname: the short name of course. + * - string coursefullname: the full name of course. + * } + * + * @package core + * @since Moodle 2.6 + * @copyright 2013 Mark Nelson + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +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, ''); } - } diff --git a/lib/classes/event/user_loggedin.php b/lib/classes/event/user_loggedin.php index 772c4f994e0..e16b5570a6f 100644 --- a/lib/classes/event/user_loggedin.php +++ b/lib/classes/event/user_loggedin.php @@ -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.'); } } } diff --git a/lib/classes/event/user_loggedinas.php b/lib/classes/event/user_loggedinas.php index b292c58ecc9..eb194356ac8 100644 --- a/lib/classes/event/user_loggedinas.php +++ b/lib/classes/event/user_loggedinas.php @@ -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'."; } /** diff --git a/lib/classes/event/user_loggedout.php b/lib/classes/event/user_loggedout.php index 310e5e6c601..048cf6da317 100644 --- a/lib/classes/event/user_loggedout.php +++ b/lib/classes/event/user_loggedout.php @@ -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."; } /** diff --git a/lib/classes/event/user_login_failed.php b/lib/classes/event/user_login_failed.php index c671792afa8..6a05fed6154 100644 --- a/lib/classes/event/user_login_failed.php +++ b/lib/classes/event/user_login_failed.php @@ -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 * @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.'); } } diff --git a/lib/classes/event/user_password_updated.php b/lib/classes/event/user_password_updated.php index c0915ca56ec..aea7bb94702 100644 --- a/lib/classes/event/user_password_updated.php +++ b/lib/classes/event/user_password_updated.php @@ -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(); diff --git a/lib/classes/event/user_profile_viewed.php b/lib/classes/event/user_profile_viewed.php index 7bc8ba8fd00..c0318429eab 100644 --- a/lib/classes/event/user_profile_viewed.php +++ b/lib/classes/event/user_profile_viewed.php @@ -15,18 +15,9 @@ // along with Moodle. If not, see . /** - * Defines the user profile 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 fullname of course. - * } + * The user profile viewed event. * * @package core - * @since Moodle 2.6 * @copyright 2013 Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -35,6 +26,22 @@ namespace core\event; defined('MOODLE_INTERNAL') || die(); +/** + * The user profile viewed event class. + * + * @property-read array $other { + * Extra information about event. + * + * - int courseid: id of course. + * - string courseshortname: short name of course. + * - string coursefullname: fullname of course. + * } + * + * @package core + * @since Moodle 2.6 + * @copyright 2013 Mark Nelson + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ 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']; } diff --git a/lib/classes/event/user_updated.php b/lib/classes/event/user_updated.php index 69e36c5857d..54dc983547e 100644 --- a/lib/classes/event/user_updated.php +++ b/lib/classes/event/user_updated.php @@ -21,6 +21,7 @@ * @copyright 2013 Rajesh Taneja * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ + namespace core\event; defined('MOODLE_INTERNAL') || die(); diff --git a/lib/classes/event/webservice_function_called.php b/lib/classes/event/webservice_function_called.php index ad7e3e7c561..64ac2beed62 100644 --- a/lib/classes/event/webservice_function_called.php +++ b/lib/classes/event/webservice_function_called.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * 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.'); } } diff --git a/lib/classes/event/webservice_login_failed.php b/lib/classes/event/webservice_login_failed.php index b7e3025b9ec..07781af5e76 100644 --- a/lib/classes/event/webservice_login_failed.php +++ b/lib/classes/event/webservice_login_failed.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * 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.'); } diff --git a/lib/classes/event/webservice_service_created.php b/lib/classes/event/webservice_service_created.php index f906d951233..c23101e1e17 100644 --- a/lib/classes/event/webservice_service_created.php +++ b/lib/classes/event/webservice_service_created.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * 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. diff --git a/lib/classes/event/webservice_service_deleted.php b/lib/classes/event/webservice_service_deleted.php index 41fdf3c5fc2..170c89e6caf 100644 --- a/lib/classes/event/webservice_service_deleted.php +++ b/lib/classes/event/webservice_service_deleted.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * 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. diff --git a/lib/classes/event/webservice_service_updated.php b/lib/classes/event/webservice_service_updated.php index 36355ebb197..e8d44a7721f 100644 --- a/lib/classes/event/webservice_service_updated.php +++ b/lib/classes/event/webservice_service_updated.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * 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. diff --git a/lib/classes/event/webservice_service_user_added.php b/lib/classes/event/webservice_service_user_added.php index 8e775b78105..1bea51bcc3c 100644 --- a/lib/classes/event/webservice_service_user_added.php +++ b/lib/classes/event/webservice_service_user_added.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * 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. diff --git a/lib/classes/event/webservice_service_user_removed.php b/lib/classes/event/webservice_service_user_removed.php index c421e46af0d..ca4d6eeccf5 100644 --- a/lib/classes/event/webservice_service_user_removed.php +++ b/lib/classes/event/webservice_service_user_removed.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * 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. diff --git a/lib/classes/event/webservice_token_created.php b/lib/classes/event/webservice_token_created.php index 736804112b3..a9c4f27d151 100644 --- a/lib/classes/event/webservice_token_created.php +++ b/lib/classes/event/webservice_token_created.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * 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.'); } } - } diff --git a/lib/classes/event/webservice_token_sent.php b/lib/classes/event/webservice_token_sent.php index a43bdc12a85..be2c2a209d5 100644 --- a/lib/classes/event/webservice_token_sent.php +++ b/lib/classes/event/webservice_token_sent.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * 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. diff --git a/lib/completionlib.php b/lib/completionlib.php index 96c3f6a975d..3ff0c28d0d4 100644 --- a/lib/completionlib.php +++ b/lib/completionlib.php @@ -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(); diff --git a/lib/tests/authlib_test.php b/lib/tests/authlib_test.php index 468b32796f4..53ad3076306 100644 --- a/lib/tests/authlib_test.php +++ b/lib/tests/authlib_test.php @@ -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); - } } - } diff --git a/lib/tests/completionlib_test.php b/lib/tests/completionlib_test.php index 5062e3b23ee..150bafc789d 100644 --- a/lib/tests/completionlib_test.php +++ b/lib/tests/completionlib_test.php @@ -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(); diff --git a/lib/tests/fixtures/event_fixtures.php b/lib/tests/fixtures/event_fixtures.php index cc8de0b22a7..58cf2ab4c8a 100644 --- a/lib/tests/fixtures/event_fixtures.php +++ b/lib/tests/fixtures/event_fixtures.php @@ -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 diff --git a/mod/assign/classes/event/all_submissions_downloaded.php b/mod/assign/classes/event/all_submissions_downloaded.php index 176c73485aa..2f24926b062 100644 --- a/mod/assign/classes/event/all_submissions_downloaded.php +++ b/mod/assign/classes/event/all_submissions_downloaded.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * 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'."; } /** diff --git a/mod/assign/classes/event/assessable_submitted.php b/mod/assign/classes/event/assessable_submitted.php index 2ea5a232fd1..4a49433b6f4 100644 --- a/mod/assign/classes/event/assessable_submitted.php +++ b/mod/assign/classes/event/assessable_submitted.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * 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('MOODLE_INTERNAL') || die(); /** - * mod_assign assessable submitted event class. + * The mod_assign assessable submitted event class. * * @property-read array $other { * Extra information about event. * - * @type bool submission_editable is submission editable. + * - bool submission_editable: is submission editable. * } * * @package mod_assign @@ -77,7 +77,8 @@ class assessable_submitted extends base { * @return string */ public function get_description() { - return "User {$this->userid} has submitted the submission {$this->objectid}."; + return "The user with the id '$this->userid' has submitted the submission with the id '$this->objectid' " . + "for the assignment with the course module id '$this->contextinstanceid'."; } /** @@ -146,7 +147,7 @@ class assessable_submitted extends base { parent::validate_data(); if (!isset($this->other['submission_editable'])) { - throw new \coding_exception('Other must contain the key submission_editable.'); + throw new \coding_exception('The \'submission_editable\' value must be set in other.'); } } } diff --git a/mod/assign/classes/event/base.php b/mod/assign/classes/event/base.php index 2dacf2efcd7..bb7d06b3717 100644 --- a/mod/assign/classes/event/base.php +++ b/mod/assign/classes/event/base.php @@ -15,12 +15,9 @@ // along with Moodle. If not, see . /** - * The mod_assign abstract base class. - * - * Most events can extend this class. + * The mod_assign abstract base event. * * @package mod_assign - * @since Moodle 2.7 * @copyright 2014 Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -29,7 +26,18 @@ namespace mod_assign\event; defined('MOODLE_INTERNAL') || die(); +/** + * The mod_assign abstract base event class. + * + * Most mod_assign events can extend this class. + * + * @package mod_assign + * @since Moodle 2.7 + * @copyright 2014 Mark Nelson + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ abstract class base extends \core\event\base { + /** @var \assign */ protected $assign; @@ -60,6 +68,7 @@ abstract class base extends \core\event\base { * * NOTE: to be used from observers only. * + * @throws \coding_exception * @return \assign */ public function get_assign() { @@ -125,7 +134,7 @@ abstract class base extends \core\event\base { 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.'); } } } diff --git a/mod/assign/classes/event/batch_set_marker_allocation_viewed.php b/mod/assign/classes/event/batch_set_marker_allocation_viewed.php index e4e2ca07f71..4b1baf238f5 100644 --- a/mod/assign/classes/event/batch_set_marker_allocation_viewed.php +++ b/mod/assign/classes/event/batch_set_marker_allocation_viewed.php @@ -27,7 +27,7 @@ namespace mod_assign\event; defined('MOODLE_INTERNAL') || die(); /** - * The mod_assign batch set marker allocation viewed event. + * The mod_assign batch set marker allocation viewed event class. * * @property-read array $other { * Extra information about event. @@ -91,8 +91,8 @@ class batch_set_marker_allocation_viewed extends base { * @return string */ public function get_description() { - return "The user with the id {$this->userid} viewed the batch set marker allocation for the assignment with the id - {$this->other['assignid']}."; + return "The user with the id '$this->userid' viewed the batch set marker allocation for the assignment with the course " . + "module id '$this->contextinstanceid'."; } /** @@ -120,7 +120,7 @@ class batch_set_marker_allocation_viewed extends base { parent::validate_data(); if (!isset($this->other['assignid'])) { - throw new \coding_exception('The \'assignid\' must be set in other.'); + throw new \coding_exception('The \'assignid\' value must be set in other.'); } } } diff --git a/mod/assign/classes/event/batch_set_workflow_state_viewed.php b/mod/assign/classes/event/batch_set_workflow_state_viewed.php index 8353cb765c4..1c3b071e30d 100644 --- a/mod/assign/classes/event/batch_set_workflow_state_viewed.php +++ b/mod/assign/classes/event/batch_set_workflow_state_viewed.php @@ -91,7 +91,8 @@ class batch_set_workflow_state_viewed extends base { * @return string */ public function get_description() { - return "The user with the id {$this->userid} viewed the batch set workflow for the assignment with the id {$this->other['assignid']}."; + return "The user with the id '$this->userid' viewed the batch set workflow for the assignment with the course " . + "module id '$this->contextinstanceid'."; } /** @@ -119,7 +120,7 @@ class batch_set_workflow_state_viewed extends base { parent::validate_data(); if (!isset($this->other['assignid'])) { - throw new \coding_exception('The \'assignid\' must be set in other.'); + throw new \coding_exception('The \'assignid\' value must be set in other.'); } } } diff --git a/mod/assign/classes/event/course_module_instance_list_viewed.php b/mod/assign/classes/event/course_module_instance_list_viewed.php index 71bfc3def56..f4228d41968 100644 --- a/mod/assign/classes/event/course_module_instance_list_viewed.php +++ b/mod/assign/classes/event/course_module_instance_list_viewed.php @@ -27,7 +27,7 @@ namespace mod_assign\event; defined('MOODLE_INTERNAL') || die(); /** - * The mod_assign instance list viewed event. + * The mod_assign instance list viewed event class. * * @package mod_assign * @since Moodle 2.7 diff --git a/mod/assign/classes/event/extension_granted.php b/mod/assign/classes/event/extension_granted.php index 7210060295b..078bf60b6b8 100644 --- a/mod/assign/classes/event/extension_granted.php +++ b/mod/assign/classes/event/extension_granted.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * mod_assign extension granted event. + * The mod_assign extension granted event. * * @package mod_assign * @copyright 2013 Frédéric Massart @@ -27,7 +27,7 @@ namespace mod_assign\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_assign extension granted event class. + * The mod_assign extension granted event class. * * @package mod_assign * @since Moodle 2.6 @@ -70,7 +70,8 @@ class extension_granted extends base { * @return string */ public function get_description() { - return "User {$this->userid} has granted an extension to {$this->relateduserid}."; + return "The user with the id '$this->userid' has granted an extension for the user with the id '$this->relateduserid' " . + "for the assignment with the course module id '$this->contextinstanceid'."; } /** @@ -117,7 +118,7 @@ class extension_granted extends base { parent::validate_data(); if (!isset($this->relateduserid)) { - throw new \coding_exception('relateduserid is a mandatory property.'); + throw new \coding_exception('The \'relateduserid\' must be set.'); } } } diff --git a/mod/assign/classes/event/feedback_viewed.php b/mod/assign/classes/event/feedback_viewed.php index 18fdec31b2c..e6374f5a03d 100644 --- a/mod/assign/classes/event/feedback_viewed.php +++ b/mod/assign/classes/event/feedback_viewed.php @@ -27,7 +27,7 @@ namespace mod_assign\event; defined('MOODLE_INTERNAL') || die(); /** - * The mod_assign feedback viewed event. + * The mod_assign feedback viewed event class. * * @property-read array $other { * Extra information about event. @@ -88,8 +88,8 @@ class feedback_viewed extends base { * @return string */ public function get_description() { - return "The user with the id {$this->userid} viewed the feedback for the user with the id {$this->relateduserid} - for the assignment with the id {$this->other['assignid']}."; + return "The user with the id '$this->userid' viewed the feedback for the user with the id '$this->relateduserid' " . + "for the assignment with the course module id '$this->contextinstanceid'."; } /** @@ -116,7 +116,7 @@ class feedback_viewed extends base { } if (!isset($this->other['assignid'])) { - throw new \coding_exception('The \'assignid\' must be set in other.'); + throw new \coding_exception('The \'assignid\' value must be set in other.'); } } } diff --git a/mod/assign/classes/event/grading_form_viewed.php b/mod/assign/classes/event/grading_form_viewed.php index 337b34a0250..ee0d3211452 100644 --- a/mod/assign/classes/event/grading_form_viewed.php +++ b/mod/assign/classes/event/grading_form_viewed.php @@ -27,7 +27,7 @@ namespace mod_assign\event; defined('MOODLE_INTERNAL') || die(); /** - * The mod_assign grading form viewed event. + * The mod_assign grading form viewed event class. * * @property-read array $other { * Extra information about event. @@ -94,8 +94,8 @@ class grading_form_viewed extends base { * @return string */ public function get_description() { - return "The user with the id {$this->userid} viewed the grading form for the user with the id {$this->relateduserid} - for the assignment with the id {$this->other['assignid']}."; + return "The user with the id '$this->userid' viewed the grading form for the user with the id '$this->relateduserid' " . + "for the assignment with the course module id '$this->contextinstanceid'."; } /** @@ -128,7 +128,7 @@ class grading_form_viewed extends base { } if (!isset($this->other['assignid'])) { - throw new \coding_exception('The \'assignid\' must be set in other.'); + throw new \coding_exception('The \'assignid\' value must be set in other.'); } } } diff --git a/mod/assign/classes/event/grading_table_viewed.php b/mod/assign/classes/event/grading_table_viewed.php index 76b384853ce..5bd293b87ec 100644 --- a/mod/assign/classes/event/grading_table_viewed.php +++ b/mod/assign/classes/event/grading_table_viewed.php @@ -27,7 +27,7 @@ namespace mod_assign\event; defined('MOODLE_INTERNAL') || die(); /** - * The mod_assign grading table viewed event. + * The mod_assign grading table viewed event class. * * @property-read array $other { * Extra information about event. @@ -91,7 +91,8 @@ class grading_table_viewed extends base { * @return string */ public function get_description() { - return "The user with the id {$this->userid} viewed the grading table for the assignment with the id {$this->other['assignid']}."; + return "The user with the id '$this->userid' viewed the grading table for the assignment with the course module " . + "id '$this->contextinstanceid'."; } /** @@ -119,7 +120,7 @@ class grading_table_viewed extends base { parent::validate_data(); if (!isset($this->other['assignid'])) { - throw new \coding_exception('The \'assignid\' must be set in other.'); + throw new \coding_exception('The \'assignid\' value must be set in other.'); } } } diff --git a/mod/assign/classes/event/identities_revealed.php b/mod/assign/classes/event/identities_revealed.php index a724d9bbed7..b5788ed63f0 100644 --- a/mod/assign/classes/event/identities_revealed.php +++ b/mod/assign/classes/event/identities_revealed.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * mod_assign identities revealed event. + * The mod_assign identities revealed event. * * @package mod_assign * @copyright 2013 Frédéric Massart @@ -27,7 +27,7 @@ namespace mod_assign\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_assign identities revealed event class. + * The mod_assign identities revealed event class. * * @package mod_assign * @since Moodle 2.6 @@ -68,7 +68,8 @@ class identities_revealed extends base { * @return string */ public function get_description() { - return "User {$this->userid} has revealed the identities in assignment {$this->objectid}."; + return "The user with the id '$this->userid' has revealed the identities in the assignment with the course module " . + "id '$this->contextinstanceid'."; } /** diff --git a/mod/assign/classes/event/marker_updated.php b/mod/assign/classes/event/marker_updated.php index 9a1eea6f85a..8fcd3521a15 100644 --- a/mod/assign/classes/event/marker_updated.php +++ b/mod/assign/classes/event/marker_updated.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * mod_assign marker updated event. + * The mod_assign marker updated event. * * @package mod_assign * @copyright 2013 Frédéric Massart @@ -27,12 +27,12 @@ namespace mod_assign\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_assign marker updated event class. + * The mod_assign marker updated event class. * * @property-read array $other { * Extra information about event. * - * @type int markerid userid id of marker. + * - int markerid: user id of marker. * } * * @package mod_assign @@ -82,7 +82,8 @@ class marker_updated extends base { * @return string */ public function get_description() { - return "User {$this->userid} has set the marker of {$this->relateduserid} to {$this->other['markerid']}."; + return "The user with the id '$this->userid' has set the marker for the user with the id '$this->relateduserid' to " . + "'{$this->other['markerid']}' for the assignment with the course module id '$this->contextinstanceid'."; } /** @@ -131,10 +132,12 @@ class marker_updated extends base { parent::validate_data(); + if (!isset($this->relateduserid)) { + throw new \coding_exception('The \'relateduserid\' must be set.'); + } + if (!isset($this->other['markerid'])) { - throw new \coding_exception('markerid must be set in $other.'); - } else if (!isset($this->relateduserid)) { - throw new \coding_exception('relateduserid must be set.'); + throw new \coding_exception('The \'markerid\' value must be set in other.'); } } } diff --git a/mod/assign/classes/event/reveal_identities_confirmation_page_viewed.php b/mod/assign/classes/event/reveal_identities_confirmation_page_viewed.php index 5a788ea2ee1..86442a04087 100644 --- a/mod/assign/classes/event/reveal_identities_confirmation_page_viewed.php +++ b/mod/assign/classes/event/reveal_identities_confirmation_page_viewed.php @@ -27,7 +27,7 @@ namespace mod_assign\event; defined('MOODLE_INTERNAL') || die(); /** - * The mod_assign reveal identities confirmation page viewed event. + * The mod_assign reveal identities confirmation page viewed event class. * * @property-read array $other { * Extra information about event. @@ -91,8 +91,8 @@ class reveal_identities_confirmation_page_viewed extends base { * @return string */ public function get_description() { - return "The user with the id {$this->userid} viewed the confirmation page for revealing identities for the - assignment with the id {$this->other['assignid']}."; + return "The user with the id '$this->userid' viewed the confirmation page for revealing identities for the " . + "assignment with the course module id '$this->contextinstanceid'."; } diff --git a/mod/assign/classes/event/statement_accepted.php b/mod/assign/classes/event/statement_accepted.php index f9b452f08be..6e887fd457e 100644 --- a/mod/assign/classes/event/statement_accepted.php +++ b/mod/assign/classes/event/statement_accepted.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * mod_assign statement accepted event. + * The mod_assign statement accepted event. * * @package mod_assign * @copyright 2013 Frédéric Massart @@ -27,7 +27,7 @@ namespace mod_assign\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_assign statement accepted event class. + * The mod_assign statement accepted event class. * * @package mod_assign * @since Moodle 2.6 @@ -70,7 +70,8 @@ class statement_accepted extends base { * @return string */ public function get_description() { - return "The user {$this->userid} has accepted the statement of the submission {$this->objectid}."; + return "The user with the id '$this->userid' has accepted the statement of the submission with the id '$this->objectid' " . + "for the assignment with the course module id '$this->contextinstanceid'."; } /** diff --git a/mod/assign/classes/event/submission_confirmation_form_viewed.php b/mod/assign/classes/event/submission_confirmation_form_viewed.php index 15884d73178..640eff15aca 100644 --- a/mod/assign/classes/event/submission_confirmation_form_viewed.php +++ b/mod/assign/classes/event/submission_confirmation_form_viewed.php @@ -27,7 +27,7 @@ namespace mod_assign\event; defined('MOODLE_INTERNAL') || die(); /** - * The mod_assign submission form viewed event. + * The mod_assign submission form viewed event class. * * @property-read array $other { * Extra information about event. @@ -91,8 +91,8 @@ class submission_confirmation_form_viewed extends base { * @return string */ public function get_description() { - return "The user with the id {$this->userid} viewed the submission confirmation form for the assignment with the id - {$this->other['assignid']}."; + return "The user with the id '$this->userid' viewed the submission confirmation form for the assignment with the " . + "course module id '$this->contextinstanceid'."; } /** diff --git a/mod/assign/classes/event/submission_created.php b/mod/assign/classes/event/submission_created.php index af1c9e98501..c420ce38255 100644 --- a/mod/assign/classes/event/submission_created.php +++ b/mod/assign/classes/event/submission_created.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * mod_assign submission_created abstract event. + * The mod_assign submission_created abstract event. * * @package mod_assign * @copyright 2014 Adrian Greeve @@ -27,13 +27,16 @@ namespace mod_assign\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_assign submission_created abstract event class. + * The mod_assign submission_created abstract event class. * - * @property-read array $other Extra information about the event. - * -int submissionid: ID number of this submission. - * -int submissionattempt: Number of attempts made on this submission. - * -string submissionstatus: Status of the submission. - * -int groupid: (optional) The group ID if this is a teamsubmission (optional). + * @property-read array $other { + * Extra information about the event. + * + * - int submissionid: ID number of this submission. + * - int submissionattempt: Number of attempts made on this submission. + * - string submissionstatus: Status of the submission. + * - int groupid: (optional) The group ID if this is a teamsubmission. + * - string groupname: (optional) The name of the group if this is a teamsubmission. * } * * @package mod_assign @@ -69,13 +72,13 @@ abstract class submission_created extends base { protected function validate_data() { parent::validate_data(); if (!isset($this->other['submissionid'])) { - throw new \coding_exception('Other must contain the key submissionid.'); + throw new \coding_exception('The \'submissionid\' value must be set in other.'); } if (!isset($this->other['submissionattempt'])) { - throw new \coding_exception('Other must contain the key submissionattempt.'); + throw new \coding_exception('The \'submissionattempt\' value must be set in other.'); } if (!isset($this->other['submissionstatus'])) { - throw new \coding_exception('Other must contain the key submissionstatus.'); + throw new \coding_exception('The \'submissionstatus\' value must be set in other.'); } } } diff --git a/mod/assign/classes/event/submission_duplicated.php b/mod/assign/classes/event/submission_duplicated.php index 894ac486fb6..061ca56f9cc 100644 --- a/mod/assign/classes/event/submission_duplicated.php +++ b/mod/assign/classes/event/submission_duplicated.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * mod_assign submission duplicated event. + * The mod_assign submission duplicated event. * * @package mod_assign * @copyright 2013 Frédéric Massart @@ -27,7 +27,7 @@ namespace mod_assign\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_assign submission duplicated event class. + * The mod_assign submission duplicated event class. * * @package mod_assign * @since Moodle 2.6 @@ -70,7 +70,8 @@ class submission_duplicated extends base { * @return string */ public function get_description() { - return "The user {$this->userid} duplicated his submission {$this->objectid}."; + return "The user with the id '$this->userid' duplicated their submission with the id '$this->objectid' for the " . + "assignment with the course module id '$this->contextinstanceid'."; } /** diff --git a/mod/assign/classes/event/submission_form_viewed.php b/mod/assign/classes/event/submission_form_viewed.php index f2838aa1dea..45a2e8fba06 100644 --- a/mod/assign/classes/event/submission_form_viewed.php +++ b/mod/assign/classes/event/submission_form_viewed.php @@ -27,7 +27,7 @@ namespace mod_assign\event; defined('MOODLE_INTERNAL') || die(); /** - * The mod_assign submission form viewed event. + * The mod_assign submission form viewed event class. * * @property-read array $other { * Extra information about event. @@ -90,17 +90,17 @@ class submission_form_viewed extends base { /** * Returns description of what happened. - * + *the course module id '$this->contextinstanceid' * @return string */ public function get_description() { if ($this->userid != $this->relateduserid) { - return "The user with the id {$this->userid} viewed the submission form for the user with the id {$this->relateduserid} - for the assignment with the id {$this->other['assignid']}."; + return "The user with the id '$this->userid' viewed the submission form for the user with the id '$this->relateduserid' " . + "for the assignment with the course module id '$this->contextinstanceid'."; } - return "The user with the id {$this->userid} viewed their submission for the assignment with the id - {$this->other['assignid']}."; + return "The user with the id '$this->userid' viewed their submission for the assignment with the the course " . + "module id '$this->contextinstanceid'."; } /** @@ -136,7 +136,7 @@ class submission_form_viewed extends base { } if (!isset($this->other['assignid'])) { - throw new \coding_exception('The \'assignid\' must be set in other.'); + throw new \coding_exception('The \'assignid\' value must be set in other.'); } } } diff --git a/mod/assign/classes/event/submission_graded.php b/mod/assign/classes/event/submission_graded.php index 5f04c83342d..f08d859c29a 100644 --- a/mod/assign/classes/event/submission_graded.php +++ b/mod/assign/classes/event/submission_graded.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * mod_assign submission graded event. + * The mod_assign submission graded event. * * @package mod_assign * @copyright 2013 Frédéric Massart @@ -27,7 +27,7 @@ namespace mod_assign\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_assign submission graded event class. + * The mod_assign submission graded event class. * * @package mod_assign * @since Moodle 2.6 @@ -71,7 +71,8 @@ class submission_graded extends base { * @return string */ public function get_description() { - return "User {$this->userid} has graded the submission {$this->objectid}."; + return "The user with the id '$this->userid' has graded the submission '$this->objectid' for the user with the " . + "id '$this->relateduserid' for the assignment with the the course module id '$this->contextinstanceid'."; } /** @@ -119,7 +120,7 @@ class submission_graded extends base { parent::validate_data(); if (!isset($this->relateduserid)) { - throw new \coding_exception('relateduserid is a mandatory property.'); + throw new \coding_exception('The \'relateduserid\' must be set.'); } } } diff --git a/mod/assign/classes/event/submission_locked.php b/mod/assign/classes/event/submission_locked.php index e5f16b7a35c..7939d689965 100644 --- a/mod/assign/classes/event/submission_locked.php +++ b/mod/assign/classes/event/submission_locked.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * mod_assign submission locked event. + * The mod_assign submission locked event. * * @package mod_assign * @copyright 2013 Frédéric Massart @@ -27,7 +27,7 @@ namespace mod_assign\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_assign submission locked event class. + * The mod_assign submission locked event class. * * @package mod_assign * @since Moodle 2.6 @@ -71,7 +71,8 @@ class submission_locked extends base { * @return string */ public function get_description() { - return "User {$this->userid} locked the submission for user {$this->relateduserid}."; + return "The user with the id '$this->userid' locked the submission for the user with the id '$this->relateduserid' for " . + "the assignment with the course module id '$this->contextinstanceid'."; } /** @@ -119,7 +120,7 @@ class submission_locked extends base { parent::validate_data(); if (!isset($this->relateduserid)) { - throw new \coding_exception('relateduserid is a mandatory property.'); + throw new \coding_exception('The \'relateduserid\' must be set.'); } } } diff --git a/mod/assign/classes/event/submission_status_updated.php b/mod/assign/classes/event/submission_status_updated.php index 4d1b2078b38..3290bf1351c 100644 --- a/mod/assign/classes/event/submission_status_updated.php +++ b/mod/assign/classes/event/submission_status_updated.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * mod_assign submission status updated event. + * The mod_assign submission status updated event. * * @package mod_assign * @copyright 2013 Frédéric Massart @@ -27,12 +27,12 @@ namespace mod_assign\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_assign submission status updated event class. + * The mod_assign submission status updated event class. * * @property-read array $other { * Extra information about event. * - * @type string newstatus status of submission. + * - string newstatus: status of submission. * } * * @package mod_assign @@ -72,7 +72,8 @@ class submission_status_updated extends base { * @return string */ public function get_description() { - return "User {$this->userid} has updated the status of the submission {$this->objectid} to {$this->other['newstatus']}."; + return "The user with the id '$this->userid' has updated the status of the submission with the id '$this->objectid' for " . + "the assignment with the course module id '$this->contextinstanceid' to the status '{$this->other['newstatus']}'."; } /** @@ -117,7 +118,7 @@ class submission_status_updated extends base { parent::validate_data(); if (!isset($this->other['newstatus'])) { - throw new \coding_exception('newstatus must be set in $other.'); + throw new \coding_exception('The \'newstatus\' value must be set in other.'); } } } diff --git a/mod/assign/classes/event/submission_status_viewed.php b/mod/assign/classes/event/submission_status_viewed.php index 34d8d58110b..a4bfddae63a 100644 --- a/mod/assign/classes/event/submission_status_viewed.php +++ b/mod/assign/classes/event/submission_status_viewed.php @@ -27,7 +27,7 @@ namespace mod_assign\event; defined('MOODLE_INTERNAL') || die(); /** - * The mod_assign submission status viewed event. + * The mod_assign submission status viewed event class. * * @property-read array $other { * Extra information about event. @@ -93,8 +93,8 @@ class submission_status_viewed extends base { * @return string */ public function get_description() { - return "The user with the id {$this->userid} has viewed the status of their submission for the assignment with - the id {$this->other['assignid']}."; + return "The user with the id '$this->userid' has viewed the status of the submission with the id '$this->objectid' for " . + "the assignment with the course module id '$this->contextinstanceid'."; } /** diff --git a/mod/assign/classes/event/submission_unlocked.php b/mod/assign/classes/event/submission_unlocked.php index 69198ac84ae..bb50ec83801 100644 --- a/mod/assign/classes/event/submission_unlocked.php +++ b/mod/assign/classes/event/submission_unlocked.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * mod_assign submission unlocked event. + * The mod_assign submission unlocked event. * * @package mod_assign * @copyright 2013 Frédéric Massart @@ -27,7 +27,7 @@ namespace mod_assign\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_assign submission unlocked event class. + * The mod_assign submission unlocked event class. * * @package mod_assign * @since Moodle 2.6 @@ -71,7 +71,8 @@ class submission_unlocked extends base { * @return string */ public function get_description() { - return "User {$this->userid} unlocked the submission for user {$this->relateduserid}."; + return "The user with the id '$this->userid' locked the submission for the user with the id '$this->relateduserid' " . + "for the assignment with the course module id '$this->contextinstanceid'."; } /** @@ -119,7 +120,7 @@ class submission_unlocked extends base { parent::validate_data(); if (!isset($this->relateduserid)) { - throw new \coding_exception('relateduserid is a mandatory property.'); + throw new \coding_exception('The \'relateduserid\' must be set.'); } } } diff --git a/mod/assign/classes/event/submission_updated.php b/mod/assign/classes/event/submission_updated.php index 8b22fd4fc8f..deb2e13feb4 100644 --- a/mod/assign/classes/event/submission_updated.php +++ b/mod/assign/classes/event/submission_updated.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * mod_assign submission updated event. + * The mod_assign submission updated event. * * @package mod_assign * @copyright 2013 Frédéric Massart @@ -27,13 +27,16 @@ namespace mod_assign\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_assign submission updated event class. + * The mod_assign submission updated event class. * - * @property-read array $other Extra information about the event. - * -int submissionid: ID number of this submission. - * -int submissionattempt: Number of attempts made on this submission. - * -string submissionstatus: Status of the submission. - * -int groupid: (optional) The group ID if this is a teamsubmission (optional). + * @property-read array $other { + * Extra information about the event. + * + * - int submissionid: ID number of this submission. + * - int submissionattempt: Number of attempts made on this submission. + * - string submissionstatus: Status of the submission. + * - int groupid: (optional) The group ID if this is a teamsubmission. + * - string groupname: (optional) The name of the group if this is a teamsubmission. * } * * @package mod_assign @@ -69,13 +72,13 @@ abstract class submission_updated extends base { protected function validate_data() { parent::validate_data(); if (!isset($this->other['submissionid'])) { - throw new \coding_exception('Other must contain the key submissionid.'); + throw new \coding_exception('The \'submissionid\' value must be set in other.'); } if (!isset($this->other['submissionattempt'])) { - throw new \coding_exception('Other must contain the key submissionattempt.'); + throw new \coding_exception('The \'submissionattempt\' value must be set in other.'); } if (!isset($this->other['submissionstatus'])) { - throw new \coding_exception('Other must contain the key submissionstatus.'); + throw new \coding_exception('The \'submissionstatus\' value must be set in other.'); } } } diff --git a/mod/assign/classes/event/submission_viewed.php b/mod/assign/classes/event/submission_viewed.php index b19723085e3..00ef3212990 100644 --- a/mod/assign/classes/event/submission_viewed.php +++ b/mod/assign/classes/event/submission_viewed.php @@ -27,7 +27,7 @@ namespace mod_assign\event; defined('MOODLE_INTERNAL') || die(); /** - * The mod_assign submission viewed event. + * The mod_assign submission viewed event class. * * @property-read array $other { * Extra information about the event. @@ -88,8 +88,8 @@ class submission_viewed extends base { * @return string */ public function get_description() { - return "The user with the id {$this->userid} viewed the submission for the user with the id {$this->relateduserid} for the - assignment with the id {$this->other['assignid']}."; + return "The user with the id '$this->userid' viewed the submission for the user with the id '$this->relateduserid' for the " . + "assignment with the course module id '$this->contextinstanceid'."; } /** @@ -116,7 +116,7 @@ class submission_viewed extends base { } if (!isset($this->other['assignid'])) { - throw new \coding_exception('The \'assignid\' must be set in other.'); + throw new \coding_exception('The \'assignid\' value must be set in other.'); } } } diff --git a/mod/assign/classes/event/workflow_state_updated.php b/mod/assign/classes/event/workflow_state_updated.php index 32919427978..479550fc938 100644 --- a/mod/assign/classes/event/workflow_state_updated.php +++ b/mod/assign/classes/event/workflow_state_updated.php @@ -32,7 +32,7 @@ defined('MOODLE_INTERNAL') || die(); * @property-read array $other { * Extra information about event. * - * @type string newstatus status of submission. + * - string newstatus: status of submission. * } * * @package mod_assign @@ -81,7 +81,8 @@ class workflow_state_updated extends base { * @return string */ public function get_description() { - return "User {$this->userid} has set the workflow state of {$this->relateduserid} to {$this->other['newstate']}."; + return "The user with the id '$this->userid' has set the workflow state of the user with the id '$this->relateduserid' " . + "to the state '{$this->other['newstate']}' for the assignment with the course module id '$this->contextinstanceid'."; } /** @@ -129,10 +130,12 @@ class workflow_state_updated extends base { parent::validate_data(); + if (!isset($this->relateduserid)) { + throw new \coding_exception('The \'relateduserid\' must be set.'); + } + if (!isset($this->other['newstate'])) { - throw new \coding_exception('newstate must be set in $other.'); - } else if (!isset($this->relateduserid)) { - throw new \coding_exception('relateduserid must be set.'); + throw new \coding_exception('The \'newstate\' value must be set in other.'); } } } diff --git a/mod/assign/submission/comments/classes/event/comment_created.php b/mod/assign/submission/comments/classes/event/comment_created.php index 73a97a05c6e..7749fd6c980 100644 --- a/mod/assign/submission/comments/classes/event/comment_created.php +++ b/mod/assign/submission/comments/classes/event/comment_created.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * assignsubmission_comments comment created event. + * The assignsubmission_comments comment created event. * * @package assignsubmission_comments * @copyright 2013 Rajesh Taneja @@ -26,7 +26,7 @@ namespace assignsubmission_comments\event; defined('MOODLE_INTERNAL') || die(); /** - * assignsubmission_comments comment created event. + * The assignsubmission_comments comment created event class. * * @package assignsubmission_comments * @since Moodle 2.7 @@ -49,6 +49,7 @@ class comment_created extends \core\event\comment_created { * @return string */ public function get_description() { - return 'User with id ' . $this->userid . ' added comment for assignment submission with id ' . $this->other['itemid']; + return "The user with the id '$this->userid' added the comment with the id '$this->objectid' to the submission " . + "with the id '{$this->other['itemid']}' for the assignment with the course module id '$this->contextinstanceid'."; } } diff --git a/mod/assign/submission/comments/classes/event/comment_deleted.php b/mod/assign/submission/comments/classes/event/comment_deleted.php index ed650728f7f..8aa2c780401 100644 --- a/mod/assign/submission/comments/classes/event/comment_deleted.php +++ b/mod/assign/submission/comments/classes/event/comment_deleted.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * assignsubmission_comments comment deleted event. + * The assignsubmission_comments comment deleted event. * * @package assignsubmission_comments * @copyright 2013 Rajesh Taneja @@ -26,7 +26,7 @@ namespace assignsubmission_comments\event; defined('MOODLE_INTERNAL') || die(); /** - * assignsubmission_comments comment deleted event. + * The assignsubmission_comments comment deleted event. * * @package assignsubmission_comments * @since Moodle 2.7 @@ -49,6 +49,7 @@ class comment_deleted extends \core\event\comment_deleted { * @return string */ public function get_description() { - return 'User with id ' . $this->userid . ' deleted comment for assignment submission with id ' . $this->other['itemid']; + return "The user with the id '$this->userid' deleted the comment with the id '$this->objectid' from the submission " . + "with the id '{$this->other['itemid']}' for the assignment with the course module id '$this->contextinstanceid'."; } } diff --git a/mod/assign/submission/file/classes/event/assessable_uploaded.php b/mod/assign/submission/file/classes/event/assessable_uploaded.php index 1f3bdefb5e4..9f98b968c5d 100644 --- a/mod/assign/submission/file/classes/event/assessable_uploaded.php +++ b/mod/assign/submission/file/classes/event/assessable_uploaded.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * assignsubmission_file assessable uploaded event. + * The assignsubmission_file assessable uploaded event. * * @package assignsubmission_file * @copyright 2013 Frédéric Massart @@ -27,14 +27,7 @@ namespace assignsubmission_file\event; defined('MOODLE_INTERNAL') || die(); /** - * assignsubmission_file assessable uploaded event class. - * - * @property-read array $other { - * Extra information about event. - * - * @type array pathnamehashes uploaded files path name hash. - * @type string content empty string. - * } + * The assignsubmission_file assessable uploaded event class. * * @package assignsubmission_file * @since Moodle 2.6 @@ -56,7 +49,8 @@ class assessable_uploaded extends \core\event\assessable_uploaded { * @return string */ public function get_description() { - return "User {$this->userid} has uploaded a file in submission {$this->objectid}."; + return "The user with the id '$this->userid' has uploaded a file to the submission with the id '$this->objectid' " . + "in the assignment activity with the course module id '$this->contextinstanceid'."; } /** diff --git a/mod/assign/submission/file/classes/event/submission_created.php b/mod/assign/submission/file/classes/event/submission_created.php index c04ee4b0065..d945832fa49 100644 --- a/mod/assign/submission/file/classes/event/submission_created.php +++ b/mod/assign/submission/file/classes/event/submission_created.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * assignsubmission_file submission_created event. + * The assignsubmission_file submission_created event. * * @package assignsubmission_file * @copyright 2014 Adrian Greeve @@ -27,14 +27,12 @@ namespace assignsubmission_file\event; defined('MOODLE_INTERNAL') || die(); /** - * assignsubmission_file submission_created event class. + * The assignsubmission_file submission_created event class. * - * @property-read array $other Extra information about the event. - * -int submissionid: ID number of this submission. - * -int submissionattempt: Number of attempts made on this submission. - * -string submissionstatus: Status of the submission. - * -int groupid: (optional) The group ID if this is a teamsubmission (optional). - * -int filesubmissioncount: The number of files uploaded. + * @property-read array $other { + * Extra information about the event. + * + * - int filesubmissioncount: The number of files uploaded. * } * * @package assignsubmission_file @@ -58,24 +56,15 @@ class submission_created extends \mod_assign\event\submission_created { * @return string */ public function get_description() { + $descriptionstring = "The user with the id '$this->userid' created a file submission and uploaded " . + "'{$this->other['filesubmissioncount']}' file/s in the assignment with the course module id " . + "'$this->contextinstanceid'"; if (!empty($this->other['groupid'])) { - $context = $this->get_context(); - if (isset($context)) { - $descriptionstring = 'A user with an id of ' . $this->userid . ' updated a file submission and uploaded ' . - $this->other['filesubmissioncount'] . ' file/s in the assign module with an id of ' . - $this->other['submissionid'] . ' for the group ' . - \format_string($this->other['groupname'], true, array('context' => $context)) . '.'; - } else { - $descriptionstring = 'A user with an id of ' . $this->userid . ' updated a file submission and uploaded ' . - $this->other['filesubmissioncount'] . ' file/s in the assign module with an id of ' . - $this->other['submissionid'] . ' for the group ' . $this->other['groupid'] . '.'; - - } + $descriptionstring .= " for the group with the id '{$this->other['groupid']}'."; } else { - $descriptionstring = 'A user with an id of ' . $this->userid . ' updated a file submission and uploaded '. - $this->other['filesubmissioncount'] . ' file/s in the assign module with an id of ' . - $this->other['submissionid']; + $descriptionstring .= "."; } + return $descriptionstring; } @@ -88,7 +77,7 @@ class submission_created extends \mod_assign\event\submission_created { protected function validate_data() { parent::validate_data(); if (!isset($this->other['filesubmissioncount'])) { - throw new \coding_exception('Other must contain the key filesubmissioncount.'); + throw new \coding_exception('The \'filesubmissioncount\' value must be set in other.'); } } } diff --git a/mod/assign/submission/file/classes/event/submission_updated.php b/mod/assign/submission/file/classes/event/submission_updated.php index 7fc9e0b4fe5..a0cef1cde89 100644 --- a/mod/assign/submission/file/classes/event/submission_updated.php +++ b/mod/assign/submission/file/classes/event/submission_updated.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * assignsubmission_file submission_updated event. + * The assignsubmission_file submission_updated event. * * @package assignsubmission_file * @copyright 2014 Adrian Greeve @@ -27,14 +27,12 @@ namespace assignsubmission_file\event; defined('MOODLE_INTERNAL') || die(); /** - * assignsubmission_file submission_updated event class. + * The assignsubmission_file submission_updated event class. * - * @property-read array $other Extra information about the event. - * -int submissionid: ID number of this submission. - * -int submissionattempt: Number of attempts made on this submission. - * -string submissionstatus: Status of the submission. - * -int groupid: (optional) The group ID if this is a teamsubmission (optional). - * -int filesubmissioncount: The number of files uploaded. + * @property-read array $other { + * Extra information about the event. + * + * - int filesubmissioncount: The number of files uploaded. * } * * @package assignsubmission_file @@ -58,24 +56,15 @@ class submission_updated extends \mod_assign\event\submission_updated { * @return string */ public function get_description() { + $descriptionstring = "The user with the id '$this->userid' updated a file submission and uploaded " . + "'{$this->other['filesubmissioncount']}' file/s in the assignment with the course module id " . + "'$this->contextinstanceid'"; if (!empty($this->other['groupid'])) { - $context = $this->get_context(); - if (isset($context)) { - $descriptionstring = 'A user with an id of ' . $this->userid . ' updated a file submission and uploaded ' . - $this->other['filesubmissioncount'] . ' file/s in the assign module with an id of ' . - $this->other['submissionid'] . ' for the group ' . - \format_string($this->other['groupname'], true, array('context' => $context)) . '.'; - } else { - $descriptionstring = 'A user with an id of ' . $this->userid . ' updated a file submission and uploaded ' . - $this->other['filesubmissioncount'] . ' file/s in the assign module with an id of ' . - $this->other['submissionid'] . ' for the group ' . $this->other['groupid'] . '.'; - - } + $descriptionstring .= " for the group with the id '{$this->other['groupid']}'."; } else { - $descriptionstring = 'A user with an id of ' . $this->userid . ' updated a file submission and uploaded '. - $this->other['filesubmissioncount'] . ' file/s in the assign module with an id of ' . - $this->other['submissionid']; + $descriptionstring .= "."; } + return $descriptionstring; } @@ -88,7 +77,7 @@ class submission_updated extends \mod_assign\event\submission_updated { protected function validate_data() { parent::validate_data(); if (!isset($this->other['filesubmissioncount'])) { - throw new \coding_exception('Other must contain the key filesubmissioncount.'); + throw new \coding_exception('The \'filesubmissioncount\' value must be set in other.'); } } } diff --git a/mod/assign/submission/onlinetext/classes/event/assessable_uploaded.php b/mod/assign/submission/onlinetext/classes/event/assessable_uploaded.php index 98bf3783ceb..624b37d1f5f 100644 --- a/mod/assign/submission/onlinetext/classes/event/assessable_uploaded.php +++ b/mod/assign/submission/onlinetext/classes/event/assessable_uploaded.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * assignsubmission_onlinetext assessable uploaded event. + * The assignsubmission_onlinetext assessable uploaded event. * * @package assignsubmission_onlinetext * @copyright 2013 Frédéric Massart @@ -27,14 +27,12 @@ namespace assignsubmission_onlinetext\event; defined('MOODLE_INTERNAL') || die(); /** - * assignsubmission_onlinetext assessable uploaded event class. + * The assignsubmission_onlinetext assessable uploaded event class. * * @property-read array $other { * Extra information about event. * - * @type array pathnamehashes uploaded files path name hashes. - * @type string content string. - * @type string format content format. + * - string format: content format. * } * * @package assignsubmission_onlinetext @@ -50,7 +48,8 @@ class assessable_uploaded extends \core\event\assessable_uploaded { * @return string */ public function get_description() { - return "User {$this->userid} has saved an online text in submission {$this->objectid}."; + return "The user with the id '$this->userid' has saved an online text submission with the id '$this->objectid' " . + "in the assignment activity with the course module id '$this->contextinstanceid'."; } /** diff --git a/mod/assign/submission/onlinetext/classes/event/submission_created.php b/mod/assign/submission/onlinetext/classes/event/submission_created.php index 2320e031910..4e12e256d97 100644 --- a/mod/assign/submission/onlinetext/classes/event/submission_created.php +++ b/mod/assign/submission/onlinetext/classes/event/submission_created.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * assignsubmission_onlinetext submission_created event. + * The assignsubmission_onlinetext submission_created event. * * @package assignsubmission_onlinetext * @copyright 2014 Adrian Greeve @@ -27,14 +27,12 @@ namespace assignsubmission_onlinetext\event; defined('MOODLE_INTERNAL') || die(); /** - * assignsubmission_onlinetext submission_created event class. + * The assignsubmission_onlinetext submission_created event class. * - * @property-read array $other Extra information about the event. - * -int submissionid: ID number of this submission. - * -int submissionattempt: Number of attempts made on this submission. - * -string submissionstatus: Status of the submission. - * -int groupid: (optional) The group ID if this is a teamsubmission (optional). - * -int onlinetextwordcount: Word count of the online text submission. + * @property-read array $other { + * Extra information about the event. + * + * - int onlinetextwordcount: Word count of the online text submission. * } * * @package assignsubmission_onlinetext @@ -58,24 +56,15 @@ class submission_created extends \mod_assign\event\submission_created { * @return string */ public function get_description() { + $descriptionstring = "The user with the id '$this->userid' created an online text submission with " . + "'{$this->other['onlinetextwordcount']}' words in the assignment with the course module id " . + "'$this->contextinstanceid'"; if (!empty($this->other['groupid'])) { - $context = $this->get_context(); - if (isset($context)) { - $descriptionstring = 'A user with an id of ' . $this->userid . ' updated a file submission and uploaded ' . - $this->other['onlinetextwordcount'] . ' file/s in the assign module with an id of ' . - $this->other['submissionid'] . ' for the group ' . - \format_string($this->other['groupname'], true, array('context' => $context)) . '.'; - } else { - $descriptionstring = 'A user with an id of ' . $this->userid . ' updated a file submission and uploaded ' . - $this->other['onlinetextwordcount'] . ' file/s in the assign module with an id of ' . - $this->other['submissionid'] . ' for the group ' . $this->other['groupid'] . '.'; - - } + $descriptionstring .= " for the group with the id '{$this->other['groupid']}'."; } else { - $descriptionstring = 'A user with an id of ' . $this->userid . ' updated a file submission and uploaded '. - $this->other['onlinetextwordcount'] . ' file/s in the assign module with an id of ' . - $this->other['submissionid']; + $descriptionstring .= "."; } + return $descriptionstring; } @@ -88,7 +77,7 @@ class submission_created extends \mod_assign\event\submission_created { protected function validate_data() { parent::validate_data(); if (!isset($this->other['onlinetextwordcount'])) { - throw new \coding_exception('Other must contain the key onlinetextwordcount.'); + throw new \coding_exception('The \'onlinetextwordcount\' value must be set in other.'); } } } diff --git a/mod/assign/submission/onlinetext/classes/event/submission_updated.php b/mod/assign/submission/onlinetext/classes/event/submission_updated.php index fab9f4118c7..18ae0a5bcb5 100644 --- a/mod/assign/submission/onlinetext/classes/event/submission_updated.php +++ b/mod/assign/submission/onlinetext/classes/event/submission_updated.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * assignsubmission_onlinetext submission_updated event. + * The assignsubmission_onlinetext submission_updated event. * * @package assignsubmission_onlinetext * @copyright 2014 Adrian Greeve @@ -27,14 +27,12 @@ namespace assignsubmission_onlinetext\event; defined('MOODLE_INTERNAL') || die(); /** - * assignsubmission_onlinetext submission_updated event class. + * The assignsubmission_onlinetext submission_updated event class. * - * @property-read array $other Extra information about the event. - * -int submissionid: ID number of this submission. - * -int submissionattempt: Number of attempts made on this submission. - * -string submissionstatus: Status of the submission. - * -int groupid: (optional) The group ID if this is a teamsubmission (optional). - * -int onlinetextwordcount: Word count of the online text submission. + * @property-read array $other { + * Extra information about the event. + * + * - int onlinetextwordcount: Word count of the online text submission. * } * * @package assignsubmission_onlinetext @@ -58,24 +56,15 @@ class submission_updated extends \mod_assign\event\submission_updated { * @return string */ public function get_description() { + $descriptionstring = "The user with the id '$this->userid' updated an online text submission with " . + "'{$this->other['onlinetextwordcount']}' words in the assignment with the course module id " . + "'$this->contextinstanceid'"; if (!empty($this->other['groupid'])) { - $context = $this->get_context(); - if (isset($context)) { - $descriptionstring = 'A user with an id of ' . $this->userid . ' updated a file submission and uploaded ' . - $this->other['onlinetextwordcount'] . ' file/s in the assign module with an id of ' . - $this->other['submissionid'] . ' for the group ' . - \format_string($this->other['groupname'], true, array('context' => $context)) . '.'; - } else { - $descriptionstring = 'A user with an id of ' . $this->userid . ' updated a file submission and uploaded ' . - $this->other['onlinetextwordcount'] . ' file/s in the assign module with an id of ' . - $this->other['submissionid'] . ' for the group ' . $this->other['groupid'] . '.'; - - } + $descriptionstring .= " for the group with the id '{$this->other['groupid']}'."; } else { - $descriptionstring = 'A user with an id of ' . $this->userid . ' updated a file submission and uploaded '. - $this->other['onlinetextwordcount'] . ' file/s in the assign module with an id of ' . - $this->other['submissionid']; + $descriptionstring .= "."; } + return $descriptionstring; } diff --git a/mod/book/classes/event/chapter_created.php b/mod/book/classes/event/chapter_created.php index 9a6d00f9f6d..96efdf7fa2c 100644 --- a/mod/book/classes/event/chapter_created.php +++ b/mod/book/classes/event/chapter_created.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * mod_book chapter created event. + * The mod_book chapter created event. * * @package mod_book * @copyright 2013 Frédéric Massart @@ -26,7 +26,7 @@ namespace mod_book\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_book chapter created event class. + * The mod_book chapter created event class. * * @package mod_book * @since Moodle 2.6 @@ -62,7 +62,8 @@ class chapter_created extends \core\event\base { * @return string */ public function get_description() { - return "The chapter $this->objectid of the book " . $this->contextinstanceid . " has been created."; + return "The chapter with the id '$this->objectid' of the book with the course module id '$this->contextinstanceid' + has been created by the user with the id '$this->userid'."; } /** diff --git a/mod/book/classes/event/chapter_deleted.php b/mod/book/classes/event/chapter_deleted.php index d2e1f258b5f..b7f988940a2 100644 --- a/mod/book/classes/event/chapter_deleted.php +++ b/mod/book/classes/event/chapter_deleted.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * mod_book chapter deleted event. + * The mod_book chapter deleted event. * * @package mod_book * @copyright 2013 Frédéric Massart @@ -26,7 +26,7 @@ namespace mod_book\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_book chapter deleted event class. + * The mod_book chapter deleted event class. * * @package mod_book * @since Moodle 2.6 @@ -62,7 +62,8 @@ class chapter_deleted extends \core\event\base { * @return string */ public function get_description() { - return "The chapter $this->objectid of the book " . $this->contextinstanceid . " has been deleted."; + return "The chapter with the id '$this->objectid' of the book with the course module id '$this->contextinstanceid' + has been deleted by the user with the id '$this->userid."; } /** diff --git a/mod/book/classes/event/chapter_updated.php b/mod/book/classes/event/chapter_updated.php index bf295b73a12..c13c05c2056 100644 --- a/mod/book/classes/event/chapter_updated.php +++ b/mod/book/classes/event/chapter_updated.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * mod_book chapter updated event. + * The mod_book chapter updated event. * * @package mod_book * @copyright 2013 Frédéric Massart @@ -26,7 +26,7 @@ namespace mod_book\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_book chapter updated event class. + * The mod_book chapter updated event class. * * @package mod_book * @since Moodle 2.6 @@ -62,7 +62,8 @@ class chapter_updated extends \core\event\base { * @return string */ public function get_description() { - return "The chapter $this->objectid of the book " . $this->contextinstanceid . " has been updated."; + return "The chapter with the id '$this->objectid' of the book with the course module id '$this->contextinstanceid' + has been updated by the user with the id '$this->userid'."; } /** diff --git a/mod/book/classes/event/chapter_viewed.php b/mod/book/classes/event/chapter_viewed.php index 007e5273ce5..41836562a65 100644 --- a/mod/book/classes/event/chapter_viewed.php +++ b/mod/book/classes/event/chapter_viewed.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * mod_book chapter viewed event. + * The mod_book chapter viewed event. * * @package mod_book * @copyright 2013 Frédéric Massart @@ -26,7 +26,7 @@ namespace mod_book\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_book chapter viewed event class. + * The mod_book chapter viewed event class. * * @package mod_book * @since Moodle 2.6 @@ -62,7 +62,8 @@ class chapter_viewed extends \core\event\base { * @return string */ public function get_description() { - return "The user $this->userid has viewed the chapter $this->objectid of book module $this->contextinstanceid"; + return "The chapter with the id '$this->objectid' of the book with the course module id '$this->contextinstanceid' + has been viewed by the user with the id '$this->userid'."; } /** diff --git a/mod/book/classes/event/course_module_instance_list_viewed.php b/mod/book/classes/event/course_module_instance_list_viewed.php index 2216d31806d..6199b4a749f 100644 --- a/mod/book/classes/event/course_module_instance_list_viewed.php +++ b/mod/book/classes/event/course_module_instance_list_viewed.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * mod_book course module instance list viewed event. + * The mod_book instance list viewed event. * * @package mod_book * @copyright 2013 Ankit Agarwal @@ -26,7 +26,7 @@ namespace mod_book\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_book course module instance list viewed event class. + * The mod_book instance list viewed event class. * * @package mod_book * @since Moodle 2.7 diff --git a/mod/book/classes/event/course_module_viewed.php b/mod/book/classes/event/course_module_viewed.php index af02c7c6dd0..d24eceb3575 100644 --- a/mod/book/classes/event/course_module_viewed.php +++ b/mod/book/classes/event/course_module_viewed.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * mod_book course module viewed event. + * The mod_book course module viewed event. * * @package mod_book * @copyright 2013 Frédéric Massart @@ -26,7 +26,7 @@ namespace mod_book\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_book course module viewed event class. + * The mod_book course module viewed event class. * * @package mod_book * @since Moodle 2.6 diff --git a/mod/book/tool/exportimscp/classes/event/book_exported.php b/mod/book/tool/exportimscp/classes/event/book_exported.php index a40a21113b8..acd43a09d58 100644 --- a/mod/book/tool/exportimscp/classes/event/book_exported.php +++ b/mod/book/tool/exportimscp/classes/event/book_exported.php @@ -60,7 +60,7 @@ class book_exported extends \core\event\base { * @return string */ public function get_description() { - return "The user $this->userid has exported the book $this->objectid."; + return "The user with the id '$this->userid' has exported the book with the course module id '$this->contextinstanceid'."; } /** @@ -88,7 +88,7 @@ class book_exported extends \core\event\base { * @return \moodle_url */ public function get_url() { - return new \moodle_url('/mod/book/view.php', array('id' => $this->contextinstanceid)); + return new \moodle_url('/mod/book/tool/exportimscp/index.php', array('id' => $this->contextinstanceid)); } /** diff --git a/mod/book/tool/print/classes/event/book_printed.php b/mod/book/tool/print/classes/event/book_printed.php index 0d680618966..8a5115e2e55 100644 --- a/mod/book/tool/print/classes/event/book_printed.php +++ b/mod/book/tool/print/classes/event/book_printed.php @@ -60,7 +60,7 @@ class book_printed extends \core\event\base { * @return string */ public function get_description() { - return "The user $this->userid has printed the book $this->objectid."; + return "The user with the id '$this->userid' has printed the book with the course module id '$this->contextinstanceid'."; } /** diff --git a/mod/book/tool/print/classes/event/chapter_printed.php b/mod/book/tool/print/classes/event/chapter_printed.php index fa8e86f3f9c..e4ff8990c47 100644 --- a/mod/book/tool/print/classes/event/chapter_printed.php +++ b/mod/book/tool/print/classes/event/chapter_printed.php @@ -62,8 +62,8 @@ class chapter_printed extends \core\event\base { * @return string */ public function get_description() { - return "The user " . $this->userid . " has printed the chapter $this->objectid of the book module " . - $this->contextinstanceid; + return "The user with the id '$this->userid' has printed the chapter with the id '$this->objectid' of the book with the + course module id '$this->contextinstanceid'."; } /** diff --git a/mod/chat/classes/event/course_module_instance_list_viewed.php b/mod/chat/classes/event/course_module_instance_list_viewed.php index ff189124124..b3df3382205 100644 --- a/mod/chat/classes/event/course_module_instance_list_viewed.php +++ b/mod/chat/classes/event/course_module_instance_list_viewed.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * mod_chat course module instance list viewed event. + * The mod_chat instance list viewed event. * * @package mod_chat * @copyright 2013 onwards Ankit Agarwal @@ -26,7 +26,7 @@ namespace mod_chat\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_chat course module instance list viewed event class. + * The mod_chat instance list viewed event class. * * @package mod_chat * @since Moodle 2.7 diff --git a/mod/chat/classes/event/course_module_viewed.php b/mod/chat/classes/event/course_module_viewed.php index 419f440cc7e..21fc8f8bac7 100644 --- a/mod/chat/classes/event/course_module_viewed.php +++ b/mod/chat/classes/event/course_module_viewed.php @@ -15,10 +15,9 @@ // along with Moodle. If not, see . /** - * Chat main page viewed event. + * The mod_chat course module viewed event. * * @package mod_chat - * @since Moodle 2.7 * @copyright 2014 Petr Skoda * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -28,7 +27,7 @@ namespace mod_chat\event; defined('MOODLE_INTERNAL') || die(); /** - * Chat main page viewed event. + * The mod_chat course module viewed event class. * * @package mod_chat * @since Moodle 2.7 diff --git a/mod/chat/classes/event/message_sent.php b/mod/chat/classes/event/message_sent.php index 3f4b5db15d2..943af0448bd 100644 --- a/mod/chat/classes/event/message_sent.php +++ b/mod/chat/classes/event/message_sent.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * mod_chat message sent event. + * The mod_chat message sent event. * * @package mod_chat * @copyright 2013 Frédéric Massart @@ -26,7 +26,7 @@ namespace mod_chat\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_chat message sent event class. + * The mod_chat message sent event class. * * @package mod_chat * @since Moodle 2.6 @@ -41,7 +41,8 @@ class message_sent extends \core\event\base { * @return string */ public function get_description() { - return "The user $this->relateduserid has sent a message in a chat."; + return "The user with the id '$this->relateduserid' has sent a message in the chat with the course module id + '$this->contextinstanceid'."; } /** @@ -87,12 +88,13 @@ class message_sent extends \core\event\base { /** * Custom validation. * + * @throws \coding_exception * @return void */ 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.'); } } diff --git a/mod/chat/classes/event/sessions_viewed.php b/mod/chat/classes/event/sessions_viewed.php index 620d23e5da7..5a4d3b9b006 100644 --- a/mod/chat/classes/event/sessions_viewed.php +++ b/mod/chat/classes/event/sessions_viewed.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * mod_chat sessions viewed event. + * The mod_chat sessions viewed event. * * @package mod_chat * @copyright 2013 Frédéric Massart @@ -26,11 +26,14 @@ namespace mod_chat\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_chat sessions viewed event class. + * The mod_chat sessions viewed event class. * - * @property-read array $other Extra information about the event. - * -int start: start of period. - * -int end: end of period. + * @property-read array $other { + * Extra information about the event. + * + * - int start: start of period. + * - int end: end of period. + * } * * @package mod_chat * @since Moodle 2.6 @@ -45,7 +48,8 @@ class sessions_viewed extends \core\event\base { * @return string */ public function get_description() { - return "The user {$this->userid} has viewed the sessions of the chat {$this->objectid}."; + return "The user with the id '$this->userid' has viewed the sessions of the chat with the course module id + '$this->contextinstanceid'."; } /** @@ -95,11 +99,11 @@ class sessions_viewed extends \core\event\base { */ protected function validate_data() { parent::validate_data(); - if (!isset($this->data['other']['start'])) { - throw new \coding_exception('The property start must be set in other.'); + if (!isset($this->other['start'])) { + throw new \coding_exception('The \'start\' value must be set in other.'); } - if (!isset($this->data['other']['end'])) { - throw new \coding_exception('The property end must be set in other.'); + if (!isset($this->other['end'])) { + throw new \coding_exception('The \'end\' value must be set in other.'); } } diff --git a/mod/choice/classes/event/answer_submitted.php b/mod/choice/classes/event/answer_submitted.php index 1016c8c2aec..a40f38dafeb 100644 --- a/mod/choice/classes/event/answer_submitted.php +++ b/mod/choice/classes/event/answer_submitted.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * mod_choice answer submitted event. + * The mod_choice answer submitted event. * * @package mod_choice * @copyright 2013 Adrian Greeve @@ -27,13 +27,13 @@ namespace mod_choice\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_choice answer submitted event class. + * The mod_choice answer submitted event class. * * @property-read array $other { * Extra information about event. * - * @type int choiceid id of choice. - * @type int optionid id of option + * - int choiceid: id of choice. + * - int optionid: id of option. * } * * @package mod_choice @@ -49,7 +49,8 @@ class answer_submitted extends \core\event\base { * @return string */ public function get_description() { - return "User {$this->userid} has made their choice {$this->objectid} in {$this->other['choiceid']}."; + return "The user with the id '$this->userid' made the choice with the id '$this->objectid' in the choice activity + with the course module id '$this->contextinstanceid'."; } /** @@ -105,8 +106,9 @@ class answer_submitted extends \core\event\base { */ protected function validate_data() { parent::validate_data(); + if (!isset($this->other['choiceid'])) { - throw new \coding_exception('choiceid must be set in $other.'); + throw new \coding_exception('The \'choiceid\' value must be set in other.'); } } } diff --git a/mod/choice/classes/event/answer_updated.php b/mod/choice/classes/event/answer_updated.php index dd8bc5fb259..ca6434a289f 100644 --- a/mod/choice/classes/event/answer_updated.php +++ b/mod/choice/classes/event/answer_updated.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * mod_choice answer updated event. + * The mod_choice answer updated event. * * @package mod_choice * @copyright 2013 Adrian Greeve @@ -27,13 +27,13 @@ namespace mod_choice\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_choice answer updated event class. + * The mod_choice answer updated event class. * * @property-read array $other { * Extra information about event. * - * @type int choiceid id of choice. - * @type int optionid id of option + * - int choiceid: id of choice. + * - int optionid: id of option. * } * * @package mod_choice @@ -49,7 +49,8 @@ class answer_updated extends \core\event\base { * @return string */ public function get_description() { - return "User {$this->userid} has updated their choice {$this->objectid} in {$this->other['choiceid']}."; + return "The user with the id '$this->userid' updated their choice with the id '$this->objectid' in the choice activity + with the course module id '$this->contextinstanceid'."; } /** @@ -105,8 +106,9 @@ class answer_updated extends \core\event\base { */ protected function validate_data() { parent::validate_data(); + if (!isset($this->other['choiceid'])) { - throw new \coding_exception('choiceid must be set in $other.'); + throw new \coding_exception('The \'choiceid\' value must be set in other.'); } } } diff --git a/mod/choice/classes/event/course_module_instance_list_viewed.php b/mod/choice/classes/event/course_module_instance_list_viewed.php index c3cb1e23eb3..b0562487067 100644 --- a/mod/choice/classes/event/course_module_instance_list_viewed.php +++ b/mod/choice/classes/event/course_module_instance_list_viewed.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * mod_choice course module instance list viewed event. + * The mod_choice instance list viewed event. * * @package mod_choice * @copyright 2013 Ankit Agarwal @@ -26,7 +26,7 @@ namespace mod_choice\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_choice course module instance list event class. + * The mod_choice instance list viewed event class. * * @package mod_choice * @since Moodle 2.7 diff --git a/mod/choice/classes/event/course_module_viewed.php b/mod/choice/classes/event/course_module_viewed.php index 4865ddb351e..5069a89e583 100644 --- a/mod/choice/classes/event/course_module_viewed.php +++ b/mod/choice/classes/event/course_module_viewed.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * This file contains an event for when a choice activity is viewed. + * The mod_choice course module viewed event. * * @package mod_choice * @copyright 2013 Adrian Greeve @@ -26,12 +26,12 @@ namespace mod_choice\event; defined('MOODLE_INTERNAL') || die(); /** - * Event for when a choice activity is viewed. + * The mod_choice course module viewed event class. * * @package mod_choice * @since Moodle 2.6 - * @copyright 2013 Adrian Greeve - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @copyright 2013 Adrian Greeve + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class course_module_viewed extends \core\event\course_module_viewed { diff --git a/mod/choice/classes/event/report_viewed.php b/mod/choice/classes/event/report_viewed.php index bf312b3b14d..efa3566dc3d 100644 --- a/mod/choice/classes/event/report_viewed.php +++ b/mod/choice/classes/event/report_viewed.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * This file contains an event for when a choice activity report is viewed. + * The mod_choice report viewed event. * * @package mod_choice * @copyright 2013 Adrian Greeve @@ -26,12 +26,12 @@ namespace mod_choice\event; defined('MOODLE_INTERNAL') || die(); /** - * Event for when a choice activity report is viewed. + * The mod_choice report viewed event class. * * @package mod_choice * @since Moodle 2.6 - * @copyright 2013 Adrian Greeve - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @copyright 2013 Adrian Greeve + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class report_viewed extends \core\event\base { @@ -59,7 +59,8 @@ class report_viewed extends \core\event\base { * @return string */ public function get_description() { - return "The user with id $this->userid has viewed report for choice with instanceid $this->objectid"; + return "The user with id '$this->userid' has viewed the report for the choice activity with the course module id + '$this->contextinstanceid'"; } /** diff --git a/mod/data/classes/event/comment_created.php b/mod/data/classes/event/comment_created.php index 859f3cb5c86..d7a40637fed 100644 --- a/mod/data/classes/event/comment_created.php +++ b/mod/data/classes/event/comment_created.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * mod_data comment created event. + * The mod_data comment created event. * * @package mod_data * @copyright 2013 Rajesh Taneja @@ -26,7 +26,7 @@ namespace mod_data\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_data comment created event. + * The mod_data comment created event class. * * @package mod_data * @since Moodle 2.7 @@ -49,6 +49,7 @@ class comment_created extends \core\event\comment_created { * @return string */ public function get_description() { - return 'User with id ' . $this->userid . ' added comment for database activity with id ' . $this->other['itemid']; + return "The user with the id '$this->userid' added the comment with the id '$this->objectid' to the database activity with " . + "the course module id '$this->contextinstanceid'."; } } diff --git a/mod/data/classes/event/comment_deleted.php b/mod/data/classes/event/comment_deleted.php index 73e978ce997..c1eb8fa41f4 100644 --- a/mod/data/classes/event/comment_deleted.php +++ b/mod/data/classes/event/comment_deleted.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * mod_data comment deleted event. + * The mod_data comment deleted event. * * @package mod_data * @copyright 2013 Rajesh Taneja @@ -26,7 +26,7 @@ namespace mod_data\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_data comment deleted event. + * The mod_data comment deleted event class. * * @package mod_data * @since Moodle 2.7 @@ -49,6 +49,7 @@ class comment_deleted extends \core\event\comment_deleted { * @return string */ public function get_description() { - return 'User with id ' . $this->userid . ' deleted comment for database activity with id ' . $this->other['itemid']; + return "The user with the id '$this->userid' deleted the comment with the id '$this->objectid' from the database activity with " . + "the course module id '$this->contextinstanceid'."; } } diff --git a/mod/data/classes/event/course_module_instance_list_viewed.php b/mod/data/classes/event/course_module_instance_list_viewed.php index 9cc3e4f8747..1929b2f7446 100644 --- a/mod/data/classes/event/course_module_instance_list_viewed.php +++ b/mod/data/classes/event/course_module_instance_list_viewed.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * The mod_data course module instance list viewed event. + * The mod_data instance list viewed event. * * @package mod_data * @since Moodle 2.7 @@ -27,6 +27,14 @@ namespace mod_data\event; defined('MOODLE_INTERNAL') || die(); +/** + * The mod_data instance list viewed event class. + * + * @package mod_data + * @since Moodle 2.7 + * @copyright 2014 Mark Nelson + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class course_module_instance_list_viewed extends \core\event\course_module_instance_list_viewed { // No code required here as the parent class handles it all. } diff --git a/mod/data/classes/event/course_module_viewed.php b/mod/data/classes/event/course_module_viewed.php index a5ff9fc4f9d..a3feffaa032 100644 --- a/mod/data/classes/event/course_module_viewed.php +++ b/mod/data/classes/event/course_module_viewed.php @@ -27,6 +27,14 @@ namespace mod_data\event; defined('MOODLE_INTERNAL') || die(); +/** + * The mod_data course module viewed event class. + * + * @package mod_data + * @since Moodle 2.7 + * @copyright 2014 Mark Nelson + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class course_module_viewed extends \core\event\course_module_viewed { /** diff --git a/mod/data/classes/event/field_created.php b/mod/data/classes/event/field_created.php index ea1f7becf66..0b69a82cd8c 100644 --- a/mod/data/classes/event/field_created.php +++ b/mod/data/classes/event/field_created.php @@ -17,13 +17,6 @@ /** * The mod_data field created event. * - * @property-read array $other { - * Extra information about event. - * - * @type string fieldname the name of the field. - * @type int dataid the id of the data activity. - * } - * * @package mod_data * @since Moodle 2.7 * @copyright 2014 Mark Nelson @@ -34,6 +27,21 @@ namespace mod_data\event; defined('MOODLE_INTERNAL') || die(); +/** + * The mod_data field created event class. + * + * @property-read array $other { + * Extra information about event. + * + * - string fieldname: the name of the field. + * - int dataid: the id of the data activity. + * } + * + * @package mod_data + * @since Moodle 2.7 + * @copyright 2014 Mark Nelson + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class field_created extends \core\event\base { /** @@ -62,7 +70,8 @@ class field_created extends \core\event\base { * @return string */ public function get_description() { - return 'The field ' . $this->objectid . ' belonging to the data activity ' . $this->other['dataid'] . ' has been created.'; + return "The user with the id '$this->userid' created the field with the id '$this->objectid' for the data activity " . + "with the course module id '$this->contextinstanceid'."; } /** @@ -94,11 +103,11 @@ class field_created extends \core\event\base { parent::validate_data(); if (!isset($this->other['fieldname'])) { - throw new \coding_exception('The fieldname must be set in $other.'); + throw new \coding_exception('The \'fieldname\' value must be set in other.'); } if (!isset($this->other['dataid'])) { - throw new \coding_exception('The dataid must be set in $other.'); + throw new \coding_exception('The \'dataid\' value must be set in other.'); } } } diff --git a/mod/data/classes/event/field_deleted.php b/mod/data/classes/event/field_deleted.php index 8472a815737..1d753c523a1 100644 --- a/mod/data/classes/event/field_deleted.php +++ b/mod/data/classes/event/field_deleted.php @@ -17,15 +17,7 @@ /** * The mod_data field deleted event. * - * @property-read array $other { - * Extra information about event. - * - * @type string fieldname the name of the field. - * @type int dataid the id of the data activity. - * } - * * @package mod_data - * @since Moodle 2.7 * @copyright 2014 Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -34,6 +26,21 @@ namespace mod_data\event; defined('MOODLE_INTERNAL') || die(); +/** + * The mod_data field deleted event class. + * + * @property-read array $other { + * Extra information about event. + * + * - string fieldname: the name of the field. + * - int dataid: the id of the data activity. + * } + * + * @package mod_data + * @since Moodle 2.7 + * @copyright 2014 Mark Nelson + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class field_deleted extends \core\event\base { /** @@ -62,7 +69,8 @@ class field_deleted extends \core\event\base { * @return string */ public function get_description() { - return 'The field ' . $this->objectid . ' belonging to the data activity ' . $this->other['dataid'] . ' has been deleted.'; + return "The user with the id '$this->userid' deleted the field with the id '$this->objectid' in the data activity " . + "with the course module id '$this->contextinstanceid'."; } /** @@ -94,11 +102,11 @@ class field_deleted extends \core\event\base { parent::validate_data(); if (!isset($this->other['fieldname'])) { - throw new \coding_exception('The fieldname must be set in $other.'); + throw new \coding_exception('The \'fieldname\' value must be set in other.'); } if (!isset($this->other['dataid'])) { - throw new \coding_exception('The dataid must be set in $other.'); + throw new \coding_exception('The \'dataid\' value must be set in other.'); } } } diff --git a/mod/data/classes/event/field_updated.php b/mod/data/classes/event/field_updated.php index eb6283bd422..ae5d71bfe76 100644 --- a/mod/data/classes/event/field_updated.php +++ b/mod/data/classes/event/field_updated.php @@ -17,15 +17,7 @@ /** * The mod_data field updated event. * - * @property-read array $other { - * Extra information about event. - * - * @type string fieldname the name of the field. - * @type int dataid the id of the data activity. - * } - * * @package mod_data - * @since Moodle 2.7 * @copyright 2014 Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -34,6 +26,21 @@ namespace mod_data\event; defined('MOODLE_INTERNAL') || die(); +/** + * The mod_data field updated event class. + * + * @property-read array $other { + * Extra information about event. + * + * - string fieldname: the name of the field. + * - int dataid: the id of the data activity. + * } + * + * @package mod_data + * @since Moodle 2.7 + * @copyright 2014 Mark Nelson + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class field_updated extends \core\event\base { /** @@ -62,7 +69,8 @@ class field_updated extends \core\event\base { * @return string */ public function get_description() { - return 'The field ' . $this->objectid . ' belonging to the data activity ' . $this->other['dataid'] . ' has been updated.'; + return "The user with the id '$this->userid' updated the field with the id '$this->objectid' in the data activity " . + "with the course module id '$this->contextinstanceid'."; } /** @@ -94,11 +102,11 @@ class field_updated extends \core\event\base { parent::validate_data(); if (!isset($this->other['fieldname'])) { - throw new \coding_exception('The fieldname must be set in $other.'); + throw new \coding_exception('The \'fieldname\' value must be set in other.'); } if (!isset($this->other['dataid'])) { - throw new \coding_exception('The dataid must be set in $other.'); + throw new \coding_exception('The \'dataid\' value must be set in other.'); } } } diff --git a/mod/data/classes/event/record_created.php b/mod/data/classes/event/record_created.php index b5feebe1623..c0f34673afe 100644 --- a/mod/data/classes/event/record_created.php +++ b/mod/data/classes/event/record_created.php @@ -15,16 +15,9 @@ // along with Moodle. If not, see . /** - * The mod_data data record created event. - * - * @property-read array $other { - * Extra information about event. - * - * @type int dataid the id of the data activity. - * } + * The mod_data record created event. * * @package mod_data - * @since Moodle 2.7 * @copyright 2014 Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -33,6 +26,20 @@ namespace mod_data\event; defined('MOODLE_INTERNAL') || die(); +/** + * The mod_data record created event class. + * + * @property-read array $other { + * Extra information about event. + * + * - int dataid: the id of the data activity. + * } + * + * @package mod_data + * @since Moodle 2.7 + * @copyright 2014 Mark Nelson + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class record_created extends \core\event\base { /** @@ -61,8 +68,8 @@ class record_created extends \core\event\base { * @return string */ public function get_description() { - return 'The data record ' . $this->objectid . ' belonging to the database activity ' . $this->other['dataid'] . - ' was created by the user ' . $this->userid; + return "The user with the id '$this->userid' created the data record the id '$this->objectid' for the data activity " . + "with the course module id '$this->contextinstanceid'."; } /** @@ -94,7 +101,7 @@ class record_created extends \core\event\base { parent::validate_data(); if (!isset($this->other['dataid'])) { - throw new \coding_exception('The dataid must be set in $other.'); + throw new \coding_exception('The \'dataid\' value must be set in other.'); } } } diff --git a/mod/data/classes/event/record_deleted.php b/mod/data/classes/event/record_deleted.php index d2ed28db164..a56c34e896e 100644 --- a/mod/data/classes/event/record_deleted.php +++ b/mod/data/classes/event/record_deleted.php @@ -17,14 +17,7 @@ /** * The mod_data record deleted event. * - * @property-read array $other { - * Extra information about event. - * - * @type int dataid the id of the data activity. - * } - * * @package mod_data - * @since Moodle 2.7 * @copyright 2014 Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -33,6 +26,20 @@ namespace mod_data\event; defined('MOODLE_INTERNAL') || die(); +/** + * The mod_data record deleted event class. + * + * @property-read array $other { + * Extra information about event. + * + * - int dataid: the id of the data activity. + * } + * + * @package mod_data + * @since Moodle 2.7 + * @copyright 2014 Mark Nelson + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class record_deleted extends \core\event\base { /** @@ -61,8 +68,8 @@ class record_deleted extends \core\event\base { * @return string */ public function get_description() { - return 'The data record ' . $this->objectid . ' belonging to the database activity ' . $this->other['dataid'] . - ' was deleted by the user ' . $this->userid; + return "The user with the id '$this->userid' deleted the data record the id '$this->objectid' in the data activity " . + "with the course module id '$this->contextinstanceid'."; } /** @@ -94,7 +101,7 @@ class record_deleted extends \core\event\base { parent::validate_data(); if (!isset($this->other['dataid'])) { - throw new \coding_exception('The dataid must be set in $other.'); + throw new \coding_exception('The \'dataid\' value must be set in other.'); } } } diff --git a/mod/data/classes/event/record_updated.php b/mod/data/classes/event/record_updated.php index 26f30496014..296cce2474a 100644 --- a/mod/data/classes/event/record_updated.php +++ b/mod/data/classes/event/record_updated.php @@ -17,14 +17,7 @@ /** * The mod_data record updated event. * - * @property-read array $other { - * Extra information about event. - * - * @type int dataid the id of the data activity. - * } - * * @package mod_data - * @since Moodle 2.7 * @copyright 2014 Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -33,6 +26,20 @@ namespace mod_data\event; defined('MOODLE_INTERNAL') || die(); +/** + * The mod_data record updated event class. + * + * @property-read array $other { + * Extra information about event. + * + * - int dataid: the id of the data activity. + * } + * + * @package mod_data + * @since Moodle 2.7 + * @copyright 2014 Mark Nelson + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class record_updated extends \core\event\base { /** @@ -61,8 +68,8 @@ class record_updated extends \core\event\base { * @return string */ public function get_description() { - return 'The data record ' . $this->objectid . ' belonging to the database activity ' . $this->other['dataid'] . - ' was updated by the user ' . $this->userid; + return "The user with the id '$this->userid' updated the data record the id '$this->objectid' in the data activity " . + "with the course module id '$this->contextinstanceid'."; } /** @@ -94,7 +101,7 @@ class record_updated extends \core\event\base { parent::validate_data(); if (!isset($this->other['dataid'])) { - throw new \coding_exception('The dataid must be set in $other.'); + throw new \coding_exception('The \'dataid\' value must be set in other.'); } } } diff --git a/mod/data/classes/event/template_updated.php b/mod/data/classes/event/template_updated.php index 7f692918cb8..95915030060 100644 --- a/mod/data/classes/event/template_updated.php +++ b/mod/data/classes/event/template_updated.php @@ -17,14 +17,7 @@ /** * The mod_data template updated event. * - * @property-read array $other { - * Extra information about event. - * - * @type int dataid the id of the data activity. - * } - * * @package mod_data - * @since Moodle 2.7 * @copyright 2014 Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -33,6 +26,21 @@ namespace mod_data\event; defined('MOODLE_INTERNAL') || die(); +/** + * The mod_data template updated event class. + * + * @property-read array $other { + * Extra information about event. + * + * - int dataid: the id of the data activity. + * } + * + * @package mod_data + * @since Moodle 2.7 + * @copyright 2014 Mark Nelson + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + class template_updated extends \core\event\base { /** @@ -60,7 +68,8 @@ class template_updated extends \core\event\base { * @return string */ public function get_description() { - return 'The template for the database activity ' . $this->other['dataid'] . ' was updated by the user ' . $this->userid; + return "The user with the id '$this->userid' updated the template for the data activity with the course module " . + "id '$this->contextinstanceid'."; } /** @@ -92,7 +101,7 @@ class template_updated extends \core\event\base { parent::validate_data(); if (!isset($this->other['dataid'])) { - throw new \coding_exception('The dataid must be set in $other.'); + throw new \coding_exception('The \'dataid\' value must be set in other.'); } } } diff --git a/mod/data/classes/event/template_viewed.php b/mod/data/classes/event/template_viewed.php index 6bb4153fa06..f59c2d340aa 100644 --- a/mod/data/classes/event/template_viewed.php +++ b/mod/data/classes/event/template_viewed.php @@ -15,16 +15,9 @@ // along with Moodle. If not, see . /** - * The mod_data templates viewed event. - * - * @property-read array $other { - * Extra information about event. - * - * @type int dataid the id of the data activity. - * } + * The mod_data template viewed event. * * @package mod_data - * @since Moodle 2.7 * @copyright 2014 Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -33,6 +26,20 @@ namespace mod_data\event; defined('MOODLE_INTERNAL') || die(); +/** + * The mod_data template viewed event class. + * + * @property-read array $other { + * Extra information about event. + * + * - int dataid the id of the data activity. + * } + * + * @package mod_data + * @since Moodle 2.7 + * @copyright 2014 Mark Nelson + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class template_viewed extends \core\event\base { /** @@ -60,8 +67,8 @@ class template_viewed extends \core\event\base { * @return string */ public function get_description() { - return 'The template for the database activity with the id ' . $this->other['dataid'] . ' was viewed by the ' . - 'user with the id ' . $this->userid; + return "The user with the id '$this->userid' viewed the template for the data activity with the course module " . + "id '$this->contextinstanceid'."; } /** @@ -93,7 +100,7 @@ class template_viewed extends \core\event\base { parent::validate_data(); if (!isset($this->other['dataid'])) { - throw new \coding_exception('The dataid must be set in $other.'); + throw new \coding_exception('The \'dataid\' value must be set in other.'); } } } diff --git a/mod/feedback/classes/event/course_module_instance_list_viewed.php b/mod/feedback/classes/event/course_module_instance_list_viewed.php index adc4326a639..12e80b67d98 100644 --- a/mod/feedback/classes/event/course_module_instance_list_viewed.php +++ b/mod/feedback/classes/event/course_module_instance_list_viewed.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * mod_feedback course module instance list viewed event. + * The mod_feedback instance list viewed event. * * @package mod_feedback * @copyright 2013 Ankit Agarwal @@ -26,7 +26,7 @@ namespace mod_feedback\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_feedback course module instance list event class. + * The mod_feedback instance list viewed event class. * * @package mod_feedback * @since Moodle 2.7 diff --git a/mod/feedback/classes/event/course_module_viewed.php b/mod/feedback/classes/event/course_module_viewed.php index 9b56a7f7098..ad9585bc061 100644 --- a/mod/feedback/classes/event/course_module_viewed.php +++ b/mod/feedback/classes/event/course_module_viewed.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * This file contains an event for when a feedback activity is viewed. + * The mod_feedback course module viewed event. * * @package mod_feedback * @copyright 2013 Ankit Agarwal @@ -26,13 +26,12 @@ namespace mod_feedback\event; defined('MOODLE_INTERNAL') || die(); /** - * Event for when a feedback activity is viewed. + * The mod_feedback course module viewed event class. * * @property-read array $other { * Extra information about event. * - * @type int anonymous if feedback is anonymous. - * @type int cmid course module id. + * - int anonymous if feedback is anonymous. * } * * @package mod_feedback @@ -93,12 +92,11 @@ class course_module_viewed extends \core\event\course_module_viewed { * @throws \coding_exception in case of any problems. */ protected function validate_data() { - if (!isset($this->other['anonymous'])) { - throw new \coding_exception("Field other['anonymous'] cannot be empty"); - } - - // Call parent validations. parent::validate_data(); + + if (!isset($this->other['anonymous'])) { + throw new \coding_exception('The \'anonymous\' value must be set in other.'); + } } } diff --git a/mod/feedback/classes/event/response_deleted.php b/mod/feedback/classes/event/response_deleted.php index 33941558335..99012c97058 100644 --- a/mod/feedback/classes/event/response_deleted.php +++ b/mod/feedback/classes/event/response_deleted.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * Event to be triggered when a feedback response is deleted. + * The mod_feedback response deleted event. * * @package mod_feedback * @copyright 2013 Ankit Agarwal @@ -26,16 +26,16 @@ namespace mod_feedback\event; defined('MOODLE_INTERNAL') || die(); /** - * Class response_deleted + * The mod_feedback response deleted event class. * - * Class for event to be triggered when a feedback response is deleted. + * This event is triggered when a feedback response is deleted. * * @property-read array $other { * Extra information about event. * - * @type int anonymous if feedback is anonymous. - * @type int cmid course module id. - * @type int instanceid id of instance. + * - int anonymous: if feedback is anonymous. + * - int cmid: course module id. + * - int instanceid: id of instance. * } * * @package mod_feedback @@ -69,7 +69,8 @@ class response_deleted extends \core\event\base { * @return string */ public function get_description() { - return 'The feedback from user ' . $this->relateduserid . ' was deleted by' . $this->userid; + return "The user with the id '$this->userid' deleted the feedback for the user with the id '$this->relateduserid' " . + "for the feedback activity with the course module id '$this->contextinstanceid'."; } /** @@ -110,18 +111,17 @@ class response_deleted extends \core\event\base { * @throws \coding_exception in case of any problems. */ protected function validate_data() { + parent::validate_data(); + if (!isset($this->other['anonymous'])) { - throw new \coding_exception("Field other['anonymous'] cannot be empty"); + throw new \coding_exception('The \'anonymous\' value must be set in other.'); } if (!isset($this->other['cmid'])) { - throw new \coding_exception("Field other['cmid'] cannot be empty"); + throw new \coding_exception('The \'cmid\' 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.'); } - - // Call parent validations. - parent::validate_data(); } } diff --git a/mod/feedback/classes/event/response_submitted.php b/mod/feedback/classes/event/response_submitted.php index f0d74828ad0..6cd72c32d47 100644 --- a/mod/feedback/classes/event/response_submitted.php +++ b/mod/feedback/classes/event/response_submitted.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * Event to be triggered when a feedback response is submitted. + * The mod_feedback response submitted event. * * @package mod_feedback * @copyright 2013 Ankit Agarwal @@ -26,16 +26,16 @@ namespace mod_feedback\event; defined('MOODLE_INTERNAL') || die(); /** - * Class response_submitted + * The mod_feedback response submitted event class. * - * Class for event to be triggered when a feedback response is submitted. + * This event is triggered when a feedback response is submitted. * * @property-read array $other { * Extra information about event. * - * @type int anonymous if feedback is anonymous. - * @type int cmid course module id. - * @type int instanceid id of instance. + * - int anonymous: if feedback is anonymous. + * - int cmid: course module id. + * - int instanceid: id of instance. * } * * @package mod_feedback @@ -72,7 +72,8 @@ class response_submitted extends \core\event\base { * @return string */ public function get_description() { - return 'The user ' . $this->relateduserid . ' submited a feedback'; + return "The user with the id '$this->userid' created feedback for the user with the id '$this->relateduserid' " . + "for the feedback activity with the course module id '$this->contextinstanceid'."; } /** @@ -132,18 +133,17 @@ class response_submitted extends \core\event\base { * @throws \coding_exception in case of any problems. */ protected function validate_data() { + parent::validate_data(); + if (!isset($this->other['anonymous'])) { - throw new \coding_exception("Field other['anonymous'] cannot be empty"); + throw new \coding_exception('The \'anonymous\' value must be set in other.'); } if (!isset($this->other['cmid'])) { - throw new \coding_exception("Field other['cmid'] cannot be empty"); + throw new \coding_exception('The \'cmid\' 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.'); } - - // Call parent validations. - parent::validate_data(); } } diff --git a/mod/feedback/tests/events_test.php b/mod/feedback/tests/events_test.php index 5e198e1b2ac..300c2311188 100644 --- a/mod/feedback/tests/events_test.php +++ b/mod/feedback/tests/events_test.php @@ -189,7 +189,7 @@ class mod_feedback_events_testcase extends advanced_testcase { $this->fail("Event validation should not allow \\mod_feedback\\event\\response_deleted to be triggered without other['anonymous']"); } catch (coding_exception $e) { - $this->assertContains("Field other['anonymous'] cannot be empty", $e->getMessage()); + $this->assertContains("The 'anonymous' value must be set in other.", $e->getMessage()); } } @@ -295,7 +295,7 @@ class mod_feedback_events_testcase extends advanced_testcase { $this->fail("Event validation should not allow \\mod_feedback\\event\\response_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 cmid. @@ -309,7 +309,7 @@ class mod_feedback_events_testcase extends advanced_testcase { $this->fail("Event validation should not allow \\mod_feedback\\event\\response_deleted to be triggered without other['cmid']"); } catch (coding_exception $e) { - $this->assertContains("Field other['cmid'] cannot be empty", $e->getMessage()); + $this->assertContains("The 'cmid' value must be set in other.", $e->getMessage()); } // Test not setting anonymous. @@ -322,7 +322,7 @@ class mod_feedback_events_testcase extends advanced_testcase { $this->fail("Event validation should not allow \\mod_feedback\\event\\response_deleted to be triggered without other['anonymous']"); } catch (coding_exception $e) { - $this->assertContains("Field other['anonymous'] cannot be empty", $e->getMessage()); + $this->assertContains("The 'anonymous' value must be set in other.", $e->getMessage()); } } } diff --git a/mod/folder/classes/event/course_module_instance_list_viewed.php b/mod/folder/classes/event/course_module_instance_list_viewed.php index 6b25e6162a7..a50224bb9bb 100644 --- a/mod/folder/classes/event/course_module_instance_list_viewed.php +++ b/mod/folder/classes/event/course_module_instance_list_viewed.php @@ -18,7 +18,6 @@ * The mod_folder instance list viewed event. * * @package mod_folder - * @since Moodle 2.7 * @copyright 2013 Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -27,6 +26,14 @@ namespace mod_folder\event; defined('MOODLE_INTERNAL') || die(); +/** + * The mod_folder instance list viewed event class. + * + * @package mod_folder + * @since Moodle 2.7 + * @copyright 2013 Mark Nelson + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class course_module_instance_list_viewed extends \core\event\course_module_instance_list_viewed { // No code required here as the parent class handles it all. } diff --git a/mod/folder/classes/event/course_module_viewed.php b/mod/folder/classes/event/course_module_viewed.php index 8da69e35059..475c72fcd7e 100644 --- a/mod/folder/classes/event/course_module_viewed.php +++ b/mod/folder/classes/event/course_module_viewed.php @@ -18,7 +18,6 @@ * The mod_folder course module viewed event. * * @package mod_folder - * @since Moodle 2.7 * @copyright 2013 Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -27,6 +26,14 @@ namespace mod_folder\event; defined('MOODLE_INTERNAL') || die(); +/** + * The mod_folder course module viewed event class. + * + * @package mod_folder + * @since Moodle 2.7 + * @copyright 2013 Mark Nelson + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class course_module_viewed extends \core\event\course_module_viewed { /** diff --git a/mod/folder/classes/event/folder_updated.php b/mod/folder/classes/event/folder_updated.php index 90a99d20f02..c34e4d1bef9 100644 --- a/mod/folder/classes/event/folder_updated.php +++ b/mod/folder/classes/event/folder_updated.php @@ -18,7 +18,6 @@ * The mod_folder folder updated event. * * @package mod_folder - * @since Moodle 2.7 * @copyright 2013 Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -27,6 +26,14 @@ namespace mod_folder\event; defined('MOODLE_INTERNAL') || die(); +/** + * The mod_folder folder updated event class. + * + * @package mod_folder + * @since Moodle 2.7 + * @copyright 2013 Mark Nelson + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class folder_updated extends \core\event\base { /** @@ -53,7 +60,7 @@ class folder_updated extends \core\event\base { * @return string */ public function get_description() { - return 'User with id ' . $this->userid . ' updated the folder activity with instance id ' . $this->objectid; + return "The user with the id '$this->userid' updated the folder activity with course module id '$this->contextinstanceid'."; } /** diff --git a/mod/forum/classes/event/assessable_uploaded.php b/mod/forum/classes/event/assessable_uploaded.php index bab3c6de338..6a9d37a8ce0 100644 --- a/mod/forum/classes/event/assessable_uploaded.php +++ b/mod/forum/classes/event/assessable_uploaded.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * mod_forum assessable uploaded event. + * The mod_forum assessable uploaded event. * * @package mod_forum * @copyright 2013 Frédéric Massart @@ -27,15 +27,13 @@ namespace mod_forum\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_forum assessable uploaded event class. + * The mod_forum assessable uploaded event class. * * @property-read array $other { * Extra information about event. * - * @type array pathnamehashes uploaded files path name hashes. - * @type string content post discussion message. - * @type int discussionid id of discussion. - * @type string triggeredfrom name of the function from where event is triggred. + * - int discussionid: id of discussion. + * - string triggeredfrom: name of the function from where event was triggered. * } * * @package mod_forum @@ -51,7 +49,9 @@ class assessable_uploaded extends \core\event\assessable_uploaded { * @return string */ public function get_description() { - return "User {$this->userid} has posted some content in the forum post {$this->objectid}."; + return "The user with the id '$this->userid' has posted content in the forum post with the id '$this->objectid' " . + "in the discussion '{$this->other['discussionid']}' located in the forum with the course module id " . + "'$this->contextinstanceid'."; } /** @@ -119,10 +119,11 @@ class assessable_uploaded extends \core\event\assessable_uploaded { */ protected function validate_data() { parent::validate_data(); + if (!isset($this->other['discussionid'])) { - throw new \coding_exception('discussionid must be set in $other.'); + throw new \coding_exception('The \'discussionid\' value must be set in other.'); } else if (!isset($this->other['triggeredfrom'])) { - throw new \coding_exception('triggeredfrom must be set in $other'); + throw new \coding_exception('The \'triggeredfrom\' value must be set in other.'); } } } diff --git a/mod/forum/classes/event/course_module_instance_list_viewed.php b/mod/forum/classes/event/course_module_instance_list_viewed.php index 8d9c33d2569..5283b51fd9c 100644 --- a/mod/forum/classes/event/course_module_instance_list_viewed.php +++ b/mod/forum/classes/event/course_module_instance_list_viewed.php @@ -27,7 +27,7 @@ namespace mod_forum\event; defined('MOODLE_INTERNAL') || die(); /** - * The mod_forum instance list viewed event. + * The mod_forum instance list viewed event class. * * @package mod_forum * @since Moodle 2.7 diff --git a/mod/forum/classes/event/course_module_viewed.php b/mod/forum/classes/event/course_module_viewed.php index 820df5d5d32..8621898cc83 100644 --- a/mod/forum/classes/event/course_module_viewed.php +++ b/mod/forum/classes/event/course_module_viewed.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * The mod_forum forum viewed event. + * The mod_forum course module viewed event. * * @package mod_forum * @copyright 2014 Dan Poltawski @@ -27,7 +27,7 @@ namespace mod_forum\event; defined('MOODLE_INTERNAL') || die(); /** - * The mod_forum forum viewed event. + * The mod_forum course module viewed event class. * * @package mod_forum * @since Moodle 2.7 diff --git a/mod/forum/classes/event/course_searched.php b/mod/forum/classes/event/course_searched.php index 0d3193d5159..436fadd353f 100644 --- a/mod/forum/classes/event/course_searched.php +++ b/mod/forum/classes/event/course_searched.php @@ -27,10 +27,13 @@ namespace mod_forum\event; defined('MOODLE_INTERNAL') || die(); /** - * The mod_forum course searched event. + * The mod_forum course searched event class. * - * @property-read array $other Extra information about the event. - * -string searchterm: The searchterm used on forum search + * @property-read array $other { + * Extra information about the event. + * + * - string searchterm: The searchterm used on forum search. + * } * * @package mod_forum * @since Moodle 2.7 @@ -56,8 +59,8 @@ class course_searched extends \core\event\base { */ public function get_description() { $searchterm = s($this->other['searchterm']); - return "The user {$this->userid} has searched the course {$this->courseid} for ". - "forum posts containing '{$searchterm}''"; + return "The user with the id '$this->userid' has searched the course with the id '$this->courseid' for forum posts " . + "containing \"{$searchterm}\"."; } /** @@ -100,11 +103,11 @@ class course_searched extends \core\event\base { protected function validate_data() { parent::validate_data(); if (!isset($this->other['searchterm'])) { - throw new \coding_exception('searchterm must be set in $other.'); + throw new \coding_exception('The \'searchterm\' value must be set in other.'); } if ($this->contextlevel != CONTEXT_COURSE) { - throw new \coding_exception('Context passed must be course.'); + throw new \coding_exception('Context level must be CONTEXT_COURSE.'); } } diff --git a/mod/forum/classes/event/discussion_created.php b/mod/forum/classes/event/discussion_created.php index 6123ca1d128..e4c1c042892 100644 --- a/mod/forum/classes/event/discussion_created.php +++ b/mod/forum/classes/event/discussion_created.php @@ -27,10 +27,13 @@ namespace mod_forum\event; defined('MOODLE_INTERNAL') || die(); /** - * The mod_forum discussion created event. + * The mod_forum discussion created event class. * - * @property-read array $other Extra information about the event. - * -int forumid: The id of the forum the discussion is in + * @property-read array $other { + * Extra information about the event. + * + * - int forumid: The id of the forum the discussion is in. + * } * * @package mod_forum * @since Moodle 2.7 @@ -55,7 +58,8 @@ class discussion_created extends \core\event\base { * @return string */ public function get_description() { - return "The user {$this->userid} has created a discussion in the forum {$this->other['forumid']}"; + return "The user with the id '$this->userid' has created the discussion with the id '$this->objectid' in the forum " . + "with the course module id '$this->contextinstanceid'."; } /** @@ -98,15 +102,11 @@ class discussion_created extends \core\event\base { protected function validate_data() { parent::validate_data(); if (!isset($this->other['forumid'])) { - throw new \coding_exception('forumid must be set in $other.'); + throw new \coding_exception('The \'forumid\' value must be set in other.'); } if ($this->contextlevel != CONTEXT_MODULE) { - throw new \coding_exception('Context passed must be module context.'); - } - - if (!isset($this->objectid)) { - throw new \coding_exception('objectid must be set to the discussionid.'); + throw new \coding_exception('Context level must be CONTEXT_MODULE.'); } } } diff --git a/mod/forum/classes/event/discussion_deleted.php b/mod/forum/classes/event/discussion_deleted.php index c2435ea8f03..101e6dffc91 100644 --- a/mod/forum/classes/event/discussion_deleted.php +++ b/mod/forum/classes/event/discussion_deleted.php @@ -27,10 +27,13 @@ namespace mod_forum\event; defined('MOODLE_INTERNAL') || die(); /** - * The mod_forum discussion deleted event. + * The mod_forum discussion deleted event class. * - * @property-read array $other Extra information about the event. - * -int forumid: The id of the forum the discussion is in + * @property-read array $other { + * Extra information about the event. + * + * - int forumid: The id of the forum the discussion is in. + * } * * @package mod_forum * @since Moodle 2.7 @@ -56,8 +59,8 @@ class discussion_deleted extends \core\event\base { * @return string */ public function get_description() { - return "The user {$this->userid} has deleted the forum discussion {$this->objectid} ". - "in forum {$this->other['forumid']}"; + return "The user with the id '$this->userid' has deleted the discussion with the id '$this->objectid' in the forum " . + "with the course module id '$this->contextinstanceid'."; } /** @@ -97,15 +100,11 @@ class discussion_deleted extends \core\event\base { protected function validate_data() { parent::validate_data(); if (!isset($this->other['forumid'])) { - throw new \coding_exception('forumid must be set in $other.'); + throw new \coding_exception('The \'forumid\' value must be set in other.'); } if ($this->contextlevel != CONTEXT_MODULE) { - throw new \coding_exception('Context passed must be module context.'); - } - - if (!isset($this->objectid)) { - throw new \coding_exception('objectid must be set to the discussionid.'); + throw new \coding_exception('Context level must be CONTEXT_MODULE.'); } } } diff --git a/mod/forum/classes/event/discussion_moved.php b/mod/forum/classes/event/discussion_moved.php index 1a68c2b9639..65b9a6a66d8 100644 --- a/mod/forum/classes/event/discussion_moved.php +++ b/mod/forum/classes/event/discussion_moved.php @@ -27,11 +27,14 @@ namespace mod_forum\event; defined('MOODLE_INTERNAL') || die(); /** - * The mod_forum discussion moved event. + * The mod_forum discussion moved event class. * - * @property-read array $other Extra information about the event. - * - int fromforumid: The id of the forum the discussion is being moved from - * - int toforumid: The id of the forum the discussion is being moved to + * @property-read array $other { + * Extra information about the event. + * + * - int fromforumid: The id of the forum the discussion is being moved from. + * - int toforumid: The id of the forum the discussion is being moved to. + * } * * @package mod_forum * @since Moodle 2.7 @@ -56,8 +59,8 @@ class discussion_moved extends \core\event\base { * @return string */ public function get_description() { - return "The user {$this->userid} has moved the forum discussion {$this->objectid} ". - "from forum {$this->other['fromforumid']} to forum {$this->other['toforumid']}"; + return "The user with the id '$this->userid' has moved the discussion with the id '$this->objectid' from the " . + "forum with the id '{$this->other['fromforumid']}' to the forum with the id '{$this->other['toforumid']}'."; } /** @@ -97,19 +100,15 @@ class discussion_moved extends \core\event\base { protected function validate_data() { parent::validate_data(); if (!isset($this->other['fromforumid'])) { - throw new \coding_exception('fromforumid must be set in $other.'); + throw new \coding_exception('The \'fromforumid\' value must be set in other.'); } if (!isset($this->other['toforumid'])) { - throw new \coding_exception('toforumid must be set in $other.'); + throw new \coding_exception('The \'toforumid\' value must be set in other.'); } if ($this->contextlevel != CONTEXT_MODULE) { - throw new \coding_exception('Context passed must be module context.'); - } - - if (!isset($this->objectid)) { - throw new \coding_exception('objectid must be set to the discussionid.'); + throw new \coding_exception('Context level must be CONTEXT_MODULE.'); } } } diff --git a/mod/forum/classes/event/discussion_updated.php b/mod/forum/classes/event/discussion_updated.php index 473fb82de3d..cc77fc1fb4c 100644 --- a/mod/forum/classes/event/discussion_updated.php +++ b/mod/forum/classes/event/discussion_updated.php @@ -27,10 +27,13 @@ namespace mod_forum\event; defined('MOODLE_INTERNAL') || die(); /** - * The mod_forum discussion updated event. + * The mod_forum discussion updated event class. * - * @property-read array $other Extra information about the event. - * -int forumid: The id of the forum the discussion is in + * @property-read array $other { + * Extra information about the event. + * + * - int forumid: The id of the forum the discussion is in + * } * * @package mod_forum * @since Moodle 2.7 @@ -55,7 +58,8 @@ class discussion_updated extends \core\event\base { * @return string */ public function get_description() { - return "The user {$this->userid} has updated the discussion {$this->objectid}."; + return "The user with the id '$this->userid' has updated the discussion with the id '$this->objectid' in the forum " . + "with the course module id '$this->contextinstanceid'."; } /** @@ -86,15 +90,11 @@ class discussion_updated extends \core\event\base { protected function validate_data() { parent::validate_data(); if (!isset($this->other['forumid'])) { - throw new \coding_exception('forumid must be set in $other.'); + throw new \coding_exception('The \'forumid\' value must be set in other.'); } if ($this->contextlevel != CONTEXT_MODULE) { - throw new \coding_exception('Context passed must be module context.'); - } - - if (!isset($this->objectid)) { - throw new \coding_exception('objectid must be set to the discussionid.'); + throw new \coding_exception('Context level must be CONTEXT_MODULE.'); } } } diff --git a/mod/forum/classes/event/discussion_viewed.php b/mod/forum/classes/event/discussion_viewed.php index 9e2e75e4fbd..6a870c9c3ca 100644 --- a/mod/forum/classes/event/discussion_viewed.php +++ b/mod/forum/classes/event/discussion_viewed.php @@ -27,7 +27,7 @@ namespace mod_forum\event; defined('MOODLE_INTERNAL') || die(); /** - * The mod_forum discussion viewed event. + * The mod_forum discussion viewed event class. * * @package mod_forum * @since Moodle 2.7 @@ -53,7 +53,8 @@ class discussion_viewed extends \core\event\base { * @return string */ public function get_description() { - return "The user {$this->userid} has viewed the forum discussion {$this->objectid}"; + return "The user with the id '$this->userid' has viewed the discussion with the id '$this->objectid' in the forum " . + "with the course module id '$this->contextinstanceid'."; } /** @@ -94,11 +95,7 @@ class discussion_viewed extends \core\event\base { parent::validate_data(); if ($this->contextlevel != CONTEXT_MODULE) { - throw new \coding_exception('Context passed must be module context.'); - } - - if (!isset($this->objectid)) { - throw new \coding_exception('objectid must be set to the discussionid.'); + throw new \coding_exception('Context level must be CONTEXT_MODULE.'); } } diff --git a/mod/forum/classes/event/post_created.php b/mod/forum/classes/event/post_created.php index 7ea2c199eb7..fe6d6ac7cf2 100644 --- a/mod/forum/classes/event/post_created.php +++ b/mod/forum/classes/event/post_created.php @@ -27,11 +27,15 @@ namespace mod_forum\event; defined('MOODLE_INTERNAL') || die(); /** - * The mod_forum post created event. - * @property-read array $other Extra information about the event. - * - int discussionid: The discussion id the post is part of. - * - int forumid: The forum id the post is part of. - * - string forumtype: The type of forum the post is part of. + * The mod_forum post created event class. + * + * @property-read array $other { + * Extra information about the event. + * + * - int discussionid: The discussion id the post is part of. + * - int forumid: The forum id the post is part of. + * - string forumtype: The type of forum the post is part of. + * } * * @package mod_forum * @since Moodle 2.7 @@ -56,8 +60,8 @@ class post_created extends \core\event\base { * @return string */ public function get_description() { - return "The user {$this->userid} has created a post in the discussion {$this->other['discussionid']} ". - " in forum {$this->other['forumid']}."; + return "The user with the id '$this->userid' has created the post with the id '$this->objectid' in the discussion with " . + "the id '{$this->other['discussionid']}' in the forum with the course module id '$this->contextinstanceid'."; } /** @@ -93,7 +97,6 @@ class post_created extends \core\event\base { * @return array|null */ protected function get_legacy_logdata() { - // The legacy log table expects a relative path to /mod/forum/. $logurl = substr($this->get_url()->out_as_local_url(), strlen('/mod/forum/')); @@ -109,24 +112,20 @@ class post_created extends \core\event\base { protected function validate_data() { parent::validate_data(); - if (!isset($this->objectid)) { - throw new \coding_exception('objectid must be set to the postid.'); - } - if (!isset($this->other['discussionid'])) { - throw new \coding_exception('discussionid must be set in other.'); + throw new \coding_exception('The \'discussionid\' value must be set in other.'); } if (!isset($this->other['forumid'])) { - throw new \coding_exception('forumid must be set in other.'); + throw new \coding_exception('The \'forumid\' value must be set in other.'); } if (!isset($this->other['forumtype'])) { - throw new \coding_exception('forumtype must be set in other.'); + throw new \coding_exception('The \'forumtype\' value must be set in other.'); } 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.'); } } } diff --git a/mod/forum/classes/event/post_deleted.php b/mod/forum/classes/event/post_deleted.php index 6cfdd7799c8..a50b3005d48 100644 --- a/mod/forum/classes/event/post_deleted.php +++ b/mod/forum/classes/event/post_deleted.php @@ -27,12 +27,15 @@ namespace mod_forum\event; defined('MOODLE_INTERNAL') || die(); /** - * The mod_forum post deleted event. + * The mod_forum post deleted event class. * - * @property-read array $other Extra information about the event. - * - int discussionid: The discussion id the post is part of. - * - int forumid: The forum id the post is part of. - * - string forumtype: The type of forum the post is part of. + * @property-read array $other { + * Extra information about the event. + * + * - int discussionid: The discussion id the post is part of. + * - int forumid: The forum id the post is part of. + * - string forumtype: The type of forum the post is part of. + * } * * @package mod_forum * @since Moodle 2.7 @@ -57,8 +60,8 @@ class post_deleted extends \core\event\base { * @return string */ public function get_description() { - return "The user {$this->userid} has deleted the post {$this->objectid} ". - " in discussion {$this->other['discussionid']}."; + return "The user with the id '$this->userid' has deleted the post with the id '$this->objectid' in the discussion with " . + "the id '{$this->other['discussionid']}' in the forum with the course module id '$this->contextinstanceid'."; } /** @@ -108,24 +111,20 @@ class post_deleted extends \core\event\base { protected function validate_data() { parent::validate_data(); - if (!isset($this->objectid)) { - throw new \coding_exception('objectid must be set to the postid.'); - } - if (!isset($this->other['discussionid'])) { - throw new \coding_exception('discussionid must be set in other.'); + throw new \coding_exception('The \'discussionid\' value must be set in other.'); } if (!isset($this->other['forumid'])) { - throw new \coding_exception('forumid must be set in other.'); + throw new \coding_exception('The \'forumid\' value must be set in other.'); } if (!isset($this->other['forumtype'])) { - throw new \coding_exception('forumtype must be set in other.'); + throw new \coding_exception('The \'forumtype\' value must be set in other.'); } 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.'); } } } diff --git a/mod/forum/classes/event/post_updated.php b/mod/forum/classes/event/post_updated.php index 2fc3716a772..13d9b7e47fd 100644 --- a/mod/forum/classes/event/post_updated.php +++ b/mod/forum/classes/event/post_updated.php @@ -27,12 +27,15 @@ namespace mod_forum\event; defined('MOODLE_INTERNAL') || die(); /** - * The mod_forum post updated event. + * The mod_forum post updated event class. * - * @property-read array $other Extra information about the event. - * - int discussionid: The discussion id the post is part of. - * - int forumid: The forum id the post is part of. - * - string forumtype: The type of forum the post is part of. + * @property-read array $other { + * Extra information about the event. + * + * - int discussionid: The discussion id the post is part of. + * - int forumid: The forum id the post is part of. + * - string forumtype: The type of forum the post is part of. + * } * * @package mod_forum * @since Moodle 2.7 @@ -57,8 +60,8 @@ class post_updated extends \core\event\base { * @return string */ public function get_description() { - return "The user {$this->userid} has created updated the post {$this->objectid} ". - " in discussion {$this->other['discussionid']}."; + return "The user with the id '$this->userid' has updated the post with the id '$this->objectid' in the discussion with " . + "the id '{$this->other['discussionid']}' in the forum with the course module id '$this->contextinstanceid'."; } /** @@ -109,24 +112,20 @@ class post_updated extends \core\event\base { protected function validate_data() { parent::validate_data(); - if (!isset($this->objectid)) { - throw new \coding_exception('objectid must be set to the postid.'); - } - if (!isset($this->other['discussionid'])) { - throw new \coding_exception('discussionid must be set in other.'); + throw new \coding_exception('The \'discussionid\' value must be set in other.'); } if (!isset($this->other['forumid'])) { - throw new \coding_exception('forumid must be set in other.'); + throw new \coding_exception('The \'forumid\' value must be set in other.'); } if (!isset($this->other['forumtype'])) { - throw new \coding_exception('forumtype must be set in other.'); + throw new \coding_exception('The \'forumtype\' value must be set in other.'); } 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.'); } } } diff --git a/mod/forum/classes/event/readtracking_disabled.php b/mod/forum/classes/event/readtracking_disabled.php index 86900bef6bc..ee8571464cc 100644 --- a/mod/forum/classes/event/readtracking_disabled.php +++ b/mod/forum/classes/event/readtracking_disabled.php @@ -27,10 +27,13 @@ namespace mod_forum\event; defined('MOODLE_INTERNAL') || die(); /** - * The mod_forum subscription created event. + * The mod_forum subscription created event class. * - * @property-read array $other Extra information about the event. - * - int forumid: The id of the forum which readtracking has been disabled on. + * @property-read array $other { + * Extra information about the event. + * + * - int forumid: The id of the forum which read tracking has been disabled on. + * } * * @package mod_forum * @since Moodle 2.7 @@ -54,7 +57,8 @@ class readtracking_disabled extends \core\event\base { * @return string */ public function get_description() { - return "Read tracking has been disabled for user {$this->relateduserid} in forum {$this->other['forumid']}"; + return "Read tracking has been disabled for the user with the id '$this->relateduserid' in the forum with the " . + "course module id '$this->contextinstanceid'."; } /** @@ -95,15 +99,15 @@ class readtracking_disabled extends \core\event\base { parent::validate_data(); if (!isset($this->relateduserid)) { - throw new \coding_exception('relateduserid must be set.'); + throw new \coding_exception('The \'relateduserid\' must be set.'); } if (!isset($this->other['forumid'])) { - throw new \coding_exception('forumid must be set in other.'); + throw new \coding_exception('The \'forumid\' value must be set in other.'); } 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.'); } } } diff --git a/mod/forum/classes/event/readtracking_enabled.php b/mod/forum/classes/event/readtracking_enabled.php index 657002b2fd8..5604187d231 100644 --- a/mod/forum/classes/event/readtracking_enabled.php +++ b/mod/forum/classes/event/readtracking_enabled.php @@ -27,10 +27,13 @@ namespace mod_forum\event; defined('MOODLE_INTERNAL') || die(); /** - * The mod_forum read tracking enabled event. + * The mod_forum read tracking enabled event class. * - * @property-read array $other Extra information about the event. - * - int forumid: The id of the forum which readtracking has been enabled on. + * @property-read array $other { + * Extra information about the event. + * + * - int forumid: The id of the forum which readtracking has been enabled on. + * } * * @package mod_forum * @since Moodle 2.7 @@ -54,7 +57,8 @@ class readtracking_enabled extends \core\event\base { * @return string */ public function get_description() { - return "Read tracking has been enabled for user {$this->relateduserid} in forum {$this->other['forumid']}"; + return "Read tracking has been enabled for the user with the id '$this->relateduserid' in the forum with the " . + "course module id '$this->contextinstanceid'."; } /** @@ -95,15 +99,15 @@ class readtracking_enabled extends \core\event\base { parent::validate_data(); if (!isset($this->relateduserid)) { - throw new \coding_exception('relateduserid must be set.'); + throw new \coding_exception('The \'relateduserid\' must be set.'); } if (!isset($this->other['forumid'])) { - throw new \coding_exception('forumid must be set in other.'); + throw new \coding_exception('The \'forumid\' value must be set in other.'); } 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.'); } } } diff --git a/mod/forum/classes/event/subscribers_viewed.php b/mod/forum/classes/event/subscribers_viewed.php index cc74efb2169..febe4037e91 100644 --- a/mod/forum/classes/event/subscribers_viewed.php +++ b/mod/forum/classes/event/subscribers_viewed.php @@ -27,10 +27,13 @@ namespace mod_forum\event; defined('MOODLE_INTERNAL') || die(); /** - * The mod_forum subscribers list viewed event. + * The mod_forum subscribers list viewed event class. * - * @property-read array $other Extra information about the event. - * - int forumid: The id of the forum which the subscriberslist has been viewed. + * @property-read array $other { + * Extra information about the event. + * + * - int forumid: The id of the forum which the subscriberslist has been viewed. + * } * * @package mod_forum * @since Moodle 2.7 @@ -55,7 +58,8 @@ class subscribers_viewed extends \core\event\base { * @return string */ public function get_description() { - return "The user {$this->userid} has viewed the subscribers list for forum {$this->other['forumid']}"; + return "The user with the id '$this->userid' has viewed the subscribers list for the forum with the course " . + "module id '$this->contextinstanceid'."; } /** @@ -96,11 +100,11 @@ class subscribers_viewed extends \core\event\base { parent::validate_data(); if (!isset($this->other['forumid'])) { - throw new \coding_exception('forumid must be set in other.'); + throw new \coding_exception('The \'forumid\' value must be set in other.'); } 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.'); } } diff --git a/mod/forum/classes/event/subscription_created.php b/mod/forum/classes/event/subscription_created.php index b549a94dde2..03625fe783b 100644 --- a/mod/forum/classes/event/subscription_created.php +++ b/mod/forum/classes/event/subscription_created.php @@ -27,10 +27,13 @@ namespace mod_forum\event; defined('MOODLE_INTERNAL') || die(); /** - * The mod_forum subscription created event. + * The mod_forum subscription created event class. * - * @property-read array $other Extra information about the event. - * - int forumid: The id of the forum which has been subscribed to. + * @property-read array $other { + * Extra information about the event. + * + * - int forumid: The id of the forum which has been subscribed to. + * } * * @package mod_forum * @since Moodle 2.7 @@ -54,7 +57,8 @@ class subscription_created extends \core\event\base { * @return string */ public function get_description() { - return "The user {$this->relateduserid} was subscribed to the forum {$this->other['forumid']}"; + return "The user with the id '$this->relateduserid' was subscribed to the forum with the course module id " . + "'$this->contextinstanceid' by the user with the id '$this->userid'."; } /** @@ -93,15 +97,17 @@ class subscription_created extends \core\event\base { */ protected function validate_data() { parent::validate_data(); + if (!isset($this->relateduserid)) { - throw new \coding_exception('relateduserid must be set.'); + throw new \coding_exception('The \'relateduserid\' must be set.'); } + if (!isset($this->other['forumid'])) { - throw new \coding_exception('forumid must be set in other.'); + throw new \coding_exception('The \'forumid\' value must be set in other.'); } 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.'); } } } diff --git a/mod/forum/classes/event/subscription_deleted.php b/mod/forum/classes/event/subscription_deleted.php index 46baa687f7b..c075bc356ed 100644 --- a/mod/forum/classes/event/subscription_deleted.php +++ b/mod/forum/classes/event/subscription_deleted.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * The mod_forum subscription created event. + * The mod_forum subscription deleted event. * * @package mod_forum * @copyright 2014 Dan Poltawski @@ -27,10 +27,13 @@ namespace mod_forum\event; defined('MOODLE_INTERNAL') || die(); /** - * The mod_forum subscription created event. + * The mod_forum subscription deleted event class. * - * @property-read array $other Extra information about the event. - * - int forumid: The id of the forum which has been unsusbcribed from. + * @property-read array $other { + * Extra information about the event. + * + * - int forumid: The id of the forum which has been unsusbcribed from. + * } * * @package mod_forum * @since Moodle 2.7 @@ -54,7 +57,8 @@ class subscription_deleted extends \core\event\base { * @return string */ public function get_description() { - return "The user {$this->relateduserid} was unsubscribed the forum {$this->other['forumid']}"; + return "The user with the id '$this->relateduserid' was unsubscribed to the forum with the course module id " . + "'$this->contextinstanceid' by the user with the id '$this->userid'."; } /** @@ -95,15 +99,15 @@ class subscription_deleted extends \core\event\base { parent::validate_data(); if (!isset($this->relateduserid)) { - throw new \coding_exception('relateduserid must be set.'); + throw new \coding_exception('The \'relateduserid\' must be set.'); } if (!isset($this->other['forumid'])) { - throw new \coding_exception('forumid must be set in other.'); + throw new \coding_exception('The \'forumid\' value must be set in other.'); } 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.'); } } } diff --git a/mod/forum/classes/event/user_report_viewed.php b/mod/forum/classes/event/user_report_viewed.php index dc2d522dd6e..9540386bbf4 100644 --- a/mod/forum/classes/event/user_report_viewed.php +++ b/mod/forum/classes/event/user_report_viewed.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * The mod_forum userreport viewed event. + * The mod_forum user report viewed event. * * @package mod_forum * @copyright 2014 Dan Poltawski @@ -27,10 +27,13 @@ namespace mod_forum\event; defined('MOODLE_INTERNAL') || die(); /** - * The mod_forum userreport viewed event. + * The mod_forum user report viewed event class. * - * @property-read array $other Extra information about the event. - * - string reportmode: The mode the report has been viewed in (posts or discussions). + * @property-read array $other { + * Extra information about the event. + * + * - string reportmode: The mode the report has been viewed in (posts or discussions). + * } * * @package mod_forum * @since Moodle 2.7 @@ -55,8 +58,8 @@ class user_report_viewed extends \core\event\base { * @return string */ public function get_description() { - return "The user {$this->userid} has viewed the userreport for user {$this->relateduserid} in ". - "course {$this->courseid} with viewing mode {$this->other['reportmode']}"; + return "The user with the id '$this->userid' has viewed the user report for the user with the id '$this->relateduserid' in " . + "the course with the id '$this->courseid' with viewing mode '{$this->other['reportmode']}'."; } /** @@ -106,10 +109,10 @@ class user_report_viewed extends \core\event\base { protected function validate_data() { parent::validate_data(); if (!isset($this->relateduserid)) { - throw new \coding_exception('relateduserid must be set.'); + throw new \coding_exception('The \'relateduserid\' must be set.'); } if (!isset($this->other['reportmode'])) { - throw new \coding_exception('reportmode must be set in other.'); + throw new \coding_exception('The \'reportmode\' value must be set in other.'); } switch ($this->contextlevel) @@ -120,7 +123,7 @@ class user_report_viewed extends \core\event\base { break; default: // Unexpected contextlevel. - throw new \coding_exception('Context passed must be system or course.'); + throw new \coding_exception('Context level must be either CONTEXT_SYSTEM or CONTEXT_COURSE.'); } } diff --git a/mod/forum/lib.php b/mod/forum/lib.php index b703fc40459..09a4d8a14f0 100644 --- a/mod/forum/lib.php +++ b/mod/forum/lib.php @@ -4652,8 +4652,8 @@ function forum_trigger_content_uploaded_event($post, $cm, $name) { 'objectid' => $post->id, 'other' => array( 'content' => $post->message, - 'discussionid' => $post->discussion, 'pathnamehashes' => array_keys($files), + 'discussionid' => $post->discussion, 'triggeredfrom' => $name, ) ); diff --git a/mod/forum/tests/events_test.php b/mod/forum/tests/events_test.php index 2570ced95f8..424d5a935a9 100644 --- a/mod/forum/tests/events_test.php +++ b/mod/forum/tests/events_test.php @@ -52,7 +52,7 @@ class mod_forum_events_testcase extends advanced_testcase { 'context' => $coursectx, ); - $this->setExpectedException('coding_exception', 'searchterm must be set in $other.'); + $this->setExpectedException('coding_exception', 'The \'searchterm\' value must be set in other.'); \mod_forum\event\course_searched::create($params); } @@ -68,7 +68,7 @@ class mod_forum_events_testcase extends advanced_testcase { 'other' => array('searchterm' => 'testing'), ); - $this->setExpectedException('coding_exception', 'Context passed must be course.'); + $this->setExpectedException('coding_exception', 'Context level must be CONTEXT_COURSE.'); \mod_forum\event\course_searched::create($params); } @@ -119,24 +119,7 @@ class mod_forum_events_testcase extends advanced_testcase { 'context' => $context, ); - $this->setExpectedException('coding_exception', 'forumid must be set in $other.'); - \mod_forum\event\discussion_created::create($params); - } - - /** - * Ensure discussion_created event validates that discussionid is set. - */ - public function test_discussion_created_objectid_validation() { - $course = $this->getDataGenerator()->create_course(); - $forum = $this->getDataGenerator()->create_module('forum', array('course' => $course->id)); - $context = context_module::instance($forum->cmid); - - $params = array( - 'context' => $context, - 'other' => array('forumid' => $forum->id) - ); - - $this->setExpectedException('coding_exception', 'objectid must be set to the discussionid.'); + $this->setExpectedException('coding_exception', 'The \'forumid\' value must be set in other.'); \mod_forum\event\discussion_created::create($params); } @@ -152,7 +135,7 @@ class mod_forum_events_testcase extends advanced_testcase { 'other' => array('forumid' => $forum->id), ); - $this->setExpectedException('coding_exception', 'Context passed must be module context.'); + $this->setExpectedException('coding_exception', 'Context level must be CONTEXT_MODULE.'); \mod_forum\event\discussion_created::create($params); } @@ -213,24 +196,7 @@ class mod_forum_events_testcase extends advanced_testcase { 'context' => $context, ); - $this->setExpectedException('coding_exception', 'forumid must be set in $other.'); - \mod_forum\event\discussion_updated::create($params); - } - - /** - * Ensure discussion_updated event validates that discussionid is set. - */ - public function test_discussion_updated_objectid_validation() { - $course = $this->getDataGenerator()->create_course(); - $forum = $this->getDataGenerator()->create_module('forum', array('course' => $course->id)); - $context = context_module::instance($forum->cmid); - - $params = array( - 'context' => $context, - 'other' => array('forumid' => $forum->id) - ); - - $this->setExpectedException('coding_exception', 'objectid must be set to the discussionid.'); + $this->setExpectedException('coding_exception', 'The \'forumid\' value must be set in other.'); \mod_forum\event\discussion_updated::create($params); } @@ -246,7 +212,7 @@ class mod_forum_events_testcase extends advanced_testcase { 'other' => array('forumid' => $forum->id), ); - $this->setExpectedException('coding_exception', 'Context passed must be module context.'); + $this->setExpectedException('coding_exception', 'Context level must be CONTEXT_MODULE.'); \mod_forum\event\discussion_updated::create($params); } @@ -305,24 +271,7 @@ class mod_forum_events_testcase extends advanced_testcase { 'context' => $context, ); - $this->setExpectedException('coding_exception', 'forumid must be set in $other.'); - \mod_forum\event\discussion_deleted::create($params); - } - - /** - * Ensure discussion_deleted event validates that discussionid is set. - */ - public function test_discussion_deleted_objectid_validation() { - $course = $this->getDataGenerator()->create_course(); - $forum = $this->getDataGenerator()->create_module('forum', array('course' => $course->id)); - $context = context_module::instance($forum->cmid); - - $params = array( - 'context' => $context, - 'other' => array('forumid' => $forum->id) - ); - - $this->setExpectedException('coding_exception', 'objectid must be set to the discussionid.'); + $this->setExpectedException('coding_exception', 'The \'forumid\' value must be set in other.'); \mod_forum\event\discussion_deleted::create($params); } @@ -338,7 +287,7 @@ class mod_forum_events_testcase extends advanced_testcase { 'other' => array('forumid' => $forum->id), ); - $this->setExpectedException('coding_exception', 'Context passed must be module context.'); + $this->setExpectedException('coding_exception', 'Context level must be CONTEXT_MODULE.'); \mod_forum\event\discussion_deleted::create($params); } @@ -400,7 +349,7 @@ class mod_forum_events_testcase extends advanced_testcase { 'other' => array('toforumid' => $toforum->id) ); - $this->setExpectedException('coding_exception', 'fromforumid must be set in $other.'); + $this->setExpectedException('coding_exception', 'The \'fromforumid\' value must be set in other.'); \mod_forum\event\discussion_moved::create($params); } @@ -418,25 +367,7 @@ class mod_forum_events_testcase extends advanced_testcase { 'other' => array('fromforumid' => $fromforum->id) ); - $this->setExpectedException('coding_exception', 'toforumid must be set in $other.'); - \mod_forum\event\discussion_moved::create($params); - } - - /** - * Ensure discussion_moved event validates that the discussionid is set. - */ - public function test_discussion_moved_objectid_validation() { - $course = $this->getDataGenerator()->create_course(); - $fromforum = $this->getDataGenerator()->create_module('forum', array('course' => $course->id)); - $toforum = $this->getDataGenerator()->create_module('forum', array('course' => $course->id)); - $context = context_module::instance($toforum->cmid); - - $params = array( - 'context' => $context, - 'other' => array('fromforumid' => $fromforum->id, 'toforumid' => $toforum->id) - ); - - $this->setExpectedException('coding_exception', 'objectid must be set to the discussionid.'); + $this->setExpectedException('coding_exception', 'The \'toforumid\' value must be set in other.'); \mod_forum\event\discussion_moved::create($params); } @@ -462,7 +393,7 @@ class mod_forum_events_testcase extends advanced_testcase { 'other' => array('fromforumid' => $fromforum->id, 'toforumid' => $toforum->id) ); - $this->setExpectedException('coding_exception', 'Context passed must be module context.'); + $this->setExpectedException('coding_exception', 'Context level must be CONTEXT_MODULE.'); \mod_forum\event\discussion_moved::create($params); } @@ -511,21 +442,6 @@ class mod_forum_events_testcase extends advanced_testcase { $this->assertNotEmpty($event->get_name()); } - /** - * Ensure discussion_viewed event validates that the discussionid is set - */ - public function test_discussion_viewed_objectid_validation() { - $course = $this->getDataGenerator()->create_course(); - $forum = $this->getDataGenerator()->create_module('forum', array('course' => $course->id)); - $context = context_module::instance($forum->cmid); - - $params = array( - 'context' => $context, - ); - - $this->setExpectedException('coding_exception', 'objectid must be set to the discussionid.'); - \mod_forum\event\discussion_viewed::create($params); - } /** * Ensure discussion_viewed event validates that the contextlevel is correct. @@ -547,7 +463,7 @@ class mod_forum_events_testcase extends advanced_testcase { 'objectid' => $discussion->id, ); - $this->setExpectedException('coding_exception', 'Context passed must be module context.'); + $this->setExpectedException('coding_exception', 'Context level must be CONTEXT_MODULE.'); \mod_forum\event\discussion_viewed::create($params); } @@ -594,22 +510,6 @@ class mod_forum_events_testcase extends advanced_testcase { $this->assertNotEmpty($event->get_name()); } - /** - * Ensure course_module_viewed event validates that the forumid is set. - */ - public function test_course_module_viewed_objectid_validation() { - $course = $this->getDataGenerator()->create_course(); - $forum = $this->getDataGenerator()->create_module('forum', array('course' => $course->id)); - $context = context_module::instance($forum->cmid); - - $params = array( - 'context' => $context, - ); - - $this->setExpectedException('coding_exception', 'must define objectid'); - \mod_forum\event\course_module_viewed::create($params); - } - /** * Ensure course_module_viewed event validates that the contextlevel is correct. */ @@ -622,7 +522,7 @@ class mod_forum_events_testcase extends advanced_testcase { 'objectid' => $forum->id, ); - $this->setExpectedException('coding_exception', 'Context passed must be module context.'); + $this->setExpectedException('coding_exception', 'Context level must be CONTEXT_MODULE.'); \mod_forum\event\course_module_viewed::create($params); } @@ -675,7 +575,7 @@ class mod_forum_events_testcase extends advanced_testcase { 'relateduserid' => $user->id, ); - $this->setExpectedException('coding_exception', 'forumid must be set in other.'); + $this->setExpectedException('coding_exception', 'The \'forumid\' value must be set in other.'); \mod_forum\event\subscription_created::create($params); } @@ -691,7 +591,7 @@ class mod_forum_events_testcase extends advanced_testcase { 'objectid' => $forum->id, ); - $this->setExpectedException('coding_exception', 'relateduserid must be set.'); + $this->setExpectedException('coding_exception', 'The \'relateduserid\' must be set.'); \mod_forum\event\subscription_created::create($params); } @@ -709,7 +609,7 @@ class mod_forum_events_testcase extends advanced_testcase { 'relateduserid' => $user->id, ); - $this->setExpectedException('coding_exception', 'Context passed must be module context.'); + $this->setExpectedException('coding_exception', 'Context level must be CONTEXT_MODULE.'); \mod_forum\event\subscription_created::create($params); } @@ -763,7 +663,7 @@ class mod_forum_events_testcase extends advanced_testcase { 'relateduserid' => $user->id, ); - $this->setExpectedException('coding_exception', 'forumid must be set in other.'); + $this->setExpectedException('coding_exception', 'The \'forumid\' value must be set in other.'); \mod_forum\event\subscription_deleted::create($params); } @@ -779,7 +679,7 @@ class mod_forum_events_testcase extends advanced_testcase { 'objectid' => $forum->id, ); - $this->setExpectedException('coding_exception', 'relateduserid must be set.'); + $this->setExpectedException('coding_exception', 'The \'relateduserid\' must be set.'); \mod_forum\event\subscription_deleted::create($params); } @@ -797,7 +697,7 @@ class mod_forum_events_testcase extends advanced_testcase { 'relateduserid' => $user->id, ); - $this->setExpectedException('coding_exception', 'Context passed must be module context.'); + $this->setExpectedException('coding_exception', 'Context level must be CONTEXT_MODULE.'); \mod_forum\event\subscription_deleted::create($params); } @@ -851,7 +751,7 @@ class mod_forum_events_testcase extends advanced_testcase { 'relateduserid' => $user->id, ); - $this->setExpectedException('coding_exception', 'forumid must be set in other.'); + $this->setExpectedException('coding_exception', 'The \'forumid\' value must be set in other.'); \mod_forum\event\readtracking_enabled::create($params); } @@ -867,7 +767,7 @@ class mod_forum_events_testcase extends advanced_testcase { 'objectid' => $forum->id, ); - $this->setExpectedException('coding_exception', 'relateduserid must be set.'); + $this->setExpectedException('coding_exception', 'The \'relateduserid\' must be set.'); \mod_forum\event\readtracking_enabled::create($params); } @@ -885,7 +785,7 @@ class mod_forum_events_testcase extends advanced_testcase { 'relateduserid' => $user->id, ); - $this->setExpectedException('coding_exception', 'Context passed must be module context.'); + $this->setExpectedException('coding_exception', 'Context level must be CONTEXT_MODULE.'); \mod_forum\event\readtracking_enabled::create($params); } @@ -939,7 +839,7 @@ class mod_forum_events_testcase extends advanced_testcase { 'relateduserid' => $user->id, ); - $this->setExpectedException('coding_exception', 'forumid must be set in other.'); + $this->setExpectedException('coding_exception', 'The \'forumid\' value must be set in other.'); \mod_forum\event\readtracking_disabled::create($params); } @@ -955,7 +855,7 @@ class mod_forum_events_testcase extends advanced_testcase { 'objectid' => $forum->id, ); - $this->setExpectedException('coding_exception', 'relateduserid must be set.'); + $this->setExpectedException('coding_exception', 'The \'relateduserid\' must be set.'); \mod_forum\event\readtracking_disabled::create($params); } @@ -973,7 +873,7 @@ class mod_forum_events_testcase extends advanced_testcase { 'relateduserid' => $user->id, ); - $this->setExpectedException('coding_exception', 'Context passed must be module context.'); + $this->setExpectedException('coding_exception', 'Context level must be CONTEXT_MODULE.'); \mod_forum\event\readtracking_disabled::create($params); } @@ -1027,7 +927,7 @@ class mod_forum_events_testcase extends advanced_testcase { 'relateduserid' => $user->id, ); - $this->setExpectedException('coding_exception', 'forumid must be set in other.'); + $this->setExpectedException('coding_exception', 'The \'forumid\' value must be set in other.'); \mod_forum\event\subscribers_viewed::create($params); } @@ -1045,7 +945,7 @@ class mod_forum_events_testcase extends advanced_testcase { 'relateduserid' => $user->id, ); - $this->setExpectedException('coding_exception', 'Context passed must be module context.'); + $this->setExpectedException('coding_exception', 'Context level must be CONTEXT_MODULE.'); \mod_forum\event\subscribers_viewed::create($params); } @@ -1094,7 +994,7 @@ class mod_forum_events_testcase extends advanced_testcase { 'relateduserid' => $user->id, ); - $this->setExpectedException('coding_exception', 'reportmode must be set in other.'); + $this->setExpectedException('coding_exception', 'The \'reportmode\' value must be set in other.'); \mod_forum\event\user_report_viewed::create($params); } @@ -1112,7 +1012,7 @@ class mod_forum_events_testcase extends advanced_testcase { 'relateduserid' => $user->id, ); - $this->setExpectedException('coding_exception', 'Context passed must be system or course.'); + $this->setExpectedException('coding_exception', 'Context level must be either CONTEXT_SYSTEM or CONTEXT_COURSE.'); \mod_forum\event\user_report_viewed::create($params); } @@ -1126,7 +1026,7 @@ class mod_forum_events_testcase extends advanced_testcase { 'other' => array('reportmode' => 'posts'), ); - $this->setExpectedException('coding_exception', 'relateduserid must be set.'); + $this->setExpectedException('coding_exception', 'The \'relateduserid\' must be set.'); \mod_forum\event\user_report_viewed::create($params); } @@ -1185,7 +1085,6 @@ class mod_forum_events_testcase extends advanced_testcase { 'other' => array('forumid' => $forum->id, 'forumtype' => $forum->type, 'discussionid' => $discussion->id) ); - $this->setExpectedException('coding_exception', 'objectid must be set to the postid.'); \mod_forum\event\post_created::create($params); } @@ -1216,7 +1115,7 @@ class mod_forum_events_testcase extends advanced_testcase { 'other' => array('forumid' => $forum->id, 'forumtype' => $forum->type) ); - $this->setExpectedException('coding_exception', 'discussionid must be set in other.'); + $this->setExpectedException('coding_exception', 'The \'discussionid\' value must be set in other.'); \mod_forum\event\post_created::create($params); } @@ -1247,7 +1146,7 @@ class mod_forum_events_testcase extends advanced_testcase { 'other' => array('discussionid' => $discussion->id, 'forumtype' => $forum->type) ); - $this->setExpectedException('coding_exception', 'forumid must be set in other.'); + $this->setExpectedException('coding_exception', 'The \'forumid\' value must be set in other.'); \mod_forum\event\post_created::create($params); } @@ -1278,7 +1177,7 @@ class mod_forum_events_testcase extends advanced_testcase { 'other' => array('discussionid' => $discussion->id, 'forumid' => $forum->id) ); - $this->setExpectedException('coding_exception', 'forumtype must be set in other.'); + $this->setExpectedException('coding_exception', 'The \'forumtype\' value must be set in other.'); \mod_forum\event\post_created::create($params); } @@ -1309,7 +1208,7 @@ class mod_forum_events_testcase extends advanced_testcase { 'other' => array('discussionid' => $discussion->id, 'forumid' => $forum->id, 'forumtype' => $forum->type) ); - $this->setExpectedException('coding_exception', 'Context passed must be module context'); + $this->setExpectedException('coding_exception', 'Context level must be CONTEXT_MODULE'); \mod_forum\event\post_created::create($params); } @@ -1439,7 +1338,6 @@ class mod_forum_events_testcase extends advanced_testcase { 'other' => array('forumid' => $forum->id, 'forumtype' => $forum->type, 'discussionid' => $discussion->id) ); - $this->setExpectedException('coding_exception', 'objectid must be set to the postid.'); \mod_forum\event\post_deleted::create($params); } @@ -1470,7 +1368,7 @@ class mod_forum_events_testcase extends advanced_testcase { 'other' => array('forumid' => $forum->id, 'forumtype' => $forum->type) ); - $this->setExpectedException('coding_exception', 'discussionid must be set in other.'); + $this->setExpectedException('coding_exception', 'The \'discussionid\' value must be set in other.'); \mod_forum\event\post_deleted::create($params); } @@ -1501,7 +1399,7 @@ class mod_forum_events_testcase extends advanced_testcase { 'other' => array('discussionid' => $discussion->id, 'forumtype' => $forum->type) ); - $this->setExpectedException('coding_exception', 'forumid must be set in other.'); + $this->setExpectedException('coding_exception', 'The \'forumid\' value must be set in other.'); \mod_forum\event\post_deleted::create($params); } @@ -1532,7 +1430,7 @@ class mod_forum_events_testcase extends advanced_testcase { 'other' => array('discussionid' => $discussion->id, 'forumid' => $forum->id) ); - $this->setExpectedException('coding_exception', 'forumtype must be set in other.'); + $this->setExpectedException('coding_exception', 'The \'forumtype\' value must be set in other.'); \mod_forum\event\post_deleted::create($params); } @@ -1563,7 +1461,7 @@ class mod_forum_events_testcase extends advanced_testcase { 'other' => array('discussionid' => $discussion->id, 'forumid' => $forum->id, 'forumtype' => $forum->type) ); - $this->setExpectedException('coding_exception', 'Context passed must be module context'); + $this->setExpectedException('coding_exception', 'Context level must be CONTEXT_MODULE'); \mod_forum\event\post_deleted::create($params); } @@ -1669,30 +1567,6 @@ class mod_forum_events_testcase extends advanced_testcase { $this->assertNotEmpty($event->get_name()); } - /** - * Ensure post_updated event validates that the postid is set. - */ - public function test_post_updated_postid_validation() { - $course = $this->getDataGenerator()->create_course(); - $forum = $this->getDataGenerator()->create_module('forum', array('course' => $course->id)); - $user = $this->getDataGenerator()->create_user(); - - // Add a discussion. - $record = array(); - $record['course'] = $course->id; - $record['forum'] = $forum->id; - $record['userid'] = $user->id; - $discussion = $this->getDataGenerator()->get_plugin_generator('mod_forum')->create_discussion($record); - - $params = array( - 'context' => context_module::instance($forum->cmid), - 'other' => array('forumid' => $forum->id, 'forumtype' => $forum->type, 'discussionid' => $discussion->id) - ); - - $this->setExpectedException('coding_exception', 'objectid must be set to the postid.'); - \mod_forum\event\post_updated::create($params); - } - /** * Ensure post_updated event validates that the discussionid is set. */ @@ -1720,7 +1594,7 @@ class mod_forum_events_testcase extends advanced_testcase { 'other' => array('forumid' => $forum->id, 'forumtype' => $forum->type) ); - $this->setExpectedException('coding_exception', 'discussionid must be set in other.'); + $this->setExpectedException('coding_exception', 'The \'discussionid\' value must be set in other.'); \mod_forum\event\post_updated::create($params); } @@ -1751,7 +1625,7 @@ class mod_forum_events_testcase extends advanced_testcase { 'other' => array('discussionid' => $discussion->id, 'forumtype' => $forum->type) ); - $this->setExpectedException('coding_exception', 'forumid must be set in other.'); + $this->setExpectedException('coding_exception', 'The \'forumid\' value must be set in other.'); \mod_forum\event\post_updated::create($params); } @@ -1782,7 +1656,7 @@ class mod_forum_events_testcase extends advanced_testcase { 'other' => array('discussionid' => $discussion->id, 'forumid' => $forum->id) ); - $this->setExpectedException('coding_exception', 'forumtype must be set in other.'); + $this->setExpectedException('coding_exception', 'The \'forumtype\' value must be set in other.'); \mod_forum\event\post_updated::create($params); } @@ -1813,7 +1687,7 @@ class mod_forum_events_testcase extends advanced_testcase { 'other' => array('discussionid' => $discussion->id, 'forumid' => $forum->id, 'forumtype' => $forum->type) ); - $this->setExpectedException('coding_exception', 'Context passed must be module context'); + $this->setExpectedException('coding_exception', 'Context level must be CONTEXT_MODULE'); \mod_forum\event\post_updated::create($params); } diff --git a/mod/glossary/classes/event/category_created.php b/mod/glossary/classes/event/category_created.php index a19d783999b..01439606e29 100644 --- a/mod/glossary/classes/event/category_created.php +++ b/mod/glossary/classes/event/category_created.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * mod_glossary glossary category added event. + * The mod_glossary glossary category created event. * * @package mod_glossary * @copyright 2014 Marina Glancy @@ -26,7 +26,7 @@ namespace mod_glossary\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_glossary glossary category created event. + * The mod_glossary glossary category created event class. * * @package mod_glossary * @since Moodle 2.7 @@ -58,7 +58,8 @@ class category_created extends \core\event\base { * @return string */ public function get_description() { - return "User {$this->userid} has created a glossary category with id {$this->objectid}."; + return "The user with the id '$this->userid' created the category with the id '$this->objectid' for the " . + "glossary activity with the course module id '$this->contextinstanceid'."; } /** diff --git a/mod/glossary/classes/event/category_deleted.php b/mod/glossary/classes/event/category_deleted.php index fad11207776..57915b0ec22 100644 --- a/mod/glossary/classes/event/category_deleted.php +++ b/mod/glossary/classes/event/category_deleted.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * mod_glossary glossary category deleted event. + * The mod_glossary glossary category deleted event. * * @package mod_glossary * @copyright 2014 Marina Glancy @@ -26,7 +26,7 @@ namespace mod_glossary\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_glossary glossary category deleted event. + * The mod_glossary glossary category deleted event class. * * @package mod_glossary * @since Moodle 2.7 @@ -58,7 +58,8 @@ class category_deleted extends \core\event\base { * @return string */ public function get_description() { - return "User {$this->userid} has deleted a glossary category with id {$this->objectid}."; + return "The user with the id '$this->userid' deleted the category with the id '$this->objectid' in the " . + "glossary activity with the course module id '$this->contextinstanceid'."; } /** diff --git a/mod/glossary/classes/event/category_updated.php b/mod/glossary/classes/event/category_updated.php index ae479544f30..498f4963c67 100644 --- a/mod/glossary/classes/event/category_updated.php +++ b/mod/glossary/classes/event/category_updated.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * mod_glossary glossary category updated event. + * The mod_glossary glossary category updated event. * * @package mod_glossary * @copyright 2014 Marina Glancy @@ -26,7 +26,7 @@ namespace mod_glossary\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_glossary glossary category updated event. + * The mod_glossary glossary category updated event class. * * @package mod_glossary * @since Moodle 2.7 @@ -58,7 +58,8 @@ class category_updated extends \core\event\base { * @return string */ public function get_description() { - return "User {$this->userid} has updated a glossary category with id {$this->objectid}."; + return "The user with the id '$this->userid' updated the category with the id '$this->objectid' in the " . + "glossary activity with the course module id '$this->contextinstanceid'."; } /** diff --git a/mod/glossary/classes/event/comment_created.php b/mod/glossary/classes/event/comment_created.php index 8e1b5cb67b0..b09f36cf832 100644 --- a/mod/glossary/classes/event/comment_created.php +++ b/mod/glossary/classes/event/comment_created.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * mod_glossary comment created event. + * The mod_glossary comment created event. * * @package mod_glossary * @copyright 2013 Rajesh Taneja @@ -26,7 +26,7 @@ namespace mod_glossary\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_glossary comment created event. + * The mod_glossary comment created event class. * * @package mod_glossary * @since Moodle 2.7 @@ -49,6 +49,7 @@ class comment_created extends \core\event\comment_created { * @return string */ public function get_description() { - return 'User with id ' . $this->userid . ' added comment for glossary activity with id ' . $this->other['itemid']; + return "The user with the id '$this->userid' added the comment with the id '$this->objectid' to the glossary activity " . + "with the course module id '$this->contextinstanceid'."; } } diff --git a/mod/glossary/classes/event/comment_deleted.php b/mod/glossary/classes/event/comment_deleted.php index 764ba0748c5..1dabce323f2 100644 --- a/mod/glossary/classes/event/comment_deleted.php +++ b/mod/glossary/classes/event/comment_deleted.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * mod_glossary comment deleted event. + * The mod_glossary comment deleted event. * * @package mod_glossary * @copyright 2013 Rajesh Taneja @@ -26,7 +26,7 @@ namespace mod_glossary\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_glossary comment deleted event. + * The mod_glossary comment deleted event class. * * @package mod_glossary * @since Moodle 2.7 @@ -49,6 +49,7 @@ class comment_deleted extends \core\event\comment_deleted { * @return string */ public function get_description() { - return 'User with id ' . $this->userid . ' deleted comment for glossary activity with id ' . $this->other['itemid']; + return "The user with the id '$this->userid' deleted the comment with the id '$this->objectid' from the glossary activity " . + "with the course module id '$this->contextinstanceid'."; } } diff --git a/mod/glossary/classes/event/course_module_instance_list_viewed.php b/mod/glossary/classes/event/course_module_instance_list_viewed.php index 9a2b319a8f6..e5f115b4cc9 100644 --- a/mod/glossary/classes/event/course_module_instance_list_viewed.php +++ b/mod/glossary/classes/event/course_module_instance_list_viewed.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * mod_glossary course module instance list viewed event. + * The mod_glossary instance list viewed event. * * @package mod_glossary * @copyright 2014 Marina Glancy @@ -26,7 +26,7 @@ namespace mod_glossary\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_glossary course module instance list viewed event class. + * The mod_glossary instance list viewed event class. * * @package mod_glossary * @since Moodle 2.7 diff --git a/mod/glossary/classes/event/course_module_viewed.php b/mod/glossary/classes/event/course_module_viewed.php index 3fa8089a8b2..32e459035a8 100644 --- a/mod/glossary/classes/event/course_module_viewed.php +++ b/mod/glossary/classes/event/course_module_viewed.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * This file contains an event for when a glossary activity is viewed. + * The mod_glossary course module viewed event. * * @package mod_glossary * @copyright 2014 Marina Glancy @@ -26,7 +26,7 @@ namespace mod_glossary\event; defined('MOODLE_INTERNAL') || die(); /** - * Event for when a page activity is viewed. + * The mod_glossary course module viewed event class. * * @package mod_glossary * @since Moodle 2.7 diff --git a/mod/glossary/classes/event/entry_approved.php b/mod/glossary/classes/event/entry_approved.php index 6cbaf843af1..fc1482f1532 100644 --- a/mod/glossary/classes/event/entry_approved.php +++ b/mod/glossary/classes/event/entry_approved.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * mod_glossary entry approved event. + * The mod_glossary entry approved event. * * @package mod_glossary * @copyright 2014 Marina Glancy @@ -26,7 +26,7 @@ namespace mod_glossary\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_glossary entry approved event. + * The mod_glossary entry approved event class. * * @package mod_glossary * @since Moodle 2.7 @@ -58,7 +58,8 @@ class entry_approved extends \core\event\base { * @return string */ public function get_description() { - return "User {$this->userid} has approved a glossary entry with id {$this->objectid}."; + return "The user with the id '$this->userid' has approved the glossary entry with the id '$this->objectid' for " . + "the glossary activity with the course module id '$this->contextinstanceid'."; } /** diff --git a/mod/glossary/classes/event/entry_created.php b/mod/glossary/classes/event/entry_created.php index 8f524c06589..5bc04b9336c 100644 --- a/mod/glossary/classes/event/entry_created.php +++ b/mod/glossary/classes/event/entry_created.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * mod_glossary entry created event. + * The mod_glossary entry created event. * * @package mod_glossary * @copyright 2014 Marina Glancy @@ -26,12 +26,12 @@ namespace mod_glossary\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_glossary entry created event. + * The mod_glossary entry created event class. * * @property-read array $other { * Extra information about event. * - * @type string concept the concept of created entry. + * - string concept: the concept of created entry. * } * * @package mod_glossary @@ -64,7 +64,8 @@ class entry_created extends \core\event\base { * @return string */ public function get_description() { - return "User {$this->userid} has created a glossary entry with id {$this->objectid}."; + return "The user with the id '$this->userid' has created the glossary entry with the id '$this->objectid' for " . + "the glossary activity with the course module id '$this->contextinstanceid'."; } /** diff --git a/mod/glossary/classes/event/entry_deleted.php b/mod/glossary/classes/event/entry_deleted.php index 8e024da1dc2..c22e5b817d1 100644 --- a/mod/glossary/classes/event/entry_deleted.php +++ b/mod/glossary/classes/event/entry_deleted.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * mod_glossary entry deleted event. + * The mod_glossary entry deleted event. * * @package mod_glossary * @copyright 2014 Marina Glancy @@ -26,14 +26,14 @@ namespace mod_glossary\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_glossary entry deleted event. + * The mod_glossary entry deleted event class. * * @property-read array $other { * Extra information about event. * - * @type string concept the concept of deleted entry. - * @type string mode (optional) view mode user was in before deleting entry. - * @type int|string hook (optional) hook parameter in the previous view mode. + * - string concept: the concept of deleted entry. + * - string mode: (optional) view mode user was in before deleting entry. + * - int|string hook: (optional) hook parameter in the previous view mode. * } * * @package mod_glossary @@ -66,7 +66,8 @@ class entry_deleted extends \core\event\base { * @return string */ public function get_description() { - return "User {$this->userid} has deleted a glossary entry with id {$this->objectid}."; + return "The user with the id '$this->userid' has deleted the glossary entry with the id '$this->objectid' in " . + "the glossary activity with the course module id '$this->contextinstanceid'."; } /** diff --git a/mod/glossary/classes/event/entry_disapproved.php b/mod/glossary/classes/event/entry_disapproved.php index 13b616ae17e..656bcb63572 100644 --- a/mod/glossary/classes/event/entry_disapproved.php +++ b/mod/glossary/classes/event/entry_disapproved.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * mod_glossary entry disapproved event. + * The mod_glossary entry disapproved event. * * @package mod_glossary * @copyright 2014 Marina Glancy @@ -26,7 +26,7 @@ namespace mod_glossary\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_glossary entry disapproved event. + * The mod_glossary entry disapproved event. * * @package mod_glossary * @since Moodle 2.7 @@ -58,7 +58,8 @@ class entry_disapproved extends \core\event\base { * @return string */ public function get_description() { - return "User {$this->userid} has disapproved a glossary entry with id {$this->objectid}."; + return "The user with the id '$this->userid' has disapproved the glossary entry with the id '$this->objectid' for " . + "the glossary activity with the course module id '$this->contextinstanceid'."; } /** diff --git a/mod/glossary/classes/event/entry_updated.php b/mod/glossary/classes/event/entry_updated.php index 6279780dac8..cfe5b1bdbaa 100644 --- a/mod/glossary/classes/event/entry_updated.php +++ b/mod/glossary/classes/event/entry_updated.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * mod_glossary entry updated event. + * The mod_glossary entry updated event. * * @package mod_glossary * @copyright 2014 Marina Glancy @@ -26,12 +26,12 @@ namespace mod_glossary\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_glossary entry updated event. + * The mod_glossary entry updated event. * * @property-read array $other { * Extra information about event. * - * @type string concept the concept of updated entry (after update). + * - string concept: the concept of updated entry (after update). * } * * @package mod_glossary @@ -64,7 +64,8 @@ class entry_updated extends \core\event\base { * @return string */ public function get_description() { - return "User {$this->userid} has updated a glossary entry with id {$this->objectid}."; + return "The user with the id '$this->userid' has updated the glossary entry with the id '$this->objectid' in " . + "the glossary activity with the course module id '$this->contextinstanceid'."; } /** diff --git a/mod/glossary/classes/event/entry_viewed.php b/mod/glossary/classes/event/entry_viewed.php index da335492fb4..bdb99a58afb 100644 --- a/mod/glossary/classes/event/entry_viewed.php +++ b/mod/glossary/classes/event/entry_viewed.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * mod_glossary entry viwed event. + * The mod_glossary entry viwed event. * * @package mod_glossary * @copyright 2014 Marina Glancy @@ -26,7 +26,7 @@ namespace mod_glossary\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_glossary entry viewed event. + * The mod_glossary entry viewed event class. * * Triggered when glossary entry is autolinked and viewed by user from another context. * @@ -60,7 +60,8 @@ class entry_viewed extends \core\event\base { * @return string */ public function get_description() { - return "User {$this->userid} has viewed a glossary entry with id {$this->objectid}."; + return "The user with the id '$this->userid' has viewed the glossary entry with the id '$this->objectid' in " . + "the glossary activity with the course module id '$this->contextinstanceid'."; } /** diff --git a/mod/imscp/classes/event/course_module_instance_list_viewed.php b/mod/imscp/classes/event/course_module_instance_list_viewed.php index d2d03ddcd5d..786ef1c8d8f 100644 --- a/mod/imscp/classes/event/course_module_instance_list_viewed.php +++ b/mod/imscp/classes/event/course_module_instance_list_viewed.php @@ -18,7 +18,6 @@ * The mod_imscp instance list viewed event. * * @package mod_imscp - * @since Moodle 2.7 * @copyright 2014 Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -27,6 +26,14 @@ namespace mod_imscp\event; defined('MOODLE_INTERNAL') || die(); +/** + * The mod_imscp instance list viewed event class. + * + * @package mod_imscp + * @since Moodle 2.7 + * @copyright 2014 Mark Nelson + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class course_module_instance_list_viewed extends \core\event\course_module_instance_list_viewed { // No code required here as the parent class handles it all. } diff --git a/mod/imscp/classes/event/course_module_viewed.php b/mod/imscp/classes/event/course_module_viewed.php index bd978aaacdb..5a1681ffbc1 100644 --- a/mod/imscp/classes/event/course_module_viewed.php +++ b/mod/imscp/classes/event/course_module_viewed.php @@ -27,6 +27,14 @@ namespace mod_imscp\event; defined('MOODLE_INTERNAL') || die(); +/** + * The mod_imscp course module viewed event class. + * + * @package mod_imscp + * @since Moodle 2.7 + * @copyright 2014 Mark Nelson + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class course_module_viewed extends \core\event\course_module_viewed { /** diff --git a/mod/lesson/classes/event/course_module_instance_list_viewed.php b/mod/lesson/classes/event/course_module_instance_list_viewed.php index 04d9d894554..d582a7c5f84 100644 --- a/mod/lesson/classes/event/course_module_instance_list_viewed.php +++ b/mod/lesson/classes/event/course_module_instance_list_viewed.php @@ -15,10 +15,9 @@ // along with Moodle. If not, see . /** - * Event for when all lesson instances for a course are viewed. + * The mod_lesson instance list viewed event. * * @package mod_lesson - * @since Moodle 2.7 * @copyright 2013 Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -27,6 +26,14 @@ namespace mod_lesson\event; defined('MOODLE_INTERNAL') || die(); +/** + * The mod_lesson instance list viewed event class. + * + * @package mod_lesson + * @since Moodle 2.7 + * @copyright 2013 Mark Nelson + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class course_module_instance_list_viewed extends \core\event\course_module_instance_list_viewed { // No code required here as the parent class handles it all. } diff --git a/mod/lesson/classes/event/course_module_viewed.php b/mod/lesson/classes/event/course_module_viewed.php index 9d2e16e95ad..8b7992bdea7 100644 --- a/mod/lesson/classes/event/course_module_viewed.php +++ b/mod/lesson/classes/event/course_module_viewed.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * Course module viewed event. + * The mod_lesson course module viewed event. * * @package mod_lesson * @since Moodle 2.7 @@ -27,6 +27,14 @@ namespace mod_lesson\event; defined('MOODLE_INTERNAL') || die(); +/** + * The mod_lesson course module viewed event class. + * + * @package mod_lesson + * @since Moodle 2.7 + * @copyright 2013 Mark Nelson + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class course_module_viewed extends \core\event\course_module_viewed { /** diff --git a/mod/lesson/classes/event/essay_assessed.php b/mod/lesson/classes/event/essay_assessed.php index e8a723bd8a1..af3bfcc8de1 100644 --- a/mod/lesson/classes/event/essay_assessed.php +++ b/mod/lesson/classes/event/essay_assessed.php @@ -15,10 +15,9 @@ // along with Moodle. If not, see . /** - * mod_lesson essay assessed event. + * The mod_lesson essay assessed event. * * @package mod_lesson - * @since Moodle 2.7 * @copyright 2014 Adrian Greeve * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -28,16 +27,17 @@ namespace mod_lesson\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_lesson essay assessed event class. + * The mod_lesson essay assessed event class. * * @property-read array $other { * Extra information about the event. * - * @type int lessonid The ID of the lesson. - * @type int attemptid The ID for the attempt. + * - int lessonid: The ID of the lesson. + * - int attemptid: The ID for the attempt. * } * * @package mod_lesson + * @since Moodle 2.7 * @copyright 2014 Adrian Greeve * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -60,8 +60,8 @@ class essay_assessed extends \core\event\base { * @return string */ public function get_description() { - return 'User ' . $this->userid . ' has marked the essay ' . $this->other['attemptid'] - . ' and recorded a mark ' . $this->objectid . ' in the lesson ' . $this->other['lessonid'] . '.'; + return "The user with the id '$this->userid' has marked the essay with the id '{$this->other['attemptid']}' and " . + "recorded a mark '$this->objectid' in the lesson with the course module id '$this->contextinstanceid'."; } /** @@ -102,13 +102,13 @@ class essay_assessed extends \core\event\base { protected function validate_data() { parent::validate_data(); if (!isset($this->relateduserid)) { - throw new \coding_exception('relateduserid is a mandatory property.'); + throw new \coding_exception('The \'relateduserid\' must be set.'); } if (!isset($this->other['lessonid'])) { - throw new \coding_exception('lessonid is a mandatory property.'); + throw new \coding_exception('The \'lessonid\' value must be set in other.'); } if (!isset($this->other['attemptid'])) { - throw new \coding_exception('attemptid is a mandatory property.'); + throw new \coding_exception('The \'attemptid\' value must be set in other.'); } } } diff --git a/mod/lesson/classes/event/essay_attempt_viewed.php b/mod/lesson/classes/event/essay_attempt_viewed.php index 1b5c1d8ada6..92d34f969f0 100644 --- a/mod/lesson/classes/event/essay_attempt_viewed.php +++ b/mod/lesson/classes/event/essay_attempt_viewed.php @@ -15,10 +15,9 @@ // along with Moodle. If not, see . /** - * Event to be triggered when the an essay attempt is viewed + * The mod_lesson essay attempt viewed event. * * @package mod_lesson - * @since Moodle 2.7 * @copyright 2013 Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. */ @@ -27,6 +26,14 @@ namespace mod_lesson\event; defined('MOODLE_INTERNAL') || die(); +/** + * The mod_lesson essay attempt viewed event class. + * + * @package mod_lesson + * @since Moodle 2.7 + * @copyright 2013 Mark Nelson + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ class essay_attempt_viewed extends \core\event\base { /** @@ -63,8 +70,9 @@ class essay_attempt_viewed extends \core\event\base { * @return string */ public function get_description() { - return 'The essay grade for the user with the id ' . $this->relateduserid . ' for the attempt with the id ' . - $this->objectid . ' was viewed by the user with the id ' . $this->userid; + return "The essay grade for the user with the id '$this->relateduserid' for the attempt with the id " . + "'$this->objectid' was viewed by the user with the id '$this->userid' for the lesson activity with the " . + "course module id '$this->contextinstanceid'."; } /** diff --git a/mod/lesson/classes/event/highscore_added.php b/mod/lesson/classes/event/highscore_added.php index b8cd4aaad51..969a745df7d 100644 --- a/mod/lesson/classes/event/highscore_added.php +++ b/mod/lesson/classes/event/highscore_added.php @@ -15,10 +15,9 @@ // along with Moodle. If not, see . /** - * Event to be triggered when a highscore is added. + * The mod_lesson highscore added event. * * @package mod_lesson - * @since Moodle 2.7 * @copyright 2013 Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. */ @@ -28,7 +27,7 @@ namespace mod_lesson\event; defined('MOODLE_INTERNAL') || die(); /** - * Event to be triggered when a highscore is added. + * The mod_lesson highscore added event class. * * @property-read array $other { * Extra information about event. diff --git a/mod/lesson/classes/event/highscores_viewed.php b/mod/lesson/classes/event/highscores_viewed.php index bc1141d4ca8..2c644097a57 100644 --- a/mod/lesson/classes/event/highscores_viewed.php +++ b/mod/lesson/classes/event/highscores_viewed.php @@ -15,10 +15,9 @@ // along with Moodle. If not, see . /** - * Event to be triggered when the highscores are viewed. + * The mod_lesson highscores viewed. * * @package mod_lesson - * @since Moodle 2.7 * @copyright 2013 Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. */ @@ -27,6 +26,14 @@ namespace mod_lesson\event; defined('MOODLE_INTERNAL') || die(); +/** + * The mod_lesson highscores viewed class. + * + * @package mod_lesson + * @since Moodle 2.7 + * @copyright 2013 Mark Nelson + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ class highscores_viewed extends \core\event\base { /** @@ -62,7 +69,8 @@ class highscores_viewed extends \core\event\base { * @return string */ public function get_description() { - return 'The highscores for lesson ' . $this->objectid . ' were viewed by ' . $this->userid; + return "The user with the id '$this->userid' viewed the highscores for the lesson activity with the course module " . + "id '$this->contextinstanceid'."; } /** diff --git a/mod/lesson/classes/event/lesson_ended.php b/mod/lesson/classes/event/lesson_ended.php index 0e7a636b77e..ab1c87bd3cd 100644 --- a/mod/lesson/classes/event/lesson_ended.php +++ b/mod/lesson/classes/event/lesson_ended.php @@ -15,10 +15,9 @@ // along with Moodle. If not, see . /** - * Event to be triggered when a lesson is ended. + * The mod_lesson lesson ended event. * * @package mod_lesson - * @since Moodle 2.7 * @copyright 2013 Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. */ @@ -27,6 +26,15 @@ namespace mod_lesson\event; defined('MOODLE_INTERNAL') || die(); +/** + * The mod_lesson lesson ended event class. + * + * @package mod_lesson + * @since Moodle 2.7 + * @copyright 2013 Mark Nelson + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + class lesson_ended extends \core\event\base { /** @@ -62,7 +70,7 @@ class lesson_ended extends \core\event\base { * @return string */ public function get_description() { - return 'The lesson ' . $this->objectid . ' was ended by the user ' . $this->userid; + return "The user with the id '$this->userid' ended the lesson with the course module id '$this->contextinstanceid'."; } /** diff --git a/mod/lesson/classes/event/lesson_started.php b/mod/lesson/classes/event/lesson_started.php index 2be55b61bee..4021811e21f 100644 --- a/mod/lesson/classes/event/lesson_started.php +++ b/mod/lesson/classes/event/lesson_started.php @@ -15,10 +15,9 @@ // along with Moodle. If not, see . /** - * Event to be triggered when a lesson is started. + * The mod_lesson lesson started event. * * @package mod_lesson - * @since Moodle 2.7 * @copyright 2013 Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. */ @@ -27,6 +26,14 @@ namespace mod_lesson\event; defined('MOODLE_INTERNAL') || die(); +/** + * The mod_lesson lesson started event class. + * + * @package mod_lesson + * @since Moodle 2.7 + * @copyright 2013 Mark Nelson + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ class lesson_started extends \core\event\base { /** @@ -62,7 +69,7 @@ class lesson_started extends \core\event\base { * @return string */ public function get_description() { - return 'The lesson ' . $this->objectid . ' was started by the user ' . $this->userid; + return "The user with the id '$this->userid' started the lesson with the course module id '$this->contextinstanceid'."; } /** diff --git a/mod/lti/classes/event/course_module_instance_list_viewed.php b/mod/lti/classes/event/course_module_instance_list_viewed.php index cf1995aaf03..ddfcb30afaa 100644 --- a/mod/lti/classes/event/course_module_instance_list_viewed.php +++ b/mod/lti/classes/event/course_module_instance_list_viewed.php @@ -18,7 +18,6 @@ * The mod_lti instance list viewed event. * * @package mod_lti - * @since Moodle 2.7 * @copyright 2013 Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -27,6 +26,15 @@ namespace mod_lti\event; defined('MOODLE_INTERNAL') || die(); +/** + * The mod_lti instance list viewed event class. + * + * @package mod_lti + * @since Moodle 2.7 + * @copyright 2013 Mark Nelson + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + class course_module_instance_list_viewed extends \core\event\course_module_instance_list_viewed { // No need for any code here as everything is handled by the parent class. } diff --git a/mod/lti/classes/event/course_module_viewed.php b/mod/lti/classes/event/course_module_viewed.php index 781a12e75b2..a42d007ec41 100644 --- a/mod/lti/classes/event/course_module_viewed.php +++ b/mod/lti/classes/event/course_module_viewed.php @@ -18,7 +18,6 @@ * The mod_lti course module viewed event. * * @package mod_lti - * @since Moodle 2.7 * @copyright 2013 Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -27,6 +26,14 @@ namespace mod_lti\event; defined('MOODLE_INTERNAL') || die(); +/** + * The mod_lti course module viewed event class. + * + * @package mod_lti + * @since Moodle 2.7 + * @copyright 2013 Mark Nelson + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class course_module_viewed extends \core\event\course_module_viewed { /** diff --git a/mod/lti/classes/event/unknown_service_api_called.php b/mod/lti/classes/event/unknown_service_api_called.php index 9f66c6cceb1..9a3c06acc1c 100644 --- a/mod/lti/classes/event/unknown_service_api_called.php +++ b/mod/lti/classes/event/unknown_service_api_called.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * This file contains an event for an unknown service API call. + * The mod_lti unknown service api called event. * * @package mod_lti * @copyright 2013 Adrian Greeve @@ -26,18 +26,10 @@ namespace mod_lti\event; defined('MOODLE_INTERNAL') || die(); /** + * The mod_lti unknown service api called event class. + * * Event for when something happens with an unknown lti service API call. * - * @property-read array $other { - * Extra information about event. - * - * @type string body raw body. - * @type string messageid id of message. - * @type string messagetype type of message. - * @type string consumerkey key of consumer. - * @type string sharedsecret shared secret key. - * } - * * @package mod_lti * @since Moodle 2.6 * @copyright 2013 Adrian Greeve diff --git a/mod/page/classes/event/course_module_instance_list_viewed.php b/mod/page/classes/event/course_module_instance_list_viewed.php index cd91bc8987f..c92e8953bd1 100644 --- a/mod/page/classes/event/course_module_instance_list_viewed.php +++ b/mod/page/classes/event/course_module_instance_list_viewed.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * mod_page course module instance list viewed event. + * The mod_page instance list viewed event. * * @package mod_page * @copyright 2013 Ankit Agarwal @@ -26,7 +26,7 @@ namespace mod_page\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_page course module instance list event class. + * The mod_page instance list viewed event class. * * @package mod_page * @since Moodle 2.7 diff --git a/mod/page/classes/event/course_module_viewed.php b/mod/page/classes/event/course_module_viewed.php index 26881d723bc..c61cbe374af 100644 --- a/mod/page/classes/event/course_module_viewed.php +++ b/mod/page/classes/event/course_module_viewed.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * This file contains an event for when a page activity is viewed. + * The mod_page course module viewed event. * * @package mod_page * @copyright 2013 Ankit Agarwal @@ -26,7 +26,7 @@ namespace mod_page\event; defined('MOODLE_INTERNAL') || die(); /** - * Event for when a page activity is viewed. + * The mod_page course module viewed event class. * * @package mod_page * @since Moodle 2.6 diff --git a/mod/quiz/classes/event/attempt_abandoned.php b/mod/quiz/classes/event/attempt_abandoned.php index 1b7e63cfb91..58942b904f9 100644 --- a/mod/quiz/classes/event/attempt_abandoned.php +++ b/mod/quiz/classes/event/attempt_abandoned.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * Quiz module event class. + * The mod_quiz attempt abandoned event. * * @package mod_quiz * @copyright 2013 Adrian Greeve @@ -25,12 +25,13 @@ namespace mod_quiz\event; defined('MOODLE_INTERNAL') || die(); /** - * Event for when a quiz attempt is abandoned. + * The mod_quiz attempt abandoned event class. * * @property-read array $other { * Extra information about event. * - * @type int submitterid id of submitter. + * - int submitterid: id of submitter (null when trigged by CLI script). + * - int quizid: id of the quiz. * } * * @package mod_quiz @@ -55,8 +56,8 @@ class attempt_abandoned extends \core\event\base { * @return string */ public function get_description() { - return 'A quiz with the id of ' . $this->other['quizid'] . ' has been marked as abandoned for the user with the id of ' . - $this->relateduserid; + return "The user with the id '$this->relateduserid' has had their attempt with the id '$this->objectid' marked as abandoned " . + "for the quiz with the course module id '$this->contextinstanceid'."; } /** @@ -110,13 +111,19 @@ class attempt_abandoned extends \core\event\base { /** * Custom validation. + * + * @throws \coding_exception + * @return void */ protected function validate_data() { parent::validate_data(); + + if (!isset($this->relateduserid)) { + throw new \coding_exception('The \'relateduserid\' must be set.'); + } + if (!array_key_exists('submitterid', $this->other)) { - throw new \coding_exception('Other must contain the key submitterid'); - } else if (!isset($this->relateduserid)) { - throw new \coding_exception('relateduserid must be set'); + throw new \coding_exception('The \'submitterid\' value must be set in other.'); } } } diff --git a/mod/quiz/classes/event/attempt_becameoverdue.php b/mod/quiz/classes/event/attempt_becameoverdue.php index f8269822776..50ee1154551 100644 --- a/mod/quiz/classes/event/attempt_becameoverdue.php +++ b/mod/quiz/classes/event/attempt_becameoverdue.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * Quiz module event class. + * The mod_quiz attempt became overdue event. * * @package mod_quiz * @copyright 2013 Adrian Greeve @@ -25,7 +25,7 @@ namespace mod_quiz\event; defined('MOODLE_INTERNAL') || die(); /** - * Event for when a quiz attempt is overdue. + * The mod_quiz attempt became overdue event class. * * Please note that the name of this event is not following the event naming convention. * Its name should not be used as a reference for other events to be created. @@ -33,7 +33,8 @@ defined('MOODLE_INTERNAL') || die(); * @property-read array $other { * Extra information about event. * - * @type int submitterid id of submitter. + * - int submitterid: id of submitter (null when trigged by CLI script). + * - int quizid: the id of the quiz. * } * * @package mod_quiz @@ -58,8 +59,7 @@ class attempt_becameoverdue extends \core\event\base { * @return string */ public function get_description() { - return 'A quiz with the id of ' . $this->other['quizid'] . ' has been marked as overdue for the user with ' . - 'the id of '. $this->relateduserid; + } /** @@ -118,10 +118,13 @@ class attempt_becameoverdue extends \core\event\base { */ protected function validate_data() { parent::validate_data(); + + if (!isset($this->relateduserid)) { + throw new \coding_exception('The \'relateduserid\' must be set.'); + } + if (!array_key_exists('submitterid', $this->other)) { - throw new \coding_exception('Other must contain the key submitterid'); - } else if (!isset($this->relateduserid)) { - throw new \coding_exception('relateduserid must be set'); + throw new \coding_exception('The \'submitterid\' value must be set in other.'); } } } diff --git a/mod/quiz/classes/event/attempt_deleted.php b/mod/quiz/classes/event/attempt_deleted.php index 7b4f9d30819..9d04251e8c5 100644 --- a/mod/quiz/classes/event/attempt_deleted.php +++ b/mod/quiz/classes/event/attempt_deleted.php @@ -15,10 +15,9 @@ // along with Moodle. If not, see . /** - * Attempt deleted event class. + * The mod_quiz attempt deleted event. * * @package mod_quiz - * @since Moodle 2.7 * @copyright 2014 Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -26,6 +25,14 @@ namespace mod_quiz\event; defined('MOODLE_INTERNAL') || die(); +/** + * The mod_quiz attempt deleted event class. + * + * @package mod_quiz + * @since Moodle 2.7 + * @copyright 2014 Mark Nelson + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class attempt_deleted extends \core\event\base { /** @@ -52,8 +59,8 @@ class attempt_deleted extends \core\event\base { * @return string */ public function get_description() { - return 'A quiz attempt with the id of ' . $this->objectid . ' belonging to the quiz with the id ' . $this->other['quizid'] . - ' for the user with the id ' . $this->relateduserid . ' was deleted by a user with the id ' . $this->userid; + return "The user with the id '$this->userid' deleted the attempt with the id '$this->objectid' belonging to the quiz " . + "with the course module id '$this->contextinstanceid' for the user with the id '$this->relateduserid'."; } /** @@ -89,7 +96,7 @@ class attempt_deleted extends \core\event\base { } if (!isset($this->other['quizid'])) { - throw new \coding_exception('The \'quizid\' must be set in other.'); + throw new \coding_exception('The \'quizid\' value must be set in other.'); } } } diff --git a/mod/quiz/classes/event/attempt_preview_started.php b/mod/quiz/classes/event/attempt_preview_started.php index fc352a2f61f..02247621d52 100644 --- a/mod/quiz/classes/event/attempt_preview_started.php +++ b/mod/quiz/classes/event/attempt_preview_started.php @@ -15,7 +15,19 @@ // along with Moodle. If not, see . /** - * Attempt preview started event class. + * The mod_quiz attempt preview started event. + * + * @package mod_quiz + * @copyright 2014 Mark Nelson + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +namespace mod_quiz\event; + +defined('MOODLE_INTERNAL') || die(); + +/** + * The mod_quiz attempt preview started event class. * * @property-read array $other { * Extra information about event. @@ -28,10 +40,6 @@ * @copyright 2014 Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -namespace mod_quiz\event; - -defined('MOODLE_INTERNAL') || die(); - class attempt_preview_started extends \core\event\base { /** @@ -58,8 +66,8 @@ class attempt_preview_started extends \core\event\base { * @return string */ public function get_description() { - return 'A quiz attempt with the id of ' . $this->objectid . ' belonging to the quiz with the id ' . $this->other['quizid'] . - ' was previewed by the user with the id ' . $this->relateduserid; + return "The user with the id '$this->relateduserid' has had their attempt with the id '$this->objectid' previewed by " . + "the user with the id '$this->userid' for the quiz with the course module id '$this->contextinstanceid'."; } /** @@ -95,7 +103,7 @@ class attempt_preview_started extends \core\event\base { } if (!isset($this->other['quizid'])) { - throw new \coding_exception('The \'quizid\' must be set in other.'); + throw new \coding_exception('The \'quizid\' value must be set in other.'); } } } diff --git a/mod/quiz/classes/event/attempt_reviewed.php b/mod/quiz/classes/event/attempt_reviewed.php index dd46467ef9b..4a8fb9a01fa 100644 --- a/mod/quiz/classes/event/attempt_reviewed.php +++ b/mod/quiz/classes/event/attempt_reviewed.php @@ -15,7 +15,18 @@ // along with Moodle. If not, see . /** - * Attempt reviewed event class. + * The mod_quiz attempt reviewed event. + * + * @package mod_quiz + * @copyright 2014 Mark Nelson + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +namespace mod_quiz\event; + +defined('MOODLE_INTERNAL') || die(); + +/** + * The mod_quiz attempt reviewed event class. * * @property-read array $other { * Extra information about event. @@ -28,10 +39,6 @@ * @copyright 2014 Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -namespace mod_quiz\event; - -defined('MOODLE_INTERNAL') || die(); - class attempt_reviewed extends \core\event\base { /** @@ -58,8 +65,8 @@ class attempt_reviewed extends \core\event\base { * @return string */ public function get_description() { - return 'A quiz attempt with the id of ' . $this->objectid . ' for the quiz with the id ' . $this->other['quizid'] . - ' belonging to a user with the id ' . $this->relateduserid . ' was reviewed by a user with the id ' . $this->userid; + return "The user with the id '$this->userid' has had their attempt with the id '$this->objectid' reviewed by the user " . + "with the id '$this->relateduserid' for the quiz with the course module id '$this->contextinstanceid'."; } /** @@ -95,7 +102,7 @@ class attempt_reviewed extends \core\event\base { } if (!isset($this->other['quizid'])) { - throw new \coding_exception('The \'quizid\' must be set in other.'); + throw new \coding_exception('The \'quizid\' value must be set in other.'); } } } diff --git a/mod/quiz/classes/event/attempt_started.php b/mod/quiz/classes/event/attempt_started.php index edccb6183fb..6aa7dba56ad 100644 --- a/mod/quiz/classes/event/attempt_started.php +++ b/mod/quiz/classes/event/attempt_started.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * Quiz module event class. + * The mod_quiz attempt started event. * * @package mod_quiz * @copyright 2013 Adrian Greeve @@ -25,7 +25,7 @@ namespace mod_quiz\event; defined('MOODLE_INTERNAL') || die(); /** - * Event for when a quiz attempt is started. + * The mod_quiz attempt started event class. * * @package mod_quiz * @since Moodle 2.6 @@ -49,8 +49,8 @@ class attempt_started extends \core\event\base { * @return string */ public function get_description() { - return 'A quiz with the id of ' . $this->other['quizid'] . ' was started by a user with the id ' . - $this->relateduserid . '.'; + return "The user with the id '$this->relateduserid' has started the attempt with the id '$this->objectid' for the " . + "quiz with the course module id '$this->contextinstanceid'."; } /** @@ -122,7 +122,7 @@ class attempt_started extends \core\event\base { protected function validate_data() { parent::validate_data(); if (!isset($this->relateduserid)) { - throw new \coding_exception('relateduserid must be set'); + throw new \coding_exception('The \'relateduserid\' must be set.'); } } } diff --git a/mod/quiz/classes/event/attempt_submitted.php b/mod/quiz/classes/event/attempt_submitted.php index 244ba0f56f7..7248ad51656 100644 --- a/mod/quiz/classes/event/attempt_submitted.php +++ b/mod/quiz/classes/event/attempt_submitted.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * Quiz module event class. + * The mod_quiz attempt submitted event. * * @package mod_quiz * @copyright 2013 Adrian Greeve @@ -25,12 +25,13 @@ namespace mod_quiz\event; defined('MOODLE_INTERNAL') || die(); /** - * Event for when a quiz attempt is submitted. + * The mod_quiz attempt submitted event class. * * @property-read array $other { * Extra information about event. * - * @type int submitterid id of submitter. + * - int submitterid: id of submitter (null when trigged by CLI script). + * - int quizid: the id of the quiz. * } * * @package mod_quiz @@ -55,8 +56,8 @@ class attempt_submitted extends \core\event\base { * @return string */ public function get_description() { - return 'A quiz with the id of ' . $this->other['quizid'] . ' has been marked as submitted for the user with the id of ' . - $this->relateduserid; + return "The user with the id '$this->relateduserid' has submitted the attempt with the id '$this->objectid' for the " . + "quiz with the course module id '$this->contextinstanceid'."; } /** @@ -116,10 +117,13 @@ class attempt_submitted extends \core\event\base { */ protected function validate_data() { parent::validate_data(); + + if (!isset($this->relateduserid)) { + throw new \coding_exception('The \'relateduserid\' must be set.'); + } + if (!array_key_exists('submitterid', $this->other)) { - throw new \coding_exception('Other must contain the key submitterid'); - } else if (!isset($this->relateduserid)) { - throw new \coding_exception('relateduserid must be set'); + throw new \coding_exception('The \'submitterid\' value must be set in other.'); } } } diff --git a/mod/quiz/classes/event/attempt_summary_viewed.php b/mod/quiz/classes/event/attempt_summary_viewed.php index 2b110ad5fb3..c6c4aa1cad0 100644 --- a/mod/quiz/classes/event/attempt_summary_viewed.php +++ b/mod/quiz/classes/event/attempt_summary_viewed.php @@ -15,7 +15,19 @@ // along with Moodle. If not, see . /** - * Attempt summary viewed event. + * The mod_quiz attempt summary viewed event. + * + * @package mod_quiz + * @copyright 2014 Mark Nelson + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +namespace mod_quiz\event; + +defined('MOODLE_INTERNAL') || die(); + +/** + * The mod_quiz attempt summary viewed event class. * * @property-read array $other { * Extra information about event. @@ -28,11 +40,6 @@ * @copyright 2014 Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ - -namespace mod_quiz\event; - -defined('MOODLE_INTERNAL') || die(); - class attempt_summary_viewed extends \core\event\base { /** @@ -61,8 +68,8 @@ class attempt_summary_viewed extends \core\event\base { * @return string */ public function get_description() { - return 'The summary for the quiz attempt with the id of ' . $this->objectid . ' belonging to a user with the id ' . - $this->relateduserid . ' was viewed by a user with the id ' . $this->userid; + return "The user with the id '$this->userid' has viewed the summary for the attempt with the id '$this->objectid' belonging " . + "to the user with the id '$this->relateduserid' for the quiz with the course module id '$this->contextinstanceid'."; } /** diff --git a/mod/quiz/classes/event/attempt_viewed.php b/mod/quiz/classes/event/attempt_viewed.php index a9620ffbe78..209f66487ab 100644 --- a/mod/quiz/classes/event/attempt_viewed.php +++ b/mod/quiz/classes/event/attempt_viewed.php @@ -15,7 +15,19 @@ // along with Moodle. If not, see . /** - * Attempt viewed event class. + * The mod_quiz attempt viewed event. + * + * @package mod_quiz + * @copyright 2014 Mark Nelson + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +namespace mod_quiz\event; + +defined('MOODLE_INTERNAL') || die(); + +/** + * The mod_quiz attempt viewed event class. * * @property-read array $other { * Extra information about event. @@ -28,10 +40,6 @@ * @copyright 2014 Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -namespace mod_quiz\event; - -defined('MOODLE_INTERNAL') || die(); - class attempt_viewed extends \core\event\base { /** @@ -58,8 +66,8 @@ class attempt_viewed extends \core\event\base { * @return string */ public function get_description() { - return 'A quiz attempt with the id of ' . $this->objectid . ' belonging to the quiz with the id ' . $this->other['quizid'] . - ' was viewed by the user with the id ' . $this->relateduserid; + return "The user with the id '$this->userid' has viewed the attempt with the id '$this->objectid' belonging to the user " . + "with the id '$this->relateduserid' for the quiz with the course module id '$this->contextinstanceid'."; } /** @@ -95,7 +103,7 @@ class attempt_viewed extends \core\event\base { } if (!isset($this->other['quizid'])) { - throw new \coding_exception('The \'quizid\' must be set in other.'); + throw new \coding_exception('The \'quizid\' value must be set in other.'); } } } diff --git a/mod/quiz/classes/event/course_module_instance_list_viewed.php b/mod/quiz/classes/event/course_module_instance_list_viewed.php index 1218cff9b23..b547120e924 100644 --- a/mod/quiz/classes/event/course_module_instance_list_viewed.php +++ b/mod/quiz/classes/event/course_module_instance_list_viewed.php @@ -15,10 +15,9 @@ // along with Moodle. If not, see . /** - * The instance list viewed event. + * The mod_quiz instance list viewed event. * * @package mod_quiz - * @since Moodle 2.7 * @copyright 2014 Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -27,6 +26,14 @@ namespace mod_quiz\event; defined('MOODLE_INTERNAL') || die(); +/** + * The mod_quiz instance list viewed event class. + * + * @package mod_quiz + * @since Moodle 2.7 + * @copyright 2014 Mark Nelson + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class course_module_instance_list_viewed extends \core\event\course_module_instance_list_viewed { // No code required here as the parent class handles it all. } diff --git a/mod/quiz/classes/event/course_module_viewed.php b/mod/quiz/classes/event/course_module_viewed.php index 4a1c3bbbaa7..f1977873fa6 100644 --- a/mod/quiz/classes/event/course_module_viewed.php +++ b/mod/quiz/classes/event/course_module_viewed.php @@ -15,10 +15,9 @@ // along with Moodle. If not, see . /** - * Course module viewed event. + * The mod_quiz course module viewed event. * * @package mod_quiz - * @since Moodle 2.7 * @copyright 2014 Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -27,6 +26,14 @@ namespace mod_quiz\event; defined('MOODLE_INTERNAL') || die(); +/** + * The mod_quiz course module viewed event class. + * + * @package mod_quiz + * @since Moodle 2.7 + * @copyright 2014 Mark Nelson + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class course_module_viewed extends \core\event\course_module_viewed { /** diff --git a/mod/quiz/classes/event/edit_page_viewed.php b/mod/quiz/classes/event/edit_page_viewed.php index 45a9501c63d..2d1e619ca7a 100644 --- a/mod/quiz/classes/event/edit_page_viewed.php +++ b/mod/quiz/classes/event/edit_page_viewed.php @@ -15,7 +15,19 @@ // along with Moodle. If not, see . /** - * Edit page viewed event class. + * The mod_quiz edit page viewed event. + * + * @package mod_quiz + * @copyright 2014 Mark Nelson + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +namespace mod_quiz\event; + +defined('MOODLE_INTERNAL') || die(); + +/** + * The mod_quiz edit page viewed event class. * * @property-read array $other { * Extra information about event. @@ -28,10 +40,6 @@ * @copyright 2014 Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -namespace mod_quiz\event; - -defined('MOODLE_INTERNAL') || die(); - class edit_page_viewed extends \core\event\base { /** @@ -57,8 +65,8 @@ class edit_page_viewed extends \core\event\base { * @return string */ public function get_description() { - return 'The edit quiz page belonging to the quiz with the id ' . $this->other['quizid'] . ' was viewed by the user - with the id ' . $this->userid; + return "The edit page for the quiz with the course module id '$this->contextinstanceid' was viewed by the user with " . + "the id '$this->userid'."; } /** @@ -90,7 +98,7 @@ class edit_page_viewed extends \core\event\base { parent::validate_data(); if (!isset($this->other['quizid'])) { - throw new \coding_exception('The \'quizid\' must be set in other.'); + throw new \coding_exception('The \'quizid\' value must be set in other.'); } } } diff --git a/mod/quiz/classes/event/group_override_created.php b/mod/quiz/classes/event/group_override_created.php index cac8c89e50c..d19d1fc031d 100644 --- a/mod/quiz/classes/event/group_override_created.php +++ b/mod/quiz/classes/event/group_override_created.php @@ -15,7 +15,19 @@ // along with Moodle. If not, see . /** - * Group override created event class. + * The mod_quiz group override created event. + * + * @package mod_quiz + * @copyright 2014 Mark Nelson + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +namespace mod_quiz\event; + +defined('MOODLE_INTERNAL') || die(); + +/** + * The mod_quiz group override created event class. * * @property-read array $other { * Extra information about event. @@ -29,10 +41,6 @@ * @copyright 2014 Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -namespace mod_quiz\event; - -defined('MOODLE_INTERNAL') || die(); - class group_override_created extends \core\event\base { /** @@ -59,8 +67,8 @@ class group_override_created extends \core\event\base { * @return string */ public function get_description() { - return 'An override with the id ' . $this->objectid . ' for the quiz with the id of ' . $this->other['quizid'] . - ' was created by the user with the id ' . $this->userid . ' for the group with the id ' . $this->other['groupid']; + return "The user with the id '$this->userid' created the override with the id '$this->objectid' for the quiz with the " . + "course module id '$this->contextinstanceid' for the group with the id '{$this->other['groupid']}'."; } /** @@ -82,11 +90,11 @@ class group_override_created extends \core\event\base { parent::validate_data(); if (!isset($this->other['quizid'])) { - throw new \coding_exception('The \'quizid\' must be set in other.'); + throw new \coding_exception('The \'quizid\' value must be set in other.'); } if (!isset($this->other['groupid'])) { - throw new \coding_exception('The \'groupid\' must be set in other.'); + throw new \coding_exception('The \'groupid\' value must be set in other.'); } } } diff --git a/mod/quiz/classes/event/group_override_deleted.php b/mod/quiz/classes/event/group_override_deleted.php index f1304bb6c64..64e953acc13 100644 --- a/mod/quiz/classes/event/group_override_deleted.php +++ b/mod/quiz/classes/event/group_override_deleted.php @@ -15,7 +15,18 @@ // along with Moodle. If not, see . /** - * Group override deleted event class. + * The mod_quiz group override deleted event. + * + * @package mod_quiz + * @copyright 2014 Mark Nelson + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +namespace mod_quiz\event; + +defined('MOODLE_INTERNAL') || die(); + +/** + * The mod_quiz group override deleted event class. * * @property-read array $other { * Extra information about event. @@ -29,10 +40,6 @@ * @copyright 2014 Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -namespace mod_quiz\event; - -defined('MOODLE_INTERNAL') || die(); - class group_override_deleted extends \core\event\base { /** @@ -59,8 +66,8 @@ class group_override_deleted extends \core\event\base { * @return string */ public function get_description() { - return 'An override with the id ' . $this->objectid . ' for the quiz with the id of ' . $this->other['quizid'] . - ' was deleted by the user with the id ' . $this->userid . ' for the group with the id ' . $this->other['groupid']; + return "The user with the id '$this->userid' deleted the override with the id '$this->objectid' for the quiz with the " . + "course module id '$this->contextinstanceid' for the group with the id '{$this->other['groupid']}'."; } /** @@ -92,11 +99,11 @@ class group_override_deleted extends \core\event\base { parent::validate_data(); if (!isset($this->other['quizid'])) { - throw new \coding_exception('The \'quizid\' must be set in other.'); + throw new \coding_exception('The \'quizid\' value must be set in other.'); } if (!isset($this->other['groupid'])) { - throw new \coding_exception('The \'groupid\' must be set in other.'); + throw new \coding_exception('The \'groupid\' value must be set in other.'); } } } diff --git a/mod/quiz/classes/event/group_override_updated.php b/mod/quiz/classes/event/group_override_updated.php index 24942c407e9..1970a70ee44 100644 --- a/mod/quiz/classes/event/group_override_updated.php +++ b/mod/quiz/classes/event/group_override_updated.php @@ -15,7 +15,18 @@ // along with Moodle. If not, see . /** - * Group override updated event class. + * The mod_quiz group override updated event. + * + * @package mod_quiz + * @copyright 2014 Mark Nelson + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +namespace mod_quiz\event; + +defined('MOODLE_INTERNAL') || die(); + +/** + * The mod_quiz group override updated event class. * * @property-read array $other { * Extra information about event. @@ -29,10 +40,6 @@ * @copyright 2014 Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -namespace mod_quiz\event; - -defined('MOODLE_INTERNAL') || die(); - class group_override_updated extends \core\event\base { /** @@ -59,8 +66,8 @@ class group_override_updated extends \core\event\base { * @return string */ public function get_description() { - return 'An override with the id ' . $this->objectid . ' for the quiz with the id of ' . $this->other['quizid'] . - ' was updated by the user with the id ' . $this->userid . ' for the group with the id ' . $this->other['groupid']; + return "The user with the id '$this->userid' updated the override with the id '$this->objectid' for the quiz with the " . + "course module id '$this->contextinstanceid' for the group with the id '{$this->other['groupid']}'."; } /** @@ -92,11 +99,11 @@ class group_override_updated extends \core\event\base { parent::validate_data(); if (!isset($this->other['quizid'])) { - throw new \coding_exception('The \'quizid\' must be set in other.'); + throw new \coding_exception('The \'quizid\' value must be set in other.'); } if (!isset($this->other['groupid'])) { - throw new \coding_exception('The \'groupid\' must be set in other.'); + throw new \coding_exception('The \'groupid\' value must be set in other.'); } } } diff --git a/mod/quiz/classes/event/question_manually_graded.php b/mod/quiz/classes/event/question_manually_graded.php index d6444dc922d..55aeaaa3338 100644 --- a/mod/quiz/classes/event/question_manually_graded.php +++ b/mod/quiz/classes/event/question_manually_graded.php @@ -15,7 +15,18 @@ // along with Moodle. If not, see . /** - * Question manually graded event class. + * The mod_quiz question manually graded event. + * + * @package core + * @copyright 2014 Mark Nelson + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +namespace mod_quiz\event; + +defined('MOODLE_INTERNAL') || die(); + +/** + * The mod_quiz question manually graded event class. * * @property-read array $other { * Extra information about event. @@ -30,10 +41,6 @@ * @copyright 2014 Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -namespace mod_quiz\event; - -defined('MOODLE_INTERNAL') || die(); - class question_manually_graded extends \core\event\base { /** @@ -60,8 +67,8 @@ class question_manually_graded extends \core\event\base { * @return string */ public function get_description() { - return 'A question with the id of ' . $this->objectid . ' was manually graded by a user with the id ' . $this->userid . - ' for the attempt with the id ' . $this->other['attemptid']; + return "The user with the id '$this->userid' manually graded the question with the id '$this->objectid' for the attempt " . + "with the id '{$this->other['attemptid']}' for the quiz with the course module id '$this->contextinstanceid'."; } /** @@ -94,15 +101,15 @@ class question_manually_graded extends \core\event\base { parent::validate_data(); if (!isset($this->other['quizid'])) { - throw new \coding_exception('The \'quizid\' must be set in other.'); + throw new \coding_exception('The \'quizid\' value must be set in other.'); } if (!isset($this->other['attemptid'])) { - throw new \coding_exception('The \'attemptid\' must be set in other.'); + throw new \coding_exception('The \'attemptid\' value must be set in other.'); } if (!isset($this->other['slot'])) { - throw new \coding_exception('The \'slot\' must be set in other.'); + throw new \coding_exception('The \'slot\' value must be set in other.'); } } diff --git a/mod/quiz/classes/event/report_viewed.php b/mod/quiz/classes/event/report_viewed.php index da2d3012fa0..9a51d509c36 100644 --- a/mod/quiz/classes/event/report_viewed.php +++ b/mod/quiz/classes/event/report_viewed.php @@ -15,7 +15,19 @@ // along with Moodle. If not, see . /** - * Report viewed event. + * The mod_quiz report viewed event. + * + * @package mod_quiz + * @copyright 2014 Mark Nelson + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +namespace mod_quiz\event; + +defined('MOODLE_INTERNAL') || die(); + +/** + * The mod_quiz report viewed event class. * * @property-read array $other { * Extra information about event. @@ -29,11 +41,6 @@ * @copyright 2014 Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ - -namespace mod_quiz\event; - -defined('MOODLE_INTERNAL') || die(); - class report_viewed extends \core\event\base { /** @@ -61,8 +68,8 @@ class report_viewed extends \core\event\base { * @return string */ public function get_description() { - return 'User with id ' . $this->userid . ' viewed the report \'' . s($this->other['reportname']) . '\' for the quiz - with the id ' . $this->other['quizid']; + return "The user with the id '$this->userid' viewed the report '" . s($this->other['reportname']) . "' for the quiz with " . + "the course module id '$this->contextinstanceid'."; } /** @@ -95,11 +102,11 @@ class report_viewed extends \core\event\base { parent::validate_data(); if (!isset($this->other['quizid'])) { - throw new \coding_exception('The \'quizid\' must be set in other.'); + throw new \coding_exception('The \'quizid\' value must be set in other.'); } if (!isset($this->other['reportname'])) { - throw new \coding_exception('The \'reportname\' must be set in other.'); + throw new \coding_exception('The \'reportname\' value must be set in other.'); } } } diff --git a/mod/quiz/classes/event/user_override_created.php b/mod/quiz/classes/event/user_override_created.php index 3a1eafb0431..1bc60a6010d 100644 --- a/mod/quiz/classes/event/user_override_created.php +++ b/mod/quiz/classes/event/user_override_created.php @@ -15,7 +15,18 @@ // along with Moodle. If not, see . /** - * User override created event class. + * The mod_quiz user override created event. + * + * @package mod_quiz + * @copyright 2014 Mark Nelson + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +namespace mod_quiz\event; + +defined('MOODLE_INTERNAL') || die(); + +/** + * The mod_quiz user override created event class. * * @property-read array $other { * Extra information about event. @@ -28,10 +39,6 @@ * @copyright 2014 Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -namespace mod_quiz\event; - -defined('MOODLE_INTERNAL') || die(); - class user_override_created extends \core\event\base { /** @@ -58,8 +65,8 @@ class user_override_created extends \core\event\base { * @return string */ public function get_description() { - return 'An override with the id ' . $this->objectid . ' for the quiz with the id of ' . $this->other['quizid'] . - ' was created by the user with the id ' . $this->userid . ' for the user with the id ' . $this->relateduserid; + return "The user with the id '$this->userid' created the override with the id '$this->objectid' for the quiz with the " . + "course module id '$this->contextinstanceid' for the user with the id '{$this->relateduserid}'."; } /** @@ -85,7 +92,7 @@ class user_override_created extends \core\event\base { } if (!isset($this->other['quizid'])) { - throw new \coding_exception('The \'quizid\' must be set in other.'); + throw new \coding_exception('The \'quizid\' value must be set in other.'); } } } diff --git a/mod/quiz/classes/event/user_override_deleted.php b/mod/quiz/classes/event/user_override_deleted.php index b441593014a..785e2f6f49d 100644 --- a/mod/quiz/classes/event/user_override_deleted.php +++ b/mod/quiz/classes/event/user_override_deleted.php @@ -15,7 +15,18 @@ // along with Moodle. If not, see . /** - * User override deleted event class. + * The mod_quiz user override deleted event. + * + * @package mod_quiz + * @copyright 2014 Mark Nelson + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +namespace mod_quiz\event; + +defined('MOODLE_INTERNAL') || die(); + +/** + * The mod_quiz user override deleted event class. * * @property-read array $other { * Extra information about event. @@ -28,10 +39,6 @@ * @copyright 2014 Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -namespace mod_quiz\event; - -defined('MOODLE_INTERNAL') || die(); - class user_override_deleted extends \core\event\base { /** @@ -58,8 +65,8 @@ class user_override_deleted extends \core\event\base { * @return string */ public function get_description() { - return 'An override with the id ' . $this->objectid . ' for the quiz with the id of ' . $this->other['quizid'] . - ' was deleted by the user with the id ' . $this->userid . ' for the user with the id ' . $this->relateduserid; + return "The user with the id '$this->userid' deleted the override with the id '$this->objectid' for the quiz with the " . + "course module id '$this->contextinstanceid' for the user with the id '{$this->relateduserid}'."; } /** @@ -95,7 +102,7 @@ class user_override_deleted extends \core\event\base { } if (!isset($this->other['quizid'])) { - throw new \coding_exception('The \'quizid\' must be set in other.'); + throw new \coding_exception('The \'quizid\' value must be set in other.'); } } } diff --git a/mod/quiz/classes/event/user_override_updated.php b/mod/quiz/classes/event/user_override_updated.php index 3c61d90d2a8..4932497760e 100644 --- a/mod/quiz/classes/event/user_override_updated.php +++ b/mod/quiz/classes/event/user_override_updated.php @@ -15,7 +15,19 @@ // along with Moodle. If not, see . /** - * User override updated event class. + * The mod_quiz user override updated event. + * + * @package mod_quiz + * @copyright 2014 Mark Nelson + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +namespace mod_quiz\event; + +defined('MOODLE_INTERNAL') || die(); + +/** + * The mod_quiz user override updated event class. * * @property-read array $other { * Extra information about event. @@ -28,10 +40,6 @@ * @copyright 2014 Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -namespace mod_quiz\event; - -defined('MOODLE_INTERNAL') || die(); - class user_override_updated extends \core\event\base { /** @@ -58,8 +66,8 @@ class user_override_updated extends \core\event\base { * @return string */ public function get_description() { - return 'An override with the id ' . $this->objectid . ' for the quiz with the id of ' . $this->other['quizid'] . - ' was updated by the user with the id ' . $this->userid . ' for the user with the id ' . $this->relateduserid; + return "The user with the id '$this->userid' updated the override with the id '$this->objectid' for the quiz with the " . + "course module id '$this->contextinstanceid' for the user with the id '{$this->relateduserid}'."; } /** @@ -95,7 +103,7 @@ class user_override_updated extends \core\event\base { } if (!isset($this->other['quizid'])) { - throw new \coding_exception('The \'quizid\' must be set in other.'); + throw new \coding_exception('The \'quizid\' value must be set in other.'); } } } diff --git a/mod/resource/classes/event/course_module_instance_list_viewed.php b/mod/resource/classes/event/course_module_instance_list_viewed.php index bedef052e95..76d310ec6c4 100644 --- a/mod/resource/classes/event/course_module_instance_list_viewed.php +++ b/mod/resource/classes/event/course_module_instance_list_viewed.php @@ -27,7 +27,7 @@ namespace mod_resource\event; defined('MOODLE_INTERNAL') || die(); /** - * The mod_resource instance list viewed event. + * The mod_resource instance list viewed event class. * * @package mod_resource * @since Moodle 2.7 diff --git a/mod/resource/classes/event/course_module_viewed.php b/mod/resource/classes/event/course_module_viewed.php index 82d500df975..880a0ae5b30 100644 --- a/mod/resource/classes/event/course_module_viewed.php +++ b/mod/resource/classes/event/course_module_viewed.php @@ -27,7 +27,7 @@ namespace mod_resource\event; defined('MOODLE_INTERNAL') || die(); /** - * The mod_resource course module viewed event. + * The mod_resource course module viewed event class. * * @package mod_resource * @since Moodle 2.7 diff --git a/mod/scorm/classes/event/attempt_deleted.php b/mod/scorm/classes/event/attempt_deleted.php index 3f35dfed15b..dd962f0f62b 100644 --- a/mod/scorm/classes/event/attempt_deleted.php +++ b/mod/scorm/classes/event/attempt_deleted.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * This file contains an event for when attempts are deleted. + * The mod_scorm attempt deleted event. * * @package mod_scorm * @copyright 2013 onwards Ankit Agarwal @@ -26,13 +26,14 @@ namespace mod_scorm\event; defined('MOODLE_INTERNAL') || die(); /** - * Event for when attempts are deleted. + * The mod_scorm attempt deleted event class. * * @property-read array $other { * Extra information about event properties. * - * @type int attemptid Attempt id. + * - int attemptid: Attempt id. * } + * * @package mod_scorm * @since Moodle 2.7 * @copyright 2013 onwards Ankit Agarwal @@ -54,7 +55,8 @@ class attempt_deleted extends \core\event\base { * @return string */ public function get_description() { - return 'User with id ' . $this->userid . ' deleted attempt for scorm activity with attemptid ' . $this->other['attemptid']; + return "The user with the id '$this->userid' deleted the attempt with the id '{$this->other['attemptid']}' " . + "for the scorm activity with the course module id '$this->contextinstanceid'."; } /** @@ -92,9 +94,10 @@ class attempt_deleted extends \core\event\base { * @return void */ protected function validate_data() { - if (empty($this->other['attemptid'])) { - throw new \coding_exception('The event must specify attemptid.'); - } parent::validate_data(); + + if (empty($this->other['attemptid'])) { + throw new \coding_exception('The \'attemptid\' must be set in other.'); + } } } diff --git a/mod/scorm/classes/event/course_module_instance_list_viewed.php b/mod/scorm/classes/event/course_module_instance_list_viewed.php index 47cb147af41..df33296939d 100644 --- a/mod/scorm/classes/event/course_module_instance_list_viewed.php +++ b/mod/scorm/classes/event/course_module_instance_list_viewed.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * mod_scorm course module instances list viewed event. + * The mod_scorm instance list viewed event. * * @package mod_scorm * @copyright 2013 Ankit Agarwal @@ -26,7 +26,7 @@ namespace mod_scorm\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_scorm course module instances list viewed event class. + * The mod_scorm instance list viewed event class. * * @package mod_scorm * @since Moodle 2.7 diff --git a/mod/scorm/classes/event/course_module_viewed.php b/mod/scorm/classes/event/course_module_viewed.php index 5e339a61735..e598045b489 100644 --- a/mod/scorm/classes/event/course_module_viewed.php +++ b/mod/scorm/classes/event/course_module_viewed.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * This file contains an event for when a scorm activity is viewed. + * The mod_scorm course module viewed event. * * @package mod_scorm * @copyright 2013 onwards Ankit Agarwal @@ -26,7 +26,7 @@ namespace mod_scorm\event; defined('MOODLE_INTERNAL') || die(); /** - * Event for when a scorm activity is viewed. + * The mod_scorm course module viewed event class. * * @package mod_scorm * @since Moodle 2.7 diff --git a/mod/scorm/classes/event/interactions_viewed.php b/mod/scorm/classes/event/interactions_viewed.php index 6ce455208c5..d816f4b31b8 100644 --- a/mod/scorm/classes/event/interactions_viewed.php +++ b/mod/scorm/classes/event/interactions_viewed.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * This file contains an event for when user interactions is viewed. + * The mod_scorm interactions viewed event. * * @package mod_scorm * @copyright 2013 onwards Ankit Agarwal @@ -26,14 +26,15 @@ namespace mod_scorm\event; defined('MOODLE_INTERNAL') || die(); /** - * Event for when a user interactions are viewed. + * The mod_scorm interactions viewed event class. * * @property-read array $other { * Extra information about event properties. * - * @type int attemptid Attempt id. - * @type int instanceid Instance id of the scorm activity. + * - int attemptid: Attempt id. + * - int instanceid: Instance id of the scorm activity. * } + * * @package mod_scorm * @since Moodle 2.7 * @copyright 2013 onwards Ankit Agarwal @@ -55,7 +56,8 @@ class interactions_viewed extends \core\event\base { * @return string */ public function get_description() { - return 'User with id ' . $this->userid . ' viewed interactions for user ' . $this->relateduserid; + return "The user with the id '$this->userid' viewed the interactions for the user with the id '$this->relateduserid' " . + "for the scorm activity with the course module id '$this->contextinstanceid'."; } /** @@ -100,11 +102,13 @@ class interactions_viewed extends \core\event\base { */ protected function validate_data() { parent::validate_data(); + if (empty($this->other['attemptid'])) { - throw new \coding_exception('The \\mod_scorm\\event\\interactions_viewed must specify attemptid.'); + throw new \coding_exception('The \'attemptid\' must be set in other.'); } + if (empty($this->other['instanceid'])) { - throw new \coding_exception('The \\mod_scorm\\event\\interactions_viewed must specify instanceid of the activity.'); + throw new \coding_exception('The \'instanceid\' must be set in other.'); } } } diff --git a/mod/scorm/classes/event/report_viewed.php b/mod/scorm/classes/event/report_viewed.php index 922cb758f84..f59a93c64d4 100644 --- a/mod/scorm/classes/event/report_viewed.php +++ b/mod/scorm/classes/event/report_viewed.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * This file contains an event for when a scorm report is viewed. + * The mod_scorm report viewed event. * * @package mod_scorm * @copyright 2013 onwards Ankit Agarwal @@ -26,13 +26,15 @@ namespace mod_scorm\event; defined('MOODLE_INTERNAL') || die(); /** - * Event for when a scorm report is viewed. + * The mod_scorm report viewed event class. * * @property-read array $other { * Extra information about event properties. * - * @string mode Mode of the report viewed. + * - int scormid: The ID of the scorm. + * - string mode: Mode of the report viewed. * } + * * @package mod_scorm * @since Moodle 2.7 * @copyright 2013 onwards Ankit Agarwal @@ -46,7 +48,6 @@ class report_viewed extends \core\event\base { protected function init() { $this->data['crud'] = 'r'; $this->data['edulevel'] = self::LEVEL_TEACHING; - $this->data['objecttable'] = 'scorm'; } /** @@ -55,8 +56,8 @@ class report_viewed extends \core\event\base { * @return string */ public function get_description() { - return 'User with id ' . $this->userid . ' viewed scorm report (' . $this->other['mode'] . ') with instanceid ' . - $this->objectid; + return "The user with the id '$this->userid' viewed the scorm report '{$this->other['mode']}' for the scorm with " . + "the course module id '$this->contextinstanceid'."; } /** @@ -84,7 +85,7 @@ class report_viewed extends \core\event\base { */ protected function get_legacy_logdata() { return array($this->courseid, 'scorm', 'report', 'report.php?id=' . $this->contextinstanceid . - '&mode=' . $this->other['mode'], $this->objectid, $this->contextinstanceid); + '&mode=' . $this->other['mode'], $this->other['scormid'], $this->contextinstanceid); } /** @@ -95,8 +96,9 @@ class report_viewed extends \core\event\base { */ protected function validate_data() { parent::validate_data(); + if (empty($this->other['mode'])) { - throw new \coding_exception('The event must specify mode to define which report was viewed.'); + throw new \coding_exception('The \'mode\' value must be set in other.'); } } } diff --git a/mod/scorm/classes/event/sco_launched.php b/mod/scorm/classes/event/sco_launched.php index 870cf08549f..ebf49cc5a80 100644 --- a/mod/scorm/classes/event/sco_launched.php +++ b/mod/scorm/classes/event/sco_launched.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * This file contains an event for when sco is loaded. + * The mod_scorm sco launched event. * * @package mod_scorm * @copyright 2013 onwards Ankit Agarwal @@ -26,13 +26,13 @@ namespace mod_scorm\event; defined('MOODLE_INTERNAL') || die(); /** - * Event for when a sco is loaded. + * The mod_scorm sco launched event class. * * @property-read array $other { * Extra information about event properties. * - * @type string loadedcontent A reference to the content loaded. - * @type int instanceid Instance id of the scorm activity. + * - string loadedcontent: A reference to the content loaded. + * - int instanceid: Instance id of the scorm activity. * } * * @package mod_scorm @@ -57,7 +57,8 @@ class sco_launched extends \core\event\base { * @return string */ public function get_description() { - return 'User with id ' . $this->userid . ' launched a sco with id ' . $this->objectid; + return "The user with the id '$this->userid' launched the sco with the id '$this->objectid' for the scorm with " . + "the course module id '$this->contextinstanceid'."; } /** @@ -96,8 +97,9 @@ class sco_launched extends \core\event\base { */ protected function validate_data() { parent::validate_data(); + if (empty($this->other['loadedcontent'])) { - throw new \coding_exception('The event mod_scorm\\event\\sco_launched must specify loadedcontent.'); + throw new \coding_exception('The \'loadedcontent\' value must be set in other.'); } } } diff --git a/mod/scorm/classes/event/tracks_viewed.php b/mod/scorm/classes/event/tracks_viewed.php index dd2a1e95f74..25a6a7b2019 100644 --- a/mod/scorm/classes/event/tracks_viewed.php +++ b/mod/scorm/classes/event/tracks_viewed.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * This file contains an event for when user tracks is viewed. + * The mod_scorm tracks viewed event. * * @package mod_scorm * @copyright 2013 onwards Ankit Agarwal @@ -26,15 +26,16 @@ namespace mod_scorm\event; defined('MOODLE_INTERNAL') || die(); /** - * Event for when a user tracks is viewed. + * The mod_scorm tracks viewed event class. * * @property-read array $other { * Extra information about event properties. * - * @type int attemptid Attempt id. - * @type int instanceid Instance id of the scorm activity. - * @type int scoid Sco Id for which the trackes are viewed. + * - int attemptid: Attempt id. + * - int instanceid: Instance id of the scorm activity. + * - int scoid: Sco Id for which the trackes are viewed. * } + * * @package mod_scorm * @since Moodle 2.7 * @copyright 2013 onwards Ankit Agarwal @@ -56,7 +57,8 @@ class tracks_viewed extends \core\event\base { * @return string */ public function get_description() { - return 'User with id ' . $this->userid . ' viewed interactions for user ' . $this->relateduserid; + return "The user with the id '$this->userid' viewed the tracks for the user with the id '$this->relateduserid' " . + "for the scorm activity with the course module id '$this->contextinstanceid'."; } /** @@ -101,15 +103,16 @@ class tracks_viewed extends \core\event\base { * @return void */ protected function validate_data() { + parent::validate_data(); + if (empty($this->other['attemptid'])) { - throw new \coding_exception('The \\mod_scorm\\event\\tracks_viewed must specify attemptid.'); + throw new \coding_exception('The \'attemptid\' value must be set in other.'); } if (empty($this->other['instanceid'])) { - throw new \coding_exception('The \\mod_scorm\\event\\tracks_viewed must specify instanceid of the activity.'); + throw new \coding_exception('The \'instanceid\' value must be set in other.'); } if (empty($this->other['scoid'])) { - throw new \coding_exception('The \\mod_scorm\\event\\tracks_viewed must specify scoid for the report.'); + throw new \coding_exception('The \'scoid\' value must be set in other.'); } - parent::validate_data(); } } diff --git a/mod/scorm/classes/event/user_report_viewed.php b/mod/scorm/classes/event/user_report_viewed.php index a615ec5de8e..d818f8f2dfb 100644 --- a/mod/scorm/classes/event/user_report_viewed.php +++ b/mod/scorm/classes/event/user_report_viewed.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * This file contains an event for when a user report is viewed. + * The mod_scorm tracks user report viewed event. * * @package mod_scorm * @copyright 2013 onwards Ankit Agarwal @@ -26,14 +26,15 @@ namespace mod_scorm\event; defined('MOODLE_INTERNAL') || die(); /** - * Event for when a user report is viewed. + * The mod_scorm tracks user report viewed event class. * * @property-read array $other { * Extra information about event properties. * - * @type int attemptid Attempt id. - * @type int instanceid Instance id of the scorm activity. + * - int attemptid: Attempt id. + * - int instanceid: Instance id of the scorm activity. * } + * * @package mod_scorm * @since Moodle 2.7 * @copyright 2013 onwards Ankit Agarwal @@ -101,10 +102,10 @@ class user_report_viewed extends \core\event\base { protected function validate_data() { parent::validate_data(); if (empty($this->other['attemptid'])) { - throw new \coding_exception('The \\mod_scorm\\event\\user_report_viewed must specify attemptid.'); + throw new \coding_exception('The \'attemptid\' value must be set in other.'); } if (empty($this->other['instanceid'])) { - throw new \coding_exception('The \\mod_scorm\\event\\user_report_viewed must specify instanceid of the activity.'); + throw new \coding_exception('The \'instanceid\' value must be set in other.'); } } } diff --git a/mod/scorm/report.php b/mod/scorm/report.php index 69524896a59..bbad079b174 100644 --- a/mod/scorm/report.php +++ b/mod/scorm/report.php @@ -61,9 +61,11 @@ if (count($reportlist) < 1) { // Trigger a report viewed event. $event = \mod_scorm\event\report_viewed::create(array( - 'objectid' => $scorm->id, 'context' => $contextmodule, - 'other' => array('mode' => $mode) + 'other' => array( + 'scormid' => $scorm->id, + 'mode' => $mode + ) )); $event->add_record_snapshot('course_modules', $cm); $event->add_record_snapshot('scorm', $scorm); diff --git a/mod/scorm/tests/event_test.php b/mod/scorm/tests/events_test.php similarity index 96% rename from mod/scorm/tests/event_test.php rename to mod/scorm/tests/events_test.php index 7171bf270a8..97ee85ec9b1 100644 --- a/mod/scorm/tests/event_test.php +++ b/mod/scorm/tests/events_test.php @@ -204,10 +204,12 @@ class mod_scorm_event_testcase extends advanced_testcase { public function test_report_viewed_event() { $this->resetAfterTest(); $event = \mod_scorm\event\report_viewed::create(array( - 'objectid' => $this->eventscorm->id, 'context' => context_module::instance($this->eventcm->id), 'courseid' => $this->eventcourse->id, - 'other' => array('mode' => 'basic') + 'other' => array( + 'scormid' => $this->eventscorm->id, + 'mode' => 'basic' + ) )); // Trigger and capture the event. @@ -221,15 +223,6 @@ class mod_scorm_event_testcase extends advanced_testcase { $this->eventscorm->id, $this->eventcm->id); $this->assertEventLegacyLogData($expected, $event); $this->assertEventContextNotUsed($event); - - // Test validations. - $this->setExpectedException('coding_exception'); - \mod_scorm\event\report_viewed::create(array( - 'objectid' => $this->eventscorm->id, - 'context' => context_module::instance($this->eventcm->id), - 'courseid' => $this->eventcourse->id - )); - $this->fail('Event \\mod_scorm\\event\\report_viewed is not validating "mode" properly'); } /** Tests for sco launched event. diff --git a/mod/survey/classes/event/course_module_instance_list_viewed.php b/mod/survey/classes/event/course_module_instance_list_viewed.php index 598ef03b401..e3a3fe88fd1 100644 --- a/mod/survey/classes/event/course_module_instance_list_viewed.php +++ b/mod/survey/classes/event/course_module_instance_list_viewed.php @@ -15,10 +15,9 @@ // along with Moodle. If not, see . /** - * Event triggered when all survey instances for a course are viewed. + * The mod_survey instance list viewed event. * * @package mod_survey - * @since Moodle 2.7 * @copyright 2014 Rajesh Taneja * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -27,6 +26,14 @@ namespace mod_survey\event; defined('MOODLE_INTERNAL') || die(); +/** + * The mod_survey instance list viewed event class. + * + * @package mod_survey + * @since Moodle 2.7 + * @copyright 2014 Rajesh Taneja + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class course_module_instance_list_viewed extends \core\event\course_module_instance_list_viewed { // No code required here as the parent class handles it all. } diff --git a/mod/survey/classes/event/course_module_viewed.php b/mod/survey/classes/event/course_module_viewed.php index 9e315dacc4f..c8cf62a4ce1 100644 --- a/mod/survey/classes/event/course_module_viewed.php +++ b/mod/survey/classes/event/course_module_viewed.php @@ -15,10 +15,9 @@ // along with Moodle. If not, see . /** - * Course module viewed event. + * The mod_survey course module viewed event. * * @package mod_survey - * @since Moodle 2.7 * @copyright 2014 Rajesh Taneja * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -27,6 +26,14 @@ namespace mod_survey\event; defined('MOODLE_INTERNAL') || die(); +/** + * The mod_survery course module viewed event. + * + * @package mod_survey + * @since Moodle 2.7 + * @copyright 2014 Rajesh Taneja + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class course_module_viewed extends \core\event\course_module_viewed { /** diff --git a/mod/survey/classes/event/report_downloaded.php b/mod/survey/classes/event/report_downloaded.php index 2dd054ab5c1..87a0eebc724 100644 --- a/mod/survey/classes/event/report_downloaded.php +++ b/mod/survey/classes/event/report_downloaded.php @@ -15,14 +15,9 @@ // along with Moodle. If not, see . /** - * Event triggered, when survey report is downloaded. - * - * @property-read array $other Extra information about the event. - * -string type: Type of report format downloaded. - * -int groupid: (optional) report for groupid. + * The mod_survey report downloaded event. * * @package mod_survey - * @since Moodle 2.7 * @copyright 2014 Rajesh Taneja * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -31,6 +26,21 @@ namespace mod_survey\event; defined('MOODLE_INTERNAL') || die(); +/** + * The mod_survey report downloaded event class. + * + * @property-read array $other { + * Extra information about the event. + * + * - string type: Type of report format downloaded. + * - int groupid: (optional) report for groupid. + * } + * + * @package mod_survey + * @since Moodle 2.7 + * @copyright 2014 Rajesh Taneja + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class report_downloaded extends \core\event\base { /** @@ -57,7 +67,7 @@ class report_downloaded extends \core\event\base { * @return string */ public function get_description() { - return "User with id '$this->userid' downloaded survey report for survey with instance id '$this->objectid'"; + return "The user with the id '$this->userid' downloaded the report for the survey with course module id '$this->contextinstanceid'."; } /** @@ -91,7 +101,7 @@ class report_downloaded extends \core\event\base { protected function validate_data() { parent::validate_data(); if (empty($this->other['type'])) { - throw new \coding_exception('Other must contain the key type.'); + throw new \coding_exception('The \'type\' value must be set in other.'); } } } diff --git a/mod/survey/classes/event/report_viewed.php b/mod/survey/classes/event/report_viewed.php index d0cad0b986e..fcfd25240d6 100644 --- a/mod/survey/classes/event/report_viewed.php +++ b/mod/survey/classes/event/report_viewed.php @@ -15,14 +15,9 @@ // along with Moodle. If not, see . /** - * Event triggered, when survey report is viewed. - * - * @property-read array $other Extra information about the event. - * -string action: (optional) report view. - * -int groupid: (optional) report for groupid. + * The mod_survey report viewed event. * * @package mod_survey - * @since Moodle 2.7 * @copyright 2014 Rajesh Taneja * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -31,6 +26,21 @@ namespace mod_survey\event; defined('MOODLE_INTERNAL') || die(); +/** + * The mod_survey report viewed event class. + * + * @property-read array $other { + * Extra information about the event. + * + * - string action: (optional) report view. + * - int groupid: (optional) report for groupid. + * } + * + * @package mod_survey + * @since Moodle 2.7 + * @copyright 2014 Rajesh Taneja + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class report_viewed extends \core\event\base { /** @@ -57,7 +67,7 @@ class report_viewed extends \core\event\base { * @return string */ public function get_description() { - return "User with id '$this->userid' viewed survey report for survey with instance id '$this->objectid'"; + return "The user with the id '$this->userid' viewed the report for the survey with course module id '$this->contextinstanceid'."; } /** @@ -66,8 +76,12 @@ class report_viewed extends \core\event\base { * @return \moodle_url */ public function get_url() { - return new \moodle_url("/mod/survey/report.php", array('id' => $this->contextinstanceid, - 'action' => $this->other['action'])); + $params = array(); + $params['id'] = $this->contextinstanceid; + if (isset($this->other['action'])) { + $params['action'] = $this->other['action']; + } + return new \moodle_url("/mod/survey/report.php", $params); } /** diff --git a/mod/survey/classes/event/response_submitted.php b/mod/survey/classes/event/response_submitted.php index 367b5a33748..80267b10cfe 100644 --- a/mod/survey/classes/event/response_submitted.php +++ b/mod/survey/classes/event/response_submitted.php @@ -15,13 +15,9 @@ // along with Moodle. If not, see . /** - *Event triggered, when survey response is submitted. - * - * @property-read array $other Extra information about the event. - * -int surveyid: ID of survey for which response was submitted. + * The mod_survey response submitted event. * * @package mod_survey - * @since Moodle 2.7 * @copyright 2014 Rajesh Taneja * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -30,6 +26,20 @@ namespace mod_survey\event; defined('MOODLE_INTERNAL') || die(); +/** + * The mod_survey response submitted event class. + * + * @property-read array $other { + * Extra information about the event. + * + * - int surveyid: ID of survey for which response was submitted. + * } + * + * @package mod_survey + * @since Moodle 2.7 + * @copyright 2014 Rajesh Taneja + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class response_submitted extends \core\event\base { /** @@ -55,8 +65,7 @@ class response_submitted extends \core\event\base { * @return string */ public function get_description() { - return "User with id '". $this->userid . "' submitted response for for survey with instance id '" . - $this->other['surveyid'] . "'"; + return "The user with the id '$this->userid' submitted a response for the survey with course module id '$this->contextinstanceid'."; } /** @@ -87,7 +96,7 @@ class response_submitted extends \core\event\base { protected function validate_data() { parent::validate_data(); if (empty($this->other['surveyid'])) { - throw new \coding_exception('Other must contain the key surveyid.'); + throw new \coding_exception('The \'surveyid\' value must be set in other.'); } } } diff --git a/mod/url/classes/event/course_module_instance_list_viewed.php b/mod/url/classes/event/course_module_instance_list_viewed.php index 6457e9040ec..232ff8a257d 100644 --- a/mod/url/classes/event/course_module_instance_list_viewed.php +++ b/mod/url/classes/event/course_module_instance_list_viewed.php @@ -18,7 +18,6 @@ * The mod_url instance list viewed event. * * @package mod_url - * @since Moodle 2.7 * @copyright 2013 Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -27,6 +26,14 @@ namespace mod_url\event; defined('MOODLE_INTERNAL') || die(); +/** + * The mod_url instance list viewed event class. + * + * @package mod_url + * @since Moodle 2.7 + * @copyright 2013 Mark Nelson + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class course_module_instance_list_viewed extends \core\event\course_module_instance_list_viewed { } diff --git a/mod/url/classes/event/course_module_viewed.php b/mod/url/classes/event/course_module_viewed.php index 5c102b27b2d..2f86aa46622 100644 --- a/mod/url/classes/event/course_module_viewed.php +++ b/mod/url/classes/event/course_module_viewed.php @@ -18,7 +18,6 @@ * The mod_url course module viewed event. * * @package mod_url - * @since Moodle 2.7 * @copyright 2013 Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -27,6 +26,14 @@ namespace mod_url\event; defined('MOODLE_INTERNAL') || die(); +/** + * The mod_url course module viewed event class. + * + * @package mod_url + * @since Moodle 2.7 + * @copyright 2013 Mark Nelson + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class course_module_viewed extends \core\event\course_module_viewed { /** diff --git a/mod/wiki/classes/event/comment_created.php b/mod/wiki/classes/event/comment_created.php index 18d805490ce..4c0efd91ec7 100644 --- a/mod/wiki/classes/event/comment_created.php +++ b/mod/wiki/classes/event/comment_created.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * mod_wiki comment created event. + * The mod_wiki comment created event. * * @package mod_wiki * @copyright 2013 Rajesh Taneja @@ -26,13 +26,7 @@ namespace mod_wiki\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_wiki comment created event. - * - * @property-read array $other { - * Extra information about event. - * - * @type int itemid id of item for which comment is created. - * } + * The mod_wiki comment created event class. * * @package mod_wiki * @since Moodle 2.7 @@ -56,6 +50,7 @@ class comment_created extends \core\event\comment_created { * @return string */ public function get_description() { - return 'User with id ' . $this->userid . ' added comment for wiki with page id ' . $this->other['itemid']; + return "The user with the id '$this->userid' added a comment with the id '$this->objectid' on the page with the id " . + "'{$this->other['itemid']}' for the wiki with the course module id '$this->contextinstanceid'."; } } diff --git a/mod/wiki/classes/event/comment_deleted.php b/mod/wiki/classes/event/comment_deleted.php index dbca2574902..321652489e4 100644 --- a/mod/wiki/classes/event/comment_deleted.php +++ b/mod/wiki/classes/event/comment_deleted.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * mod_wiki comment deleted event. + * The mod_wiki comment deleted event. * * @package mod_wiki * @copyright 2013 Rajesh Taneja @@ -26,13 +26,7 @@ namespace mod_wiki\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_wiki comment deleted event. - * - * @property-read array $other { - * Extra information about event. - * - * @type int itemid id of item for which comment is deleted. - * } + * The mod_wiki comment deleted event class. * * @package mod_wiki * @since Moodle 2.7 @@ -56,6 +50,7 @@ class comment_deleted extends \core\event\comment_deleted { * @return string */ public function get_description() { - return 'User with id ' . $this->userid . ' deleted comment for wiki with page id ' . $this->other['itemid']; + return "The user with the id '$this->userid' deleted a comment with the id '$this->objectid' on the page with the id " . + "'{$this->other['itemid']}' for the wiki with the course module id '$this->contextinstanceid'."; } } diff --git a/mod/wiki/classes/event/comments_viewed.php b/mod/wiki/classes/event/comments_viewed.php index e6f5982cce8..876e7041166 100644 --- a/mod/wiki/classes/event/comments_viewed.php +++ b/mod/wiki/classes/event/comments_viewed.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * mod_wiki comments viewed event. + * The mod_wiki comments viewed event. * * @package mod_wiki * @copyright 2013 Rajesh Taneja @@ -26,7 +26,7 @@ namespace mod_wiki\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_wiki comments viewed event. + * The mod_wiki comments viewed event class. * * @package mod_wiki * @since Moodle 2.7 @@ -51,8 +51,8 @@ class comments_viewed extends \core\event\comments_viewed { * @return string */ public function get_description() { - return 'User with id ' . $this->userid . ' viewed comments for wiki page id ' . - $this->objectid; + return "The user with the id '$this->userid' viewed a comment with the id '$this->objectid' on the page with the id " . + "'{$this->other['itemid']}' for the wiki with the course module id '$this->contextinstanceid'."; } /** @@ -73,17 +73,4 @@ class comments_viewed extends \core\event\comments_viewed { public function get_url() { return new \moodle_url('/mod/wiki/comments.php', array('pageid' => $this->objectid)); } - - /** - * Custom validation. - * - * @throws \coding_exception - * @return void - */ - protected function validate_data() { - parent::validate_data(); - if (empty($this->objectid) || empty($this->objecttable)) { - throw new \coding_exception('The objectid and objecttable need to be set in $other'); - } - } } diff --git a/mod/wiki/classes/event/course_module_instance_list_viewed.php b/mod/wiki/classes/event/course_module_instance_list_viewed.php index 90a284d371c..b44139ae205 100644 --- a/mod/wiki/classes/event/course_module_instance_list_viewed.php +++ b/mod/wiki/classes/event/course_module_instance_list_viewed.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * mod_wiki instances list viewed event. + * The mod_wiki instance list viewed event. * * @package mod_wiki * @copyright 2013 Rajesh Taneja @@ -26,7 +26,7 @@ namespace mod_wiki\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_wiki instances list viewed event class. + * The mod_wiki instance list viewed event class. * * @package mod_wiki * @since Moodle 2.7 diff --git a/mod/wiki/classes/event/course_module_viewed.php b/mod/wiki/classes/event/course_module_viewed.php index b1fbe05be63..52a86603433 100644 --- a/mod/wiki/classes/event/course_module_viewed.php +++ b/mod/wiki/classes/event/course_module_viewed.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * mod_wiki course module viewed event. + * The mod_wiki course module viewed event. * * @package mod_wiki * @copyright 2013 Rajesh Taneja @@ -26,7 +26,7 @@ namespace mod_wiki\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_wiki course module viewed event class. + * The mod_wiki course module viewed event class. * * @package mod_wiki * @since Moodle 2.7 diff --git a/mod/wiki/classes/event/page_created.php b/mod/wiki/classes/event/page_created.php index d6069bb33e5..c4f9a6660f0 100644 --- a/mod/wiki/classes/event/page_created.php +++ b/mod/wiki/classes/event/page_created.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * mod_wiki page created event. + * The mod_wiki page created event. * * @package mod_wiki * @copyright 2013 Rajesh Taneja @@ -26,7 +26,7 @@ namespace mod_wiki\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_wiki page created event class. + * The mod_wiki page created event class. * * @package mod_wiki * @since Moodle 2.7 @@ -60,7 +60,8 @@ class page_created extends \core\event\base { * @return string */ public function get_description() { - return 'User with id ' . $this->userid . ' created wiki page id ' . $this->objectid; + return "The user with the id '$this->userid' created the page with the id '$this->objectid' for the wiki with " . + "the course module id '$this->contextinstanceid'."; } /** diff --git a/mod/wiki/classes/event/page_deleted.php b/mod/wiki/classes/event/page_deleted.php index ae8290e32b0..1db6426585f 100644 --- a/mod/wiki/classes/event/page_deleted.php +++ b/mod/wiki/classes/event/page_deleted.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * mod_wiki page deleted. + * The mod_wiki page deleted event. * * @package mod_wiki * @copyright 2013 Rajesh Taneja @@ -26,12 +26,12 @@ namespace mod_wiki\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_wiki page deleted. + * The mod_wiki page deleted event class. * * @property-read array $other { * Extra information about event. * - * @type int subwikiid id subwiki. + * - int subwikiid: (optional) id subwiki. * } * * @package mod_wiki @@ -66,7 +66,8 @@ class page_deleted extends \core\event\base { * @return string */ public function get_description() { - return 'User with id ' . $this->userid . ' deleted wiki page id ' . $this->objectid; + return "The user with the id '$this->userid' deleted the page with the id '$this->objectid' for the wiki with " . + "the course module id '$this->contextinstanceid'."; } /** diff --git a/mod/wiki/classes/event/page_diff_viewed.php b/mod/wiki/classes/event/page_diff_viewed.php index fd1c0e5c89b..3b25d09d3dc 100644 --- a/mod/wiki/classes/event/page_diff_viewed.php +++ b/mod/wiki/classes/event/page_diff_viewed.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * mod_wiki diff viewed event. + * The mod_wiki diff viewed event. * * @package mod_wiki * @copyright 2013 Rajesh Taneja @@ -26,13 +26,13 @@ namespace mod_wiki\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_wiki diff viewed event class. + * The mod_wiki diff viewed event class. * * @property-read array $other { * Extra information about event. * - * @type int comparewith version number to compare with. - * @type int compare version number to compare. + * - int comparewith: version number to compare with. + * - int compare: version number to compare. * } * * @package mod_wiki @@ -67,7 +67,8 @@ class page_diff_viewed extends \core\event\base { * @return string */ public function get_description() { - return 'User with id ' . $this->userid . ' viewed wiki diff for page id ' . $this->objectid; + return "The user with the id '$this->userid' viewed the diff for the page with the id '$this->objectid' for the wiki with " . + "the course module id '$this->contextinstanceid'."; } /** @@ -102,8 +103,11 @@ class page_diff_viewed extends \core\event\base { */ protected function validate_data() { parent::validate_data(); - if (!isset($this->other['comparewith']) || !isset($this->other['compare'])) { - throw new \coding_exception('The comparewith and compare need to be set in $other'); + if (!isset($this->other['comparewith'])) { + throw new \coding_exception('The \'comparewith\' value must be set in other.'); + } + if (!isset($this->other['compare'])) { + throw new \coding_exception('The \'compare\' value must be set in other.'); } } } diff --git a/mod/wiki/classes/event/page_history_viewed.php b/mod/wiki/classes/event/page_history_viewed.php index 63a6ca4dde8..c50f66fbda1 100644 --- a/mod/wiki/classes/event/page_history_viewed.php +++ b/mod/wiki/classes/event/page_history_viewed.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * mod_wiki history viewed event. + * The mod_wiki history viewed event. * * @package mod_wiki * @copyright 2013 Rajesh Taneja @@ -26,7 +26,7 @@ namespace mod_wiki\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_wiki history viewed event class. + * The mod_wiki history viewed event class. * * @package mod_wiki * @since Moodle 2.7 @@ -60,7 +60,8 @@ class page_history_viewed extends \core\event\base { * @return string */ public function get_description() { - return 'User with id ' . $this->userid . ' viewed wiki history for page id ' . $this->objectid; + return "The user with the id '$this->userid' viewed the history for the page with the id '$this->objectid' for the wiki with " . + "the course module id '$this->contextinstanceid'."; } /** diff --git a/mod/wiki/classes/event/page_locks_deleted.php b/mod/wiki/classes/event/page_locks_deleted.php index acd33165886..7c858678f9f 100644 --- a/mod/wiki/classes/event/page_locks_deleted.php +++ b/mod/wiki/classes/event/page_locks_deleted.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * mod_wiki page locks deleted (override locks) + * The mod_wiki page locks deleted (override locks) event. * * @package mod_wiki * @copyright 2013 Rajesh Taneja @@ -26,12 +26,12 @@ namespace mod_wiki\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_wiki page locks deleted (override locks) + * The mod_wiki page locks deleted (override locks) event class. * * @property-read array $other { * Extra information about event. * - * @type int section section id. + * - int section: section id. * } * * @package mod_wiki @@ -66,7 +66,8 @@ class page_locks_deleted extends \core\event\base { * @return string */ public function get_description() { - return 'User with id ' . $this->userid . ' deleted locks for page id ' . $this->objectid; + return "The user with the id '$this->userid' deleted locks for the page with the id '$this->objectid' for the wiki with " . + "the course module id '$this->contextinstanceid'."; } /** diff --git a/mod/wiki/classes/event/page_map_viewed.php b/mod/wiki/classes/event/page_map_viewed.php index e5f1018eeeb..ac4a20dab0f 100644 --- a/mod/wiki/classes/event/page_map_viewed.php +++ b/mod/wiki/classes/event/page_map_viewed.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * mod_wiki map viewed event. + * The mod_wiki map viewed event. * * @package mod_wiki * @copyright 2013 Rajesh Taneja @@ -26,12 +26,12 @@ namespace mod_wiki\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_wiki map viewed event class. + * The mod_wiki map viewed event class. * * @property-read array $other { * Extra information about event. * - * @type int option map option viewed. + * - int option: map option viewed. * } * * @package mod_wiki @@ -66,7 +66,8 @@ class page_map_viewed extends \core\event\base { * @return string */ public function get_description() { - return 'User with id ' . $this->userid . ' viewed wiki map for page id ' . $this->objectid; + return "The user with the id '$this->userid' viewed the wiki map for the page with the id '$this->objectid' for the wiki with " . + "the course module id '$this->contextinstanceid'."; } /** @@ -97,7 +98,7 @@ class page_map_viewed extends \core\event\base { protected function validate_data() { parent::validate_data(); if (!isset($this->other['option'])) { - throw new \coding_exception('The option need to be set in $other, even if 0.'); + throw new \coding_exception('The \'option\' value must be set in other, even if 0.'); } } } diff --git a/mod/wiki/classes/event/page_updated.php b/mod/wiki/classes/event/page_updated.php index f750586ad02..593365ea7c3 100644 --- a/mod/wiki/classes/event/page_updated.php +++ b/mod/wiki/classes/event/page_updated.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * mod_wiki page updated. + * The mod_wiki page updated event. * * @package mod_wiki * @copyright 2013 Rajesh Taneja @@ -26,12 +26,12 @@ namespace mod_wiki\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_wiki page updated. + * The mod_wiki page updated event class. * * @property-read array $other { * Extra information about event. * - * @type string newcontent updated content. + * - string newcontent: updated content. * } * * @package mod_wiki @@ -66,7 +66,8 @@ class page_updated extends \core\event\base { * @return string */ public function get_description() { - return 'User with id ' . $this->userid . ' viewed wiki page id ' . $this->objectid; + return "The user with the id '$this->userid' updated the page with the id '$this->objectid' for the wiki with " . + "the course module id '$this->contextinstanceid'."; } /** diff --git a/mod/wiki/classes/event/page_version_deleted.php b/mod/wiki/classes/event/page_version_deleted.php index 0a2d5154777..530a60ea354 100644 --- a/mod/wiki/classes/event/page_version_deleted.php +++ b/mod/wiki/classes/event/page_version_deleted.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * mod_wiki page version deleted. + * The mod_wiki page version deleted event. * * @package mod_wiki * @copyright 2013 Rajesh Taneja @@ -26,12 +26,12 @@ namespace mod_wiki\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_wiki page version deleted. + * The mod_wiki page version deleted event class. * * @property-read array $other { * Extra information about event. * - * @type int pageid id wiki page. + * - int pageid: id wiki page. * } * * @package mod_wiki @@ -66,8 +66,8 @@ class page_version_deleted extends \core\event\base { * @return string */ public function get_description() { - return 'User with id ' . $this->userid . ' deleted version ' . $this->objectid . ' for page id ' . - $this->other['pageid']; + return "The user with the id '$this->userid' deleted version '$this->objectid' for the page with the id '{$this->other['pageid']}' " . + "for the wiki with the course module id '$this->contextinstanceid'."; } /** @@ -98,7 +98,7 @@ class page_version_deleted extends \core\event\base { protected function validate_data() { parent::validate_data(); if (!isset($this->other['pageid'])) { - throw new \coding_exception('The pageid need to be set in $other'); + throw new \coding_exception('The \'pageid\' value must be set in other.'); } } } diff --git a/mod/wiki/classes/event/page_version_restored.php b/mod/wiki/classes/event/page_version_restored.php index f8e464a476a..130ff316b43 100644 --- a/mod/wiki/classes/event/page_version_restored.php +++ b/mod/wiki/classes/event/page_version_restored.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * mod_wiki version restored event. + * The mod_wiki version restored event. * * @package mod_wiki * @copyright 2013 Rajesh Taneja @@ -26,12 +26,12 @@ namespace mod_wiki\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_wiki version restored event. + * The mod_wiki version restored event class. * * @property-read array $other { * Extra information about event. * - * @type int pageid id wiki page. + * - int pageid: id wiki page. * } * * @package mod_wiki @@ -66,7 +66,8 @@ class page_version_restored extends \core\event\base { * @return string */ public function get_description() { - return 'User with id ' . $this->userid . ' restored wiki version for page id ' . $this->other['pageid']; + return "The user with the id '$this->userid' restored version '$this->objectid' for the page with the id '{$this->other['pageid']}' " . + "for the wiki with the course module id '$this->contextinstanceid'."; } /** diff --git a/mod/wiki/classes/event/page_version_viewed.php b/mod/wiki/classes/event/page_version_viewed.php index 46cfe38a05d..3f07311ebb9 100644 --- a/mod/wiki/classes/event/page_version_viewed.php +++ b/mod/wiki/classes/event/page_version_viewed.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * mod_wiki version viewed event. + * The mod_wiki version viewed event. * * @package mod_wiki * @copyright 2013 Rajesh Taneja @@ -26,12 +26,12 @@ namespace mod_wiki\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_wiki version viewed event. + * The mod_wiki version viewed event class. * * @property-read array $other { * Extra information about event. * - * @type int versionid id page version. + * - int versionid: id page version. * } * * @package mod_wiki @@ -66,8 +66,8 @@ class page_version_viewed extends \core\event\base { * @return string */ public function get_description() { - return 'User with id ' . $this->userid . ' viewed versionid ' . $this->other['versionid'] . - ' for page id ' . $this->objectid; + return "The user with the id '$this->userid' viewed the version for the page with the id '$this->objectid' for the wiki with " . + "the course module id '$this->contextinstanceid'."; } /** diff --git a/mod/wiki/classes/event/page_viewed.php b/mod/wiki/classes/event/page_viewed.php index e56a0dc1428..f544a73f022 100644 --- a/mod/wiki/classes/event/page_viewed.php +++ b/mod/wiki/classes/event/page_viewed.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * mod_wiki page viewed event. + * The mod_wiki page viewed event. * * @package mod_wiki * @copyright 2013 Rajesh Taneja @@ -26,7 +26,7 @@ namespace mod_wiki\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_wiki page viewed event class. + * The mod_wiki page viewed event class. * * @package mod_wiki * @since Moodle 2.7 @@ -60,7 +60,8 @@ class page_viewed extends \core\event\base { * @return string */ public function get_description() { - return 'User with id ' . $this->userid . ' viewed wiki page id ' . $this->objectid; + return "The user with the id '$this->userid' viewed the page with the id '$this->objectid' for the wiki with " . + "the course module id '$this->contextinstanceid'."; } /** diff --git a/mod/workshop/assessment.php b/mod/workshop/assessment.php index 09baa58db21..7a33b104de3 100644 --- a/mod/workshop/assessment.php +++ b/mod/workshop/assessment.php @@ -189,6 +189,7 @@ if (is_null($assessment->grade) and !$assessmenteditable) { if (count((array)$coredata) > 1 ) { $DB->update_record('workshop_assessments', $coredata); $params = array( + 'relateduserid' => $assessment->authorid, 'objectid' => $assessment->id, 'context' => $workshop->context, 'other' => array( diff --git a/mod/workshop/classes/event/assessable_uploaded.php b/mod/workshop/classes/event/assessable_uploaded.php index cf7ca856a28..2d8216b41e3 100644 --- a/mod/workshop/classes/event/assessable_uploaded.php +++ b/mod/workshop/classes/event/assessable_uploaded.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * mod_workshop assessable uploaded event. + * The mod_workshop assessable uploaded event. * * @package mod_workshop * @copyright 2013 Frédéric Massart @@ -27,13 +27,13 @@ namespace mod_workshop\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_workshop assessable uploaded event class. + * The mod_workshop assessable uploaded event class. * * @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: string. * } * * @package mod_workshop @@ -56,13 +56,14 @@ class assessable_uploaded extends \core\event\assessable_uploaded { * @return string */ public function get_description() { - return "User {$this->userid} has uploaded the submission {$this->objectid}."; + return "The user with the id '$this->userid' has uploaded the submission with the id '$this->objectid' " . + "to the workshop activity with the course module id '$this->contextinstanceid'."; } /** * Legacy event data if get_legacy_eventname() is not empty. * - * @return stdClass + * @return \stdClass */ protected function get_legacy_eventdata() { $eventdata = new \stdClass(); diff --git a/mod/workshop/classes/event/assessment_evaluated.php b/mod/workshop/classes/event/assessment_evaluated.php index a7aac1399d4..989445fd926 100644 --- a/mod/workshop/classes/event/assessment_evaluated.php +++ b/mod/workshop/classes/event/assessment_evaluated.php @@ -15,10 +15,9 @@ // along with Moodle. If not, see . /** - * mod_workshop assessment evaluated event. + * The mod_workshop assessment evaluated event. * * @package mod_workshop - * @category event * @copyright 2013 Adrian Greeve * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -27,18 +26,17 @@ namespace mod_workshop\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_workshop assessment evaluated event class. + * The mod_workshop assessment evaluated event class. * * @property-read array $other { * Extra information about the event. * - * @type string currentgrade current saved grade. - * @type string finalgrade final grade. + * - string currentgrade: (could be null) current saved grade. + * - string finalgrade: (could be null) final grade. * } * * @package mod_workshop * @since Moodle 2.7 - * @category event * @copyright 2013 Adrian Greeve * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -61,7 +59,8 @@ class assessment_evaluated extends \core\event\base { * @return string */ public function get_description() { - return 'An assessment has been evaluated ' . $this->objectid . '.'; + return "The user with the id '$this->userid' has had their assessment attempt evaluated for the workshop with " . + "the course module id '$this->contextinstanceid'."; } /** diff --git a/mod/workshop/classes/event/assessment_evaluations_reset.php b/mod/workshop/classes/event/assessment_evaluations_reset.php index 912e741998a..80398e29675 100644 --- a/mod/workshop/classes/event/assessment_evaluations_reset.php +++ b/mod/workshop/classes/event/assessment_evaluations_reset.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * mod_workshop assessment_evaluations reset event. + * The mod_workshop assessment_evaluations reset event. * * @package mod_workshop * @category event @@ -27,11 +27,16 @@ namespace mod_workshop\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_workshop assessment_evaluations reset event class. + * The mod_workshop assessment_evaluations reset event class. + * + * @property-read array $other { + * Extra information about the event. + * + * - int workshopid: the ID of the workshop. + * } * * @package mod_workshop * @since Moodle 2.7 - * @category event * @copyright 2013 Adrian Greeve * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -45,7 +50,6 @@ class assessment_evaluations_reset extends \core\event\base { protected function init() { $this->data['crud'] = 'u'; $this->data['edulevel'] = self::LEVEL_TEACHING; - $this->data['objecttable'] = 'workshop_aggregations'; } /** @@ -54,7 +58,8 @@ class assessment_evaluations_reset extends \core\event\base { * @return string */ public function get_description() { - return 'The assessment evaluations have been reset ' . $this->objectid . '.'; + return "The user with the id '$this->userid' has reset the assessment evaluations for the workshop with the course module id " . + "'$this->contextinstanceid'."; } /** @@ -64,7 +69,7 @@ class assessment_evaluations_reset extends \core\event\base { */ protected function get_legacy_logdata() { return array($this->courseid, 'workshop', 'update clear aggregated grade', 'view.php?id=' . $this->contextinstanceid, - $this->objectid, $this->contextinstanceid); + $this->other['workshopid'], $this->contextinstanceid); } /** diff --git a/mod/workshop/classes/event/assessment_reevaluated.php b/mod/workshop/classes/event/assessment_reevaluated.php index 61ae47d4d1c..5e9edda982d 100644 --- a/mod/workshop/classes/event/assessment_reevaluated.php +++ b/mod/workshop/classes/event/assessment_reevaluated.php @@ -15,10 +15,9 @@ // along with Moodle. If not, see . /** - * mod_workshop assessment_reevaluated event. + * The mod_workshop assessment_reevaluated event. * * @package mod_workshop - * @category event * @copyright 2013 Adrian Greeve * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -27,18 +26,17 @@ namespace mod_workshop\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_workshop assessment_reevaluated event class. + * The mod_workshop assessment_reevaluated event class. * * @property-read array $other { * Extra information about the event. * - * @type float currentgrade current saved grade. - * @type float finalgrade final grade. + * - float currentgrade: (may be null) current saved grade. + * - float finalgrade: (may be null) final grade. * } * * @package mod_workshop * @since Moodle 2.7 - * @category event * @copyright 2013 Adrian Greeve * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -61,7 +59,8 @@ class assessment_reevaluated extends \core\event\base { * @return string */ public function get_description() { - return 'The assessment has been re-evaluated ' . $this->objectid . '.'; + return "The user with the id '$this->userid' has had their assessment attempt reevaluated for the workshop with " . + "the course module id '$this->contextinstanceid'."; } /** diff --git a/mod/workshop/classes/event/assessments_reset.php b/mod/workshop/classes/event/assessments_reset.php index 860ffa20804..5b5a0c9797f 100644 --- a/mod/workshop/classes/event/assessments_reset.php +++ b/mod/workshop/classes/event/assessments_reset.php @@ -15,10 +15,9 @@ // along with Moodle. If not, see . /** - * mod_workshop submission assessments reset event. + * The mod_workshop submission assessments reset event. * * @package mod_workshop - * @category event * @copyright 2013 Adrian Greeve * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -27,11 +26,16 @@ namespace mod_workshop\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_workshop submission assessments reset event class. + * The mod_workshop submission assessments reset event class. + * + * @property-read array $other { + * Extra information about the event. + * + * - int workshopid: the ID of the workshop. + * } * * @package mod_workshop * @since Moodle 2.7 - * @category event * @copyright 2013 Adrian Greeve * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -45,7 +49,6 @@ class assessments_reset extends \core\event\base { protected function init() { $this->data['crud'] = 'u'; $this->data['edulevel'] = self::LEVEL_TEACHING; - $this->data['objecttable'] = 'workshop_assessments'; } /** @@ -54,7 +57,8 @@ class assessments_reset extends \core\event\base { * @return string */ public function get_description() { - return 'The submission assessments of the workshop ' . $this->objectid . ' have been cleared.'; + return "The user with the id '$this->userid' has reset the assessments for the workshop with the course module id " . + "'$this->contextinstanceid'."; } /** @@ -64,7 +68,7 @@ class assessments_reset extends \core\event\base { */ protected function get_legacy_logdata() { return array($this->courseid, 'workshop', 'update clear assessments', 'view.php?id=' . $this->contextinstanceid, - $this->objectid, $this->contextinstanceid); + $this->other['workshopid'], $this->contextinstanceid); } /** diff --git a/mod/workshop/classes/event/course_module_instance_list_viewed.php b/mod/workshop/classes/event/course_module_instance_list_viewed.php index 82f6e99cba3..98a343b9d06 100644 --- a/mod/workshop/classes/event/course_module_instance_list_viewed.php +++ b/mod/workshop/classes/event/course_module_instance_list_viewed.php @@ -15,10 +15,9 @@ // along with Moodle. If not, see . /** - * mod_workshop instances list viewed event. + * The mod_workshop instance list viewed event. * * @package mod_workshop - * @category event * @copyright 2013 Adrian Greeve * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -27,11 +26,10 @@ namespace mod_workshop\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_workshop instances list viewed event class. + * The mod_workshop instance list viewed event class. * * @package mod_workshop * @since Moodle 2.7 - * @category event * @copyright 2013 Adrian Greeve * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/mod/workshop/classes/event/course_module_viewed.php b/mod/workshop/classes/event/course_module_viewed.php index 4ec8813c520..00e184bfb1d 100644 --- a/mod/workshop/classes/event/course_module_viewed.php +++ b/mod/workshop/classes/event/course_module_viewed.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * This file contains an event for when a workshop activity is viewed. + * The mod_workshop course module viewed event. * * @package mod_workshop * @copyright 2013 Adrian Greeve @@ -30,7 +30,7 @@ global $CFG; require_once("$CFG->dirroot/mod/workshop/locallib.php"); /** - * Event for when a workshop activity is viewed. + * The mod_workshop course module viewed event class. * * @package mod_workshop * @since Moodle 2.6 diff --git a/mod/workshop/classes/event/phase_switched.php b/mod/workshop/classes/event/phase_switched.php index 07e8ca43064..33bc9ff8b2c 100644 --- a/mod/workshop/classes/event/phase_switched.php +++ b/mod/workshop/classes/event/phase_switched.php @@ -15,10 +15,9 @@ // along with Moodle. If not, see . /** - * mod_workshop phase switched event. + * The mod_workshop phase switched event. * * @package mod_workshop - * @category event * @copyright 2013 Adrian Greeve * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -27,17 +26,16 @@ namespace mod_workshop\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_workshop phase switched event class. + * The mod_workshop phase switched event class. * * @property-read array $other { * Extra information about the event. * - * @type int workshopphase Workshop phase. + * - int workshopphase: Workshop phase. * } * * @package mod_workshop * @since Moodle 2.7 - * @category event * @copyright 2013 Adrian Greeve * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -60,7 +58,8 @@ class phase_switched extends \core\event\base { * @return string */ public function get_description() { - return 'The phase of the workshop ' . $this->objectid . ' has been switched to ' . $this->other['workshopphase']. '.'; + return "The user with the id '$this->userid' has switched the phase of the workshop with the course module id " . + "'$this->contextinstanceid' to '{$this->other['workshopphase']}'."; } /** diff --git a/mod/workshop/classes/event/submission_assessed.php b/mod/workshop/classes/event/submission_assessed.php index a568dbb3a30..87b0b1a7806 100644 --- a/mod/workshop/classes/event/submission_assessed.php +++ b/mod/workshop/classes/event/submission_assessed.php @@ -15,10 +15,9 @@ // along with Moodle. If not, see . /** - * mod_workshop submission_assessed event. + * The mod_workshop submission assessed event. * * @package mod_workshop - * @category event * @copyright 2013 Adrian Greeve * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -27,18 +26,17 @@ namespace mod_workshop\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_workshop submission_assessed event class. + * The mod_workshop submission assessed event class. * * @property-read array $other { * Extra information about the event. * - * @type int workshopid Workshop ID. - * @type int submissionid Submission ID. + * - int workshopid: Workshop ID. + * - int submissionid: Submission ID. * } * * @package mod_workshop * @since Moodle 2.7 - * @category event * @copyright 2013 Adrian Greeve * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -61,7 +59,8 @@ class submission_assessed extends \core\event\base { * @return string */ public function get_description() { - return 'A submission has been assessed in the workshop ' . $this->other['workshopid'] . '.'; + return "The submission with the id '$this->objectid' has been assessed by the user with the id '$this->userid' for the user " . + "with the id '$this->relateduserid' in the workshop with the course module id '$this->contextinstanceid'."; } /** diff --git a/mod/workshop/classes/event/submission_created.php b/mod/workshop/classes/event/submission_created.php index a54c072c32a..e9e363387a6 100644 --- a/mod/workshop/classes/event/submission_created.php +++ b/mod/workshop/classes/event/submission_created.php @@ -15,10 +15,9 @@ // along with Moodle. If not, see . /** - * This file contains an event for when a workshop submission is created. + * The mod_workshop submission created event. * * @package mod_workshop - * @category event * @copyright 2013 Adrian Greeve * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -27,17 +26,16 @@ namespace mod_workshop\event; defined('MOODLE_INTERNAL') || die(); /** - * Event for when a workshop submission is created. + * The mod_workshop submission created event class. * * @property-read array $other { * Extra information about the event. * - * @type string submissiontitle Submission title. + * - string submissiontitle: Submission title. * } * * @package mod_workshop * @since Moodle 2.7 - * @category event * @copyright 2013 Adrian Greeve * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -58,7 +56,8 @@ class submission_created extends \core\event\base { * @return string */ public function get_description() { - return 'A user with an id of ' . $this->userid . ' created a workshop submission with an id of ' . $this->objectid; + return "The user with the id '$this->userid' created the submission with the id of '$this->objectid' for the workshop " . + "with the course module id '$this->contextinstanceid'."; } /** diff --git a/mod/workshop/classes/event/submission_reassessed.php b/mod/workshop/classes/event/submission_reassessed.php index 01a1ca34e6e..49bb0c42ff5 100644 --- a/mod/workshop/classes/event/submission_reassessed.php +++ b/mod/workshop/classes/event/submission_reassessed.php @@ -15,10 +15,9 @@ // along with Moodle. If not, see . /** - * mod_workshop submission_reassessed event. + * The mod_workshop submission reassessed event. * * @package mod_workshop - * @category event * @copyright 2013 Adrian Greeve * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -27,19 +26,18 @@ namespace mod_workshop\event; defined('MOODLE_INTERNAL') || die(); /** - * mod_workshop submission_reassessed event class. + * The mod_workshop submission reassessed event class. * * @property-read array $other { * Extra information about the event. * - * @type int workshopid Workshop ID. - * @type int submissionid Submission ID. - * @type float grade Assessment grade. + * - int workshopid: Workshop ID. + * - int submissionid: Submission ID. + * - float grade: Assessment grade. * } * * @package mod_workshop * @since Moodle 2.7 - * @category event * @copyright 2013 Adrian Greeve * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -62,7 +60,8 @@ class submission_reassessed extends \core\event\base { * @return string */ public function get_description() { - return 'A submission was re-assessed in the workshop ' . $this->other['workshopid'] . '.'; + return "The submission with the id '$this->objectid' has been reassessed by the user with the id '$this->userid' for the user " . + "with the id '$this->relateduserid' in the workshop with the course module id '$this->contextinstanceid'."; } /** diff --git a/mod/workshop/classes/event/submission_updated.php b/mod/workshop/classes/event/submission_updated.php index 78a404257ef..ca94d7f939a 100644 --- a/mod/workshop/classes/event/submission_updated.php +++ b/mod/workshop/classes/event/submission_updated.php @@ -15,10 +15,9 @@ // along with Moodle. If not, see . /** - * This file contains an event for when a workshop submission is updated. + * The mod_workshop submission updated event. * * @package mod_workshop - * @category event * @copyright 2013 Adrian Greeve * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -27,17 +26,16 @@ namespace mod_workshop\event; defined('MOODLE_INTERNAL') || die(); /** - * Event for when a workshop submission is updated. + * The mod_workshop submission updated event class. * * @property-read array $other { * Extra information about the event. * - * @type string submissiontitle Submission title. + * - string submissiontitle: Submission title. * } * * @package mod_workshop * @since Moodle 2.7 - * @category event * @copyright 2013 Adrian Greeve * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -58,7 +56,8 @@ class submission_updated extends \core\event\base { * @return string */ public function get_description() { - return 'A user with an id of ' . $this->userid . ' updated a workshop submission with an id of ' . $this->objectid; + return "The user with the id '$this->userid' updated the submission with the id '$this->objectid' for the workshop " . + "with the course module id '$this->contextinstanceid'."; } /** diff --git a/mod/workshop/classes/event/submission_viewed.php b/mod/workshop/classes/event/submission_viewed.php index bdb11e6395e..20dda46b2a6 100644 --- a/mod/workshop/classes/event/submission_viewed.php +++ b/mod/workshop/classes/event/submission_viewed.php @@ -15,10 +15,9 @@ // along with Moodle. If not, see . /** - * This file contains an event for when a workshop submission is viewed. + * The mod_workshop submission viewed event. * * @package mod_workshop - * @category event * @copyright 2013 Adrian Greeve * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -27,17 +26,16 @@ namespace mod_workshop\event; defined('MOODLE_INTERNAL') || die(); /** - * Event for when a workshop submission is viewed. + * The mod_workshop submission viewed event class. * * @property-read array $other { * Extra information about the event. * - * @type int workshopid workshop ID. + * - int workshopid: workshop ID. * } * * @package mod_workshop * @since Moodle 2.7 - * @category event * @copyright 2013 Adrian Greeve * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -58,7 +56,8 @@ class submission_viewed extends \core\event\base { * @return string */ public function get_description() { - return 'A user with an id of ' . $this->userid . ' viewed a workshop submission with an id of ' . $this->objectid; + return "The user with the id '$this->userid' viewed the submission with the id '$this->objectid' for the workshop " . + "with the course module id '$this->contextinstanceid'."; } /** diff --git a/mod/workshop/locallib.php b/mod/workshop/locallib.php index 8afb25a4585..a9221c902b5 100644 --- a/mod/workshop/locallib.php +++ b/mod/workshop/locallib.php @@ -2476,7 +2476,6 @@ class workshop { 'finalgrade' => $finalgrade ); - // we need to save new calculation into the database if (is_null($agid)) { // no aggregation record yet diff --git a/mod/workshop/tests/events_test.php b/mod/workshop/tests/events_test.php index 99ae64b23fd..ad531219f81 100644 --- a/mod/workshop/tests/events_test.php +++ b/mod/workshop/tests/events_test.php @@ -163,9 +163,9 @@ class mod_workshop_events_testcase extends advanced_testcase { $this->setAdminUser(); $event = \mod_workshop\event\assessment_evaluations_reset::create(array( - 'objectid' => $this->workshop->id, 'context' => $this->context, 'courseid' => $this->course->id, + 'other' => array('workshopid' => $this->workshop->id) )); // Trigger and capture the event. @@ -223,7 +223,7 @@ class mod_workshop_events_testcase extends advanced_testcase { 'courseid' => $this->course->id, 'relateduserid' => $user->id, 'other' => array( - 'workshopid' => $this->workshop->id + 'submissiontitle' => 'The submission title' ) ) ); @@ -259,7 +259,7 @@ class mod_workshop_events_testcase extends advanced_testcase { 'courseid' => $this->course->id, 'relateduserid' => $user->id, 'other' => array( - 'workshopid' => $this->workshop->id + 'submissiontitle' => 'The submission title' ) ) ); diff --git a/mod/workshop/toolbox.php b/mod/workshop/toolbox.php index d8fe9c86425..addd663b68b 100644 --- a/mod/workshop/toolbox.php +++ b/mod/workshop/toolbox.php @@ -38,9 +38,9 @@ $workshop = new workshop($workshop, $cm, $course); require_sesskey(); $params = array( - 'objectid' => $workshop->id, 'context' => $workshop->context, - 'courseid' => $course->id + 'courseid' => $course->id, + 'other' => array('workshopid' => $workshop->id) ); switch ($tool) { diff --git a/report/completion/classes/event/report_viewed.php b/report/completion/classes/event/report_viewed.php index a31e8c68503..8f150354369 100644 --- a/report/completion/classes/event/report_viewed.php +++ b/report/completion/classes/event/report_viewed.php @@ -15,10 +15,10 @@ // along with Moodle. If not, see . /** - * Event for when completion report is viewed. + * The report_completion report viewed event. * * @package report_completion - * @copyright 2014 onwards Ankit Agarwal + * @copyright 2014 onwards Ankit Agarwal * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -27,11 +27,11 @@ namespace report_completion\event; defined('MOODLE_INTERNAL') || die(); /** - * Event triggered, when completion report is viewed. + * The report_completion report viewed event class. * * @package report_completion * @since Moodle 2.7 - * @copyright 2014 onwards Ankit Agarwal + * @copyright 2014 onwards Ankit Agarwal * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class report_viewed extends \core\event\base { @@ -61,7 +61,7 @@ class report_viewed extends \core\event\base { * @return string */ public function get_description() { - return "The user with id " . $this->userid . " viewed completion report for course with id " . $this->courseid; + return "The user with the id '$this->userid' viewed the completion report for the course with the id '$this->courseid'."; } /** @@ -82,7 +82,7 @@ class report_viewed extends \core\event\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.'); } } } diff --git a/report/completion/classes/event/user_report_viewed.php b/report/completion/classes/event/user_report_viewed.php index 3e71d0994c7..91d634391e7 100644 --- a/report/completion/classes/event/user_report_viewed.php +++ b/report/completion/classes/event/user_report_viewed.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * Event for when user log report is viewed. + * The report_completion user report viewed event. * * @package report_completion * @copyright 2014 onwards Ankit Agarwal @@ -27,7 +27,7 @@ namespace report_completion\event; defined('MOODLE_INTERNAL') || die(); /** - * Event triggered, when user log report is viewed. + * The report_completion user report viewed event class. * * @package report_completion * @since Moodle 2.7 @@ -61,7 +61,7 @@ class user_report_viewed extends \core\event\base { * @return string */ public function get_description() { - return 'The user with id ' . $this->userid . ' viewed user log report for user with id ' . $this->relateduserid; + return "The user with the id '$this->userid' viewed the user completion report for the user with the id '$this->relateduserid'."; } /** @@ -92,7 +92,7 @@ class user_report_viewed extends \core\event\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.'); } } } diff --git a/report/log/classes/event/report_viewed.php b/report/log/classes/event/report_viewed.php index 49982b2072f..ea40f1a4a08 100644 --- a/report/log/classes/event/report_viewed.php +++ b/report/log/classes/event/report_viewed.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * Event for when log report is viewed. + * The report_log report viewed event. * * @package report_log * @copyright 2013 Ankit Agarwal @@ -23,15 +23,20 @@ */ namespace report_log\event; +defined('MOODLE_INTERNAL') || die(); + /** - * Event triggered, when log report is viewed. + * The report_log report viewed event class. * - * @property-read array $other Extra information about the event. - * -int groupid: Group to display. - * -int date: Date to display logs from. - * -int modid: Module id for which logs were displayed. - * -string modaction: Module action. - * -string logformat: Log format in which logs were displayed. + * @property-read array $other { + * Extra information about the event. + * + * - int groupid: Group to display. + * - int date: Date to display logs from. + * - int modid: Module id for which logs were displayed. + * - string modaction: Module action. + * - string logformat: Log format in which logs were displayed. + * } * * @package report_log * @since Moodle 2.7 @@ -65,7 +70,7 @@ class report_viewed extends \core\event\base { * @return string */ public function get_description() { - return "The user with id " . $this->userid . " viewed log report for course with id " . $this->courseid; + return "The user with the id '$this->userid' viewed the log report for the course with the id '$this->courseid'."; } /** @@ -94,28 +99,28 @@ class report_viewed extends \core\event\base { */ protected function validate_data() { parent::validate_data(); - if (!isset($this->data['other']['groupid'])) { - throw new \coding_exception('The property groupid must be set in other.'); + if (!isset($this->other['groupid'])) { + throw new \coding_exception('The \'groupid\' value must be set in other.'); } - if (!isset($this->data['other']['date'])) { - throw new \coding_exception('The property date must be set in other.'); + if (!isset($this->other['date'])) { + throw new \coding_exception('The \'date\' value must be set in other.'); } - if (!isset($this->data['other']['modid'])) { - throw new \coding_exception('The property modid must be set in other.'); + if (!isset($this->other['modid'])) { + throw new \coding_exception('The \'modid\' value must be set in other.'); } - if (!isset($this->data['other']['modaction'])) { - throw new \coding_exception('The property modaction must be set in other.'); + if (!isset($this->other['modaction'])) { + throw new \coding_exception('The \'modaction\' value must be set in other.'); } - if (!isset($this->data['other']['logformat'])) { - throw new \coding_exception('The property logformat must be set in other.'); + if (!isset($this->other['logformat'])) { + throw new \coding_exception('The \'logformat\' value must be set in other.'); } if (!isset($this->data['relateduserid'])) { - throw new \coding_exception('The property relateduserid must be set.'); + throw new \coding_exception('The \'relateduserid\' must be set.'); } } } diff --git a/report/log/classes/event/user_report_viewed.php b/report/log/classes/event/user_report_viewed.php index cf3e0d106f6..c0e555c2573 100644 --- a/report/log/classes/event/user_report_viewed.php +++ b/report/log/classes/event/user_report_viewed.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * Event for when user log report is viewed. + * The report_log user report viewed event. * * @package report_log * @copyright 2013 Ankit Agarwal @@ -23,11 +23,16 @@ */ namespace report_log\event; +defined('MOODLE_INTERNAL') || die(); + /** - * Event triggered, when user log report is viewed. + * The report_log user report viewed event class. * - * @property-read array $other Extra information about the event. - * -string mode: display mode. + * @property-read array $other { + * Extra information about the event. + * + * - string mode: display mode. + * } * * @package report_log * @since Moodle 2.7 @@ -61,7 +66,7 @@ class user_report_viewed extends \core\event\base { * @return string */ public function get_description() { - return 'The user with id ' . $this->userid . ' viewed user log report for user with id ' . $this->relateduserid; + return "The user with the id '$this->userid' viewed the user log report for the user with the id '$this->relateduserid'."; } /** @@ -92,12 +97,12 @@ class user_report_viewed extends \core\event\base { */ protected function validate_data() { parent::validate_data(); - if (empty($this->data['other']['mode'])) { - throw new \coding_exception('The property mode must be set in other.'); + if (empty($this->other['mode'])) { + throw new \coding_exception('The \'mode\' value must be set in other.'); } if (empty($this->data['relateduserid'])) { - throw new \coding_exception('The property relateduserid must be set.'); + throw new \coding_exception('The \'relateduserid\' must be set.'); } } } diff --git a/report/loglive/classes/event/report_viewed.php b/report/loglive/classes/event/report_viewed.php index 7a708ff9253..5360c11bec1 100644 --- a/report/loglive/classes/event/report_viewed.php +++ b/report/loglive/classes/event/report_viewed.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * Event for when loglive report is viewed. + * The report_loglive report viewed event. * * @package report_loglive * @copyright 2013 Ankit Agarwal @@ -23,8 +23,10 @@ */ namespace report_loglive\event; +defined('MOODLE_INTERNAL') || die(); + /** - * Event triggered, when loglive report is viewed. + * The report_loglive report viewed event class. * * @package report_loglive * @since Moodle 2.7 @@ -58,7 +60,7 @@ class report_viewed extends \core\event\base { * @return string */ public function get_description() { - return "The user with id " . $this->userid . " viewed live log report for course with id " . $this->courseid; + return "The user with the id '$this->userid' viewed the live log report for the course with the id '$this->courseid'."; } /** diff --git a/report/outline/classes/event/activity_report_viewed.php b/report/outline/classes/event/activity_report_viewed.php index 3b37a87dbb9..8e6ed253175 100644 --- a/report/outline/classes/event/activity_report_viewed.php +++ b/report/outline/classes/event/activity_report_viewed.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * Event when activity report is viewed. + * The report_outline activity report viewed event. * * @package report_outline * @copyright 2014 Rajesh Taneja @@ -23,8 +23,10 @@ */ namespace report_outline\event; +defined('MOODLE_INTERNAL') || die(); + /** - * Event when activity report is viewed. + * The report_outline activity report viewed event class. * * @package report_outline * @since Moodle 2.7 @@ -58,7 +60,7 @@ class activity_report_viewed extends \core\event\base { * @return string */ public function get_description() { - return "The user with id " . $this->userid . " viewed activity report for course with id " . $this->courseid; + return "The user with the id '$this->userid' viewed the outline activity report for the course with the id '$this->courseid'."; } /** diff --git a/report/outline/classes/event/report_viewed.php b/report/outline/classes/event/report_viewed.php index 4eb3a57baaf..e18dc8ccdb8 100644 --- a/report/outline/classes/event/report_viewed.php +++ b/report/outline/classes/event/report_viewed.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * Event when outline report is viewed. + * The report_outline outline report viewed event. * * @package report_outline * @copyright 2013 Ankit Agarwal @@ -23,11 +23,16 @@ */ namespace report_outline\event; +defined('MOODLE_INTERNAL') || die(); + /** - * Event when outline report is viewed. + * The report_outline outline report viewed event class. * - * @property-read array $other Extra information about the event. - * -string mode: display mode. + * @property-read array $other { + * Extra information about the event. + * + * - string mode: display mode. + * } * * @package report_outline * @since Moodle 2.7 @@ -61,8 +66,8 @@ class report_viewed extends \core\event\base { * @return string */ public function get_description() { - return "The user with id " . $this->userid . " viewed outline report for user with id " . $this->relateduserid . - ", for course " . $this->courseid; + return "The user with the id '$this->userid' viewed the outline report for the user with the id '$this->relateduserid' " . + "for the course with the id '$this->courseid'."; } /** @@ -93,11 +98,11 @@ class report_viewed extends \core\event\base { */ protected function validate_data() { parent::validate_data(); - if (empty($this->data['other']['mode'])) { - throw new \coding_exception('The property mode must be set in other.'); + if (empty($this->other['mode'])) { + throw new \coding_exception('The \'mode\' value must be set in other.'); } if (empty($this->data['relateduserid'])) { - throw new \coding_exception('The property relateduserid must be set.'); + throw new \coding_exception('The \'relateduserid\' must be set.'); } } } diff --git a/report/participation/classes/event/report_viewed.php b/report/participation/classes/event/report_viewed.php index c70b0418050..d5b6e23d6b8 100644 --- a/report/participation/classes/event/report_viewed.php +++ b/report/participation/classes/event/report_viewed.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * Event for when some content in participation report is viewed. + * The report_participation report viewed event. * * @package report_participation * @copyright 2013 Ankit Agarwal @@ -23,15 +23,20 @@ */ namespace report_participation\event; +defined('MOODLE_INTERNAL') || die(); + /** - * Event triggered, when some content in participation report is viewed. + * The report_participation report viewed event class. * - * @property-read array $other Extra information about the event. - * -int instanceid: Id of instance. - * -int roleid: Role id for whom report is viewed. - * -int groupid: (optional) group id. - * -int timefrom: (optional) time from which report is viewed. - * -string action: (optional) action viewed. + * @property-read array $other { + * Extra information about the event. + * + * - int instanceid: Id of instance. + * - int roleid: Role id for whom report is viewed. + * - int groupid: (optional) group id. + * - int timefrom: (optional) time from which report is viewed. + * - string action: (optional) action viewed. + * } * * @package report_participation * @since Moodle 2.7 @@ -65,7 +70,7 @@ class report_viewed extends \core\event\base { * @return string */ public function get_description() { - return "The user with id " . $this->userid . " viewed course participation report for course with id " . $this->courseid; + return "The user with the id '$this->userid' viewed the course participation report for the course with the id '$this->courseid'."; } /** @@ -85,7 +90,7 @@ class report_viewed extends \core\event\base { */ public function get_url() { return new \moodle_url('/report/participation/index.php', array('id' => $this->courseid, - 'instanceid' => $this->data['other']['instanceid'], 'roleid' => $this->data['other']['roleid'])); + 'instanceid' => $this->other['instanceid'], 'roleid' => $this->other['roleid'])); } /** @@ -96,24 +101,24 @@ class report_viewed extends \core\event\base { */ protected function validate_data() { parent::validate_data(); - if (empty($this->data['other']['instanceid'])) { - throw new \coding_exception('The property instanceid must be set in other.'); + if (empty($this->other['instanceid'])) { + throw new \coding_exception('The \'instanceid\' value must be set in other.'); } - if (empty($this->data['other']['roleid'])) { - throw new \coding_exception('The property roleid must be set in other.'); + if (empty($this->other['roleid'])) { + throw new \coding_exception('The \'roleid\' value must be set in other.'); } - if (!isset($this->data['other']['groupid'])) { - throw new \coding_exception('The property groupid must be set in other.'); + if (!isset($this->other['groupid'])) { + throw new \coding_exception('The \'groupid\' value must be set in other.'); } - if (!isset($this->data['other']['timefrom'])) { - throw new \coding_exception('The property timefrom must be set in other.'); + if (!isset($this->other['timefrom'])) { + throw new \coding_exception('The \'timefrom\' value must be set in other.'); } - if (!isset($this->data['other']['action'])) { - throw new \coding_exception('The property action must be set in other.'); + if (!isset($this->other['action'])) { + throw new \coding_exception('The \'action\' value must be set in other.'); } } } diff --git a/report/questioninstances/classes/event/report_viewed.php b/report/questioninstances/classes/event/report_viewed.php index 2d4e40aaceb..1b15e4ed9d0 100644 --- a/report/questioninstances/classes/event/report_viewed.php +++ b/report/questioninstances/classes/event/report_viewed.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * Event for when capability report is viewed. + * The report_questioninstances report viewed event. * * @package report_questioninstances * @copyright 2014 Petr Skoda @@ -23,11 +23,16 @@ */ namespace report_questioninstances\event; +defined('MOODLE_INTERNAL') || die(); + /** - * Event triggered, when capability report is viewed. + * The report_questioninstances report viewed event class. * - * @property-read array $other Extra information about the event. - * -string requestedqtype: Requested report type. + * @property-read array $other { + * Extra information about the event. + * + * -string requestedqtype: Requested question type. + * } * * @package report_questioninstances * @since Moodle 2.7 @@ -62,7 +67,7 @@ class report_viewed extends \core\event\base { * @return string */ public function get_description() { - return "The user with id " . $this->userid . " viewed question instances report"; + return "The user with the id '$this->userid' viewed the question instances report."; } /** @@ -91,9 +96,8 @@ class report_viewed extends \core\event\base { */ protected function validate_data() { parent::validate_data(); - - if (!isset($this->data['other']['requestedqtype'])) { - throw new \coding_exception('requestedqtype must be set in other array.'); + if (!isset($this->other['requestedqtype'])) { + throw new \coding_exception('The \'requestedqtype\' value must be set in other.'); } } } diff --git a/report/stats/classes/event/report_viewed.php b/report/stats/classes/event/report_viewed.php index 99e94982b8e..563c99cd50c 100644 --- a/report/stats/classes/event/report_viewed.php +++ b/report/stats/classes/event/report_viewed.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * Event when stats report is viewed. + * The report_stats report viewed event. * * @package report_stats * @copyright 2013 Ankit Agarwal @@ -23,13 +23,18 @@ */ namespace report_stats\event; +defined('MOODLE_INTERNAL') || die(); + /** - * Event triggered, when stats report is viewed. + * The report_stats report viewed event class. * - * @property-read array $other Extra information about the event. - * -int report: (optional) Report type. - * -int time: (optional) Time from which report is viewed. - * -int mode: (optional) Report mode. + * @property-read array $other { + * Extra information about the event. + * + * - int report: (optional) Report type. + * - int time: (optional) Time from which report is viewed. + * - int mode: (optional) Report mode. + * } * * @package report_stats * @since Moodle 2.7 @@ -63,7 +68,7 @@ class report_viewed extends \core\event\base { * @return string */ public function get_description() { - return 'The user with id ' . $this->userid . ' viewed statistics report for course with id ' . $this->courseid; + return "The user with the id '$this->userid' viewed the statistics report for the course with the id '$this->courseid'."; } /** @@ -81,8 +86,8 @@ class report_viewed extends \core\event\base { * @return \moodle_url */ public function get_url() { - return new \moodle_url('/report/stats/index.php', array('id' => $this->courseid, 'mode' => $this->data['other']['mode'], - 'report' => $this->data['other']['report'])); + return new \moodle_url('/report/stats/index.php', array('id' => $this->courseid, 'mode' => $this->other['mode'], + 'report' => $this->other['report'])); } /** @@ -93,20 +98,20 @@ class report_viewed extends \core\event\base { */ protected function validate_data() { parent::validate_data(); - if (!isset($this->data['other']['report'])) { - throw new \coding_exception('The property report must be set in other.'); + if (!isset($this->other['report'])) { + throw new \coding_exception('The \'report\' value must be set in other.'); } - if (!isset($this->data['other']['time'])) { - throw new \coding_exception('The property time must be set in other.'); + if (!isset($this->other['time'])) { + throw new \coding_exception('The \'time\' value must be set in other.'); } - if (!isset($this->data['other']['mode'])) { - throw new \coding_exception('The property mode must be set in other.'); + if (!isset($this->other['mode'])) { + throw new \coding_exception('The \'mode\' value must be set in other.'); } if (!isset($this->data['relateduserid'])) { - throw new \coding_exception('The property relateduserid must be set.'); + throw new \coding_exception('The \'relateduserid\' must be set.'); } } } diff --git a/report/stats/classes/event/user_report_viewed.php b/report/stats/classes/event/user_report_viewed.php index dfb9e9f5405..e530ded6a9c 100644 --- a/report/stats/classes/event/user_report_viewed.php +++ b/report/stats/classes/event/user_report_viewed.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * Event when user stats report is viewed. + * The report_stats user report viewed event. * * @package report_stats * @copyright 2013 Ankit Agarwal @@ -23,8 +23,10 @@ */ namespace report_stats\event; +defined('MOODLE_INTERNAL') || die(); + /** - * Event triggered, when user stats report is viewed. + * The report_stats user report viewed event class. * * @package report_stats * @since Moodle 2.7 @@ -58,7 +60,7 @@ class user_report_viewed extends \core\event\base { * @return string */ public function get_description() { - return 'The user with id ' . $this->userid . ' viewed user statistics report for user with id ' . $this->relateduserid; + return "The user with the id '$this->userid' viewed the user statistics report for the user with the id '$this->relateduserid'."; } /** @@ -89,7 +91,7 @@ class user_report_viewed extends \core\event\base { protected function validate_data() { parent::validate_data(); if (empty($this->data['relateduserid'])) { - throw new \coding_exception('The property relateduserid must be set.'); + throw new \coding_exception('The \'relateduserid\' must be set.'); } } } diff --git a/user/index.php b/user/index.php index c1ed567144b..e0737b4f3e7 100644 --- a/user/index.php +++ b/user/index.php @@ -106,10 +106,10 @@ if (empty($rolenames) && !$isfrontpage) { } $event = \core\event\user_list_viewed::create(array( - 'context' => $context, 'objectid' => $course->id, + 'courseid' => $course->id, + 'context' => $context, 'other' => array( - 'courseid' => $course->id, 'courseshortname' => $course->shortname, 'coursefullname' => $course->fullname )