MDL-43557 events: fixed minor issues in existing events

This commit is contained in:
Mark Nelson
2014-04-29 19:16:11 -07:00
parent 4d9c1b573e
commit 02a5a4b2ff
319 changed files with 2616 additions and 1982 deletions
@@ -15,7 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Event for when capability report is viewed.
* The tool_capability report viewed event.
*
* @package tool_capability
* @copyright 2014 Petr Skoda
@@ -24,7 +24,7 @@
namespace tool_capability\event;
/**
* Event triggered, when capability report is viewed.
* The tool_capability report viewed event class.
*
* @package tool_capability
* @since Moodle 2.7
@@ -59,7 +59,7 @@ class report_viewed extends \core\event\base {
* @return string
*/
public function get_description() {
return "The user with id " . $this->userid . " viewed capability overview report";
return "The user with the id '$this->userid' viewed the capability overview report.";
}
/**
+1 -1
View File
@@ -81,7 +81,7 @@ class core_badges_observer {
require_once($CFG->dirroot.'/lib/badgeslib.php');
$eventdata = $event->get_record_snapshot('course_completions', $event->objectid);
$userid = $event->other['relateduserid'];
$userid = $event->relateduserid;
$courseid = $event->courseid;
// Need to take into account that course can be a part of course_completion and courseset_completion criteria.
+5 -5
View File
@@ -328,7 +328,7 @@ class core_bloglib_testcase extends advanced_testcase {
'objectid' => 3,
'other' => array('associateid' => 2 , 'blogid' => 3, 'subject' => 'blog subject')));
} catch (coding_exception $e) {
$this->assertContains('Invalid associatetype', $e->getMessage());
$this->assertContains('The \'associatetype\' value must be set in other and be a valid type.', $e->getMessage());
}
try {
\core\event\blog_association_created::create(array(
@@ -336,7 +336,7 @@ class core_bloglib_testcase extends advanced_testcase {
'objectid' => 3,
'other' => array('associateid' => 2 , 'blogid' => 3, 'associatetype' => 'random', 'subject' => 'blog subject')));
} catch (coding_exception $e) {
$this->assertContains('Invalid associatetype', $e->getMessage());
$this->assertContains('The \'associatetype\' value must be set in other and be a valid type.', $e->getMessage());
}
// Make sure associateid validations work.
try {
@@ -345,7 +345,7 @@ class core_bloglib_testcase extends advanced_testcase {
'objectid' => 3,
'other' => array('blogid' => 3, 'associatetype' => 'course', 'subject' => 'blog subject')));
} catch (coding_exception $e) {
$this->assertContains('Associate id must be set', $e->getMessage());
$this->assertContains('The \'associateid\' value must be set in other.', $e->getMessage());
}
// Make sure blogid validations work.
try {
@@ -354,7 +354,7 @@ class core_bloglib_testcase extends advanced_testcase {
'objectid' => 3,
'other' => array('associateid' => 3, 'associatetype' => 'course', 'subject' => 'blog subject')));
} catch (coding_exception $e) {
$this->assertContains('Blog id must be set', $e->getMessage());
$this->assertContains('The \'blogid\' value must be set in other.', $e->getMessage());
}
// Make sure blogid validations work.
try {
@@ -363,7 +363,7 @@ class core_bloglib_testcase extends advanced_testcase {
'objectid' => 3,
'other' => array('blogid' => 3, 'associateid' => 3, 'associatetype' => 'course')));
} catch (coding_exception $e) {
$this->assertContains('Subject must be set', $e->getMessage());
$this->assertContains('The \'subject\' value must be set in other.', $e->getMessage());
}
}
@@ -33,7 +33,7 @@ require_once($CFG->dirroot . '/calendar/tests/externallib_test.php');
* @copyright 2014 Ankit Agarwal <ankit.agrr@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class core_calendar_event_testcase extends advanced_testcase {
class core_calendar_events_testcase extends advanced_testcase {
/**
* The test user.
@@ -126,7 +126,7 @@ class core_calendar_event_testcase extends advanced_testcase {
$this->fail("Event validation should not allow \\core\\event\\calendar_event_created to be triggered without
other['repeatid']");
} catch (coding_exception $e) {
$this->assertContains("Field other['repeatid'] must be set", $e->getMessage());
$this->assertContains('The \'repeatid\' value must be set in other.', $e->getMessage());
}
// Test not setting other['name'].
@@ -142,7 +142,7 @@ class core_calendar_event_testcase extends advanced_testcase {
$this->fail("Event validation should not allow \\core\\event\\calendar_event_created to be triggered without
other['name']");
} catch (coding_exception $e) {
$this->assertContains("Field other['name'] cannot be empty", $e->getMessage());
$this->assertContains('The \'name\' value must be set in other.', $e->getMessage());
}
// Test not setting other['timestart'].
@@ -158,7 +158,7 @@ class core_calendar_event_testcase extends advanced_testcase {
$this->fail("Event validation should not allow \\core\\event\\calendar_event_deleted to be triggered without
other['timestart']");
} catch (coding_exception $e) {
$this->assertContains("Field other['timestart'] cannot be empty", $e->getMessage());
$this->assertContains('The \'timestart\' value must be set in other.', $e->getMessage());
}
}
@@ -239,7 +239,7 @@ class core_calendar_event_testcase extends advanced_testcase {
$this->fail("Event validation should not allow \\core\\event\\calendar_event_updated to be triggered without
other['repeatid']");
} catch (coding_exception $e) {
$this->assertContains("Field other['repeatid'] must be set", $e->getMessage());
$this->assertContains('The \'repeatid\' value must be set in other.', $e->getMessage());
}
// Test not setting other['name'].
@@ -255,7 +255,7 @@ class core_calendar_event_testcase extends advanced_testcase {
$this->fail("Event validation should not allow \\core\\event\\calendar_event_updated to be triggered without
other['name']");
} catch (coding_exception $e) {
$this->assertContains("Field other['name'] cannot be empty", $e->getMessage());
$this->assertContains('The \'name\' value must be set in other.', $e->getMessage());
}
// Test not setting other['timestart'].
@@ -271,7 +271,7 @@ class core_calendar_event_testcase extends advanced_testcase {
$this->fail("Event validation should not allow \\core\\event\\calendar_event_deleted to be triggered without
other['timestart']");
} catch (coding_exception $e) {
$this->assertContains("Field other['timestart'] cannot be empty", $e->getMessage());
$this->assertContains('The \'timestart\' value must be set in other.', $e->getMessage());
}
}
@@ -351,7 +351,7 @@ class core_calendar_event_testcase extends advanced_testcase {
$this->fail("Event validation should not allow \\core\\event\\calendar_event_deleted to be triggered without
other['repeatid']");
} catch (coding_exception $e) {
$this->assertContains("Field other['repeatid'] must be set", $e->getMessage());
$this->assertContains('The \'repeatid\' value must be set in other.', $e->getMessage());
}
// Test not setting other['name'].
@@ -367,7 +367,7 @@ class core_calendar_event_testcase extends advanced_testcase {
$this->fail("Event validation should not allow \\core\\event\\calendar_event_deleted to be triggered without
other['name']");
} catch (coding_exception $e) {
$this->assertContains("Field other['name'] cannot be empty", $e->getMessage());
$this->assertContains('The \'name\' value must be set in other.', $e->getMessage());
}
// Test not setting other['timestart'].
@@ -383,7 +383,7 @@ class core_calendar_event_testcase extends advanced_testcase {
$this->fail("Event validation should not allow \\core\\event\\calendar_event_deleted to be triggered without
other['timestart']");
} catch (coding_exception $e) {
$this->assertContains("Field other['timestart'] cannot be empty", $e->getMessage());
$this->assertContains('The \'timestart\' value must be set in other.', $e->getMessage());
}
}
}
+2 -2
View File
@@ -165,9 +165,9 @@ class completion_completion extends data_object {
array(
'objectid' => $data->id,
'userid' => $USER->id,
'relateduserid' => $data->userid,
'context' => context_course::instance($data->course),
'courseid' => $data->course,
'other' => array('relateduserid' => $data->userid)
'courseid' => $data->course
)
);
$event->add_record_snapshot('course_completions', $data);
+8 -10
View File
@@ -2014,7 +2014,7 @@ class core_course_courselib_testcase extends advanced_testcase {
$this->fail("Event validation should not allow \\core\\event\\course_module_created to be triggered without
other['instanceid']");
} catch (coding_exception $e) {
$this->assertContains("Field other['instanceid'] cannot be empty", $e->getMessage());
$this->assertContains("The 'instanceid' value must be set in other.", $e->getMessage());
}
// Test not setting modulename.
@@ -2031,7 +2031,7 @@ class core_course_courselib_testcase extends advanced_testcase {
$this->fail("Event validation should not allow \\core\\event\\course_module_created to be triggered without
other['modulename']");
} catch (coding_exception $e) {
$this->assertContains("Field other['modulename'] cannot be empty", $e->getMessage());
$this->assertContains("The 'modulename' value must be set in other.", $e->getMessage());
}
// Test not setting name.
@@ -2049,7 +2049,7 @@ class core_course_courselib_testcase extends advanced_testcase {
$this->fail("Event validation should not allow \\core\\event\\course_module_created to be triggered without
other['name']");
} catch (coding_exception $e) {
$this->assertContains("Field other['name'] cannot be empty", $e->getMessage());
$this->assertContains("The 'name' value must be set in other.", $e->getMessage());
}
}
@@ -2166,7 +2166,7 @@ class core_course_courselib_testcase extends advanced_testcase {
$this->fail("Event validation should not allow \\core\\event\\course_module_updated to be triggered without
other['instanceid']");
} catch (coding_exception $e) {
$this->assertContains("Field other['instanceid'] cannot be empty", $e->getMessage());
$this->assertContains("The 'instanceid' value must be set in other.", $e->getMessage());
}
// Test not setting modulename.
@@ -2183,7 +2183,7 @@ class core_course_courselib_testcase extends advanced_testcase {
$this->fail("Event validation should not allow \\core\\event\\course_module_updated to be triggered without
other['modulename']");
} catch (coding_exception $e) {
$this->assertContains("Field other['modulename'] cannot be empty", $e->getMessage());
$this->assertContains("The 'modulename' value must be set in other.", $e->getMessage());
}
// Test not setting name.
@@ -2201,7 +2201,7 @@ class core_course_courselib_testcase extends advanced_testcase {
$this->fail("Event validation should not allow \\core\\event\\course_module_updated to be triggered without
other['name']");
} catch (coding_exception $e) {
$this->assertContains("Field other['name'] cannot be empty", $e->getMessage());
$this->assertContains("The 'name' value must be set in other.", $e->getMessage());
}
}
@@ -2269,7 +2269,7 @@ class core_course_courselib_testcase extends advanced_testcase {
$this->fail("Event validation should not allow \\core\\event\\course_module_deleted to be triggered without
other['instanceid']");
} catch (coding_exception $e) {
$this->assertContains("Field other['instanceid'] cannot be empty", $e->getMessage());
$this->assertContains("The 'instanceid' value must be set in other.", $e->getMessage());
}
// Test not setting modulename.
@@ -2286,7 +2286,7 @@ class core_course_courselib_testcase extends advanced_testcase {
$this->fail("Event validation should not allow \\core\\event\\course_module_deleted to be triggered without
other['modulename']");
} catch (coding_exception $e) {
$this->assertContains("Field other['modulename'] cannot be empty", $e->getMessage());
$this->assertContains("The 'modulename' value must be set in other.", $e->getMessage());
}
}
@@ -2468,8 +2468,6 @@ class core_course_courselib_testcase extends advanced_testcase {
$this->assertEquals(null, $event->objectid);
$this->assertEquals($course->id, $event->courseid);
$this->assertEquals($coursecontext->id, $event->contextid);
$expecteddesc = "User with id '$event->userid' viewed list of resources in course with id '$event->courseid'";
$this->assertEquals($expecteddesc, $event->get_description());
$expectedlegacydata = array(
array($course->id, "book", "view all", 'index.php?id=' . $course->id, ''),
array($course->id, "page", "view all", 'index.php?id=' . $course->id, ''),
+20 -6
View File
@@ -1756,9 +1756,16 @@ function role_assign($roleid, $userid, $contextid, $component = '', $itemid = 0,
reload_all_capabilities();
}
$event = \core\event\role_assigned::create(
array('context'=>$context, 'objectid'=>$ra->roleid, 'relateduserid'=>$ra->userid,
'other'=>array('id'=>$ra->id, 'component'=>$ra->component, 'itemid'=>$ra->itemid)));
$event = \core\event\role_assigned::create(array(
'context' => $context,
'objectid' => $ra->roleid,
'relateduserid' => $ra->userid,
'other' => array(
'id' => $ra->id,
'component' => $ra->component,
'itemid' => $ra->itemid
)
));
$event->add_record_snapshot('role_assignments', $ra);
$event->trigger();
@@ -1844,9 +1851,16 @@ function role_unassign_all(array $params, $subcontexts = false, $includemanual =
if (!empty($USER->id) && $USER->id == $ra->userid) {
reload_all_capabilities();
}
$event = \core\event\role_unassigned::create(
array('context'=>$context, 'objectid'=>$ra->roleid, 'relateduserid'=>$ra->userid,
'other'=>array('id'=>$ra->id, 'component'=>$ra->component, 'itemid'=>$ra->itemid)));
$event = \core\event\role_unassigned::create(array(
'context' => $context,
'objectid' => $ra->roleid,
'relateduserid' => $ra->userid,
'other' => array(
'id' => $ra->id,
'component' => $ra->component,
'itemid' => $ra->itemid
)
));
$event->add_record_snapshot('role_assignments', $ra);
$event->trigger();
}
+1 -1
View File
@@ -41,7 +41,7 @@ defined('MOODLE_INTERNAL') || die();
* @copyright 2013 Frédéric Massart
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
abstract class assessable_submitted extends \core\event\base {
abstract class assessable_submitted extends base {
/**
* Init method.
+6 -6
View File
@@ -39,8 +39,8 @@ defined('MOODLE_INTERNAL') || die();
* @property-read array $other {
* Extra information about event.
*
* @type array pathnamehashes uploaded files path name hashes.
* @type string content string.
* - array pathnamehashes: uploaded files path name hashes.
* - string content: the content.
* }
*
* @package core
@@ -48,7 +48,7 @@ defined('MOODLE_INTERNAL') || die();
* @copyright 2013 Frédéric Massart
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
abstract class assessable_uploaded extends \core\event\base {
abstract class assessable_uploaded extends base {
/**
* Init method.
@@ -69,11 +69,11 @@ abstract class assessable_uploaded extends \core\event\base {
protected function validate_data() {
parent::validate_data();
if ($this->contextlevel != CONTEXT_MODULE) {
throw new \coding_exception('Context passed must be module context.');
throw new \coding_exception('Context level must be CONTEXT_MODULE.');
} else if (!isset($this->other['pathnamehashes']) || !is_array($this->other['pathnamehashes'])) {
throw new \coding_exception('pathnamehashes must be set in $other and must be an array.');
throw new \coding_exception('The \'pathnamehashes\' value must be set in other and must be an array.');
} else if (!isset($this->other['content']) || !is_string($this->other['content'])) {
throw new \coding_exception('content must be set in $other and must be a string.');
throw new \coding_exception('The \'content\' value must be set in other and must be a string.');
}
}
+15 -14
View File
@@ -32,10 +32,10 @@ defined('MOODLE_INTERNAL') || die();
* @property-read array $other {
* Extra information about event.
*
* @type string associatetype type of blog association, course/coursemodule.
* @type int blogid id of blog.
* @type int associateid id of associate.
* @type string subject blog subject.
* - string associatetype: type of blog association, course/coursemodule.
* - int blogid: id of blog.
* - int associateid: id of associate.
* - string subject: blog subject.
* }
*
* @package core
@@ -43,7 +43,7 @@ defined('MOODLE_INTERNAL') || die();
* @copyright 2013 onwards Ankit Agarwal
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class blog_association_created extends \core\event\base {
class blog_association_created extends base {
/**
* Set basic properties for the event.
@@ -70,8 +70,8 @@ class blog_association_created extends \core\event\base {
* @return string
*/
public function get_description() {
return "Blog association added between entry id {$this->other['blogid']} and {$this->other['associatetype']} with id
{$this->other['associateid']}";
return "The blog entry with the id '{$this->other['blogid']}' was associated with the context '{$this->other['associatetype']}' with " .
"the id '{$this->other['associateid']}' by the user with the id '$this->userid'.";
}
/**
@@ -91,10 +91,10 @@ class blog_association_created extends \core\event\base {
if ($this->other['associatetype'] === 'course') {
return array (SITEID, 'blog', 'add association', 'index.php?userid=' . $this->relateduserid. '&entryid=' .
$this->other['blogid'], $this->other['subject'], 0, $this->relateduserid);
} else {
return array (SITEID, 'blog', 'add association', 'index.php?userid=' . $this->relateduserid. '&entryid=' .
$this->other['blogid'], $this->other['subject'], $this->other['associateid'], $this->relateduserid);
}
return array (SITEID, 'blog', 'add association', 'index.php?userid=' . $this->relateduserid. '&entryid=' .
$this->other['blogid'], $this->other['subject'], $this->other['associateid'], $this->relateduserid);
}
/**
@@ -105,15 +105,16 @@ class blog_association_created extends \core\event\base {
*/
protected function validate_data() {
parent::validate_data();
if (empty($this->other['associatetype']) || ($this->other['associatetype'] !== 'course'
&& $this->other['associatetype'] !== 'coursemodule')) {
throw new \coding_exception('Invalid associatetype in event blog_association_created.');
throw new \coding_exception('The \'associatetype\' value must be set in other and be a valid type.');
} else if (!isset($this->other['blogid'])) {
throw new \coding_exception('Blog id must be set in event blog_association_created.');
throw new \coding_exception('The \'blogid\' value must be set in other.');
} else if (!isset($this->other['associateid'])) {
throw new \coding_exception('Associate id must be set in event blog_association_created.');
throw new \coding_exception('The \'associateid\' value must be set in other.');
} else if (!isset($this->other['subject'])) {
throw new \coding_exception('Subject must be set in event blog_association_created.');
throw new \coding_exception('The \'subject\' value must be set in other.');
}
}
}
+5 -4
View File
@@ -15,7 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* blog comment created event.
* The blog comment created event.
*
* @package core
* @copyright 2013 Rajesh Taneja <[email protected]>
@@ -26,14 +26,15 @@ namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
* blog comment created event.
* The blog comment created event.
*
* @package core
* @since Moodle 2.7
* @copyright 2013 Rajesh Taneja <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class blog_comment_created extends \core\event\comment_created {
class blog_comment_created extends comment_created {
/**
* Get URL related to the action.
*
@@ -49,6 +50,6 @@ class blog_comment_created extends \core\event\comment_created {
* @return string
*/
public function get_description() {
return 'User with id ' . $this->userid . ' added comment for blog with id ' . $this->other['itemid'];
return "The user with the id '$this->userid' added a comment to the blog with the id '{$this->other['itemid']}'.";
}
}
+5 -4
View File
@@ -15,7 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* blog comment deleted event.
* The blog comment deleted event.
*
* @package core
* @copyright 2013 Rajesh Taneja <[email protected]>
@@ -26,14 +26,15 @@ namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
* blog comment deleted event.
* The blog comment deleted event.
*
* @package core
* @since Moodle 2.7
* @copyright 2013 Rajesh Taneja <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class blog_comment_deleted extends \core\event\comment_deleted {
class blog_comment_deleted extends comment_deleted {
/**
* Get URL related to the action.
*
@@ -49,6 +50,6 @@ class blog_comment_deleted extends \core\event\comment_deleted {
* @return string
*/
public function get_description() {
return 'User with id ' . $this->userid . ' deleted comment for blog with id ' . $this->other['itemid'];
return "The user with the id '$this->userid' deleted comment for the blog with the id '{$this->other['itemid']}'.";
}
}
+1 -3
View File
@@ -25,14 +25,12 @@ namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
* blog_entries_viewed
*
* Class for event to be triggered when blog entries are viewed.
*
* @property-read array $other {
* Extra information about event.
*
* @type int courseid id of associated course.
* - int courseid: id of associated course.
* }
*
* @package core
+11 -10
View File
@@ -14,10 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
* Event for when a new blog entry is added..
*
@@ -26,6 +22,10 @@ defined('MOODLE_INTERNAL') || die();
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
* Class blog_entry_created
*
@@ -36,7 +36,7 @@ defined('MOODLE_INTERNAL') || die();
* @copyright 2013 Ankit Agarwal
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class blog_entry_created extends \core\event\base {
class blog_entry_created extends base {
/** @var \blog_entry A reference to the active blog_entry object. */
protected $blogentry;
@@ -54,7 +54,7 @@ class blog_entry_created extends \core\event\base {
/**
* Set blog_entry object to be used by observers.
*
* @param \blog_entry $data A reference to the active blog_entry object.
* @param \blog_entry $blogentry A reference to the active blog_entry object.
*/
public function set_blog_entry(\blog_entry $blogentry) {
$this->blogentry = $blogentry;
@@ -63,6 +63,7 @@ class blog_entry_created extends \core\event\base {
/**
* Returns created blog_entry object for event observers.
*
* @throws \coding_exception
* @return \blog_entry
*/
public function get_blog_entry() {
@@ -78,7 +79,7 @@ class blog_entry_created extends \core\event\base {
* @return string
*/
public static function get_name() {
return get_string("evententryadded", "core_blog");
return get_string('evententryadded', 'core_blog');
}
/**
@@ -87,7 +88,7 @@ class blog_entry_created extends \core\event\base {
* @return string
*/
public function get_description() {
return 'Blog entry id '. $this->objectid. ' was created by userid '. $this->userid;
return "The blog entry with the id '$this->objectid' was created by the user with the id '$this->userid'.";
}
/**
@@ -117,12 +118,12 @@ class blog_entry_created extends \core\event\base {
}
/**
* replace add_to_log() statement.
* Replace add_to_log() statement.
*
* @return array of parameters to be passed to legacy add_to_log() function.
*/
protected function get_legacy_logdata() {
return array (SITEID, 'blog', 'add', 'index.php?userid=' . $this->relateduserid . '&entryid=' . $this->objectid,
$this->blogentry->subject);
$this->blogentry->subject);
}
}
+6 -5
View File
@@ -25,7 +25,7 @@ namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
* class blog_entry_deleted
* Class blog_entry_deleted
*
* Event for when a new blog entry is deleted.
*
@@ -35,9 +35,9 @@ defined('MOODLE_INTERNAL') || die();
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class blog_entry_deleted extends \core\event\base {
class blog_entry_deleted extends base {
/** @var \blog_entry A reference to the active blog_entry object. */
/** @var \blog_entry A reference to the active blog_entry object. */
protected $blogentry;
/**
@@ -62,7 +62,7 @@ class blog_entry_deleted extends \core\event\base {
/**
* Sets blog_entry object to be used by observers.
*
* @param \blog_entry $data A reference to the active blog_entry object.
* @param \blog_entry $blogentry A reference to the active blog_entry object.
*/
public function set_blog_entry(\blog_entry $blogentry) {
$this->blogentry = $blogentry;
@@ -71,6 +71,7 @@ class blog_entry_deleted extends \core\event\base {
/**
* Returns deleted blog entry for event observers.
*
* @throws \coding_exception
* @return \blog_entry
*/
public function get_blog_entry() {
@@ -86,7 +87,7 @@ class blog_entry_deleted extends \core\event\base {
* @return string
*/
public function get_description() {
return 'Blog entry id '. $this->objectid. ' was deleted by userid '. $this->userid;
return "The blog entry with the id '$this->objectid' was deleted by user with the id '$this->userid'.";
}
/**
+3 -2
View File
@@ -52,7 +52,7 @@ class blog_entry_updated extends base {
/**
* Sets blog_entry object to be used by observers.
*
* @param \blog_entry $data A reference to the active blog_entry object.
* @param \blog_entry $blogentry A reference to the active blog_entry object.
*/
public function set_blog_entry(\blog_entry $blogentry) {
$this->blogentry = $blogentry;
@@ -61,6 +61,7 @@ class blog_entry_updated extends base {
/**
* Returns updated blog entry for event observers.
*
* @throws \coding_exception
* @return \blog_entry
*/
public function get_blog_entry() {
@@ -85,7 +86,7 @@ class blog_entry_updated extends base {
* @return string
*/
public function get_description() {
return 'Blog entry id '. $this->objectid. ' was updated by userid '. $this->userid;
return "The blog entry with the id '$this->objectid' was updated by the user with the id '$this->userid'.";
}
/**
+14 -11
View File
@@ -29,10 +29,13 @@ defined('MOODLE_INTERNAL') || die();
/**
* Calendar event created event.
*
* @property-read array $other Extra information about the event.
* -int timestart: timestamp for event time start.
* -string name: Name of the event.
* -int repeatid: Id of the parent event if present, else 0.
* @property-read array $other {
* Extra information about the event.
*
* - int repeatid: id of the parent event if present, else 0.
* - int timestart: timestamp for event time start.
* - string name: name of the event.
* }
*
* @package core
* @since Moodle 2.7
@@ -67,7 +70,7 @@ class calendar_event_created extends base {
* @return string
*/
public function get_description() {
return "An event '" . s($this->other['name']) . "' was created by user with id {$this->userid}";
return "The event '" . s($this->other['name']) . "' was created by user with the id '$this->userid'.";
}
/**
@@ -90,21 +93,21 @@ class calendar_event_created extends base {
}
/**
* custom validations
* Custom validation.
*
* Throw \coding_exception notice in case of any problems.
*/
protected function validate_data() {
parent::validate_data();
if (!isset($this->other['repeatid'])) {
throw new \coding_exception("Field other['repeatid'] must be set");
throw new \coding_exception('The \'repeatid\' value must be set in other.');
}
if (empty($this->other['name'])) {
throw new \coding_exception("Field other['name'] cannot be empty");
throw new \coding_exception('The \'name\' value must be set in other.');
}
if (empty($this->other['timestart'])) {
throw new \coding_exception("Field other['timestart'] cannot be empty");
throw new \coding_exception('The \'timestart\' value must be set in other.');
}
parent::validate_data();
}
}
+14 -11
View File
@@ -29,10 +29,13 @@ defined('MOODLE_INTERNAL') || die();
/**
* Calendar event deleted event.
*
* @property-read array $other Extra information about the event.
* -int timestart: timestamp for event time start.
* -string name: Name of the event.
* -int repeatid: Id of the parent event if present, else 0.
* @property-read array $other {
* Extra information about the event.
*
* - int repeatid: id of the parent event if present, else 0.
* - int timestart: timestamp for event time start.
* - string name: name of the event.
* }
*
* @package core
* @since Moodle 2.7
@@ -67,25 +70,25 @@ class calendar_event_deleted extends base {
* @return string
*/
public function get_description() {
return "An event '" . s($this->other['name']) . "' was deleted by user with id {$this->userid}";
return "The event '" . s($this->other['name']) . "' was deleted by the user with the id '{$this->userid}'.";
}
/**
* custom validations
* Custom validation.
*
* Throw \coding_exception notice in case of any problems.
*/
protected function validate_data() {
parent::validate_data();
if (!isset($this->other['repeatid'])) {
throw new \coding_exception("Field other['repeatid'] must be set");
throw new \coding_exception('The \'repeatid\' value must be set in other.');
}
if (empty($this->other['name'])) {
throw new \coding_exception("Field other['name'] cannot be empty");
throw new \coding_exception('The \'name\' value must be set in other.');
}
if (empty($this->other['timestart'])) {
throw new \coding_exception("Field other['timestart'] cannot be empty");
throw new \coding_exception('The \'timestart\' value must be set in other.');
}
parent::validate_data();
}
}
+15 -13
View File
@@ -29,10 +29,13 @@ defined('MOODLE_INTERNAL') || die();
/**
* Calendar event updated event.
*
* @property-read array $other Extra information about the event.
* -int timestart: timestamp for event time start.
* -string name: Name of the event.
* -int repeatid: Id of the parent event if present, else 0.
* @property-read array $other {
* Extra information about the event.
*
* - int repeatid: id of the parent event if present, else 0.
* - int timestart: timestamp for event time start.
* - string name: name of the event.
* }
*
* @package core
* @since Moodle 2.7
@@ -67,7 +70,7 @@ class calendar_event_updated extends base {
* @return string
*/
public function get_description() {
return "An event '" . s($this->other['name']) . "' was updated by user with id {$this->userid}";
return "The event '" . s($this->other['name']) . "' was updated by the user with the id '{$this->userid}'.";
}
/**
@@ -85,26 +88,25 @@ class calendar_event_updated extends base {
* @return array of parameters to be passed to legacy add_to_log() function.
*/
protected function get_legacy_logdata() {
return array($this->courseid, 'calendar', 'edit', 'event.php?action=edit&amp;id=' . $this->objectid ,
$this->other['name']);
return array($this->courseid, 'calendar', 'edit', 'event.php?action=edit&amp;id=' . $this->objectid, $this->other['name']);
}
/**
* custom validations
* Custom validation.
*
* Throw \coding_exception notice in case of any problems.
*/
protected function validate_data() {
parent::validate_data();
if (!isset($this->other['repeatid'])) {
throw new \coding_exception("Field other['repeatid'] must be set");
throw new \coding_exception('The \'repeatid\' value must be set in other.');
}
if (empty($this->other['name'])) {
throw new \coding_exception("Field other['name'] cannot be empty");
throw new \coding_exception('The \'name\' value must be set in other.');
}
if (empty($this->other['timestart'])) {
throw new \coding_exception("Field other['timestart'] cannot be empty");
throw new \coding_exception('The \'timestart\' value must be set in other.');
}
parent::validate_data();
}
}
+1 -1
View File
@@ -61,7 +61,7 @@ class cohort_created extends base {
* @return string
*/
public function get_description() {
return 'Cohort '.$this->objectid.' was created by '.$this->userid.' at context '.$this->contextid;
return "The cohort with the id '$this->objectid' was created by the user with the id '$this->userid'.";
}
/**
+1 -1
View File
@@ -61,7 +61,7 @@ class cohort_deleted extends base {
* @return string
*/
public function get_description() {
return 'Cohort '.$this->objectid.' was deleted by '.$this->userid.' from context '.$this->contextid;
return "The cohort with the id '$this->objectid' was deleted by the user with the id '$this->userid'.";
}
/**
+2 -1
View File
@@ -61,7 +61,8 @@ class cohort_member_added extends base {
* @return string
*/
public function get_description() {
return 'User '.$this->relateduserid.' was added to cohort '.$this->objectid.' by user '.$this->userid;
return "The user with the id '$this->relateduserid' was added to the cohort with the id '$this->objectid' by the " .
"user with the id '$this->userid'.";
}
/**
+2 -1
View File
@@ -62,7 +62,8 @@ class cohort_member_removed extends base {
* @return string
*/
public function get_description() {
return 'User '.$this->relateduserid.' was removed from cohort '.$this->objectid.' by user '.$this->userid;
return "The user with the id '$this->relateduserid' was removed from the cohort with the id '$this->objectid' by the " .
"user with the id '$this->userid'.";
}
/**
+1 -1
View File
@@ -61,7 +61,7 @@ class cohort_updated extends base {
* @return string
*/
public function get_description() {
return 'Cohort '.$this->objectid.' was updated by '.$this->userid.' at context '.$this->contextid;
return "The cohort with the id '$this->objectid' was updated by the user with the id '$this->userid'.";
}
/**
+5 -5
View File
@@ -34,7 +34,7 @@ defined('MOODLE_INTERNAL') || die();
* @property-read array $other {
* Extra information about event.
*
* @type int itemid id of item for which comment is added.
* - int itemid: id of item for which comment is added.
* }
*
* @package core
@@ -42,7 +42,7 @@ defined('MOODLE_INTERNAL') || die();
* @copyright 2013 Rajesh Taneja <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
abstract class comment_created extends \core\event\base {
abstract class comment_created extends base {
/**
* Init method.
@@ -70,8 +70,8 @@ abstract class comment_created extends \core\event\base {
* @return string
*/
public function get_description() {
return 'User with id ' . $this->userid . ' added comment for ' . $this->component . ' with instance id ' .
$this->contextinstanceid;
return "The user with the id '$this->userid' added the comment with the id '$this->objectid' for '$this->component' " .
"with the course module id '$this->contextinstanceid'.";
}
/**
@@ -97,7 +97,7 @@ abstract class comment_created extends \core\event\base {
protected function validate_data() {
parent::validate_data();
if (!isset($this->other['itemid'])) {
throw new \coding_exception('The itemid needs to be set in $other');
throw new \coding_exception('The \'itemid\' value must be set in other.');
}
}
}
+5 -5
View File
@@ -34,7 +34,7 @@ defined('MOODLE_INTERNAL') || die();
* @property-read array $other {
* Extra information about event.
*
* @type int itemid id of item for which comment is deleted.
* - int itemid: id of item for which comment is deleted.
* }
*
* @package core
@@ -42,7 +42,7 @@ defined('MOODLE_INTERNAL') || die();
* @copyright 2013 Rajesh Taneja <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
abstract class comment_deleted extends \core\event\base {
abstract class comment_deleted extends base {
/**
* Init method.
@@ -70,8 +70,8 @@ abstract class comment_deleted extends \core\event\base {
* @return string
*/
public function get_description() {
return 'User with id ' . $this->userid . ' deleted comment for ' . $this->component . ' with instance id ' .
$this->contextinstanceid;
return "The user with the id '$this->userid' deleted the comment with the id '$this->objectid' for '$this->component' " .
"with instance id '$this->contextinstanceid'.";
}
/**
@@ -97,7 +97,7 @@ abstract class comment_deleted extends \core\event\base {
protected function validate_data() {
parent::validate_data();
if (!isset($this->other['itemid'])) {
throw new \coding_exception('The itemid needs to be set in $other');
throw new \coding_exception('The \'itemid\' value must be set in other.');
}
}
}
+3 -4
View File
@@ -29,14 +29,14 @@ defined('MOODLE_INTERNAL') || die();
/**
* Abstract comments viewed event class.
*
* This class has to be extended by any event which is triggred while viewing comment.
* This class has to be extended by any event which is triggered while viewing comment.
*
* @package core
* @since Moodle 2.7
* @copyright 2013 Rajesh Taneja <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
abstract class comments_viewed extends \core\event\base {
abstract class comments_viewed extends base {
/**
* Init method.
@@ -63,8 +63,7 @@ abstract class comments_viewed extends \core\event\base {
* @return string
*/
public function get_description() {
return 'User with id '. $this->userid . ' viewed comments for ' . $this->component . ' with instance id ' .
$this->objectid;
return "The user with the id '$this->userid' viewed the comments for '$this->component' with instance id '$this->objectid'.";
}
/**
+2 -2
View File
@@ -86,7 +86,7 @@ abstract class content_viewed extends base {
* @return string
*/
public function get_description() {
return 'User with id ' . $this->userid . ' viewed content';
return "The user with the id '$this->userid' viewed content.";
}
/**
@@ -117,7 +117,7 @@ abstract class content_viewed extends base {
parent::validate_data();
// Make sure this class is never used without a content identifier.
if (empty($this->other['content'])) {
throw new \coding_exception('content_viewed event must define content identifier.');
throw new \coding_exception('The \'content\' value must be set in other.');
}
}
}
+10 -3
View File
@@ -14,12 +14,20 @@
// 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 <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
* Course category created event.
* Course category created event class.
*
* @package core
* @since Moodle 2.7
@@ -61,8 +69,7 @@ class course_category_created extends base {
* @return string
*/
public function get_description() {
return 'The course category with the id ' . $this->objectid . ' was created by the user with the id ' .
$this->userid;
return "The course category with the id '$this->objectid' was created by the user with the id '$this->userid'.";
}
/**
+12 -3
View File
@@ -14,17 +14,25 @@
// 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 <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
* Category deleted event.
* Category deleted event class.
*
* @property-read array $other {
* Extra information about event.
*
* @type string name category name.
* - string name: category name.
* }
*
* @package core
@@ -63,7 +71,7 @@ class course_category_deleted extends base {
* @return string
*/
public function get_description() {
return "Category {$this->objectid} was deleted by user {$this->userid}";
return "The category with the id '$this->objectid' was deleted by the user with the id '$this->userid'.";
}
/**
@@ -96,6 +104,7 @@ class course_category_deleted extends base {
/**
* Returns deleted coursecat for event observers.
*
* @throws \coding_exception
* @return \coursecat
*/
public function get_coursecat() {
+10 -3
View File
@@ -14,12 +14,20 @@
// 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 <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
* Course category updated event.
* Course category updated event class.
*
* @package core
* @since Moodle 2.7
@@ -64,8 +72,7 @@ class course_category_updated extends base {
* @return string
*/
public function get_description() {
return 'The course category with the id ' . $this->objectid . ' was updated by the user with the id ' .
$this->userid;
return "The course category with the id '$this->objectid' was updated by the user with the id '$this->userid'.";
}
/**
+10 -3
View File
@@ -14,12 +14,20 @@
// 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 <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
* Event when course completed.
* Course completed event class.
*
* @package core
* @since Moodle 2.6
@@ -52,7 +60,7 @@ class course_completed extends base {
* @return string
*/
public function get_description() {
return 'Course completed by user '.$this->userid;
return "The course with the id '$this->courseid' was completed by the user with the id '$this->userid'.";
}
/**
@@ -81,5 +89,4 @@ class course_completed extends base {
protected function get_legacy_eventdata() {
return $this->get_record_snapshot('course_completions', $this->objectid);
}
}
@@ -15,7 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Event when course module completion is updated.
* Course module completion updated event.
*
* @package core
* @copyright 2013 Rajesh Taneja <[email protected]>
@@ -27,7 +27,7 @@ namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
* Event when course module completion is updated.
* Course module completion updated event class.
*
* @package core
* @since Moodle 2.6
@@ -59,7 +59,7 @@ class course_completion_updated extends base {
* @return string
*/
public function get_description() {
return 'Course completion for course' . $this->courseid . ' is updated by user ' . $this->userid;
return "The requirements to complete the course with the id '$this->courseid' was updated by the user with the id '$this->userid'.";
}
/**
+11 -3
View File
@@ -14,17 +14,25 @@
// 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 <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
* Course content_deleted event.
* Course content_deleted event class.
*
* @property-read array $other {
* Extra information about event.
*
* @type array options list of options which were skipped while deleting course content.
* - array options: list of options which were skipped while deleting course content.
* }
*
* @package core
@@ -58,7 +66,7 @@ class course_content_deleted extends base {
* @return string
*/
public function get_description() {
return "Course content was deleted by user {$this->userid}";
return "The course with the id '$this->courseid' had content deleted by the user with the id '$this->userid'.";
}
/**
+12 -4
View File
@@ -14,18 +14,26 @@
// 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 <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
* Course created event.
* Course created event class.
*
* @property-read array $other {
* Extra information about event.
*
* @type string shortname shortname of course.
* @type string fullname fullname of course.
* - string shortname: shortname of course.
* - string fullname: fullname of course.
* }
*
* @package core
@@ -59,7 +67,7 @@ class course_created extends base {
* @return string
*/
public function get_description() {
return "Course {$this->objectid} was created by user {$this->userid}";
return "The course with the id '$this->objectid' was created by the user with the id '$this->userid'.";
}
/**
+13 -5
View File
@@ -14,19 +14,27 @@
// 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 <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
* Course deleted event.
* Course deleted event class.
*
* @property-read array $other {
* Extra information about event.
*
* @type string shortname shortname of course.
* @type string fullname fullname of course.
* @type string idnumber id number of course.
* - string shortname: shortname of course.
* - string fullname: fullname of course.
* - string idnumber: id number of course.
* }
*
* @package core
@@ -60,7 +68,7 @@ class course_deleted extends base {
* @return string
*/
public function get_description() {
return "Course {$this->courseid} was deleted by user {$this->userid}";
return "The course with the id '$this->courseid' was deleted by the user with the id '$this->userid'.";
}
/**
@@ -14,12 +14,20 @@
// 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 <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
* Event when course module completion is updated.
* Course module completion event class.
*
* @package core
* @since Moodle 2.6
@@ -52,7 +60,8 @@ class course_module_completion_updated extends base {
* @return string
*/
public function get_description() {
return 'Course module completion updated for user ' . $this->userid;
return "The course module completion requirements were updated by the user with the id '$this->userid' for the user " .
"with the id '$this->relateduserid'.";
}
/**
@@ -91,10 +100,11 @@ class course_module_completion_updated extends base {
parent::validate_data();
// Make sure the context level is set to module.
if ($this->contextlevel !== CONTEXT_MODULE) {
throw new \coding_exception('Context passed must be module context.');
throw new \coding_exception('Context level must be CONTEXT_MODULE.');
}
if (!isset($this->relateduserid)) {
throw new \coding_exception('relateduserid must be set');
throw new \coding_exception('The \'relateduserid\' must be set.');
}
}
}
+15 -15
View File
@@ -17,14 +17,6 @@
/**
* Event to be triggered when a new course module is created.
*
* @property-read array $other {
* Extra information about event.
*
* @type string modulename name of module created.
* @type string name title of module.
* @type string instanceid id of module instance.
* }
*
* @package core
* @copyright 2013 Ankit Agarwal
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
@@ -38,6 +30,14 @@ defined('MOODLE_INTERNAL') || die();
*
* Class for event to be triggered when a new course module is created.
*
* @property-read array $other {
* Extra information about event.
*
* - string modulename: name of module created.
* - string name: title of module.
* - string instanceid: id of module instance.
* }
*
* @package core
* @since Moodle 2.6
* @copyright 2013 Ankit Agarwal
@@ -69,8 +69,8 @@ class course_module_created extends base {
* @return string
*/
public function get_description() {
return 'The '. $this->other['modulename'] . ' module with instance id ' . $this->other['instanceid'] .
' was created by user with id ' . $this->userid;
return "The user with the id '$this->userid' created the '{$this->other['modulename']}' activity with the " .
"course module id '$this->contextinstanceid'.";
}
/**
@@ -120,20 +120,20 @@ class course_module_created extends base {
}
/**
* custom validations
* Custom validation.
*
* Throw \coding_exception notice in case of any problems.
* @throw \coding_exception
*/
protected function validate_data() {
parent::validate_data();
if (!isset($this->other['modulename'])) {
throw new \coding_exception("Field other['modulename'] cannot be empty");
throw new \coding_exception('The \'modulename\' value must be set in other.');
}
if (!isset($this->other['instanceid'])) {
throw new \coding_exception("Field other['instanceid'] cannot be empty");
throw new \coding_exception('The \'instanceid\' value must be set in other.');
}
if (!isset($this->other['name'])) {
throw new \coding_exception("Field other['name'] cannot be empty");
throw new \coding_exception('The \'name\' value must be set in other.');
}
}
}
+6 -6
View File
@@ -33,8 +33,8 @@ defined('MOODLE_INTERNAL') || die();
* @property-read array $other {
* Extra information about event.
*
* @type string modulename name of module deleted.
* @type string instanceid id of module instance.
* - string modulename: name of module deleted.
* - string instanceid: id of module instance.
* }
*
* @package core
@@ -68,8 +68,8 @@ class course_module_deleted extends base {
* @return string
*/
public function get_description() {
return 'The module ' . $this->other['modulename'] . ' with instance id ' . $this->other['instanceid']. ' was deleted by
user with id ' . $this->userid;
return "The user with the id '$this->userid' deleted the '{$this->other['modulename']}' activity with the " .
"course module id '$this->contextinstanceid'.";
}
/**
@@ -113,10 +113,10 @@ class course_module_deleted extends base {
protected function validate_data() {
parent::validate_data();
if (!isset($this->other['modulename'])) {
throw new \coding_exception("Field other['modulename'] cannot be empty");
throw new \coding_exception('The \'modulename\' value must be set in other.');
}
if (!isset($this->other['instanceid'])) {
throw new \coding_exception("Field other['instanceid'] cannot be empty");
throw new \coding_exception('The \'instanceid\' value must be set in other.');
}
}
}
@@ -49,6 +49,7 @@ abstract class course_module_instance_list_viewed extends base{
/**
* Init method.
*
* @throws \coding_exception
* @return void
*/
protected function init() {
@@ -67,8 +68,8 @@ abstract class course_module_instance_list_viewed extends base{
* @return string
*/
public function get_description() {
return "User with id '$this->userid' viewed instance list for module '$this->modname' in course with id
'$this->courseid'";
return "The user with the id '$this->userid' viewed the instance list for the module '$this->modname' in the course " .
"with the id '$this->courseid'.";
}
/**
@@ -108,8 +109,7 @@ abstract class course_module_instance_list_viewed extends base{
protected function validate_data() {
parent::validate_data();
if ($this->contextlevel != CONTEXT_COURSE) {
throw new \coding_exception('Context passed must be course context.');
throw new \coding_exception('Context level must be CONTEXT_COURSE.');
}
}
}
+8 -8
View File
@@ -33,9 +33,9 @@ defined('MOODLE_INTERNAL') || die();
* @property-read array $other {
* Extra information about event.
*
* @type string modulename name of module updated.
* @type string name title of module.
* @type string instanceid id of module instance.
* - string modulename: name of module updated.
* - string name: title of module.
* - string instanceid: id of module instance.
* }
*
* @package core
@@ -69,8 +69,8 @@ class course_module_updated extends base {
* @return string
*/
public function get_description() {
return 'The ' . $this->other['modulename'] . ' module with instance id ' . $this->other['instanceid'] .
' was updated by user with id ' . $this->userid;
return "The user with the id '$this->userid' updated the '{$this->other['modulename']}' activity with the " .
"course module id '$this->contextinstanceid'.";
}
/**
@@ -127,13 +127,13 @@ class course_module_updated extends base {
protected function validate_data() {
parent::validate_data();
if (!isset($this->other['modulename'])) {
throw new \coding_exception("Field other['modulename'] cannot be empty");
throw new \coding_exception('The \'modulename\' value must be set in other.');
}
if (!isset($this->other['instanceid'])) {
throw new \coding_exception("Field other['instanceid'] cannot be empty");
throw new \coding_exception('The \'instanceid\' value must be set in other.');
}
if (!isset($this->other['name'])) {
throw new \coding_exception("Field other['name'] cannot be empty");
throw new \coding_exception('The \'name\' value must be set in other.');
}
}
+4 -4
View File
@@ -55,7 +55,8 @@ abstract class course_module_viewed extends base {
* @return string
*/
public function get_description() {
return "User with id '$this->userid' viewed course module '$this->objecttable' with instance id '$this->objectid'";
return "The user with the id '$this->userid' viewed the '{$this->objecttable}' activity with the " .
"course module id '$this->contextinstanceid'.";
}
/**
@@ -96,12 +97,11 @@ abstract class course_module_viewed extends base {
parent::validate_data();
// Make sure this class is never used without proper object details.
if (empty($this->objectid) || empty($this->objecttable)) {
throw new \coding_exception('course_module_viewed event must define objectid and object table.');
throw new \coding_exception('The course_module_viewed event must define objectid and object table.');
}
// Make sure the context level is set to module.
if ($this->contextlevel != CONTEXT_MODULE) {
throw new \coding_exception('Context passed must be module context.');
throw new \coding_exception('Context level must be CONTEXT_MODULE.');
}
}
}
+6 -7
View File
@@ -15,7 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* core course reset ended event.
* The course reset ended event.
*
* @package core
* @copyright 2013 Frédéric Massart
@@ -26,12 +26,12 @@ namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
* core course reset ended event class.
* The course reset ended event class.
*
* @property-read array $other {
* Extra information about event.
*
* @type array reset_options all reset options settings including courseid.
* - array reset_options: all reset options settings including courseid.
* }
*
* @package core
@@ -39,7 +39,7 @@ defined('MOODLE_INTERNAL') || die();
* @copyright 2013 Frédéric Massart
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class course_reset_ended extends \core\event\base {
class course_reset_ended extends base {
/**
* Returns description of what happened.
@@ -47,7 +47,7 @@ class course_reset_ended extends \core\event\base {
* @return string
*/
public function get_description() {
return "The reset of course $this->courseid has ended.";
return "The reset of the course with the id '$this->courseid' has ended.";
}
/**
@@ -87,8 +87,7 @@ class course_reset_ended extends \core\event\base {
protected function validate_data() {
parent::validate_data();
if (!isset($this->other['reset_options'])) {
throw new \coding_exception('The key reset_options must be set in $other.');
throw new \coding_exception('The \'reset_options\' value must be set in other.');
}
}
}
+4 -5
View File
@@ -31,7 +31,7 @@ defined('MOODLE_INTERNAL') || die();
* @property-read array $other {
* Extra information about event.
*
* @type array reset_options all reset options settings including courseid.
* - array reset_options: all reset options settings including courseid.
* }
*
* @package core
@@ -39,7 +39,7 @@ defined('MOODLE_INTERNAL') || die();
* @copyright 2013 Frédéric Massart
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class course_reset_started extends \core\event\base {
class course_reset_started extends base {
/**
* Returns description of what happened.
@@ -47,7 +47,7 @@ class course_reset_started extends \core\event\base {
* @return string
*/
public function get_description() {
return "The user $this->userid has started the reset of course $this->courseid.";
return "The user with the id '$this->userid' has started the reset of course '$this->courseid''.";
}
/**
@@ -87,8 +87,7 @@ class course_reset_started extends \core\event\base {
protected function validate_data() {
parent::validate_data();
if (!isset($this->other['reset_options'])) {
throw new \coding_exception('The key reset_options must be set in $other.');
throw new \coding_exception('The \'reset_options\' value must be set in other.');
}
}
}
@@ -54,7 +54,7 @@ class course_resources_list_viewed extends base {
* @return string
*/
public function get_description() {
return "User with id '$this->userid' viewed list of resources in course with id '$this->courseid'";
return "The user with the id '$this->userid' viewed the list of resources in the course with the id '$this->courseid'.";
}
/**
@@ -104,7 +104,6 @@ class course_resources_list_viewed extends base {
return $logs;
}
/**
* Custom validation.
*
@@ -116,5 +115,4 @@ class course_resources_list_viewed extends base {
throw new \coding_exception('Context passed must be course context.');
}
}
}
+15 -7
View File
@@ -14,21 +14,29 @@
// 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 <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
* Course restored event.
* Course restored event class.
*
* @property-read array $other {
* Extra information about event.
*
* @type string type restore type, activity, course or section.
* @type int target where restored (new/existing/current/adding/deleting)
* @type int mode execution mode
* @type string opertaion restore
* @type boolean samesite true is restored to same site.
* - string type: restore type, activity, course or section.
* - int target: where restored (new/existing/current/adding/deleting).
* - int mode: execution mode.
* - string operation: what operation are we performing?
* - boolean samesite: true if restoring to same site.
* }
*
* @package core
@@ -62,7 +70,7 @@ class course_restored extends base {
* @return string
*/
public function get_description() {
return "Course {$this->objectid} was restored by user {$this->userid}";
return "The course with the id '$this->objectid' was restored by the user with the id '$this->userid'.";
}
/**
+7 -5
View File
@@ -15,7 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Course section updated.
* Course section updated event.
*
* @package core
* @copyright 2013 Rajesh Taneja <[email protected]>
@@ -27,12 +27,12 @@ namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
* Course section updated.
* Course section updated event class.
*
* @property-read array $other {
* Extra information about event.
*
* @type int sectionnum section number.
* - int sectionnum: section number.
* }
*
* @package core
@@ -68,7 +68,8 @@ class course_section_updated extends base {
* @return string
*/
public function get_description() {
return 'Course ' . $this->courseid . ' section ' . $this->other['sectionnum'] . ' updated by user ' . $this->userid;
return "The user with the id '$this->userid' updated the section with the number '{$this->other['sectionnum']}' for the " .
"course with the id '$this->courseid'";
}
/**
@@ -98,8 +99,9 @@ class course_section_updated extends base {
*/
protected function validate_data() {
parent::validate_data();
if (!isset($this->other['sectionnum'])) {
throw new \coding_exception('The sectionnum must be set in $other');
throw new \coding_exception('The \'sectionnum\' value must be set in other.');
}
}
}
+12 -4
View File
@@ -14,18 +14,26 @@
// 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 <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
* Course updated event.
* Course updated event class.
*
* @property-read array $other {
* Extra information about event.
*
* @type string shortname shortname of course.
* @type string fullname fullname of course.
* - string shortname: shortname of course.
* - string fullname: fullname of course.
* }
*
* @package core
@@ -62,7 +70,7 @@ class course_updated extends base {
* @return string
*/
public function get_description() {
return "Course {$this->courseid} was updated by user {$this->userid}";
return "The course with the id '$this->courseid' was updated by the user with the id '$this->userid'.";
}
/**
@@ -29,8 +29,12 @@ defined('MOODLE_INTERNAL') || die();
* Course user report viewed event class.
*
* Class for event to be triggered when a course user report is viewed.
* @property-read array $other Extra information about the event.
* -string mode: Mode is used to show the user different data.
*
* @property-read array $other {
* Extra information about the event.
*
* - string mode: Mode is used to show the user different data.
* }
*
* @package core
* @since Moodle 2.7
@@ -55,7 +59,8 @@ class course_user_report_viewed extends \core\event\base {
* @return string
*/
public function get_description() {
return "A user with the id '$this->userid' viewed the user report in the course '$this->courseid' for user '$this->relateduserid'";
return "The user with the id '$this->userid' viewed the user report for the course with the id '$this->courseid' " .
"for user with the id '$this->relateduserid'.";
}
/**
+8 -4
View File
@@ -29,8 +29,12 @@ defined('MOODLE_INTERNAL') || die();
* Course viewed event class.
*
* Class for event to be triggered when a course is viewed.
* @property-read array $other Extra information about the event.
* -int coursesectionid: The course section ID (Optional!).
*
* @property-read array $other {
* Extra information about the event.
*
* - int coursesectionid: (optional) The course section ID.
* }
*
* @package core
* @since Moodle 2.7
@@ -55,7 +59,7 @@ class course_viewed extends \core\event\base {
* @return string
*/
public function get_description() {
return "A user with the id '$this->userid' viewed the course '$this->courseid'";
return "The user with the id '$this->userid' viewed the course with the id '$this->courseid'.";
}
/**
@@ -114,7 +118,7 @@ class course_viewed extends \core\event\base {
parent::validate_data();
if ($this->contextlevel != CONTEXT_COURSE) {
throw new \coding_exception('Context passed must be course context.');
throw new \coding_exception('Context level must be CONTEXT_COURSE.');
}
}
}
+12 -3
View File
@@ -14,12 +14,21 @@
// 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 <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
* Email failed event.
* Email failed event class.
*
* @package core
* @since Moodle 2.7
@@ -51,8 +60,8 @@ class email_failed extends base {
* @return string
*/
public function get_description() {
return 'Failed to send an email from the user with the id ' . $this->userid . ' to the user with the id ' .
$this->relateduserid . ' due to the following error: \'' . $this->other['errorinfo'] . '\'';
return "Failed to send an email from the user with the id '$this->userid' to the user with the id '$this->relateduserid'
due to the following error: \"{$this->other['errorinfo']}\".";
}
/**
+2 -3
View File
@@ -33,7 +33,7 @@ defined('MOODLE_INTERNAL') || die();
* @copyright 2013 Frédéric Massart
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class group_created extends \core\event\base {
class group_created extends base {
/**
* Returns description of what happened.
@@ -41,7 +41,7 @@ class group_created extends \core\event\base {
* @return string
*/
public function get_description() {
return "User {$this->userid} created the group {$this->objectid}.";
return "The user with the id '$this->userid' created the group with the id '$this->objectid'.";
}
/**
@@ -90,5 +90,4 @@ class group_created extends \core\event\base {
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = 'groups';
}
}
+2 -2
View File
@@ -33,7 +33,7 @@ defined('MOODLE_INTERNAL') || die();
* @copyright 2013 Frédéric Massart
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class group_deleted extends \core\event\base {
class group_deleted extends base {
/**
* Returns description of what happened.
@@ -41,7 +41,7 @@ class group_deleted extends \core\event\base {
* @return string
*/
public function get_description() {
return "User {$this->userid} deleted the group {$this->objectid}.";
return "The user with the id '$this->userid' deleted the group with the id '$this->objectid'.";
}
/**
+13 -8
View File
@@ -31,8 +31,8 @@ defined('MOODLE_INTERNAL') || die();
* @property-read array $other {
* Extra information about event.
*
* @type string component name of component
* @type int itemid id of item.
* - string component: name of component
* - int itemid: id of item.
* }
*
* @package core
@@ -40,7 +40,7 @@ defined('MOODLE_INTERNAL') || die();
* @copyright 2013 Frédéric Massart
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class group_member_added extends \core\event\base {
class group_member_added extends base {
/**
* Returns description of what happened.
@@ -48,7 +48,8 @@ class group_member_added extends \core\event\base {
* @return string
*/
public function get_description() {
return "User {$this->userid} added user {$this->relateduserid} to group {$this->objectid}.";
return "The user with the id '$this->userid' added the user with the id '$this->relateduserid' to the group with " .
"the id '$this->objectid'.";
}
/**
@@ -110,10 +111,14 @@ class group_member_added extends \core\event\base {
* @return void
*/
protected function validate_data() {
if (!isset($this->other['component']) || !isset($this->other['itemid'])) {
throw new \coding_exception('The component and itemid need to be set in $other, even if empty.');
}
parent::validate_data();
}
if (!isset($this->other['component'])) {
throw new \coding_exception('The \'component\' value must be set in other, even if empty.');
}
if (!isset($this->other['itemid'])) {
throw new \coding_exception('The \'itemid\' value must be set in other, even if empty.');
}
}
}
+3 -3
View File
@@ -33,7 +33,7 @@ defined('MOODLE_INTERNAL') || die();
* @copyright 2013 Frédéric Massart
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class group_member_removed extends \core\event\base {
class group_member_removed extends base {
/**
* Returns description of what happened.
@@ -41,7 +41,8 @@ class group_member_removed extends \core\event\base {
* @return string
*/
public function get_description() {
return "User {$this->userid} removed user {$this->relateduserid} from group {$this->objectid}.";
return "The user with the id '$this->userid' removed the user with the id '$this->relateduserid' to the group with " .
"the id '$this->objectid'.";
}
/**
@@ -93,5 +94,4 @@ class group_member_removed extends \core\event\base {
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = 'groups';
}
}
+2 -3
View File
@@ -33,7 +33,7 @@ defined('MOODLE_INTERNAL') || die();
* @copyright 2013 Frédéric Massart
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class group_updated extends \core\event\base {
class group_updated extends base {
/**
* Returns description of what happened.
@@ -41,7 +41,7 @@ class group_updated extends \core\event\base {
* @return string
*/
public function get_description() {
return "User {$this->userid} updated the group {$this->objectid}.";
return "The user with the id '$this->userid' updated the group with the id '$this->objectid'.";
}
/**
@@ -90,5 +90,4 @@ class group_updated extends \core\event\base {
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = 'groups';
}
}
+2 -2
View File
@@ -33,7 +33,7 @@ defined('MOODLE_INTERNAL') || die();
* @copyright 2013 Frédéric Massart
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class grouping_created extends \core\event\base {
class grouping_created extends base {
/**
* Returns description of what happened.
@@ -41,7 +41,7 @@ class grouping_created extends \core\event\base {
* @return string
*/
public function get_description() {
return "User {$this->userid} created the grouping {$this->objectid}.";
return "The user with the id '$this->userid' created the grouping with the id '$this->objectid'.";
}
/**
+2 -2
View File
@@ -33,7 +33,7 @@ defined('MOODLE_INTERNAL') || die();
* @copyright 2013 Frédéric Massart
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class grouping_deleted extends \core\event\base {
class grouping_deleted extends base {
/**
* Legacy data.
@@ -48,7 +48,7 @@ class grouping_deleted extends \core\event\base {
* @return string
*/
public function get_description() {
return "User {$this->userid} deleted the grouping {$this->objectid}.";
return "The user with the id '$this->userid' deleted the grouping with the id '$this->objectid'.";
}
/**
+3 -3
View File
@@ -33,7 +33,7 @@ defined('MOODLE_INTERNAL') || die();
* @copyright 2013 Frédéric Massart
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class grouping_updated extends \core\event\base {
class grouping_updated extends base {
/**
* Returns description of what happened.
@@ -41,13 +41,13 @@ class grouping_updated extends \core\event\base {
* @return string
*/
public function get_description() {
return "User {$this->userid} updated the grouping {$this->objectid}.";
return "The user with the id '$this->userid' updated the grouping with the id '$this->objectid'.";
}
/**
* Legacy event data if get_legacy_eventname() is not empty.
*
* @return stdClass
* @return \stdClass
*/
protected function get_legacy_eventdata() {
return $this->get_record_snapshot('groupings', $this->objectid);
+13 -6
View File
@@ -14,6 +14,18 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Message contact added event.
*
* @package core
* @copyright 2014 Mark Nelson <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
* Message contact added event class.
*
@@ -22,10 +34,6 @@
* @copyright 2014 Mark Nelson <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\event;
defined('MOODLE_INTERNAL') || die();
class message_contact_added extends base {
/**
@@ -61,8 +69,7 @@ class message_contact_added extends base {
* @return string
*/
public function get_description() {
return 'The user with the id \'' . $this->userid . '\' added the user with the id \'' .
$this->relateduserid . '\' to their contact list.';
return "The user with the id '$this->userid' added the user with the id '$this->relateduserid' to their contact list.";
}
/**
+13 -6
View File
@@ -14,6 +14,18 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Message contact blocked event.
*
* @package core
* @copyright 2014 Mark Nelson <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
* Message contact blocked event class.
*
@@ -22,10 +34,6 @@
* @copyright 2014 Mark Nelson <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\event;
defined('MOODLE_INTERNAL') || die();
class message_contact_blocked extends base {
/**
@@ -61,8 +69,7 @@ class message_contact_blocked extends base {
* @return string
*/
public function get_description() {
return 'The user with the id \'' . $this->userid . '\' blocked the user with the id \'' .
$this->relateduserid . '\' on their contact list.';
return "The user with the id '$this->userid' blocked the user with the id '$this->relateduserid' on their contact list.";
}
/**
+13 -6
View File
@@ -14,6 +14,18 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Message contact removed event.
*
* @package core
* @copyright 2014 Mark Nelson <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
* Message contact removed event class.
*
@@ -22,10 +34,6 @@
* @copyright 2014 Mark Nelson <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\event;
defined('MOODLE_INTERNAL') || die();
class message_contact_removed extends base {
/**
@@ -61,8 +69,7 @@ class message_contact_removed extends base {
* @return string
*/
public function get_description() {
return 'The user with the id \'' . $this->userid . '\' removed the user with the id \'' .
$this->relateduserid . '\' from their contact list.';
return "The user with the id '$this->userid' removed the user with the id '$this->relateduserid' from their contact list.";
}
/**
@@ -14,6 +14,18 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Message contact unblocked event.
*
* @package core
* @copyright 2014 Mark Nelson <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
* Message contact unblocked event class.
*
@@ -22,10 +34,6 @@
* @copyright 2014 Mark Nelson <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\event;
defined('MOODLE_INTERNAL') || die();
class message_contact_unblocked extends base {
/**
@@ -61,8 +69,7 @@ class message_contact_unblocked extends base {
* @return string
*/
public function get_description() {
return 'The user with the id \'' . $this->userid . '\' unblocked the user with the id \'' .
$this->relateduserid . '\' on their contact list.';
return "The user with the id '$this->userid' unblocked the user with the id '$this->relateduserid' on their contact list.";
}
/**
+15 -8
View File
@@ -14,6 +14,18 @@
// 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 <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
* Message sent event class.
*
@@ -28,10 +40,6 @@
* @copyright 2014 Mark Nelson <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\event;
defined('MOODLE_INTERNAL') || die();
class message_sent extends base {
/**
@@ -68,11 +76,10 @@ class message_sent extends base {
public function get_description() {
// Check if we are sending from a valid user.
if (\core_user::is_real_user($this->userid)) {
return 'The user with the id \'' . $this->userid . '\' sent a message to the user with the id \'' .
$this->relateduserid . '\'.';
return "The user with the id '$this->objectid' sent a message to the user with the id '$this->relateduserid'.";
}
return 'A message was sent by the system to the user with the id \'' . $this->relateduserid . '\'.';
return "A message was sent by the system to the user with the id '$this->relateduserid'.";
}
/**
@@ -105,7 +112,7 @@ class message_sent extends base {
}
if (!isset($this->other['messageid'])) {
throw new \coding_exception('The \'messageid\' needs to be set in $other.');
throw new \coding_exception('The \'messageid\' value must be set in other.');
}
}
}
+14 -7
View File
@@ -14,6 +14,18 @@
// 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 <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
* Message viewed event class.
*
@@ -28,10 +40,6 @@
* @copyright 2014 Mark Nelson <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\event;
defined('MOODLE_INTERNAL') || die();
class message_viewed extends base {
/**
@@ -67,8 +75,7 @@ class message_viewed extends base {
* @return string
*/
public function get_description() {
return 'The user with the id \'' . $this->relateduserid . '\' read a message from the user with the id \'' .
$this->userid . '\'.';
return "The user with the id '$this->relateduserid' read a message from the user with the id '$this->userid'.";
}
/**
@@ -85,7 +92,7 @@ class message_viewed extends base {
}
if (!isset($this->other['messageid'])) {
throw new \coding_exception('The \'messageid\' needs to be set in $other.');
throw new \coding_exception('The \'messageid\' value must be set in other.');
}
}
}
@@ -14,6 +14,19 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Mnet access control created event.
*
* @package core
* @since Moodle 2.7
* @copyright 2013 Mark Nelson <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
* Mnet access control created event class.
*
@@ -22,10 +35,6 @@
* @copyright 2013 Mark Nelson <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\event;
defined('MOODLE_INTERNAL') || die();
class mnet_access_control_created extends base {
/**
@@ -61,8 +70,8 @@ class mnet_access_control_created extends base {
* @return string
*/
public function get_description() {
return 'Access control created for the user with the username \'' . $this->other['username'] . '\' belonging
to the mnet host \'' . $this->other['hostname'] . '\'';
return "Access control created for the user with the username '{$this->other['username']}' belonging to the mnet " .
"host '{$this->other['hostname']}'.";
}
/**
@@ -85,15 +94,15 @@ class mnet_access_control_created extends base {
parent::validate_data();
if (!isset($this->other['username'])) {
throw new \coding_exception('The \'username\' must be set in other.');
throw new \coding_exception('The \'username\' value must be set in other.');
}
if (!isset($this->other['hostname'])) {
throw new \coding_exception('The \'hostname\' must be set in other.');
throw new \coding_exception('The \'hostname\' value must be set in other.');
}
if (!isset($this->other['accessctrl'])) {
throw new \coding_exception('The \'accessctrl\' must be set in other.');
throw new \coding_exception('The \'accessctrl\' value must be set in other.');
}
}
}
@@ -14,6 +14,19 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Mnet access control updated event.
*
* @package core
* @since Moodle 2.7
* @copyright 2013 Mark Nelson <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
* Mnet access control updated event class.
*
@@ -22,10 +35,6 @@
* @copyright 2013 Mark Nelson <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\event;
defined('MOODLE_INTERNAL') || die();
class mnet_access_control_updated extends base {
/**
@@ -61,8 +70,8 @@ class mnet_access_control_updated extends base {
* @return string
*/
public function get_description() {
return 'Access control created for the user with the username \'' . $this->other['username'] . '\' belonging
to the mnet host \'' . $this->other['hostname'] . '\'';
return "Access control updated for the user with the username '{$this->other['username']}' belonging to the mnet " .
"host '{$this->other['hostname']}'.";
}
/**
@@ -85,15 +94,15 @@ class mnet_access_control_updated extends base {
parent::validate_data();
if (!isset($this->other['username'])) {
throw new \coding_exception('The \'username\' must be set in other.');
throw new \coding_exception('The \'username\' value must be set in other.');
}
if (!isset($this->other['hostname'])) {
throw new \coding_exception('The \'hostname\' must be set in other.');
throw new \coding_exception('The \'hostname\' value must be set in other.');
}
if (!isset($this->other['accessctrl'])) {
throw new \coding_exception('The \'accessctrl\' must be set in other.');
throw new \coding_exception('The \'accessctrl\' value must be set in other.');
}
}
}
+8 -7
View File
@@ -14,10 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
* Event for when a new note entry is added.
*
@@ -26,6 +22,10 @@ defined('MOODLE_INTERNAL') || die();
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
* Class note_created
*
@@ -34,7 +34,7 @@ defined('MOODLE_INTERNAL') || die();
* @property-read array $other {
* Extra information about event.
*
* @type string publishstate publish state.
* - string publishstate: the publish state.
* }
*
* @package core
@@ -42,7 +42,7 @@ defined('MOODLE_INTERNAL') || die();
* @copyright 2013 Ankit Agarwal
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class note_created extends \core\event\base {
class note_created extends base {
/**
* Set basic properties for the event.
@@ -68,7 +68,8 @@ class note_created extends \core\event\base {
* @return string
*/
public function get_description() {
return 'Note for user with id "'. $this->relateduserid . '" was created by user with id "' . $this->userid . '"';
return "The note with the id '$this->objectid' for the user with the id '$this->relateduserid' was created by the user " .
"with the id '$this->userid'.";
}
/**
+8 -7
View File
@@ -14,10 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
* Event for when a new note entry deleted.
*
@@ -26,6 +22,10 @@ defined('MOODLE_INTERNAL') || die();
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
* Class note_deleted
*
@@ -34,7 +34,7 @@ defined('MOODLE_INTERNAL') || die();
* @property-read array $other {
* Extra information about event.
*
* @type string publishstate publish state
* - string publishstate: the publish state.
* }
*
* @package core
@@ -42,7 +42,7 @@ defined('MOODLE_INTERNAL') || die();
* @copyright 2013 Ankit Agarwal
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class note_deleted extends \core\event\base {
class note_deleted extends base {
/**
* Set basic properties for the event.
@@ -68,7 +68,8 @@ class note_deleted extends \core\event\base {
* @return string
*/
public function get_description() {
return 'Note for user with id "'. $this->relateduserid . '" was deleted by user with id "' . $this->userid . '"';
return "The note with the id '$this->objectid' for the user with the id '$this->relateduserid' was deleted by the user " .
"with the id '$this->userid'.";
}
/**
+8 -7
View File
@@ -14,10 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
* Event for when a new note entry is updated.
*
@@ -26,6 +22,10 @@ defined('MOODLE_INTERNAL') || die();
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
* Class note_updated
*
@@ -34,7 +34,7 @@ defined('MOODLE_INTERNAL') || die();
* @property-read array $other {
* Extra information about event.
*
* @type string publishstate publish state.
* - string publishstate: the publish state.
* }
*
* @package core
@@ -42,7 +42,7 @@ defined('MOODLE_INTERNAL') || die();
* @copyright 2013 Ankit Agarwal
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class note_updated extends \core\event\base {
class note_updated extends base {
/**
* Set basic properties for the event.
@@ -68,7 +68,8 @@ class note_updated extends \core\event\base {
* @return string
*/
public function get_description() {
return 'Note for user with id "'. $this->relateduserid . '" was updated by user with id "'. $this->userid . '"';
return "The note with the id '$this->objectid' for the user with the id '$this->relateduserid' was updated by the user " .
"with the id '$this->userid'.";
}
/**
+8 -8
View File
@@ -14,10 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
* Event for when a new note entry viewed.
*
@@ -26,6 +22,10 @@ defined('MOODLE_INTERNAL') || die();
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
* Class note_viewed
*
@@ -36,7 +36,7 @@ defined('MOODLE_INTERNAL') || die();
* @copyright 2013 Ankit Agarwal
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class notes_viewed extends \core\event\base {
class notes_viewed extends base {
/**
* Set basic properties for the event.
@@ -62,10 +62,10 @@ class notes_viewed extends \core\event\base {
*/
public function get_description() {
if (!empty($this->relateduserid)) {
return 'Note for user with id "'. $this->relateduserid . '" was viewed by user with id "'. $this->userid . '"';
} else {
return 'Note for course with id "'. $this->courseid . '" was viewed by user with id "'. $this->userid . '"';
return "The user with the id '$this->userid' viewed the notes for the user with the id '$this->relateduserid'.";
}
return "The user with the id '$this->userid' viewed the notes for the course with the id '$this->courseid'.";
}
/**
@@ -14,6 +14,18 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Question category created event.
*
* @package core
* @copyright 2014 Mark Nelson <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
* Question category created event class.
*
@@ -22,10 +34,6 @@
* @copyright 2014 Mark Nelson <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\event;
defined('MOODLE_INTERNAL') || die();
class question_category_created extends base {
/**
@@ -52,7 +60,7 @@ class question_category_created extends base {
* @return string
*/
public function get_description() {
return 'A question category with the id of ' . $this->objectid . ' was created by a user with the id ' . $this->userid;
return "A question category with the id of '$this->objectid' was created by the user with the id '$this->userid'.";
}
/**
+5 -2
View File
@@ -21,8 +21,11 @@
* @copyright 2014 Petr Skoda
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
* Event for recent activity page.
*
@@ -58,7 +61,7 @@ class recent_activity_viewed extends \core\event\base {
* @return string
*/
public function get_description() {
return "The user with id " . $this->userid . " viewed recent activity report in course " . $this->courseid;
return "The user with the id '$this->userid' viewed the recent activity report in the course with the id '$this->courseid'.";
}
/**
@@ -88,7 +91,7 @@ class recent_activity_viewed extends \core\event\base {
parent::validate_data();
if ($this->contextlevel != CONTEXT_COURSE) {
throw new \coding_exception('recent_activity_viewed event expects only course contexts.');
throw new \coding_exception('Context level must be CONTEXT_COURSE.');
}
}
}
@@ -14,12 +14,8 @@
// 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 when role allow assignments is updated.
* Role assignments updated event.
*
* @package core
* @since Moodle 2.6
@@ -27,6 +23,18 @@ defined('MOODLE_INTERNAL') || die();
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
* Role assignments updated event class.
*
* @package core
* @since Moodle 2.6
* @copyright 2013 Rajesh Taneja <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class role_allow_assign_updated extends base {
/**
* Initialise event parameters.
@@ -51,7 +59,7 @@ class role_allow_assign_updated extends base {
* @return string
*/
public function get_description() {
return 'Allow role assignments updated by user ' . $this->userid;
return "Allow role assignments updated by the user with the id '$this->userid'.";
}
/**
@@ -14,12 +14,8 @@
// 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 when role allow override is updated.
* Role allow override updated event.
*
* @package core
* @since Moodle 2.6
@@ -27,6 +23,18 @@ defined('MOODLE_INTERNAL') || die();
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
* Role allow override updated event class.
*
* @package core
* @since Moodle 2.6
* @copyright 2013 Rajesh Taneja <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class role_allow_override_updated extends base {
/**
* Initialise event parameters.
@@ -51,7 +59,7 @@ class role_allow_override_updated extends base {
* @return string
*/
public function get_description() {
return 'Allow role override updated by user ' . $this->userid;
return "Allow role override updated by the user with the id '$this->userid'.";
}
/**
@@ -14,12 +14,8 @@
// 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 when role allow switch is updated.
* Role allow switch updated event.
*
* @package core
* @since Moodle 2.6
@@ -27,6 +23,18 @@ defined('MOODLE_INTERNAL') || die();
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
* Role allow switch updated event class.
*
* @package core
* @since Moodle 2.6
* @copyright 2013 Rajesh Taneja <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class role_allow_switch_updated extends base {
/**
* Initialise event parameters.
@@ -51,7 +59,7 @@ class role_allow_switch_updated extends base {
* @return string
*/
public function get_description() {
return 'Allow role switch updated by user ' . $this->userid;
return "Allow role switch updated by the user with the id '$this->userid'.";
}
/**
+18 -6
View File
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Role assigned event.
*
* @package core
* @copyright 2013 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\event;
defined('MOODLE_INTERNAL') || die();
@@ -24,9 +32,9 @@ defined('MOODLE_INTERNAL') || die();
* @property-read array $other {
* Extra information about event.
*
* @type int id role assigned id.
* @type string component name of component.
* @type int itemid id of item.
* - int id: role assigned id.
* - string component: name of component.
* - int itemid: id of the item.
* }
*
* @package core
@@ -34,8 +42,11 @@ defined('MOODLE_INTERNAL') || die();
* @copyright 2013 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class role_assigned extends base {
/**
* Set basic properties for the event.
*/
protected function init() {
$this->data['objecttable'] = 'role';
$this->data['crud'] = 'c';
@@ -57,7 +68,8 @@ class role_assigned extends base {
* @return string
*/
public function get_description() {
return 'Role '.$this->objectid.' was assigned to user '.$this->relateduserid.' in context '.$this->contextid;
return "The role with the id '$this->objectid' was assigned to the user with the id '$this->relateduserid' " .
"by the user with the id '$this->userid'.";
}
/**
@@ -83,7 +95,7 @@ class role_assigned extends base {
* @return mixed
*/
protected function get_legacy_eventdata() {
return $this->get_record_snapshot('role_assignments', $this->data['other']['id']);
return $this->get_record_snapshot('role_assignments', $this->other['id']);
}
/**
@@ -14,10 +14,6 @@
// 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();
/**
* Role updated event.
*
@@ -27,6 +23,18 @@ defined('MOODLE_INTERNAL') || die();
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
* Role updated event class.
*
* @package core
* @since Moodle 2.6
* @copyright 2013 Rajesh Taneja <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class role_capabilities_updated extends base {
/** @var array Legacy log data */
protected $legacylogdata = null;
@@ -55,7 +63,7 @@ class role_capabilities_updated extends base {
* @return string
*/
public function get_description() {
return 'Capabilities for role ' . $this->objectid . ' are updated by user ' . $this->userid;
return "The capabilities for the role with the id '$this->objectid' were updated by the user with the id '$this->userid'.";
}
/**
+13 -6
View File
@@ -14,19 +14,27 @@
// 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 <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
* Role assigned event.
* Role assigned event class.
*
* @property-read array $other {
* Extra information about event.
*
* @type string shortname shortname of role.
* @type string description role description.
* @type string archetype role type.
* - string shortname: shortname of role.
* - string description: role description.
* - string archetype: role type.
* }
*
* @package core
@@ -34,7 +42,6 @@ defined('MOODLE_INTERNAL') || die();
* @copyright 2013 Rajesh Taneja <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class role_deleted extends base {
/**
* Initialise event parameters.
@@ -60,7 +67,7 @@ class role_deleted extends base {
* @return string
*/
public function get_description() {
return 'Role ' . $this->objectid . ' is deleted by user ' . $this->userid;
return "The role with the id '$this->objectid' was deleted by the user with the id '$this->userid'.";
}
/**
+23 -14
View File
@@ -14,27 +14,35 @@
// 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();
/**
* Role unassigned event.
*
* @property-read array $other {
* Extra information about event.
*
* @type int id role assigned id.
* @type string component name of component.
* @type int itemid id of item.
* }
*
* @package core
* @since Moodle 2.6
* @copyright 2013 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
* Role unassigned event class.
*
* @property-read array $other {
* Extra information about event.
*
* - int id: role assigned id.
* - string component: name of component.
* - int itemid: id of item.
* }
*
* @package core
* @since Moodle 2.6
* @copyright 2013 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class role_unassigned extends base {
protected function init() {
$this->data['objecttable'] = 'role';
@@ -57,7 +65,8 @@ class role_unassigned extends base {
* @return string
*/
public function get_description() {
return 'Role '.$this->objectid.' was unassigned from user '.$this->relateduserid.' in context '.$this->contextid;
return "The role with the id '$this->objectid' was unassigned from the user with the id '$this->relateduserid' " .
"by the user with the id '$this->userid'.";
}
/**
@@ -83,7 +92,7 @@ class role_unassigned extends base {
* @return mixed
*/
protected function get_legacy_eventdata() {
return $this->get_record_snapshot('role_assignments', $this->data['other']['id']);
return $this->get_record_snapshot('role_assignments', $this->other['id']);
}
/**
+20 -13
View File
@@ -15,7 +15,19 @@
// 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 <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
* Event class for when a tag has been added to an item.
*
* @property-read array $other {
* Extra information about event.
@@ -32,11 +44,6 @@
* @copyright 2014 Mark Nelson <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\event;
defined('MOODLE_INTERNAL') || die();
class tag_added extends base {
/**
@@ -63,8 +70,8 @@ class tag_added extends base {
* @return string
*/
public function get_description() {
return 'The tag with the id ' . $this->other['tagid'] . ' was added to the item type \'' . s($this->other['itemtype']) .
'\' with the id ' . $this->other['itemid'] . ' by the user with the id ' . $this->userid;
return "The user with the id '$this->userid' added the tag with the id '{$this->other['tagid']}' to the item type '" .
s($this->other['itemtype']) . "' with the id '{$this->other['itemid']}'.";
}
/**
@@ -91,23 +98,23 @@ class tag_added extends base {
parent::validate_data();
if (!isset($this->other['tagid'])) {
throw new \coding_exception('The tagid must be set in $other.');
throw new \coding_exception('The \'tagid\' value must be set in other.');
}
if (!isset($this->other['itemid'])) {
throw new \coding_exception('The itemid must be set in $other.');
throw new \coding_exception('The \'itemid\' value must be set in other.');
}
if (!isset($this->other['itemtype'])) {
throw new \coding_exception('The itemtype must be set in $other.');
throw new \coding_exception('The \'itemtype\' value must be set in other.');
}
if (!isset($this->other['tagname'])) {
throw new \coding_exception('The tagname must be set in $other.');
throw new \coding_exception('The \'tagname\' value must be set in other.');
}
if (!isset($this->other['tagrawname'])) {
throw new \coding_exception('The tagrawname must be set in $other.');
throw new \coding_exception('The \'tagrawname\' value must be set in other.');
}
}
}
+15 -8
View File
@@ -17,6 +17,18 @@
/**
* Tag created event.
*
* @package core
* @copyright 2014 Mark Nelson <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
* Tag created event class.
*
* @property-read array $other {
* Extra information about event.
*
@@ -29,11 +41,6 @@
* @copyright 2014 Mark Nelson <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\event;
defined('MOODLE_INTERNAL') || die();
class tag_created extends base {
/**
@@ -60,7 +67,7 @@ class tag_created extends base {
* @return string
*/
public function get_description() {
return 'The tag with the id ' . $this->objectid . ' was created by the user with the id ' . $this->userid;
return "The user with the id '$this->userid' created the tag with the id '$this->objectid'.";
}
/**
@@ -73,11 +80,11 @@ class tag_created extends base {
parent::validate_data();
if (!isset($this->other['name'])) {
throw new \coding_exception('The name must be set in $other.');
throw new \coding_exception('The \'name\' value must be set in other.');
}
if (!isset($this->other['rawname'])) {
throw new \coding_exception('The rawname must be set in $other.');
throw new \coding_exception('The \'rawname\' value must be set in other.');
}
}
}
+15 -8
View File
@@ -17,6 +17,18 @@
/**
* Tag deleted event.
*
* @package core
* @copyright 2014 Mark Nelson <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
* Tag deleted event class.
*
* @property-read array $other {
* Extra information about event.
*
@@ -29,11 +41,6 @@
* @copyright 2014 Mark Nelson <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\event;
defined('MOODLE_INTERNAL') || die();
class tag_deleted extends base {
/**
@@ -60,7 +67,7 @@ class tag_deleted extends base {
* @return string
*/
public function get_description() {
return 'The tag with the id ' . $this->objectid . ' was deleted by the user with the id ' . $this->userid;
return "The user with the id '$this->userid' deleted the tag with the id '$this->objectid'.";
}
/**
@@ -73,11 +80,11 @@ class tag_deleted extends base {
parent::validate_data();
if (!isset($this->other['name'])) {
throw new \coding_exception('The name must be set in $other.');
throw new \coding_exception('The \'name\' value must be set in other.');
}
if (!isset($this->other['rawname'])) {
throw new \coding_exception('The rawname must be set in $other.');
throw new \coding_exception('The \'rawname\' value must be set in other.');
}
}
}
+15 -8
View File
@@ -17,6 +17,18 @@
/**
* Tag flagged event.
*
* @package core
* @copyright 2014 Mark Nelson <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
* Tag flagged event class.
*
* @property-read array $other {
* Extra information about event.
*
@@ -29,11 +41,6 @@
* @copyright 2014 Mark Nelson <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\event;
defined('MOODLE_INTERNAL') || die();
class tag_flagged extends base {
/**
@@ -60,7 +67,7 @@ class tag_flagged extends base {
* @return string
*/
public function get_description() {
return 'The tag with the id ' . $this->objectid . ' was flagged by the user with the id ' . $this->userid;
return "The tag with the id '$this->objectid' was flagged by the user with the id '$this->userid'.";
}
/**
@@ -82,11 +89,11 @@ class tag_flagged extends base {
parent::validate_data();
if (!isset($this->other['name'])) {
throw new \coding_exception('The name must be set in $other.');
throw new \coding_exception('The \'name\' value must be set in other.');
}
if (!isset($this->other['rawname'])) {
throw new \coding_exception('The rawname must be set in $other.');
throw new \coding_exception('The \'rawname\' value must be set in other.');
}
}
}
+20 -13
View File
@@ -15,7 +15,19 @@
// 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 <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
* Event class for when a tag has been removed from an item.
*
* @property-read array $other {
* Extra information about event.
@@ -32,11 +44,6 @@
* @copyright 2014 Mark Nelson <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\event;
defined('MOODLE_INTERNAL') || die();
class tag_removed extends base {
/**
@@ -63,8 +70,8 @@ class tag_removed extends base {
* @return string
*/
public function get_description() {
return 'The tag with the id ' . $this->other['tagid'] . ' was removed from the item type \'' . s($this->other['itemtype']) .
'\' with the id ' . $this->other['itemid'] . ' by the user with the id ' . $this->userid;
return "The user with the id '$this->userid' removed the tag with the id '{$this->other['tagid']}' to the item type '" .
s($this->other['itemtype']) . "' with the id '{$this->other['itemid']}'.";
}
/**
@@ -77,23 +84,23 @@ class tag_removed extends base {
parent::validate_data();
if (!isset($this->other['tagid'])) {
throw new \coding_exception('The tagid must be set in $other.');
throw new \coding_exception('The \'tagid\' value must be set in other.');
}
if (!isset($this->other['itemid'])) {
throw new \coding_exception('The itemid must be set in $other.');
throw new \coding_exception('The \'itemid\' value must be set in other.');
}
if (!isset($this->other['itemtype'])) {
throw new \coding_exception('The itemtype must be set in $other.');
throw new \coding_exception('The \'itemtype\' value must be set in other.');
}
if (!isset($this->other['tagname'])) {
throw new \coding_exception('The tagname must be set in $other.');
throw new \coding_exception('The \'tagname\' value must be set in other.');
}
if (!isset($this->other['tagrawname'])) {
throw new \coding_exception('The tagrawname must be set in $other.');
throw new \coding_exception('The \'tagrawname\' value must be set in other.');
}
}
}
+15 -8
View File
@@ -14,6 +14,18 @@
// 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 <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
* Tag unflagged event.
*
@@ -29,11 +41,6 @@
* @copyright 2014 Mark Nelson <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\event;
defined('MOODLE_INTERNAL') || die();
class tag_unflagged extends base {
/**
@@ -60,7 +67,7 @@ class tag_unflagged extends base {
* @return string
*/
public function get_description() {
return 'The tag with the id ' . $this->objectid . ' was unflagged by the user with the id ' . $this->userid;
return "The tag with the id '$this->objectid' was unflagged by the user with the id '$this->userid'.";
}
/**
@@ -73,11 +80,11 @@ class tag_unflagged extends base {
parent::validate_data();
if (!isset($this->other['name'])) {
throw new \coding_exception('The name must be set in $other.');
throw new \coding_exception('The \'name\' value must be set in other.');
}
if (!isset($this->other['rawname'])) {
throw new \coding_exception('The rawname must be set in $other.');
throw new \coding_exception('The \'rawname\' value must be set in other.');
}
}
}
+15 -8
View File
@@ -14,6 +14,18 @@
// 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 <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
* Tag updated event.
*
@@ -29,11 +41,6 @@
* @copyright 2014 Mark Nelson <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\event;
defined('MOODLE_INTERNAL') || die();
class tag_updated extends base {
/** @var array The legacy log data. */
@@ -63,7 +70,7 @@ class tag_updated extends base {
* @return string
*/
public function get_description() {
return 'The tag with the id ' . $this->objectid . ' was updated by the user with the id ' . $this->userid;
return "The tag with the id '$this->objectid' was updated by the user with the id '$this->userid'.";
}
/**
@@ -98,11 +105,11 @@ class tag_updated extends base {
parent::validate_data();
if (!isset($this->other['name'])) {
throw new \coding_exception('The name must be set in $other.');
throw new \coding_exception('The \'name\' value must be set in other.');
}
if (!isset($this->other['rawname'])) {
throw new \coding_exception('The rawname must be set in $other.');
throw new \coding_exception('The \'rawname\' value must be set in other.');
}
}
}
+9
View File
@@ -14,6 +14,15 @@
// 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();
+2 -1
View File
@@ -21,6 +21,7 @@
* @copyright 2013 Rajesh Taneja <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\event;
defined('MOODLE_INTERNAL') || die();
@@ -59,7 +60,7 @@ class user_created extends base {
* @return string
*/
public function get_description() {
return 'Profile created for user '.$this->objectid;
return "The user with the id '$this->objectid' was created.";
}
/**
+1 -1
View File
@@ -69,7 +69,7 @@ class user_deleted extends base {
* @return string
*/
public function get_description() {
return 'User profile deleted for the user with the id ' . $this->objectid;
return "The user with the id '$this->objectid' was deleted.";
}
/**
+10 -7
View File
@@ -26,12 +26,12 @@ namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
* Event when user is enrolled in a course.
* Event class for when user is enrolled in a course.
*
* @property-read array $other {
* Extra information about event.
*
* @type string enrol name of enrolment instance.
* - string enrol: name of enrolment instance.
* }
*
* @package core
@@ -65,7 +65,8 @@ class user_enrolment_created extends base {
* @return string
*/
public function get_description() {
return 'User '.$this->relateduserid. ' is enrolled in course '.$this->courseid.' by user '.$this->userid;
return "The user with the id '$this->relateduserid' was enrolled in the course with the id '$this->courseid' by the " .
"user with the id '$this->userid'.";
}
/**
@@ -115,11 +116,13 @@ class user_enrolment_created extends base {
*/
protected function validate_data() {
parent::validate_data();
if (!isset($this->other['enrol'])) {
throw new \coding_exception('Enrolment plugin name must be set in $other.');
}
if (!isset($this->relateduserid)) {
throw new \coding_exception('Related user id must be set.');
throw new \coding_exception('The \'relateduserid\' must be set.');
}
if (!isset($this->other['enrol'])) {
throw new \coding_exception('The \'enrol\' value must be set in $other.');
}
}
}
+10 -9
View File
@@ -17,13 +17,6 @@
/**
* User enrolment deleted event.
*
* @property-read array $other {
* Extra information about event.
*
* @type string enrol name of enrolment instance.
* @type array userenrolment user_enrolment record.
* }
*
* @package core
* @copyright 2013 Rajesh Taneja <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
@@ -33,7 +26,14 @@ namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
* Event when user is unenrolled from a course.
* Event class for when user is unenrolled from a course.
*
* @property-read array $other {
* Extra information about event.
*
* - string enrol: name of enrolment instance.
* - array userenrolment: user_enrolment record.
* }
*
* @package core
* @since Moodle 2.6
@@ -66,7 +66,8 @@ class user_enrolment_deleted extends base {
* @return string
*/
public function get_description() {
return 'User '.$this->relateduserid. ' is enrolled in course '.$this->courseid.' by user '.$this->userid;
return "The user with the id '$this->relateduserid' was unenrolled in the course with the id '$this->courseid' by the " .
"user with the id '$this->userid'.";
}
/**
+4 -3
View File
@@ -26,12 +26,12 @@ namespace core\event;
defined('MOODLE_INTERNAL') || die();
/**
* Event when user enrolment is updated.
* Event class for when user enrolment is updated.
*
* @property-read array $other {
* Extra information about event.
*
* @type string enrol name of enrolment instance.
* - string enrol: name of enrolment instance.
* }
*
* @package core
@@ -65,7 +65,8 @@ class user_enrolment_updated extends base {
* @return string
*/
public function get_description() {
return 'User '.$this->relateduserid. ' has updated enrolment for user '.$this->userid.' in course '.$this->courseid;
return "The user with the id '$this->userid' updated the enrolment for the user with the id '$this->relateduserid' in " .
"the course with the id '$this->courseid'.";
}
/**
+10 -6
View File
@@ -32,17 +32,20 @@ defined('MOODLE_INTERNAL') || die();
* Note: use grade_grades_history table if you need to know
* the history of grades.
*
* @property-read array $other Extra information about the event.
* -int itemid: grade item id.
* -bool overridden: Is this grade override?
* -float finalgrade: the final grade value.
* @property-read array $other {
* Extra information about the event.
*
* - int itemid: grade item id.
* - bool overridden: Is this grade override?
* - float finalgrade: the final grade value.
* }
*
* @package core
* @since Moodle 2.7
* @copyright 2013 Petr Skoda
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class user_graded extends \core\event\base {
class user_graded extends base {
/** @var \grade_grade $grade */
protected $grade;
@@ -104,7 +107,8 @@ class user_graded extends \core\event\base {
* @return string
*/
public function get_description() {
return "User {$this->userid} edited grade of user {$this->objectid} for grade item " . $this->other['itemid'];
return "The user with the id '$this->userid' updated the grade with the id {$this->objectid} for the user with the " .
"id '$this->relateduserid' for the grade item with the id '{$this->other['itemid']}'.";
}
/**
+20 -14
View File
@@ -17,16 +17,7 @@
/**
* Defines the user list viewed event.
*
* @property-read array $other {
* Extra information about event.
*
* @type int courseid id of course.
* @type string courseshortname short name of course.
* @type string coursefullname full name of course.
* }
*
* @package core
* @since Moodle 2.6
* @copyright 2013 Mark Nelson <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -35,7 +26,23 @@ namespace core\event;
defined('MOODLE_INTERNAL') || die();
class user_list_viewed extends \core\event\base {
/**
* Defines the user list viewed event.
*
* @property-read array $other {
* Extra information about event.
*
* - string courseshortname: the short name of course.
* - string coursefullname: the full name of course.
* }
*
* @package core
* @since Moodle 2.6
* @copyright 2013 Mark Nelson <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class user_list_viewed extends base {
/**
* Initialise required event data properties.
@@ -61,7 +68,7 @@ class user_list_viewed extends \core\event\base {
* @return string
*/
public function get_description() {
return 'User ' . $this->userid . ' viewed the list of users in the course ' . $this->other['courseid'];
return "The user with the id '$this->userid' viewed the list of users in the course with the id '$this->courseid'.";
}
/**
@@ -70,7 +77,7 @@ class user_list_viewed extends \core\event\base {
* @return \moodle_url
*/
public function get_url() {
return new \moodle_url('/user/index.php', array('id' => $this->other['courseid']));
return new \moodle_url('/user/index.php', array('id' => $this->courseid));
}
/**
@@ -79,7 +86,6 @@ class user_list_viewed extends \core\event\base {
* @return array
*/
protected function get_legacy_logdata() {
return array($this->other['courseid'], 'user', 'view all', 'index.php?id=' . $this->other['courseid'], '');
return array($this->courseid, 'user', 'view all', 'index.php?id=' . $this->courseid, '');
}
}
+8 -9
View File
@@ -18,7 +18,6 @@
* User login event.
*
* @package core
* @since Moodle 2.6
* @copyright 2013 Frédéric Massart
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -33,14 +32,15 @@ defined('MOODLE_INTERNAL') || die();
* @property-read array $other {
* Extra information about event.
*
* @type string username name of user.
* - string username: name of user.
* }
*
* @package core
* @since Moodle 2.6
* @copyright 2013 Frédéric Massart
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class user_loggedin extends \core\event\base {
class user_loggedin extends base {
/**
* Returns non-localised event description with id's for admin use only.
@@ -48,7 +48,7 @@ class user_loggedin extends \core\event\base {
* @return string
*/
public function get_description() {
return 'Userid ' . $this->userid . ' has logged in';
return "The user with the id '$this->userid' has logged in.";
}
/**
@@ -85,7 +85,7 @@ class user_loggedin extends \core\event\base {
* @return string
*/
public function get_username() {
return $this->data['other']['username'];
return $this->other['username'];
}
/**
@@ -108,10 +108,9 @@ class user_loggedin extends \core\event\base {
*/
protected function validate_data() {
parent::validate_data();
if (!isset($this->data['objectid'])) {
throw new \coding_exception("objectid has to be specified.");
} else if (!isset($this->data['other']['username'])) {
throw new \coding_exception("other['username'] has to be specified.");
if (!isset($this->other['username'])) {
throw new \coding_exception('The \'username\' value must be set in other.');
}
}
}
+3 -3
View File
@@ -32,8 +32,8 @@ defined('MOODLE_INTERNAL') || die();
* @property-read array $other {
* Extra information about event.
*
* @type string originalusername original username.
* @type string loggedinasusername username of logged in as user.
* - string originalusername: original username.
* - string loggedinasusername: username of logged in as user.
* }
*
* @package core
@@ -69,7 +69,7 @@ class user_loggedinas extends base {
* @return string
*/
public function get_description() {
return 'Userid ' . $this->userid . ' has logged in as '. $this->relateduserid;
return "The user with the id '$this->userid' has logged in as the user with the id '$this->relateduserid'.";
}
/**
+2 -2
View File
@@ -31,7 +31,7 @@ defined('MOODLE_INTERNAL') || die();
* @property-read array $other {
* Extra information about event.
*
* @type string sessionid session id.
* - string sessionid: session id.
* }
*
* @package core
@@ -66,7 +66,7 @@ class user_loggedout extends base {
* @return string
*/
public function get_description() {
return 'User '.$this->objectid.' logged out.';
return "The user with the id '$this->objectid' has logged out.";
}
/**
+10 -7
View File
@@ -32,8 +32,8 @@ defined('MOODLE_INTERNAL') || die();
* @property-read array $other {
* Extra information about event.
*
* @type string username name of user.
* @type int reason failure reason.
* - string username name of user.
* - int reason failure reason.
* }
*
* @package core
@@ -41,7 +41,7 @@ defined('MOODLE_INTERNAL') || die();
* @copyright 2014 Rajesh Taneja <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class user_login_failed extends \core\event\base {
class user_login_failed extends base {
/**
* Init method.
*
@@ -68,7 +68,7 @@ class user_login_failed extends \core\event\base {
* @return string
*/
public function get_description() {
return 'Login failed for user "' . $this->other['username'] . '" for reason id: ' . $this->other['reason'];
return "Login failed for the username '{$this->other['username']}' for the reason with the id '{$this->other['reason']}'.";
}
/**
@@ -101,10 +101,13 @@ class user_login_failed extends \core\event\base {
*/
protected function validate_data() {
parent::validate_data();
if (!isset($this->other['reason'])) {
throw new \coding_exception("other['reason'] has to be specified.");
} else if (!isset($this->other['username'])) {
throw new \coding_exception("other['username'] has to be specified.");
throw new \coding_exception('The \'reason\' value must be set in other.');
}
if (!isset($this->other['username'])) {
throw new \coding_exception('The \'username\' value must be set in other.');
}
}
@@ -21,6 +21,7 @@
* @copyright 2014 Petr Skoda
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\event;
defined('MOODLE_INTERNAL') || die();

Some files were not shown because too many files have changed in this diff Show More