// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * Event for when capability report is viewed.
+ * The tool_capability report viewed event.
*
* @package tool_capability
* @copyright 2014 Petr Skoda
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
* @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.";
}
/**
}
public static function get_name() {
- return get_string('event_legacy_logged', 'logstore_legacy');
+ return get_string('eventlegacylogged', 'logstore_legacy');
}
public function get_description() {
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-$string['event_legacy_logged'] = 'Legacy event logged';
+$string['eventlegacylogged'] = 'Legacy event logged';
$string['loglegacy'] = 'Log legacy data';
$string['loglegacy_help'] = 'This plugin records log data to the legacy log table (mdl_log). This functionality has been replaced by newer, richer and more efficient logging plugins, so you should only run this plugin if you have old custom reports that directly query the old log table. Writing to the legacy logs will increase load, so it is recommended that you disable this plugin for performance reasons when it is not needed.';
$string['pluginname'] = 'Legacy log';
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.
'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(
'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 {
'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 {
'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 {
'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());
}
}
* @copyright 2014 Ankit Agarwal <ankit.agrr@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class core_calendar_event_testcase extends advanced_testcase {
+class core_calendar_events_testcase extends advanced_testcase {
/**
* The test user.
$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'].
$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'].
$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());
}
}
$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'].
$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'].
$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());
}
}
$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'].
$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'].
$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());
}
}
}
// Save record.
if ($result = $this->_save()) {
$data = $this->get_record_data();
- $event = \core\event\course_completed::create(
- array(
- 'objectid' => $data->id,
- 'userid' => $USER->id,
- 'context' => context_course::instance($data->course),
- 'courseid' => $data->course,
- 'other' => array('relateduserid' => $data->userid)
- )
- );
- $event->add_record_snapshot('course_completions', $data);
- $event->trigger();
+ \core\event\course_completed::create_from_completion($data)->trigger();
}
return $result;
$this->assertEquals($course->id, $event->courseid);
$this->assertEquals($coursecontext->id, $event->contextid);
$this->assertEquals($section->section, $event->other['sectionnum']);
- $expecteddesc = 'Course ' . $event->courseid . ' section ' . $event->other['sectionnum'] . ' updated by user ' . $event->userid;
+ $expecteddesc = "The user with the id '{$event->userid}' updated the section with the number '{$event->other['sectionnum']}' for the course with the id '{$event->courseid}'";
$this->assertEquals($expecteddesc, $event->get_description());
$url = new moodle_url('/course/editsection.php', array('id' => $event->objectid));
$this->assertEquals($url, $event->get_url());
$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.
$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.
$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());
}
}
$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.
$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.
$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());
}
}
$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.
$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());
}
}
$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, ''),
global $CFG;
require_once("$CFG->libdir/filterlib.php");
- filter_set_global_state('activitynames', TEXTFILTER_ON);
+ filter_set_global_state('activitynames', TEXTFILTER_ON, 1);
}
--- /dev/null
+<?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Mathjax filter post install hook
+ *
+ * @package filter
+ * @subpackage mathjaxloader
+ * @copyright 2014 onwards Andrew Davis (andyjdavis)
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+function xmldb_filter_mathjaxloader_install() {
+ global $CFG;
+ require_once("$CFG->libdir/filterlib.php");
+
+ filter_set_global_state('mathjaxloader', TEXTFILTER_ON, -1);
+}
$string['errorminpasswordnonalphanum'] = 'Passwords must have at least {$a} non-alphanumeric character(s).';
$string['errorminpasswordupper'] = 'Passwords must have at least {$a} upper case letter(s).';
$string['errorpasswordupdate'] = 'Error updating password, password not changed';
-$string['event_user_loggedin'] = 'User has logged in';
+$string['eventuserloggedin'] = 'User has logged in';
$string['eventuserloggedinas'] = 'User logged in as another user';
$string['eventuserloginfailed'] = 'User login failed';
$string['forcechangepassword'] = 'Force change password';
$string['description'] = 'Description';
$string['duplicateidnumber'] = 'Cohort with the same ID number already exists';
$string['editcohort'] = 'Edit cohort';
-$string['event_cohort_created'] = 'Cohort created';
-$string['event_cohort_deleted'] = 'Cohort deleted';
-$string['event_cohort_member_added'] = 'User added to a cohort';
-$string['event_cohort_member_removed'] = 'User removed from a cohort';
-$string['event_cohort_updated'] = 'Cohort updated';
+$string['eventcohortcreated'] = 'Cohort created';
+$string['eventcohortdeleted'] = 'Cohort deleted';
+$string['eventcohortmemberadded'] = 'User added to a cohort';
+$string['eventcohortmemberremoved'] = 'User removed from a cohort';
+$string['eventcohortupdated'] = 'Cohort updated';
$string['external'] = 'External cohort';
$string['idnumber'] = 'Cohort ID';
$string['memberscount'] = 'Cohort size';
$string['errorselectone'] = 'Please select a single group before choosing this option';
$string['errorselectsome'] = 'Please select one or more groups before choosing this option';
$string['evenallocation'] = 'Note: To keep group allocation even, the actual number of members per group differs from the number you specified.';
-$string['event_group_created'] = 'Group created';
-$string['event_group_deleted'] = 'Group deleted';
-$string['event_group_member_added'] = 'Group member added';
-$string['event_group_member_removed'] = 'Group member removed';
-$string['event_group_updated'] = 'Group updated';
-$string['event_grouping_created'] = 'Grouping created';
-$string['event_grouping_deleted'] = 'Grouping deleted';
-$string['event_grouping_updated'] = 'Grouping updated';
+$string['eventgroupcreated'] = 'Group created';
+$string['eventgroupdeleted'] = 'Group deleted';
+$string['eventgroupmemberadded'] = 'Group member added';
+$string['eventgroupmemberremoved'] = 'Group member removed';
+$string['eventgroupupdated'] = 'Group updated';
+$string['eventgroupingcreated'] = 'Grouping created';
+$string['eventgroupingdeleted'] = 'Grouping deleted';
+$string['eventgroupingupdated'] = 'Grouping updated';
$string['existingmembers'] = 'Existing members: {$a}';
$string['filtergroups'] = 'Filter groups by:';
$string['group'] = 'Group';
$string['eventmessagecontactblocked'] = 'Message contact blocked';
$string['eventmessagecontactremoved'] = 'Message contact removed';
$string['eventmessagecontactunblocked'] = 'Message contact unblocked';
-$string['eventmessageread'] = 'Message read';
+$string['eventmessageviewed'] = 'Message viewed';
$string['eventmessagesent'] = 'Message sent';
$string['forced'] = 'Forced';
$string['formorethan'] = 'For more than';
$string['entertags'] = 'Enter tags separated by commas';
$string['errortagfrontpage'] = 'Tagging the site main page is not allowed';
$string['errorupdatingrecord'] = 'Error updating tag record';
-$string['eventitemtagged'] = 'Item tagged';
-$string['eventitemuntagged'] = 'Item untagged';
+$string['eventtagadded'] = 'Tag added to an item';
$string['eventtagcreated'] = 'Tag created';
$string['eventtagdeleted'] = 'Tag deleted';
$string['eventtagflagged'] = 'Tag flagged';
+$string['eventtagremoved'] = 'Tag removed from an item';
$string['eventtagunflagged'] = 'Tag unflagged';
$string['eventtagupdated'] = 'Tag updated';
$string['flag'] = 'Flag';
$string['errorinvalidparam'] = 'The param "{$a}" is invalid.';
$string['errornotemptydefaultparamarray'] = 'The web service description parameter named \'{$a}\' is an single or multiple structure. The default can only be empty array. Check web service description.';
$string['erroroptionalparamarray'] = 'The web service description parameter named \'{$a}\' is an single or multiple structure. It can not be set as VALUE_OPTIONAL. Check web service description.';
-$string['event_webservice_function_called'] = 'Web service function called';
-$string['event_webservice_login_failed'] = 'Web service login failed';
-$string['event_webservice_service_created'] = 'Web service service created';
-$string['event_webservice_service_deleted'] = 'Web service service deleted';
-$string['event_webservice_service_updated'] = 'Web service service updated';
-$string['event_webservice_service_user_added'] = 'Web service service user added';
-$string['event_webservice_service_user_removed'] = 'Web service service user removed';
-$string['event_webservice_token_created'] = 'Web service token created';
-$string['event_webservice_token_sent'] = 'Web service token sent';
+$string['eventwebservice_function_called'] = 'Web service function called';
+$string['eventwebserviceloginfailed'] = 'Web service login failed';
+$string['eventwebserviceservicecreated'] = 'Web service service created';
+$string['eventwebserviceservicedeleted'] = 'Web service service deleted';
+$string['eventwebserviceserviceupdated'] = 'Web service service updated';
+$string['eventwebserviceserviceuseradded'] = 'Web service service user added';
+$string['eventwebserviceserviceuserremoved'] = 'Web service service user removed';
+$string['eventwebservicetokencreated'] = 'Web service token created';
+$string['eventwebservicetokensent'] = 'Web service token sent';
$string['execute'] = 'Execute';
$string['executewarnign'] = 'WARNING: If you press execute your database will be modified and changes can not be reverted automatically!';
$string['externalservice'] = 'External service';
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();
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();
}
* @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.
* @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
* @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.
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.');
}
}
* @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
* @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.
* @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'.";
}
/**
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);
}
/**
*/
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.');
}
}
}
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * blog comment created event.
+ * The blog comment created event.
*
* @package core
* @copyright 2013 Rajesh Taneja <rajesh@moodle.com>
defined('MOODLE_INTERNAL') || die();
/**
- * blog comment created event.
+ * The blog comment created event.
*
* @package core
* @since Moodle 2.7
* @copyright 2013 Rajesh Taneja <rajesh@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class blog_comment_created extends \core\event\comment_created {
+class blog_comment_created extends comment_created {
+
/**
* Get URL related to the action.
*
* @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']}'.";
}
}
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * blog comment deleted event.
+ * The blog comment deleted event.
*
* @package core
* @copyright 2013 Rajesh Taneja <rajesh@moodle.com>
defined('MOODLE_INTERNAL') || die();
/**
- * blog comment deleted event.
+ * The blog comment deleted event.
*
* @package core
* @since Moodle 2.7
* @copyright 2013 Rajesh Taneja <rajesh@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class blog_comment_deleted extends \core\event\comment_deleted {
+class blog_comment_deleted extends comment_deleted {
+
/**
* Get URL related to the action.
*
* @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']}'.";
}
}
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
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
-namespace core\event;
-
-defined('MOODLE_INTERNAL') || die();
-
/**
* Event for when a new blog entry is added..
*
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+namespace core\event;
+
+defined('MOODLE_INTERNAL') || die();
+
/**
* Class blog_entry_created
*
* @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;
/**
* 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;
/**
* Returns created blog_entry object for event observers.
*
+ * @throws \coding_exception
* @return \blog_entry
*/
public function get_blog_entry() {
* @return string
*/
public static function get_name() {
- return get_string("evententryadded", "core_blog");
+ return get_string('evententryadded', 'core_blog');
}
/**
* @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'.";
}
/**
}
/**
- * 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);
}
}
defined('MOODLE_INTERNAL') || die();
/**
- * class blog_entry_deleted
+ * Class blog_entry_deleted
*
* Event for when a new blog entry is deleted.
*
* @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;
/**
/**
* 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;
/**
* Returns deleted blog entry for event observers.
*
+ * @throws \coding_exception
* @return \blog_entry
*/
public function get_blog_entry() {
* @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'.";
}
/**
/**
* 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;
/**
* Returns updated blog entry for event observers.
*
+ * @throws \coding_exception
* @return \blog_entry
*/
public function get_blog_entry() {
* @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'.";
}
/**
/**
* 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
* @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'.";
}
/**
}
/**
- * 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();
}
}
/**
* 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
* @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();
}
}
/**
* 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
* @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}'.";
}
/**
* @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();
}
}
* @return string
*/
public static function get_name() {
- return get_string('event_cohort_created', 'core_cohort');
+ return get_string('eventcohortcreated', 'core_cohort');
}
/**
* @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'.";
}
/**
* @return string
*/
public static function get_name() {
- return get_string('event_cohort_deleted', 'core_cohort');
+ return get_string('eventcohortdeleted', 'core_cohort');
}
/**
* @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'.";
}
/**
* @return string
*/
public static function get_name() {
- return get_string('event_cohort_member_added', 'core_cohort');
+ return get_string('eventcohortmemberadded', 'core_cohort');
}
/**
* @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'.";
}
/**
* @return string
*/
public static function get_name() {
- return get_string('event_cohort_member_removed', 'core_cohort');
+ return get_string('eventcohortmemberremoved', 'core_cohort');
}
/**
* @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'.";
}
/**
* @return string
*/
public static function get_name() {
- return get_string('event_cohort_updated', 'core_cohort');
+ return get_string('eventcohortupdated', 'core_cohort');
}
/**
* @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'.";
}
/**
* @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
* @copyright 2013 Rajesh Taneja <rajesh@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-abstract class comment_created extends \core\event\base {
+abstract class comment_created extends base {
/**
* Init method.
* @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'.";
}
/**
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.');
}
}
}
* @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
* @copyright 2013 Rajesh Taneja <rajesh@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-abstract class comment_deleted extends \core\event\base {
+abstract class comment_deleted extends base {
/**
* Init method.
* @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'.";
}
/**
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.');
}
}
}
/**
* Abstract comments viewed event class.
*
- * This class has to be extended by any event which is triggred while viewing comment.
+ * This class has to be extended by any event which is triggered while viewing comment.
*
* @package core
* @since Moodle 2.7
* @copyright 2013 Rajesh Taneja <rajesh@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-abstract class comments_viewed extends \core\event\base {
+abstract class comments_viewed extends base {
/**
* Init method.
* @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'.";
}
/**
* @return string
*/
public function get_description() {
- return 'User with id ' . $this->userid . ' viewed content';
+ return "The user with the id '$this->userid' viewed content.";
}
/**
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.');
}
}
}
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+/**
+ * Course category created event.
+ *
+ * @package core
+ * @copyright 2014 Mark Nelson <markn@moodle.com>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
- * Course category created event.
+ * Course category created event class.
*
* @package core
* @since Moodle 2.7
* @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'.";
}
/**
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+/**
+ * Category deleted event.
+ *
+ * @package core
+ * @copyright 2013 Mark Nelson <markn@moodle.com>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
- * Category deleted event.
+ * Category deleted event class.
*
* @property-read array $other {
* Extra information about event.
*
- * @type string name category name.
+ * - string name: category name.
* }
*
* @package core
* @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'.";
}
/**
/**
* Returns deleted coursecat for event observers.
*
+ * @throws \coding_exception
* @return \coursecat
*/
public function get_coursecat() {
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+/**
+ * Course category updated event.
+ *
+ * @package core
+ * @copyright 2014 Mark Nelson <markn@moodle.com>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
- * Course category updated event.
+ * Course category updated event class.
*
* @package core
* @since Moodle 2.7
* @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'.";
}
/**
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+/**
+ * Course completed event.
+ *
+ * @package core
+ * @copyright 2013 Rajesh Taneja <rajesh@moodle.com>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
- * Event when course completed.
+ * Course completed event class.
+ *
+ * @property-read int $relateduserid user who completed the course
+ * @property-read array $other {
+ * Extra information about event.
+ *
+ * - int relateduserid: deprecated since 2.7, please use property relateduserid
+ * }
*
* @package core
* @since Moodle 2.6
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class course_completed extends base {
+ /**
+ * Create event from course_completion record.
+ * @param \stdClass $completion
+ * @return course_completed
+ */
+ public static function create_from_completion(\stdClass $completion) {
+ $event = self::create(
+ array(
+ 'objectid' => $completion->id,
+ 'relateduserid' => $completion->userid,
+ 'context' => \context_course::instance($completion->course),
+ 'courseid' => $completion->course,
+ 'other' => array('relateduserid' => $completion->userid), // Deprecated since 2.7, please use property relateduserid.
+ )
+ );
+ $event->add_record_snapshot('course_completions', $completion);
+ return $event;
+ }
/**
* Initialise required event data properties.
* @return string
*/
public function get_description() {
- return 'Course completed by user '.$this->userid;
+ return "The course with the id '$this->courseid' was completed for the user with the id '$this->relateduserid'.";
}
/**
return $this->get_record_snapshot('course_completions', $this->objectid);
}
+ /**
+ * Custom validation.
+ *
+ * @throws \coding_exception
+ * @return void
+ */
+ protected function validate_data() {
+ parent::validate_data();
+
+ // TODO: MDL-45319 add validation of relateduserid and other['relateduserid'].
+ }
}
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * Event when course module completion is updated.
+ * Course module completion updated event.
*
* @package core
* @copyright 2013 Rajesh Taneja <rajesh@moodle.com>
defined('MOODLE_INTERNAL') || die();
/**
- * Event when course module completion is updated.
+ * Course module completion updated event class.
*
* @package core
* @since Moodle 2.6
* @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'.";
}
/**
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+/**
+ * Course content_deleted event class.
+ *
+ * @package core
+ * @copyright 2013 Mark Nelson <markn@moodle.com>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
- * Course content_deleted event.
+ * Course content_deleted event class.
*
* @property-read array $other {
* Extra information about event.
*
- * @type array options list of options which were skipped while deleting course content.
+ * - array options: list of options which were skipped while deleting course content.
* }
*
* @package core
* @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'.";
}
/**
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+/**
+ * Course created event.
+ *
+ * @package core
+ * @copyright 2013 Mark Nelson <markn@moodle.com>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
- * Course created event.
+ * Course created event class.
*
* @property-read array $other {
* Extra information about event.
*
- * @type string shortname shortname of course.
- * @type string fullname fullname of course.
+ * - string shortname: shortname of course.
+ * - string fullname: fullname of course.
* }
*
* @package core
* @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'.";
}
/**
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+/**
+ * Course deleted event.
+ *
+ * @package core
+ * @copyright 2013 Mark Nelson <markn@moodle.com>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
- * Course deleted event.
+ * Course deleted event class.
*
* @property-read array $other {
* Extra information about event.
*
- * @type string shortname shortname of course.
- * @type string fullname fullname of course.
- * @type string idnumber id number of course.
+ * - string shortname: shortname of course.
+ * - string fullname: fullname of course.
+ * - string idnumber: id number of course.
* }
*
* @package core
* @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'.";
}
/**
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+/**
+ * Course module completion event.
+ *
+ * @package core
+ * @copyright 2013 Rajesh Taneja <rajesh@moodle.com>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
- * Event when course module completion is updated.
+ * Course module completion event class.
*
* @package core
* @since Moodle 2.6
* @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'.";
}
/**
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.');
}
}
}
/**
* 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.
*
* 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
* @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'.";
}
/**
}
/**
- * 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.');
}
}
}
* @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
* @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'.";
}
/**
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.');
}
}
}
/**
* Init method.
*
+ * @throws \coding_exception
* @return void
*/
protected function init() {
* @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'.";
}
/**
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.');
}
}
-
}
* @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
* @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'.";
}
/**
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.');
}
}
* @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'.";
}
/**
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.');
}
}
-
}
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * core course reset ended event.
+ * The course reset ended event.
*
* @package core
* @copyright 2013 Frédéric Massart
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
* @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.
* @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.";
}
/**
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.');
}
}
-
}
* @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
* @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.
* @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''.";
}
/**
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.');
}
}
-
}
* @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'.";
}
/**
return $logs;
}
-
/**
* Custom validation.
*
throw new \coding_exception('Context passed must be course context.');
}
}
-
}
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+/**
+ * Course restored event.
+ *
+ * @package core
+ * @copyright 2013 Mark Nelson <markn@moodle.com>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
- * Course restored event.
+ * Course restored event class.
*
* @property-read array $other {
* Extra information about event.
*
- * @type string type restore type, activity, course or section.
- * @type int target where restored (new/existing/current/adding/deleting)
- * @type int mode execution mode
- * @type string opertaion restore
- * @type boolean samesite true is restored to same site.
+ * - string type: restore type, activity, course or section.
+ * - int target: where restored (new/existing/current/adding/deleting).
+ * - int mode: execution mode.
+ * - string operation: what operation are we performing?
+ * - boolean samesite: true if restoring to same site.
* }
*
* @package core
* @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'.";
}
/**
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * Course section updated.
+ * Course section updated event.
*
* @package core
* @copyright 2013 Rajesh Taneja <rajesh@moodle.com>
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
* @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'";
}
/**
*/
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.');
}
}
}
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+/**
+ * Course updated event.
+ *
+ * @package core
+ * @copyright 2013 Mark Nelson <markn@moodle.com>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
- * Course updated event.
+ * Course updated event class.
*
* @property-read array $other {
* Extra information about event.
*
- * @type string shortname shortname of course.
- * @type string fullname fullname of course.
+ * - string shortname: shortname of course.
+ * - string fullname: fullname of course.
* }
*
* @package core
* @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'.";
}
/**
* 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
* @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'.";
}
/**
* 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
* @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'.";
}
/**
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.');
}
}
}
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+/**
+ * Email failed event.
+ *
+ * @package core
+ * @since Moodle 2.7
+ * @copyright 2013 Mark Nelson <markn@moodle.com>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
- * Email failed event.
+ * Email failed event class.
*
* @package core
* @since Moodle 2.7
* @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']}\".";
}
/**
* @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.
* @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'.";
}
/**
* @return string
*/
public static function get_name() {
- return get_string('event_group_created', 'group');
+ return get_string('eventgroupcreated', 'group');
}
/**
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = 'groups';
}
-
}
* @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.
* @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'.";
}
/**
* @return string
*/
public static function get_name() {
- return get_string('event_group_deleted', 'group');
+ return get_string('eventgroupdeleted', 'group');
}
/**
* @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
* @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.
* @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'.";
}
/**
* @return string
*/
public static function get_name() {
- return get_string('event_group_member_added', 'group');
+ return get_string('eventgroupmemberadded', 'group');
}
/**
* @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.');
+ }
+ }
}
* @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.
* @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'.";
}
/**
* @return string
*/
public static function get_name() {
- return get_string('event_group_member_removed', 'group');
+ return get_string('eventgroupmemberremoved', 'group');
}
/**
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = 'groups';
}
-
}
* @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.
* @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'.";
}
/**
* @return string
*/
public static function get_name() {
- return get_string('event_group_updated', 'group');
+ return get_string('eventgroupupdated', 'group');
}
/**
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = 'groups';
}
-
}
* @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.
* @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'.";
}
/**
* @return string
*/
public static function get_name() {
- return get_string('event_grouping_created', 'group');
+ return get_string('eventgroupingcreated', 'group');
}
/**
* @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.
* @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'.";
}
/**
* @return string
*/
public static function get_name() {
- return get_string('event_grouping_deleted', 'group');
+ return get_string('eventgroupingdeleted', 'group');
}
/**
* @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.
* @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);
* @return string
*/
public static function get_name() {
- return get_string('event_grouping_updated', 'group');
+ return get_string('eventgroupingupdated', 'group');
}
/**
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * Message contact added event class.
+ * Message contact added event.
*
* @package core
- * @since Moodle 2.7
* @copyright 2014 Mark Nelson <markn@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+
namespace core\event;
defined('MOODLE_INTERNAL') || die();
+/**
+ * Message contact added event class.
+ *
+ * @package core
+ * @since Moodle 2.7
+ * @copyright 2014 Mark Nelson <markn@moodle.com>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
class message_contact_added extends base {
/**
* @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.";
}
/**
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * Message contact blocked event class.
+ * Message contact blocked event.
*
* @package core
- * @since Moodle 2.7
* @copyright 2014 Mark Nelson <markn@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+
namespace core\event;
defined('MOODLE_INTERNAL') || die();
+/**
+ * Message contact blocked event class.
+ *
+ * @package core
+ * @since Moodle 2.7
+ * @copyright 2014 Mark Nelson <markn@moodle.com>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
class message_contact_blocked extends base {
/**
* @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.";
}
/**
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * Message contact removed event class.
+ * Message contact removed event.
*
* @package core
- * @since Moodle 2.7
* @copyright 2014 Mark Nelson <markn@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+
namespace core\event;
defined('MOODLE_INTERNAL') || die();
+/**
+ * Message contact removed event class.
+ *
+ * @package core
+ * @since Moodle 2.7
+ * @copyright 2014 Mark Nelson <markn@moodle.com>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
class message_contact_removed extends base {
/**
* @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.";
}
/**
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * Message contact unblocked event class.
+ * Message contact unblocked event.
*
* @package core
- * @since Moodle 2.7
* @copyright 2014 Mark Nelson <markn@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+
namespace core\event;
defined('MOODLE_INTERNAL') || die();
+/**
+ * Message contact unblocked event class.
+ *
+ * @package core
+ * @since Moodle 2.7
+ * @copyright 2014 Mark Nelson <markn@moodle.com>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
class message_contact_unblocked extends base {
/**
* @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.";
}
/**
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+/**
+ * Message sent event.
+ *
+ * @package core
+ * @copyright 2014 Mark Nelson <markn@moodle.com>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+namespace core\event;
+
+defined('MOODLE_INTERNAL') || die();
+
/**
* Message sent event class.
*
* @copyright 2014 Mark Nelson <markn@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-namespace core\event;
-
-defined('MOODLE_INTERNAL') || die();
-
class message_sent extends base {
/**
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'.";
}
/**
}
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.');
}
}
}
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * Message read event class.
+ * Message viewed event.
+ *
+ * @package core
+ * @copyright 2014 Mark Nelson <markn@moodle.com>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+namespace core\event;
+
+defined('MOODLE_INTERNAL') || die();
+
+/**
+ * Message viewed event class.
*
* @property-read array $other {
* Extra information about event.
* @copyright 2014 Mark Nelson <markn@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-namespace core\event;
-
-defined('MOODLE_INTERNAL') || die();
-
-class message_read extends base {
+class message_viewed extends base {
/**
* Init method.
* @return string
*/
public static function get_name() {
- return get_string('eventmessageread', 'message');
+ return get_string('eventmessageviewed', 'message');
}
/**
* @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'.";
}
/**
}
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.');
}
}
}
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * Mnet access control created event class.
+ * Mnet access control created event.
*
* @package core
* @since Moodle 2.7
* @copyright 2013 Mark Nelson <markn@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+
namespace core\event;
defined('MOODLE_INTERNAL') || die();
+/**
+ * Mnet access control created event class.
+ *
+ * @package core
+ * @since Moodle 2.7
+ * @copyright 2013 Mark Nelson <markn@moodle.com>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
class mnet_access_control_created extends base {
/**
* @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']}'.";
}
/**
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.');
}
}
}
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * Mnet access control updated event class.
+ * Mnet access control updated event.
*
* @package core
* @since Moodle 2.7
* @copyright 2013 Mark Nelson <markn@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+
namespace core\event;
defined('MOODLE_INTERNAL') || die();
+/**
+ * Mnet access control updated event class.
+ *
+ * @package core
+ * @since Moodle 2.7
+ * @copyright 2013 Mark Nelson <markn@moodle.com>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
class mnet_access_control_updated extends base {
/**
* @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']}'.";
}
/**
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.');
}
}
}
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
-namespace core\event;
-
-defined('MOODLE_INTERNAL') || die();
-
/**
* Event for when a new note entry is added.
*
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+namespace core\event;
+
+defined('MOODLE_INTERNAL') || die();
+
/**
* Class note_created
*
* @property-read array $other {
* Extra information about event.
*
- * @type string publishstate publish state.
+ * - string publishstate: the publish state.
* }
*
* @package core
* @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.
* @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'.";
}
/**
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
-namespace core\event;
-
-defined('MOODLE_INTERNAL') || die();
-
/**
* Event for when a new note entry deleted.
*
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+namespace core\event;
+
+defined('MOODLE_INTERNAL') || die();
+
/**
* Class note_deleted
*
* @property-read array $other {
* Extra information about event.
*
- * @type string publishstate publish state
+ * - string publishstate: the publish state.
* }
*
* @package core
* @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.
* @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'.";
}
/**
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
-namespace core\event;
-
-defined('MOODLE_INTERNAL') || die();
-
/**
* Event for when a new note entry is updated.
*
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+namespace core\event;
+
+defined('MOODLE_INTERNAL') || die();
+
/**
* Class note_updated
*
* @property-read array $other {
* Extra information about event.
*
- * @type string publishstate publish state.
+ * - string publishstate: the publish state.
* }
*
* @package core
* @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.
* @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'.";
}
/**
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
-namespace core\event;
-
-defined('MOODLE_INTERNAL') || die();
-
/**
* Event for when a new note entry viewed.
*
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+namespace core\event;
+
+defined('MOODLE_INTERNAL') || die();
+
/**
* Class note_viewed
*
* @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.
*/
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'.";
}
/**
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * Question category created event class.
+ * Question category created event.
*
* @package core
- * @since Moodle 2.7
* @copyright 2014 Mark Nelson <markn@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+
namespace core\event;
defined('MOODLE_INTERNAL') || die();
+/**
+ * Question category created event class.
+ *
+ * @package core
+ * @since Moodle 2.7
+ * @copyright 2014 Mark Nelson <markn@moodle.com>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
class question_category_created extends base {
/**
* @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'.";
}
/**
* @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.
*
* @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'.";
}
/**
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.');
}
}
}
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+/**
+ * Role assignments updated event.
+ *
+ * @package core
+ * @since Moodle 2.6
+ * @copyright 2013 Rajesh Taneja <rajesh@moodle.com>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
- * Event when role allow assignments is updated.
+ * Role assignments updated event class.
*
* @package core
* @since Moodle 2.6
* @copyright 2013 Rajesh Taneja <rajesh@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-
class role_allow_assign_updated extends base {
/**
* Initialise event parameters.
* @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'.";
}
/**
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+/**
+ * Role allow override updated event.
+ *
+ * @package core
+ * @since Moodle 2.6
+ * @copyright 2013 Rajesh Taneja <rajesh@moodle.com>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
- * Event when role allow override is updated.
+ * Role allow override updated event class.
*
* @package core
* @since Moodle 2.6
* @copyright 2013 Rajesh Taneja <rajesh@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-
class role_allow_override_updated extends base {
/**
* Initialise event parameters.
* @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'.";
}
/**
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+/**
+ * Role allow switch updated event.
+ *
+ * @package core
+ * @since Moodle 2.6
+ * @copyright 2013 Rajesh Taneja <rajesh@moodle.com>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
- * Event when role allow switch is updated.
+ * Role allow switch updated event class.
*
* @package core
* @since Moodle 2.6
* @copyright 2013 Rajesh Taneja <rajesh@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-
class role_allow_switch_updated extends base {
/**
* Initialise event parameters.
* @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'.";
}
/**
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+/**
+ * Role assigned event.
+ *
+ * @package core
+ * @copyright 2013 Petr Skoda {@link http://skodak.org}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
namespace core\event;
defined('MOODLE_INTERNAL') || die();
* @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
* @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';
* @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'.";
}
/**
* @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']);
}
/**
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+/**
+ * Role updated event.
+ *
+ * @package core
+ * @since Moodle 2.6
+ * @copyright 2013 Rajesh Taneja <rajesh@moodle.com>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
- * Role updated event.
+ * Role updated event class.
*
* @package core
* @since Moodle 2.6
* @copyright 2013 Rajesh Taneja <rajesh@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-
class role_capabilities_updated extends base {
/** @var array Legacy log data */
protected $legacylogdata = null;
* @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'.";
}
/**
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+/**
+ * Role assigned event.
+ *
+ * @package core
+ * @copyright 2013 Rajesh Taneja <rajesh@moodle.com>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
- * Role assigned event.
+ * Role assigned event class.
*
* @property-read array $other {
* Extra information about event.
*
- * @type string shortname shortname of role.
- * @type string description role description.
- * @type string archetype role type.
+ * - string shortname: shortname of role.
+ * - string description: role description.
+ * - string archetype: role type.
* }
*
* @package core
* @copyright 2013 Rajesh Taneja <rajesh@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-
class role_deleted extends base {
/**
* Initialise event parameters.
* @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'.";
}
/**
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+/**
+ * Role unassigned event.
+ *
+ * @package core
+ * @since Moodle 2.6
+ * @copyright 2013 Petr Skoda {@link http://skodak.org}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
- * Role unassigned event.
+ * Role unassigned event class.
*
* @property-read array $other {
* Extra information about event.
*
- * @type int id role assigned id.
- * @type string component name of component.
- * @type int itemid id of item.
+ * - int id: role assigned id.
+ * - string component: name of component.
+ * - int itemid: id of item.
* }
*
* @package core
* @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';
* @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'.";
}
/**
* @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']);
}
/**
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * Item tagged event.
+ * The tag added event.
+ *
+ * @package core
+ * @copyright 2014 Mark Nelson <markn@moodle.com>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+namespace core\event;
+
+defined('MOODLE_INTERNAL') || die();
+
+/**
+ * Event class for when a tag has been added to an item.
*
* @property-read array $other {
* Extra information about event.
* @copyright 2014 Mark Nelson <markn@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-
-namespace core\event;
-
-defined('MOODLE_INTERNAL') || die();
-
-class item_tagged extends base {
+class tag_added extends base {
/**
* Initialise the event data.
* @return string
*/
public static function get_name() {
- return get_string('eventitemtagged', 'tag');
+ return get_string('eventtagadded', 'tag');
}
/**
* @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']}'.";
}
/**
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.');
}
}
}
/**
* Tag created event.
*
+ * @package core
+ * @copyright 2014 Mark Nelson <markn@moodle.com>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+namespace core\event;
+
+defined('MOODLE_INTERNAL') || die();
+
+/**
+ * Tag created event class.
+ *
* @property-read array $other {
* Extra information about event.
*
* @copyright 2014 Mark Nelson <markn@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-
-namespace core\event;
-
-defined('MOODLE_INTERNAL') || die();
-
class tag_created extends base {
/**
* @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'.";
}
/**
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.');
}
}
}
/**
* Tag deleted event.
*
+ * @package core
+ * @copyright 2014 Mark Nelson <markn@moodle.com>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+namespace core\event;
+
+defined('MOODLE_INTERNAL') || die();
+
+/**
+ * Tag deleted event class.
+ *
* @property-read array $other {
* Extra information about event.
*
* @copyright 2014 Mark Nelson <markn@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-
-namespace core\event;
-
-defined('MOODLE_INTERNAL') || die();
-
class tag_deleted extends base {
/**
* @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'.";
}
/**
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.');
}
}
}
/**
* Tag flagged event.
*
+ * @package core
+ * @copyright 2014 Mark Nelson <markn@moodle.com>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+namespace core\event;
+
+defined('MOODLE_INTERNAL') || die();
+
+/**
+ * Tag flagged event class.
+ *
* @property-read array $other {
* Extra information about event.
*
* @copyright 2014 Mark Nelson <markn@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-
-namespace core\event;
-
-defined('MOODLE_INTERNAL') || die();
-
class tag_flagged extends base {
/**
* @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'.";
}
/**
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.');
}
}
}
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * Item untagged event.
+ * The tag removed event.
+ *
+ * @package core
+ * @copyright 2014 Mark Nelson <markn@moodle.com>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+namespace core\event;
+
+defined('MOODLE_INTERNAL') || die();
+
+/**
+ * Event class for when a tag has been removed from an item.
*
* @property-read array $other {
* Extra information about event.
* @copyright 2014 Mark Nelson <markn@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-
-namespace core\event;
-
-defined('MOODLE_INTERNAL') || die();
-
-class item_untagged extends base {
+class tag_removed extends base {
/**
* Initialise the event data.
* @return string
*/
public static function get_name() {
- return get_string('eventitemuntagged', 'tag');
+ return get_string('eventtagremoved', 'tag');
}
/**
* @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']}'.";
}
/**
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.');
}
}
}
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+/**
+ * Tag unflagged event.
+ *
+ * @package core
+ * @copyright 2014 Mark Nelson <markn@moodle.com>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+namespace core\event;
+
+defined('MOODLE_INTERNAL') || die();
+
/**
* Tag unflagged event.
*
* @copyright 2014 Mark Nelson <markn@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-
-namespace core\event;
-
-defined('MOODLE_INTERNAL') || die();
-
class tag_unflagged extends base {
/**
* @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'.";
}
/**
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.');
}
}
}
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+/**
+ * Tag updated event.
+ *
+ * @package core
+ * @copyright 2014 Mark Nelson <markn@moodle.com>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+namespace core\event;
+
+defined('MOODLE_INTERNAL') || die();
+
/**
* Tag updated event.
*
* @copyright 2014 Mark Nelson <markn@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-
-namespace core\event;
-
-defined('MOODLE_INTERNAL') || die();
-
class tag_updated extends base {
/** @var array The legacy log data. */
* @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'.";
}
/**
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.');
}
}
}
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+/**
+ * Unknown event.
+ *
+ * @package core
+ * @since Moodle 2.7
+ * @copyright 2014 Petr Skoda
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
namespace core\event;
defined('MOODLE_INTERNAL') || die();
* @copyright 2013 Rajesh Taneja <rajesh@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+
namespace core\event;
defined('MOODLE_INTERNAL') || die();
* @return string
*/
public function get_description() {
- return 'Profile created for user '.$this->objectid;
+ return "The user with the id '$this->objectid' was created.";
}
/**
* @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.";
}
/**
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.