// 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.";
}
/**
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());
}
}
}
array(
'objectid' => $data->id,
'userid' => $USER->id,
+ 'relateduserid' => $data->userid,
'context' => context_course::instance($data->course),
- 'courseid' => $data->course,
- 'other' => array('relateduserid' => $data->userid)
+ 'courseid' => $data->course
)
);
$event->add_record_snapshot('course_completions', $data);
$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, ''),
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 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 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 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 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 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.
*
* @package core
* @since Moodle 2.6
* @return string
*/
public function get_description() {
- return 'Course completed by user '.$this->userid;
+ return "The course with the id '$this->courseid' was completed by the user with the id '$this->userid'.";
}
/**
protected function get_legacy_eventdata() {
return $this->get_record_snapshot('course_completions', $this->objectid);
}
-
}
// 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'.";
}
/**
$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'.";
}
/**
* @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 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'.";
}
/**
$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'.";
}
/**
$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'.";
}
/**
* @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'.";
}
/**
* @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);
// 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.');
}
}
}
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+/**
+ * Message viewed event.
+ *
+ * @package core
+ * @copyright 2014 Mark Nelson <markn@moodle.com>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+namespace core\event;
+
+defined('MOODLE_INTERNAL') || die();
+
/**
* Message viewed event class.
*
* @copyright 2014 Mark Nelson <markn@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-namespace core\event;
-
-defined('MOODLE_INTERNAL') || die();
-
class message_viewed extends base {
/**
* @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/>.
/**
- * Event for when a tag has been added to an item.
+ * The tag added event.
+ *
+ * @package core
+ * @copyright 2014 Mark Nelson <markn@moodle.com>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+namespace core\event;
+
+defined('MOODLE_INTERNAL') || die();
+
+/**
+ * Event class for when a tag has been added to an item.
*
* @property-read array $other {
* Extra information about event.
* @copyright 2014 Mark Nelson <markn@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-
-namespace core\event;
-
-defined('MOODLE_INTERNAL') || die();
-
class tag_added extends base {
/**
* @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/>.
/**
- * Event for when a tag has been removed from an item.
+ * The tag removed event.
+ *
+ * @package core
+ * @copyright 2014 Mark Nelson <markn@moodle.com>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+namespace core\event;
+
+defined('MOODLE_INTERNAL') || die();
+
+/**
+ * Event class for when a tag has been removed from an item.
*
* @property-read array $other {
* Extra information about event.
* @copyright 2014 Mark Nelson <markn@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-
-namespace core\event;
-
-defined('MOODLE_INTERNAL') || die();
-
class tag_removed extends base {
/**
* @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.
* }
*
* @package core
* @return string
*/
public function get_description() {
- return 'User '.$this->relateduserid. ' is enrolled in course '.$this->courseid.' by user '.$this->userid;
+ return "The user with the id '$this->relateduserid' was enrolled in the course with the id '$this->courseid' by the " .
+ "user with the id '$this->userid'.";
}
/**
*/
protected function validate_data() {
parent::validate_data();
- if (!isset($this->other['enrol'])) {
- throw new \coding_exception('Enrolment plugin name must be set in $other.');
- }
+
if (!isset($this->relateduserid)) {
- throw new \coding_exception('Related user id must be set.');
+ throw new \coding_exception('The \'relateduserid\' must be set.');
+ }
+
+ if (!isset($this->other['enrol'])) {
+ throw new \coding_exception('The \'enrol\' value must be set in $other.');
}
}
}
/**
* User enrolment deleted event.
*
- * @property-read array $other {
- * Extra information about event.
- *
- * @type string enrol name of enrolment instance.
- * @type array userenrolment user_enrolment record.
- * }
- *
* @package core
* @copyright 2013 Rajesh Taneja <rajesh@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
defined('MOODLE_INTERNAL') || die();
/**
- * Event when user is unenrolled from a course.
+ * Event class for when user is unenrolled from a course.
+ *
+ * @property-read array $other {
+ * Extra information about event.
+ *
+ * - string enrol: name of enrolment instance.
+ * - array userenrolment: user_enrolment record.
+ * }
*
* @package core
* @since Moodle 2.6
* @return string
*/
public function get_description() {
- return 'User '.$this->relateduserid. ' is enrolled in course '.$this->courseid.' by user '.$this->userid;
+ return "The user with the id '$this->relateduserid' was unenrolled in the course with the id '$this->courseid' by the " .
+ "user with the id '$this->userid'.";
}
/**
defined('MOODLE_INTERNAL') || die();
/**
- * Event when user enrolment is updated.
+ * Event class for when user enrolment is updated.
*
* @property-read array $other {
* Extra information about event.
*
- * @type string enrol name of enrolment instance.
+ * - string enrol: name of enrolment instance.
* }
*
* @package core
* @return string
*/
public function get_description() {
- return 'User '.$this->relateduserid. ' has updated enrolment for user '.$this->userid.' in course '.$this->courseid;
+ return "The user with the id '$this->userid' updated the enrolment for the user with the id '$this->relateduserid' in " .
+ "the course with the id '$this->courseid'.";
}
/**
* Note: use grade_grades_history table if you need to know
* the history of grades.
*
- * @property-read array $other Extra information about the event.
- * -int itemid: grade item id.
- * -bool overridden: Is this grade override?
- * -float finalgrade: the final grade value.
+ * @property-read array $other {
+ * Extra information about the event.
+ *
+ * - int itemid: grade item id.
+ * - bool overridden: Is this grade override?
+ * - float finalgrade: the final grade value.
+ * }
*
* @package core
* @since Moodle 2.7
* @copyright 2013 Petr Skoda
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class user_graded extends \core\event\base {
+class user_graded extends base {
/** @var \grade_grade $grade */
protected $grade;
* @return string
*/
public function get_description() {
- return "User {$this->userid} edited grade of user {$this->objectid} for grade item " . $this->other['itemid'];
+ return "The user with the id '$this->userid' updated the grade with the id {$this->objectid} for the user with the " .
+ "id '$this->relateduserid' for the grade item with the id '{$this->other['itemid']}'.";
}
/**
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+/**
+ * Defines the user list viewed event.
+ *
+ * @package core
+ * @copyright 2013 Mark Nelson <markn@moodle.com>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+namespace core\event;
+
+defined('MOODLE_INTERNAL') || die();
+
/**
* Defines the user list viewed event.
*
* @property-read array $other {
* Extra information about event.
*
- * @type int courseid id of course.
- * @type string courseshortname short name of course.
- * @type string coursefullname full name of course.
+ * - string courseshortname: the short name of course.
+ * - string coursefullname: the full name of course.
* }
*
* @package core
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-namespace core\event;
-
-defined('MOODLE_INTERNAL') || die();
-
-class user_list_viewed extends \core\event\base {
+class user_list_viewed extends base {
/**
* Initialise required event data properties.
* @return string
*/
public function get_description() {
- return 'User ' . $this->userid . ' viewed the list of users in the course ' . $this->other['courseid'];
+ return "The user with the id '$this->userid' viewed the list of users in the course with the id '$this->courseid'.";
}
/**
* @return \moodle_url
*/
public function get_url() {
- return new \moodle_url('/user/index.php', array('id' => $this->other['courseid']));
+ return new \moodle_url('/user/index.php', array('id' => $this->courseid));
}
/**
* @return array
*/
protected function get_legacy_logdata() {
- return array($this->other['courseid'], 'user', 'view all', 'index.php?id=' . $this->other['courseid'], '');
+ return array($this->courseid, 'user', 'view all', 'index.php?id=' . $this->courseid, '');
}
-
}
* User login event.
*
* @package core
- * @since Moodle 2.6
* @copyright 2013 Frédéric Massart
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
* @property-read array $other {
* Extra information about event.
*
- * @type string username name of user.
+ * - string username: name of user.
* }
*
* @package core
+ * @since Moodle 2.6
* @copyright 2013 Frédéric Massart
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class user_loggedin extends \core\event\base {
+class user_loggedin extends base {
/**
* Returns non-localised event description with id's for admin use only.
* @return string
*/
public function get_description() {
- return 'Userid ' . $this->userid . ' has logged in';
+ return "The user with the id '$this->userid' has logged in.";
}
/**
* @return string
*/
public function get_username() {
- return $this->data['other']['username'];
+ return $this->other['username'];
}
/**
*/
protected function validate_data() {
parent::validate_data();
- if (!isset($this->data['objectid'])) {
- throw new \coding_exception("objectid has to be specified.");
- } else if (!isset($this->data['other']['username'])) {
- throw new \coding_exception("other['username'] has to be specified.");
+
+ if (!isset($this->other['username'])) {
+ throw new \coding_exception('The \'username\' value must be set in other.');
}
}
}
* @property-read array $other {
* Extra information about event.
*
- * @type string originalusername original username.
- * @type string loggedinasusername username of logged in as user.
+ * - string originalusername: original username.
+ * - string loggedinasusername: username of logged in as user.
* }
*
* @package core
* @return string
*/
public function get_description() {
- return 'Userid ' . $this->userid . ' has logged in as '. $this->relateduserid;
+ return "The user with the id '$this->userid' has logged in as the user with the id '$this->relateduserid'.";
}
/**
* @property-read array $other {
* Extra information about event.
*
- * @type string sessionid session id.
+ * - string sessionid: session id.
* }
*
* @package core
* @return string
*/
public function get_description() {
- return 'User '.$this->objectid.' logged out.';
+ return "The user with the id '$this->objectid' has logged out.";
}
/**
* @property-read array $other {
* Extra information about event.
*
- * @type string username name of user.
- * @type int reason failure reason.
+ * - string username name of user.
+ * - int reason failure reason.
* }
*
* @package core
* @copyright 2014 Rajesh Taneja <rajesh@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class user_login_failed extends \core\event\base {
+class user_login_failed extends base {
/**
* Init method.
*
* @return string
*/
public function get_description() {
- return 'Login failed for user "' . $this->other['username'] . '" for reason id: ' . $this->other['reason'];
+ return "Login failed for the username '{$this->other['username']}' for the reason with the id '{$this->other['reason']}'.";
}
/**
*/
protected function validate_data() {
parent::validate_data();
+
if (!isset($this->other['reason'])) {
- throw new \coding_exception("other['reason'] has to be specified.");
- } else if (!isset($this->other['username'])) {
- throw new \coding_exception("other['username'] has to be specified.");
+ throw new \coding_exception('The \'reason\' value must be set in other.');
+ }
+
+ if (!isset($this->other['username'])) {
+ throw new \coding_exception('The \'username\' value must be set in other.');
}
}
* @copyright 2014 Petr Skoda
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+
namespace core\event;
defined('MOODLE_INTERNAL') || die();
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * Defines the user profile viewed event.
+ * The user profile viewed event.
+ *
+ * @package core
+ * @copyright 2013 Mark Nelson <markn@moodle.com>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+namespace core\event;
+
+defined('MOODLE_INTERNAL') || die();
+
+/**
+ * The user profile viewed event class.
*
* @property-read array $other {
* Extra information about event.
*
- * @type int courseid id of course.
- * @type string courseshortname short name of course.
- * @type string coursefullname fullname of course.
+ * - int courseid: id of course.
+ * - string courseshortname: short name of course.
+ * - string coursefullname: fullname of course.
* }
*
* @package core
* @copyright 2013 Mark Nelson <markn@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-
-namespace core\event;
-
-defined('MOODLE_INTERNAL') || die();
-
class user_profile_viewed extends base {
/**
* @return string
*/
public function get_description() {
- return 'User ' . $this->userid . ' viewed the profile for user ' . $this->relateduserid . ' in the course ' .
+ return 'The user ' . $this->userid . ' viewed the profile for user ' . $this->relateduserid . ' in the course ' .
$this->other['courseid'];
}
* @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();
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * core webservice function_called event.
+ * Web service function called event.
*
* @package core
* @copyright 2013 Frédéric Massart
defined('MOODLE_INTERNAL') || die();
/**
- * core webservice function_called event class.
+ * Web service function called event class.
*
* @property-read array $other {
* Extra information about event.
*
- * @type string function name of the function.
+ * - string function: name of the function.
* }
*
* @package core
* @copyright 2013 Frédéric Massart
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class webservice_function_called extends \core\event\base {
+class webservice_function_called extends base {
/**
* Legacy log data.
/**
* Return the legacy event log data.
*
- * @return void
+ * @param array $legacydata the legacy data to set
*/
public function set_legacy_logdata($legacydata) {
$this->legacylogdata = $legacydata;
protected function validate_data() {
parent::validate_data();
if (!isset($this->other['function'])) {
- throw new \coding_exception('The key \'function\' needs to be set in $other.');
+ throw new \coding_exception('The \'function\' value must be set in other.');
}
}
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * core web service login failed event.
+ * Web service login failed event.
*
* @package core
* @copyright 2013 Frédéric Massart
defined('MOODLE_INTERNAL') || die();
/**
- * core web service login_failed event class.
+ * Web service login failed event class.
*
* @property-read array $other {
* Extra information about event.
*
- * @type string method authentication method.
- * @type string reason failure reason.
- * @type string tokenid id of token.
+ * - string method: authentication method.
+ * - string reason: failure reason.
+ * - string tokenid: id of token.
* }
*
* @package core
* @copyright 2013 Frédéric Massart
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class webservice_login_failed extends \core\event\base {
+class webservice_login_failed extends base {
/**
* Legacy log data.
* @return string
*/
public function get_description() {
- return "Web service authentication failed with code: {$this->other['reason']}.";
+ return "Web service authentication failed with code: \"{$this->other['reason']}\".";
}
/**
protected function validate_data() {
parent::validate_data();
if (!isset($this->other['reason'])) {
- throw new \coding_exception('The key \'reason\' needs to be set in $other.');
+ throw new \coding_exception('The \'reason\' value must be set in other.');
} else if (!isset($this->other['method'])) {
- throw new \coding_exception('The key \'method\' needs to be set in $other.');
+ throw new \coding_exception('The \'method\' value must be set in other.');
} else if (isset($this->other['token'])) {
throw new \coding_exception('The token cannot be set in $other.');
}
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * core webservice service created event.
+ * Web service service created event.
*
* @package core
* @copyright 2013 Frédéric Massart
defined('MOODLE_INTERNAL') || die();
/**
- * core webservice service created event class.
+ * Web service service created event class.
*
* @property-read array $other {
* Extra information about event.
*
- * @type string sessionid session id.
+ * - string: sessionid session id.
* }
*
* @package core
* @copyright 2013 Frédéric Massart
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class webservice_service_created extends \core\event\base {
+class webservice_service_created extends base {
/**
* Returns description of what happened.
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * core webservice service deleted event.
+ * Web service service deleted event.
*
* @package core
* @copyright 2013 Frédéric Massart
defined('MOODLE_INTERNAL') || die();
/**
- * core webservice service deleted event class.
+ * Web service service deleted event class.
*
* @package core
* @since Moodle 2.6
* @copyright 2013 Frédéric Massart
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class webservice_service_deleted extends \core\event\base {
+class webservice_service_deleted extends base {
/**
* Returns description of what happened.
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * core webservice service updated event.
+ * Web service service updated event.
*
* @package core
* @copyright 2013 Frédéric Massart
defined('MOODLE_INTERNAL') || die();
/**
- * core webservice service updated event class.
+ * Web service service updated event class.
*
* @package core
* @since Moodle 2.6
* @copyright 2013 Frédéric Massart
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class webservice_service_updated extends \core\event\base {
+class webservice_service_updated extends base {
/**
* Returns description of what happened.
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * core webservice service user added event.
+ * Web service service user added event.
*
* @package core
* @copyright 2013 Frédéric Massart
defined('MOODLE_INTERNAL') || die();
/**
- * core webservice service user added event class.
+ * Web service service user added event class.
*
* @package core
* @since Moodle 2.6
* @copyright 2013 Frédéric Massart
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class webservice_service_user_added extends \core\event\base {
+class webservice_service_user_added extends base {
/**
* Returns description of what happened.
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * core webservice service user removed event.
+ * Web service service user removed event.
*
* @package core
* @copyright 2013 Frédéric Massart
defined('MOODLE_INTERNAL') || die();
/**
- * core webservice service user removed event class.
+ * Web service service user removed event class.
*
* @package core
* @since Moodle 2.6
* @copyright 2013 Frédéric Massart
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class webservice_service_user_removed extends \core\event\base {
+class webservice_service_user_removed extends base {
/**
* Returns description of what happened.
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * core webservice token_created event.
+ * Web service token created event.
*
* @package core
* @copyright 2013 Frédéric Massart
defined('MOODLE_INTERNAL') || die();
/**
- * core webservice token_created event class.
+ * Web service token created event class.
*
* @property-read array $other {
* Extra information about event.
*
- * @type bool auto automatically created.
+ * - bool auto: true if it was automatically created.
* }
*
* @package core
* @copyright 2013 Frédéric Massart
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class webservice_token_created extends \core\event\base {
+class webservice_token_created extends base {
/**
* Returns description of what happened.
protected function validate_data() {
parent::validate_data();
if (!isset($this->relateduserid)) {
- throw new \coding_exception('The property \'relateduserid\' must be set.');
+ throw new \coding_exception('The \'relateduserid\' must be set.');
}
}
-
}
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * core webservice token_sent event.
+ * Webservice token_sent event.
*
* @package core
* @copyright 2013 Frédéric Massart
defined('MOODLE_INTERNAL') || die();
/**
- * core webservice token sent event class.
+ * Webservice token sent event class.
*
* @package core
* @since Moodle 2.6
* @copyright 2013 Frédéric Massart
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class webservice_token_sent extends \core\event\base {
+class webservice_token_sent extends base {
/**
* Returns description of what happened.
$coursecontext = $cmcontext->get_parent_context();
// Trigger an event for course module completion changed.
- $event = \core\event\course_module_completion_updated::create(
- array('objectid' => $data->id,
- 'context' => $cmcontext,
- 'relateduserid' => $data->userid,
- 'other' => array('relateduserid' => $data->userid)
- )
- );
+ $event = \core\event\course_module_completion_updated::create(array(
+ 'objectid' => $data->id,
+ 'context' => $cmcontext,
+ 'relateduserid' => $data->userid,
+ 'other' => array(
+ 'relateduserid' => $data->userid
+ )
+ ));
$event->add_record_snapshot('course_modules_completion', $data);
$event->trigger();
} catch(Exception $e) {
$this->assertInstanceOf('coding_exception', $e);
}
-
- try {
- $event = \core\event\user_loggedin::create(array('other' => array('username' => 'test')));
- $this->fail('\core\event\user_loggedin requires objectid');
- } catch(Exception $e) {
- $this->assertInstanceOf('coding_exception', $e);
- }
}
-
}
$this->assertEquals($current, $event->get_record_snapshot('course_modules_completion', $event->objectid));
$this->assertEquals(context_module::instance($forum->cmid), $event->get_context());
$this->assertEquals($USER->id, $event->userid);
- $this->assertEquals($this->user->id, $event->other['relateduserid']);
+ $this->assertEquals($this->user->id, $event->relateduserid);
$this->assertInstanceOf('moodle_url', $event->get_url());
$this->assertEventLegacyData($current, $event);
}
$this->assertEquals($this->course->id, $event->get_record_snapshot('course_completions', $event->objectid)->course);
$this->assertEquals($this->course->id, $event->courseid);
$this->assertEquals($USER->id, $event->userid);
- $this->assertEquals($this->user->id, $event->other['relateduserid']);
+ $this->assertEquals($this->user->id, $event->relateduserid);
$this->assertEquals(context_course::instance($this->course->id), $event->get_context());
$this->assertInstanceOf('moodle_url', $event->get_url());
$data = $ccompletion->get_record_data();
/**
* Calendar event created event.
*
- * @property-read array $other Extra information about the event.
- * -int timestart: timestamp for event time start.
- * -string name: Name of the event.
- * -int repeatid: Id of the parent event if present, else 0.
+ * @property-read array $other {
+ * Extra information about the event.
+ *
+ * - int timestart: timestamp for event time start.
+ * - string name: Name of the event.
+ * - int repeatid: Id of the parent event if present, else 0.
+ * }
*
* @package core
* @since Moodle 2.7
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * mod_assign all submissions downloaded event.
+ * The mod_assign all submissions downloaded event.
*
* @package mod_assign
* @copyright 2013 Frédéric Massart
defined('MOODLE_INTERNAL') || die();
/**
- * mod_assign all submissions downloaded event class.
+ * The mod_assign all submissions downloaded event class.
*
* @package mod_assign
* @since Moodle 2.6
* @return string
*/
public function get_description() {
- return "User {$this->userid} has downloaded all the submissions.";
+ return "The user with the id '$this->userid' has downloaded all the submissions for the assignment " .
+ "with the course module id '$this->contextinstanceid'.";
}
/**
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * mod_assign assessable submitted event.
+ * The mod_assign assessable submitted event.
*
* @package mod_assign
* @copyright 2013 Frédéric Massart
defined('