mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
Merge branch 'w14_MDL-44715_m27_eventval' of git://github.com/skodak/moodle
This commit is contained in:
commit
0b1afc71bb
@ -59,6 +59,7 @@ abstract class assessable_submitted extends \core\event\base {
|
||||
* @return void
|
||||
*/
|
||||
protected function validate_data() {
|
||||
parent::validate_data();
|
||||
if ($this->contextlevel != CONTEXT_MODULE) {
|
||||
throw new \coding_exception('Context passed must be module context.');
|
||||
}
|
||||
|
@ -66,6 +66,7 @@ abstract class assessable_uploaded extends \core\event\base {
|
||||
* @return void
|
||||
*/
|
||||
protected function validate_data() {
|
||||
parent::validate_data();
|
||||
if ($this->contextlevel != CONTEXT_MODULE) {
|
||||
throw new \coding_exception('Context passed must be module context.');
|
||||
} else if (!isset($this->other['pathnamehashes']) || !is_array($this->other['pathnamehashes'])) {
|
||||
|
@ -103,6 +103,7 @@ class blog_association_created extends \core\event\base {
|
||||
* @return void
|
||||
*/
|
||||
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.');
|
||||
|
@ -94,6 +94,7 @@ abstract class comment_created extends \core\event\base {
|
||||
* @return void
|
||||
*/
|
||||
protected function validate_data() {
|
||||
parent::validate_data();
|
||||
if (!isset($this->other['itemid'])) {
|
||||
throw new \coding_exception('The itemid needs to be set in $other');
|
||||
}
|
||||
|
@ -94,6 +94,7 @@ abstract class comment_deleted extends \core\event\base {
|
||||
* @return void
|
||||
*/
|
||||
protected function validate_data() {
|
||||
parent::validate_data();
|
||||
if (!isset($this->other['itemid'])) {
|
||||
throw new \coding_exception('The itemid needs to be set in $other');
|
||||
}
|
||||
|
@ -113,11 +113,10 @@ abstract class content_viewed extends base {
|
||||
* @return void
|
||||
*/
|
||||
protected function validate_data() {
|
||||
if (debugging('', DEBUG_DEVELOPER)) {
|
||||
// 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.');
|
||||
}
|
||||
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.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -87,6 +87,7 @@ class course_module_completion_updated extends base {
|
||||
* @throws \coding_exception in case of a problem.
|
||||
*/
|
||||
protected function validate_data() {
|
||||
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.');
|
||||
|
@ -120,6 +120,7 @@ class course_module_created extends base {
|
||||
* Throw \coding_exception notice in case of any problems.
|
||||
*/
|
||||
protected function validate_data() {
|
||||
parent::validate_data();
|
||||
if (!isset($this->other['modulename'])) {
|
||||
throw new \coding_exception("Field other['modulename'] cannot be empty");
|
||||
}
|
||||
|
@ -110,6 +110,7 @@ class course_module_deleted extends base {
|
||||
* Throw \coding_exception notice in case of any problems.
|
||||
*/
|
||||
protected function validate_data() {
|
||||
parent::validate_data();
|
||||
if (!isset($this->other['modulename'])) {
|
||||
throw new \coding_exception("Field other['modulename'] cannot be empty");
|
||||
}
|
||||
|
@ -105,6 +105,7 @@ abstract class course_module_instance_list_viewed extends base{
|
||||
* @return void
|
||||
*/
|
||||
protected function validate_data() {
|
||||
parent::validate_data();
|
||||
if ($this->contextlevel != CONTEXT_COURSE) {
|
||||
throw new \coding_exception('Context passed must be course context.');
|
||||
}
|
||||
|
@ -120,6 +120,7 @@ class course_module_updated extends base {
|
||||
* Throw \coding_exception notice in case of any problems.
|
||||
*/
|
||||
protected function validate_data() {
|
||||
parent::validate_data();
|
||||
if (!isset($this->other['modulename'])) {
|
||||
throw new \coding_exception("Field other['modulename'] cannot be empty");
|
||||
}
|
||||
|
@ -92,6 +92,7 @@ abstract class course_module_viewed extends base {
|
||||
* @return void
|
||||
*/
|
||||
protected function validate_data() {
|
||||
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.');
|
||||
|
@ -84,6 +84,7 @@ class course_reset_ended extends \core\event\base {
|
||||
* @return void
|
||||
*/
|
||||
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.');
|
||||
}
|
||||
|
@ -84,6 +84,7 @@ class course_reset_started extends \core\event\base {
|
||||
* @return void
|
||||
*/
|
||||
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.');
|
||||
}
|
||||
|
@ -69,6 +69,7 @@ class email_failed extends base {
|
||||
* @throws \coding_exception
|
||||
*/
|
||||
protected function validate_data() {
|
||||
parent::validate_data();
|
||||
if (!isset($this->other['subject'])) {
|
||||
throw new \coding_exception('The subject needs to be set in $other');
|
||||
}
|
||||
|
@ -112,6 +112,7 @@ class group_member_added extends \core\event\base {
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -113,29 +113,26 @@ class user_deleted extends base {
|
||||
* @return void
|
||||
*/
|
||||
protected function validate_data() {
|
||||
global $CFG;
|
||||
parent::validate_data();
|
||||
|
||||
if ($CFG->debugdeveloper) {
|
||||
parent::validate_data();
|
||||
if (!isset($this->other['username'])) {
|
||||
throw new \coding_exception('username must be set in $other.');
|
||||
}
|
||||
if (!isset($this->other['username'])) {
|
||||
throw new \coding_exception('username must be set in $other.');
|
||||
}
|
||||
|
||||
if (!isset($this->other['email'])) {
|
||||
throw new \coding_exception('email must be set in $other.');
|
||||
}
|
||||
if (!isset($this->other['email'])) {
|
||||
throw new \coding_exception('email must be set in $other.');
|
||||
}
|
||||
|
||||
if (!isset($this->other['idnumber'])) {
|
||||
throw new \coding_exception('idnumber must be set in $other.');
|
||||
}
|
||||
if (!isset($this->other['idnumber'])) {
|
||||
throw new \coding_exception('idnumber must be set in $other.');
|
||||
}
|
||||
|
||||
if (!isset($this->other['picture'])) {
|
||||
throw new \coding_exception('picture must be set in $other.');
|
||||
}
|
||||
if (!isset($this->other['picture'])) {
|
||||
throw new \coding_exception('picture must be set in $other.');
|
||||
}
|
||||
|
||||
if (!isset($this->other['mnethostid'])) {
|
||||
throw new \coding_exception('mnethostid must be set in $other.');
|
||||
}
|
||||
if (!isset($this->other['mnethostid'])) {
|
||||
throw new \coding_exception('mnethostid must be set in $other.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -106,11 +106,11 @@ class user_loggedin extends \core\event\base {
|
||||
* @return void
|
||||
*/
|
||||
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.");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -99,6 +99,7 @@ class user_login_failed extends \core\event\base {
|
||||
* @return void
|
||||
*/
|
||||
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'])) {
|
||||
|
@ -99,6 +99,7 @@ class webservice_function_called extends \core\event\base {
|
||||
* @return void
|
||||
*/
|
||||
protected function validate_data() {
|
||||
parent::validate_data();
|
||||
if (!isset($this->other['function'])) {
|
||||
throw new \coding_exception('The key \'function\' needs to be set in $other.');
|
||||
}
|
||||
|
@ -113,6 +113,7 @@ class webservice_login_failed extends \core\event\base {
|
||||
* @return void
|
||||
*/
|
||||
protected function validate_data() {
|
||||
parent::validate_data();
|
||||
if (!isset($this->other['reason'])) {
|
||||
throw new \coding_exception('The key \'reason\' needs to be set in $other.');
|
||||
} else if (!isset($this->other['method'])) {
|
||||
|
@ -90,6 +90,7 @@ class webservice_service_user_added extends \core\event\base {
|
||||
* @return void
|
||||
*/
|
||||
protected function validate_data() {
|
||||
parent::validate_data();
|
||||
if (!isset($this->relateduserid)) {
|
||||
throw new \coding_exception('The relateduserid must be set.');
|
||||
}
|
||||
|
@ -90,6 +90,7 @@ class webservice_service_user_removed extends \core\event\base {
|
||||
* @return void
|
||||
*/
|
||||
protected function validate_data() {
|
||||
parent::validate_data();
|
||||
if (!isset($this->relateduserid)) {
|
||||
throw new \coding_exception('The relateduserid must be set.');
|
||||
}
|
||||
|
@ -98,6 +98,7 @@ class webservice_token_created extends \core\event\base {
|
||||
* @return void
|
||||
*/
|
||||
protected function validate_data() {
|
||||
parent::validate_data();
|
||||
if (!isset($this->relateduserid)) {
|
||||
throw new \coding_exception('The property \'relateduserid\' must be set.');
|
||||
}
|
||||
|
1
lib/tests/fixtures/event_fixtures.php
vendored
1
lib/tests/fixtures/event_fixtures.php
vendored
@ -205,6 +205,7 @@ class problematic_event3 extends \core\event\base {
|
||||
}
|
||||
|
||||
protected function validate_data() {
|
||||
parent::validate_data();
|
||||
if (empty($this->data['other'])) {
|
||||
debugging('other is missing');
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ class extension_granted extends \core\event\base {
|
||||
/**
|
||||
* Sets the legacy event log data.
|
||||
*
|
||||
* @param stdClass $legacylogdata legacy log data.
|
||||
* @param \stdClass $legacylogdata legacy log data.
|
||||
* @return void
|
||||
*/
|
||||
public function set_legacy_logdata($legacylogdata) {
|
||||
@ -106,6 +106,7 @@ class extension_granted extends \core\event\base {
|
||||
* @return void
|
||||
*/
|
||||
protected function validate_data() {
|
||||
parent::validate_data();
|
||||
if (!isset($this->relateduserid)) {
|
||||
throw new \coding_exception('relateduserid is a mandatory property.');
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ class marker_updated extends \core\event\base {
|
||||
/**
|
||||
* Sets the legacy event log data.
|
||||
*
|
||||
* @param stdClass $legacylogdata legacy log data.
|
||||
* @param \stdClass $legacylogdata legacy log data.
|
||||
* @return void
|
||||
*/
|
||||
public function set_legacy_logdata($legacylogdata) {
|
||||
@ -112,6 +112,7 @@ class marker_updated extends \core\event\base {
|
||||
* @return void
|
||||
*/
|
||||
protected function validate_data() {
|
||||
parent::validate_data();
|
||||
if (!isset($this->other['markerid'])) {
|
||||
throw new \coding_exception('markerid must be set in $other.');
|
||||
} else if (!isset($this->relateduserid)) {
|
||||
|
@ -92,7 +92,7 @@ class statement_accepted extends \core\event\base {
|
||||
/**
|
||||
* Sets the legacy event log data.
|
||||
*
|
||||
* @param stdClass $legacylogdata legacy log data.
|
||||
* @param \stdClass $legacylogdata legacy log data.
|
||||
* @return void
|
||||
*/
|
||||
public function set_legacy_logdata($legacylogdata) {
|
||||
|
@ -74,6 +74,7 @@ abstract class submission_created extends \core\event\base {
|
||||
* @return void
|
||||
*/
|
||||
protected function validate_data() {
|
||||
parent::validate_data();
|
||||
if (!isset($this->other['submissionid'])) {
|
||||
throw new \coding_exception('Other must contain the key submissionid.');
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ class submission_graded extends \core\event\base {
|
||||
/**
|
||||
* Sets the legacy event log data.
|
||||
*
|
||||
* @param stdClass $legacylogdata legacy log data.
|
||||
* @param \stdClass $legacylogdata legacy log data.
|
||||
* @return void
|
||||
*/
|
||||
public function set_legacy_logdata($legacylogdata) {
|
||||
@ -106,6 +106,7 @@ class submission_graded extends \core\event\base {
|
||||
* @return void
|
||||
*/
|
||||
protected function validate_data() {
|
||||
parent::validate_data();
|
||||
if (!isset($this->relateduserid)) {
|
||||
throw new \coding_exception('relateduserid is a mandatory property.');
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ class submission_locked extends \core\event\base {
|
||||
/**
|
||||
* Sets the legacy event log data.
|
||||
*
|
||||
* @param stdClass $legacylogdata legacy log data.
|
||||
* @param \stdClass $legacylogdata legacy log data.
|
||||
* @return void
|
||||
*/
|
||||
public function set_legacy_logdata($legacylogdata) {
|
||||
@ -106,6 +106,7 @@ class submission_locked extends \core\event\base {
|
||||
* @return void
|
||||
*/
|
||||
protected function validate_data() {
|
||||
parent::validate_data();
|
||||
if (!isset($this->relateduserid)) {
|
||||
throw new \coding_exception('relateduserid is a mandatory property.');
|
||||
}
|
||||
|
@ -112,6 +112,7 @@ class submission_status_updated extends \core\event\base {
|
||||
* @return void
|
||||
*/
|
||||
protected function validate_data() {
|
||||
parent::validate_data();
|
||||
if (!isset($this->other['newstatus'])) {
|
||||
throw new \coding_exception('newstatus must be set in $other.');
|
||||
}
|
||||
|
@ -106,6 +106,7 @@ class submission_unlocked extends \core\event\base {
|
||||
* @return void
|
||||
*/
|
||||
protected function validate_data() {
|
||||
parent::validate_data();
|
||||
if (!isset($this->relateduserid)) {
|
||||
throw new \coding_exception('relateduserid is a mandatory property.');
|
||||
}
|
||||
|
@ -74,6 +74,7 @@ abstract class submission_updated extends \core\event\base {
|
||||
* @return void
|
||||
*/
|
||||
protected function validate_data() {
|
||||
parent::validate_data();
|
||||
if (!isset($this->other['submissionid'])) {
|
||||
throw new \coding_exception('Other must contain the key submissionid.');
|
||||
}
|
||||
|
@ -112,6 +112,7 @@ class workflow_state_updated extends \core\event\base {
|
||||
* @return void
|
||||
*/
|
||||
protected function validate_data() {
|
||||
parent::validate_data();
|
||||
if (!isset($this->other['newstate'])) {
|
||||
throw new \coding_exception('newstate must be set in $other.');
|
||||
} else if (!isset($this->relateduserid)) {
|
||||
|
@ -89,6 +89,7 @@ class message_sent extends \core\event\base {
|
||||
* @return void
|
||||
*/
|
||||
protected function validate_data() {
|
||||
parent::validate_data();
|
||||
if (!isset($this->relateduserid)) {
|
||||
throw new \coding_exception('The property relateduserid must be set.');
|
||||
}
|
||||
|
@ -93,6 +93,7 @@ class sessions_viewed extends \core\event\base {
|
||||
* @return void
|
||||
*/
|
||||
protected function validate_data() {
|
||||
parent::validate_data();
|
||||
if (!isset($this->data['other']['start'])) {
|
||||
throw new \coding_exception('The property start must be set in other.');
|
||||
}
|
||||
|
@ -103,6 +103,7 @@ class answer_submitted extends \core\event\base {
|
||||
* @return void
|
||||
*/
|
||||
protected function validate_data() {
|
||||
parent::validate_data();
|
||||
if (!isset($this->other['choiceid'])) {
|
||||
throw new \coding_exception('choiceid must be set in $other.');
|
||||
}
|
||||
|
@ -103,6 +103,7 @@ class answer_updated extends \core\event\base {
|
||||
* @return void
|
||||
*/
|
||||
protected function validate_data() {
|
||||
parent::validate_data();
|
||||
if (!isset($this->other['choiceid'])) {
|
||||
throw new \coding_exception('choiceid must be set in $other.');
|
||||
}
|
||||
|
@ -88,6 +88,7 @@ class category_created extends \core\event\base {
|
||||
* @return void
|
||||
*/
|
||||
protected function validate_data() {
|
||||
parent::validate_data();
|
||||
// Make sure this class is never used without proper object details.
|
||||
if (!$this->contextlevel === CONTEXT_MODULE) {
|
||||
throw new \coding_exception('Context level must be CONTEXT_MODULE.');
|
||||
|
@ -88,6 +88,7 @@ class category_deleted extends \core\event\base {
|
||||
* @return void
|
||||
*/
|
||||
protected function validate_data() {
|
||||
parent::validate_data();
|
||||
// Make sure this class is never used without proper object details.
|
||||
if (!$this->contextlevel === CONTEXT_MODULE) {
|
||||
throw new \coding_exception('Context level must be CONTEXT_MODULE.');
|
||||
|
@ -88,6 +88,7 @@ class category_updated extends \core\event\base {
|
||||
* @return void
|
||||
*/
|
||||
protected function validate_data() {
|
||||
parent::validate_data();
|
||||
// Make sure this class is never used without proper object details.
|
||||
if (!$this->contextlevel === CONTEXT_MODULE) {
|
||||
throw new \coding_exception('Context level must be CONTEXT_MODULE.');
|
||||
|
@ -90,6 +90,7 @@ class entry_approved extends \core\event\base {
|
||||
* @return void
|
||||
*/
|
||||
protected function validate_data() {
|
||||
parent::validate_data();
|
||||
// Make sure this class is never used without proper object details.
|
||||
if (!$this->contextlevel === CONTEXT_MODULE) {
|
||||
throw new \coding_exception('Context level must be CONTEXT_MODULE.');
|
||||
|
@ -96,6 +96,7 @@ class entry_created extends \core\event\base {
|
||||
* @return void
|
||||
*/
|
||||
protected function validate_data() {
|
||||
parent::validate_data();
|
||||
// Make sure this class is never used without proper object details.
|
||||
if (!$this->contextlevel === CONTEXT_MODULE) {
|
||||
throw new \coding_exception('Context level must be CONTEXT_MODULE.');
|
||||
|
@ -110,6 +110,7 @@ class entry_deleted extends \core\event\base {
|
||||
* @return void
|
||||
*/
|
||||
protected function validate_data() {
|
||||
parent::validate_data();
|
||||
// Make sure this class is never used without proper object details.
|
||||
if (!$this->contextlevel === CONTEXT_MODULE) {
|
||||
throw new \coding_exception('Context level must be CONTEXT_MODULE.');
|
||||
|
@ -90,6 +90,7 @@ class entry_disapproved extends \core\event\base {
|
||||
* @return void
|
||||
*/
|
||||
protected function validate_data() {
|
||||
parent::validate_data();
|
||||
// Make sure this class is never used without proper object details.
|
||||
if (!$this->contextlevel === CONTEXT_MODULE) {
|
||||
throw new \coding_exception('Context level must be CONTEXT_MODULE.');
|
||||
|
@ -96,6 +96,7 @@ class entry_updated extends \core\event\base {
|
||||
* @return void
|
||||
*/
|
||||
protected function validate_data() {
|
||||
parent::validate_data();
|
||||
// Make sure this class is never used without proper object details.
|
||||
if (!$this->contextlevel === CONTEXT_MODULE) {
|
||||
throw new \coding_exception('Context level must be CONTEXT_MODULE.');
|
||||
|
@ -90,6 +90,7 @@ class entry_viewed extends \core\event\base {
|
||||
* @return void
|
||||
*/
|
||||
protected function validate_data() {
|
||||
parent::validate_data();
|
||||
// Make sure this class is never used without proper object details.
|
||||
if (!$this->contextlevel === CONTEXT_MODULE) {
|
||||
throw new \coding_exception('Context level must be CONTEXT_MODULE.');
|
||||
|
@ -99,6 +99,7 @@ class essay_assessed extends \core\event\base {
|
||||
* @return void
|
||||
*/
|
||||
protected function validate_data() {
|
||||
parent::validate_data();
|
||||
if (!isset($this->relateduserid)) {
|
||||
throw new \coding_exception('relateduserid is a mandatory property.');
|
||||
}
|
||||
|
@ -111,6 +111,7 @@ class attempt_abandoned extends \core\event\base {
|
||||
* Custom validation.
|
||||
*/
|
||||
protected function validate_data() {
|
||||
parent::validate_data();
|
||||
if (!array_key_exists('submitterid', $this->other)) {
|
||||
throw new \coding_exception('Other must contain the key submitterid');
|
||||
} else if (!isset($this->relateduserid)) {
|
||||
|
@ -88,10 +88,10 @@ class attempt_becameoverdue extends \core\event\base {
|
||||
return new \moodle_url('/mod/quiz/review.php', array('attempt' => $this->objectid));
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Legacy event data if get_legacy_eventname() is not empty.
|
||||
*
|
||||
* @return stdClass
|
||||
* @return \stdClass
|
||||
*/
|
||||
protected function get_legacy_eventdata() {
|
||||
$attempt = $this->get_record_snapshot('quiz_attempts', $this->objectid);
|
||||
@ -112,10 +112,11 @@ class attempt_becameoverdue extends \core\event\base {
|
||||
/**
|
||||
* Custom validation.
|
||||
*
|
||||
* @throws coding_exception
|
||||
* @throws \coding_exception
|
||||
* @return void
|
||||
*/
|
||||
protected function validate_data() {
|
||||
parent::validate_data();
|
||||
if (!array_key_exists('submitterid', $this->other)) {
|
||||
throw new \coding_exception('Other must contain the key submitterid');
|
||||
} else if (!isset($this->relateduserid)) {
|
||||
|
@ -82,7 +82,7 @@ class attempt_started extends \core\event\base {
|
||||
/**
|
||||
* Legacy event data if get_legacy_eventname() is not empty.
|
||||
*
|
||||
* @return stdClass
|
||||
* @return \stdClass
|
||||
*/
|
||||
protected function get_legacy_eventdata() {
|
||||
$attempt = $this->get_record_snapshot('quiz_attempts', $this->objectid);
|
||||
@ -103,10 +103,11 @@ class attempt_started extends \core\event\base {
|
||||
/**
|
||||
* Custom validation.
|
||||
*
|
||||
* @throws coding_exception
|
||||
* @throws \coding_exception
|
||||
* @return void
|
||||
*/
|
||||
protected function validate_data() {
|
||||
parent::validate_data();
|
||||
if (!isset($this->relateduserid)) {
|
||||
throw new \coding_exception('relateduserid must be set');
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ class attempt_submitted extends \core\event\base {
|
||||
/**
|
||||
* Legacy event data if get_legacy_eventname() is not empty.
|
||||
*
|
||||
* @return stdClass
|
||||
* @return \stdClass
|
||||
*/
|
||||
protected function get_legacy_eventdata() {
|
||||
$attempt = $this->get_record_snapshot('quiz_attempts', $this->objectid);
|
||||
@ -110,10 +110,11 @@ class attempt_submitted extends \core\event\base {
|
||||
/**
|
||||
* Custom validation.
|
||||
*
|
||||
* @throws coding_exception
|
||||
* @throws \coding_exception
|
||||
* @return void
|
||||
*/
|
||||
protected function validate_data() {
|
||||
parent::validate_data();
|
||||
if (!array_key_exists('submitterid', $this->other)) {
|
||||
throw new \coding_exception('Other must contain the key submitterid');
|
||||
} else if (!isset($this->relateduserid)) {
|
||||
|
@ -98,6 +98,7 @@ class interactions_viewed extends \core\event\base {
|
||||
* @return void
|
||||
*/
|
||||
protected function validate_data() {
|
||||
parent::validate_data();
|
||||
if (empty($this->other['attemptid'])) {
|
||||
throw new \coding_exception('The \\mod_scorm\\event\\interactions_viewed must specify attemptid.');
|
||||
}
|
||||
|
@ -93,6 +93,7 @@ class report_viewed extends \core\event\base {
|
||||
* @return void
|
||||
*/
|
||||
protected function validate_data() {
|
||||
parent::validate_data();
|
||||
if (empty($this->other['mode'])) {
|
||||
throw new \coding_exception('The event must specify mode to define which report was viewed.');
|
||||
}
|
||||
|
@ -94,6 +94,7 @@ class sco_launched extends \core\event\base {
|
||||
* @return void
|
||||
*/
|
||||
protected function validate_data() {
|
||||
parent::validate_data();
|
||||
if (empty($this->other['loadedcontent'])) {
|
||||
throw new \coding_exception('The event mod_scorm\\event\\sco_launched must specify loadedcontent.');
|
||||
}
|
||||
|
@ -98,6 +98,7 @@ class user_report_viewed extends \core\event\base {
|
||||
* @return void
|
||||
*/
|
||||
protected function validate_data() {
|
||||
parent::validate_data();
|
||||
if (empty($this->other['attemptid'])) {
|
||||
throw new \coding_exception('The \\mod_scorm\\event\\user_report_viewed must specify attemptid.');
|
||||
}
|
||||
|
@ -54,6 +54,7 @@ class course_module_viewed extends \core\event\course_module_viewed {
|
||||
* @return void
|
||||
*/
|
||||
protected function validate_data() {
|
||||
parent::validate_data();
|
||||
if (empty($this->other['viewed'])) {
|
||||
throw new \coding_exception('Other must contain the key viewed.');
|
||||
}
|
||||
|
@ -88,6 +88,7 @@ class report_downloaded extends \core\event\base {
|
||||
* @return void
|
||||
*/
|
||||
protected function validate_data() {
|
||||
parent::validate_data();
|
||||
if (empty($this->other['type'])) {
|
||||
throw new \coding_exception('Other must contain the key type.');
|
||||
}
|
||||
|
@ -84,6 +84,7 @@ class response_submitted extends \core\event\base {
|
||||
* @return void
|
||||
*/
|
||||
protected function validate_data() {
|
||||
parent::validate_data();
|
||||
if (empty($this->other['surveyid'])) {
|
||||
throw new \coding_exception('Other must contain the key surveyid.');
|
||||
}
|
||||
|
@ -80,6 +80,7 @@ class comments_viewed extends \core\event\comments_viewed {
|
||||
* @return void
|
||||
*/
|
||||
protected function validate_data() {
|
||||
parent::validate_data();
|
||||
if (empty($this->objectid) || empty($this->objecttable)) {
|
||||
throw new \coding_exception('The objectid and objecttable need to be set in $other');
|
||||
}
|
||||
|
@ -100,6 +100,7 @@ class page_diff_viewed extends \core\event\base {
|
||||
* @return void
|
||||
*/
|
||||
protected function validate_data() {
|
||||
parent::validate_data();
|
||||
if (!isset($this->other['comparewith']) || !isset($this->other['compare'])) {
|
||||
throw new \coding_exception('The comparewith and compare need to be set in $other');
|
||||
}
|
||||
|
@ -94,6 +94,7 @@ class page_map_viewed extends \core\event\base {
|
||||
* @return void
|
||||
*/
|
||||
protected function validate_data() {
|
||||
parent::validate_data();
|
||||
if (!isset($this->other['option'])) {
|
||||
throw new \coding_exception('The option need to be set in $other, even if 0.');
|
||||
}
|
||||
|
@ -95,6 +95,7 @@ class page_version_deleted extends \core\event\base {
|
||||
* @return void
|
||||
*/
|
||||
protected function validate_data() {
|
||||
parent::validate_data();
|
||||
if (!isset($this->other['pageid'])) {
|
||||
throw new \coding_exception('The pageid need to be set in $other');
|
||||
}
|
||||
|
@ -95,6 +95,7 @@ class page_version_restored extends \core\event\base {
|
||||
* @return void
|
||||
*/
|
||||
protected function validate_data() {
|
||||
parent::validate_data();
|
||||
if (!isset($this->other['pageid'])) {
|
||||
throw new \coding_exception('The pageid needs to be set in $other');
|
||||
}
|
||||
|
@ -97,6 +97,7 @@ class page_version_viewed extends \core\event\base {
|
||||
* @return void
|
||||
*/
|
||||
protected function validate_data() {
|
||||
parent::validate_data();
|
||||
if (!isset($this->other['versionid'])) {
|
||||
throw new \coding_exception('The versionid need to be set in $other');
|
||||
}
|
||||
|
@ -92,6 +92,7 @@ class report_viewed extends \core\event\base {
|
||||
* @return void
|
||||
*/
|
||||
protected function validate_data() {
|
||||
parent::validate_data();
|
||||
if (!isset($this->data['other']['groupid'])) {
|
||||
throw new \coding_exception('The property groupid must be set in other.');
|
||||
}
|
||||
|
@ -90,6 +90,7 @@ class user_report_viewed extends \core\event\base {
|
||||
* @return void
|
||||
*/
|
||||
protected function validate_data() {
|
||||
parent::validate_data();
|
||||
if (empty($this->data['other']['mode'])) {
|
||||
throw new \coding_exception('The property mode must be set in other.');
|
||||
}
|
||||
|
@ -91,6 +91,7 @@ class outline_viewed extends \core\event\base {
|
||||
* @return void
|
||||
*/
|
||||
protected function validate_data() {
|
||||
parent::validate_data();
|
||||
if (empty($this->data['other']['mode'])) {
|
||||
throw new \coding_exception('The property mode must be set in other.');
|
||||
}
|
||||
|
@ -94,6 +94,7 @@ class report_viewed extends \core\event\base {
|
||||
* @return void
|
||||
*/
|
||||
protected function validate_data() {
|
||||
parent::validate_data();
|
||||
if (empty($this->data['other']['instanceid'])) {
|
||||
throw new \coding_exception('The property instanceid must be set in other.');
|
||||
}
|
||||
|
@ -91,6 +91,7 @@ class report_viewed extends \core\event\base {
|
||||
* @return void
|
||||
*/
|
||||
protected function validate_data() {
|
||||
parent::validate_data();
|
||||
if (!isset($this->data['other']['report'])) {
|
||||
throw new \coding_exception('The property report must be set in other.');
|
||||
}
|
||||
|
@ -86,6 +86,7 @@ class user_report_viewed extends \core\event\base {
|
||||
* @return void
|
||||
*/
|
||||
protected function validate_data() {
|
||||
parent::validate_data();
|
||||
if (empty($this->data['relateduserid'])) {
|
||||
throw new \coding_exception('The property relateduserid must be set.');
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user