/**
  * Custom validation.
  *
  * @throws \coding_exception
  * @return void
  */
 protected function validate_data()
 {
     parent::validate_data();
     if (!isset($this->other['subscriptionid'])) {
         throw new \coding_exception('The \'subscriptionid\' value must be set in other.');
     }
 }
 /**
  * Custom validation.
  *
  * @throws \coding_exception
  */
 protected function validate_data()
 {
     parent::validate_data();
     if ($this->contextlevel != CONTEXT_MODULE) {
         throw new \coding_exception('Context level must be CONTEXT_MODULE.');
     }
 }
 /**
  * Custom validation.
  *
  * @throws \coding_exception
  * @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');
     }
 }
 /**
  * Custom validation.
  *
  * @throws \coding_exception
  * @return void
  */
 protected function validate_data()
 {
     parent::validate_data();
     if (!isset($this->relateduserid)) {
         throw new \coding_exception('The \'relateduserid\' must be set.');
     }
 }
Esempio n. 5
0
 /**
  * Custom validation.
  *
  * @throws \coding_exception
  * @return void
  */
 protected function validate_data()
 {
     parent::validate_data();
     if (!isset($this->other['title'])) {
         throw new \coding_exception('The \'title\' value must be set in the object.');
     }
 }
Esempio n. 6
0
 /**
  * Custom validations.
  *
  * @throws \coding_exception when validation fails.
  * @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.');
     }
 }
 /**
  * Custom validation.
  *
  * @throws \coding_exception
  * @return void
  */
 protected function validate_data()
 {
     parent::validate_data();
     if (!isset($this->relateduserid)) {
         debugging('The \'relateduserid\' value must be specified in the event.', DEBUG_DEVELOPER);
         $this->relateduserid = $this->objectid;
     }
 }
 /**
  * Custom validation.
  *
  * @throws \coding_exception
  * @return void
  */
 protected function validate_data()
 {
     parent::validate_data();
     if (empty($this->other['mode'])) {
         throw new \coding_exception('The \'mode\' value must be set in other.');
     }
     if (empty($this->relateduserid)) {
         throw new \coding_exception('The \'relateduserid\' must be set.');
     }
 }
 /**
  * Custom validation.
  *
  * @throws \coding_exception
  * @return void
  */
 protected function validate_data()
 {
     parent::validate_data();
     if (!isset($this->other['desc'])) {
         throw new \coding_exception('The \'desc\' value must be set in other.');
     }
     if ($this->contextlevel != CONTEXT_MODULE) {
         throw new \coding_exception('Context level must be CONTEXT_MODULE.');
     }
 }
Esempio n. 10
0
 /**
  * Custom validation.
  *
  * @throws \coding_exception when validation does not pass.
  * @return void
  */
 protected function validate_data()
 {
     parent::validate_data();
     if (!isset($this->other['dataid'])) {
         throw new \coding_exception('The dataid must be set in $other.');
     }
     if (!isset($this->other['viewid'])) {
         throw new \coding_exception('The viewid must be set in $other.');
     }
 }
Esempio n. 11
0
 /**
  * Custom validation.
  *
  * @throws \coding_exception
  * @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('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 level must be CONTEXT_MODULE.');
     }
 }
 protected function validate_data()
 {
     parent::validate_data();
     if (!isset($this->userid)) {
         throw new \coding_exception('The user id must be set.');
     }
     if (!isset($this->courseid)) {
         throw new \coding_exception('The course id must be set.');
     }
     if (!isset($this->other['quizcmid']) && !isset($this->other['qcatid'])) {
         throw new \coding_exception('Either the quiz course module id or the question category id must be set.');
     }
 }
Esempio n. 13
0
 /**
  * Custom validation.
  *
  * @throws \coding_exception
  * @return void
  */
 protected function validate_data()
 {
     parent::validate_data();
     if (!isset($this->other['tourid'])) {
         throw new \coding_exception('The \'tourid\' value must be set in other.');
     }
     if (!isset($this->other['stepindex'])) {
         throw new \coding_exception('The \'stepindex\' value must be set in other.');
     }
     if (!isset($this->other['pageurl'])) {
         throw new \coding_exception('The \'pageurl\' value must be set in other.');
     }
 }
 /**
  * Custom validation.
  *
  * @throws \coding_exception
  * @return void
  */
 protected function validate_data()
 {
     parent::validate_data();
     if (empty($this->other['attemptid'])) {
         throw new \coding_exception("The 'attemptid' must be set in other.");
     }
     if (empty($this->other['cmielement'])) {
         throw new \coding_exception("The 'cmielement' must be set in other.");
     }
     // Trust that 'cmielement' represents a valid CMI datamodel element:
     // just check that the given value starts with 'cmi.'.
     if (strpos($this->other['cmielement'], 'cmi.', 0) !== 0) {
         throw new \coding_exception("A valid 'cmielement' must start with 'cmi.' ({$this->other['cmielement']}).");
     }
     // Warning: 'cmivalue' could be also "0" e.g. when 'cmielement' represents a score.
     if (!isset($this->other['cmivalue'])) {
         throw new \coding_exception("The 'cmivalue' must be set in other.");
     }
 }
 /**
  * Custom validation.
  *
  * @throws \coding_exception
  * @return void
  */
 protected function validate_data()
 {
     parent::validate_data();
     if (!isset($this->relateduserid)) {
         throw new \coding_exception('The \'relateduserid\' must be set.');
     }
     if (!isset($this->other['forumid'])) {
         throw new \coding_exception('The \'forumid\' value must be set in other.');
     }
     if (!isset($this->other['discussion'])) {
         throw new \coding_exception('The \'discussion\' value must be set in other.');
     }
     if ($this->contextlevel != CONTEXT_MODULE) {
         throw new \coding_exception('Context level must be CONTEXT_MODULE.');
     }
 }
 /**
  * Custom validation.
  *
  * @throws \coding_exception
  * @return void
  */
 protected function validate_data()
 {
     parent::validate_data();
 }
Esempio n. 17
0
 /**
  * Custom validation.
  *
  * @throws \coding_exception
  * @return void
  */
 protected function validate_data()
 {
     parent::validate_data();
     if (!isset($this->relateduserid)) {
         throw new \coding_exception('The \'relateduserid\' must be set.');
     }
     if (!isset($this->other['reportmode'])) {
         throw new \coding_exception('The \'reportmode\' value must be set in other.');
     }
     switch ($this->contextlevel) {
         case CONTEXT_COURSE:
         case CONTEXT_SYSTEM:
         case CONTEXT_USER:
             // OK, expected context level.
             break;
         default:
             // Unexpected contextlevel.
             throw new \coding_exception('Context level must be either CONTEXT_SYSTEM, CONTEXT_COURSE or CONTEXT_USER.');
     }
 }
 /**
  * Custom validation.
  *
  * @throws \coding_exception
  * @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('The queue_entry_created 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 level must be CONTEXT_MODULE.');
     }
     // ...groupid, agrpid, userid.
     if (empty($this->data['other']['groupid'])) {
         throw new \coding_exception('Groupid has to be specified!');
     }
     if (empty($this->data['other']['agrpid'])) {
         throw new \coding_exception('Active-Group-ID has to be specified!');
     }
     if (empty($this->data['other']['userid'])) {
         throw new \coding_exception('User-ID has to be specified!');
     }
 }
 /**
  * Custom validation.
  *
  * @throws \coding_exception
  * @return void
  */
 protected function validate_data()
 {
     parent::validate_data();
     if (!isset($this->relateduserid)) {
         throw new \coding_exception('The \'relateduserid\' must be set.');
     }
     if (!isset($this->other['offlinequizid'])) {
         throw new \coding_exception('The \'offlinequizid\' value must be set in other.');
     }
 }
Esempio n. 20
0
 /**
  * Custom validation.
  *
  * @throws \coding_exception
  * @return void
  */
 protected function validate_data()
 {
     parent::validate_data();
     if (!isset($this->objectid)) {
         throw new \coding_exception('The \'ouwikiid\' value must be set in the object.');
     }
     if (!isset($this->other['info'])) {
         throw new \coding_exception('The \'info\' value must be set in other.');
     }
     if (!isset($this->other['logurl'])) {
         throw new \coding_exception('The \'logurl\' value must be set in other.');
     }
     if ($this->contextlevel != CONTEXT_MODULE) {
         throw new \coding_exception('Context level must be CONTEXT_MODULE.');
     }
 }
 /**
  * Custom validation.
  *
  * @throws \coding_exception
  * @return void
  */
 protected function validate_data()
 {
     parent::validate_data();
     if (!isset($this->other['quizid'])) {
         throw new \coding_exception('The \'quizid\' value must be set in other.');
     }
     if (!isset($this->other['reportname'])) {
         throw new \coding_exception('The \'reportname\' value must be set in other.');
     }
 }
Esempio n. 22
0
 /**
  * Custom validation.
  *
  * @throws \coding_exception
  * @return void
  */
 protected function validate_data()
 {
     parent::validate_data();
     if (empty($this->other['attemptid'])) {
         throw new \coding_exception('The \'attemptid\' must be set in other.');
     }
 }
Esempio n. 23
0
 /**
  * Custom validations
  *
  * @throws \coding_exception in case of any problems.
  */
 protected function validate_data()
 {
     parent::validate_data();
     if (!isset($this->relateduserid)) {
         throw new \coding_exception('The \'relateduserid\' must be set.');
     }
     if (!isset($this->other['anonymous'])) {
         throw new \coding_exception('The \'anonymous\' value must be set in other.');
     }
     if (!isset($this->other['cmid'])) {
         throw new \coding_exception('The \'cmid\' value must be set in other.');
     }
     if (!isset($this->other['instanceid'])) {
         throw new \coding_exception('The \'instanceid\' value must be set in other.');
     }
 }
 /**
  * Custom validation.
  *
  * @throws \coding_exception
  * @return void
  */
 protected function validate_data()
 {
     parent::validate_data();
     if (!isset($this->other['option'])) {
         throw new \coding_exception('The \'option\' value must be set in other, even if 0.');
     }
 }
 /**
  * Custom validation.
  *
  * @throws \coding_exception
  * @return void
  */
 protected function validate_data()
 {
     if (empty($this->other['sessionid'])) {
         throw new \coding_exception('The event mod_attendance\\event\\attendance_taken must specify sessionid.');
     }
     parent::validate_data();
 }
Esempio n. 26
0
 /**
  * Custom validation.
  *
  * @throws \coding_exception
  * @return void
  */
 protected function validate_data()
 {
     parent::validate_data();
     debugging('Event \\mod_choice\\event\\answer_updated should not be used ' . 'any more for triggering new events and can only be initiated during restore. ' . 'For new events please use \\mod_choice\\event\\answer_created ' . 'and  \\mod_choice\\event\\answer_deleted', DEBUG_DEVELOPER);
     if (!isset($this->other['choiceid'])) {
         throw new \coding_exception('The \'choiceid\' value must be set in other.');
     }
 }
 /**
  * Custom validation.
  *
  * @throws \coding_exception
  * @return void
  */
 protected function validate_data()
 {
     if (empty($this->other['info'])) {
         throw new \coding_exception('The event mod_attendance\\event\\session_updated must specify info.');
     }
     if (empty($this->other['sessionid'])) {
         throw new \coding_exception('The event mod_attendance\\event\\session_updated must specify sessionid.');
     }
     if (empty($this->other['action'])) {
         throw new \coding_exception('The event mod_attendance\\event\\session_updated must specify action.');
     }
     parent::validate_data();
 }
 /**
  * Custom validation.
  *
  * @throws \coding_exception
  * @return void
  */
 protected function validate_data()
 {
     parent::validate_data();
     if (!isset($this->other['searchterm'])) {
         throw new \coding_exception('The \'searchterm\' value must be set in other.');
     }
     if ($this->contextlevel != CONTEXT_COURSE) {
         throw new \coding_exception('Context level must be CONTEXT_COURSE.');
     }
 }
Esempio n. 29
0
 /**
  * Custom validations.
  *
  * @throws  \coding_exception  when validation fails.
  *
  * @return  void
  *
  * @since   1.0.0
  */
 protected function validate_data()
 {
     parent::validate_data();
     if (!isset($this->other['info'])) {
         throw new \coding_exception("The 'info' value must be set in other.");
     }
     if (!isset($this->other['cue'])) {
         throw new \coding_exception("The 'cue' value must be set in other.");
     }
     if (!isset($this->other['guess'])) {
         throw new \coding_exception("The 'guess' value must be set in other.");
     }
 }
Esempio n. 30
0
 /**
  * Custom validation.
  *
  * @throws \coding_exception
  * @return void
  */
 protected function validate_data()
 {
     parent::validate_data();
     if (!isset($this->relateduserid)) {
         throw new \coding_exception('The \'relateduserid\' must be set.');
     }
     if (!array_key_exists('submitterid', $this->other)) {
         throw new \coding_exception('The \'submitterid\' value must be set in other.');
     }
 }