예제 #1
0
 /**
  * Custom validations.
  *
  * @throws \coding_exception
  * @return void
  */
 protected function validate_data()
 {
     parent::validate_data();
     if (!isset($this->objectid)) {
         throw new \coding_exception('The \'objectid\' must be set.');
     }
 }
 /**
  * Custom validation.
  *
  * @throws \coding_exception
  * @return void
  */
 protected function validate_data()
 {
     parent::validate_data();
     if ($this->contextlevel != CONTEXT_COURSE) {
         throw new \coding_exception('Context level must be CONTEXT_COURSE.');
     }
 }
예제 #3
0
 /**
  * Custom validations.
  *
  * @throws \coding_exception when validation fails.
  * @return void
  */
 protected function validate_data()
 {
     parent::validate_data();
     if (!isset($this->other['url'])) {
         throw new \coding_exception('The \'url\' value must be set in other.');
     }
 }
예제 #4
0
 /**
  * Custom validation.
  *
  * @throws \coding_exception on error.
  * @return void
  */
 protected function validate_data()
 {
     parent::validate_data();
     if ($this->contextlevel != CONTEXT_MODULE) {
         throw new \coding_exception('Context passed must be module context.');
     }
 }
예제 #5
0
 /**
  * Custom validation.
  *
  * @throws \coding_exception
  */
 protected function validate_data()
 {
     parent::validate_data();
     if (!isset($this->relateduserid)) {
         throw new \coding_exception('The \'relateduserid\' must be set.');
     }
     if (!isset($this->other['info'])) {
         throw new \coding_exception('The \'info\' value must be set in other.');
     }
 }
예제 #6
0
 /**
  * Custom validations.
  *
  * @throws \coding_exception
  * @return void
  */
 protected function validate_data()
 {
     parent::validate_data();
     if (!isset($this->other['badgeid'])) {
         throw new \coding_exception('The \'badgeid\' must be set in other.');
     }
     if (!isset($this->other['badgehash'])) {
         throw new \coding_exception('The \'badgehash\' must be set in other.');
     }
 }
 /**
  * Custom validation.
  *
  * @throws \coding_exception
  * @return void
  */
 protected function validate_data()
 {
     parent::validate_data();
     if (!isset($this->other['submissionid'])) {
         throw new \coding_exception('The \'submissionid\' value must be set in other.');
     }
     if (!isset($this->other['submissionattempt'])) {
         throw new \coding_exception('The \'submissionattempt\' value must be set in other.');
     }
     if (!isset($this->other['submissionstatus'])) {
         throw new \coding_exception('The \'submissionstatus\' value must be set in other.');
     }
 }
 /**
  * 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('The \'repeatid\' value must be set in other.');
     }
     if (empty($this->other['name'])) {
         throw new \coding_exception('The \'name\' value must be set in other.');
     }
     if (!isset($this->other['timestart'])) {
         throw new \coding_exception('The \'timestart\' value must be set in other.');
     }
 }
 /**
  * Validation that should be shared among child classes.
  *
  * @throws \coding_exception when validation fails.
  * @return void
  */
 protected function validate_data()
 {
     parent::validate_data();
     if ($this->contextlevel != CONTEXT_MODULE) {
         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('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('The \'content\' value must be set in other and must be a string.');
             }
         }
     }
 }
예제 #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['tagid'])) {
         throw new \coding_exception('The \'tagid\' value must be set in other.');
     }
     if (!isset($this->other['itemid'])) {
         throw new \coding_exception('The \'itemid\' value must be set in other.');
     }
     if (!isset($this->other['itemtype'])) {
         throw new \coding_exception('The \'itemtype\' value must be set in other.');
     }
     if (!isset($this->other['tagname'])) {
         throw new \coding_exception('The \'tagname\' value must be set in other.');
     }
     if (!isset($this->other['tagrawname'])) {
         throw new \coding_exception('The \'tagrawname\' value must be set in other.');
     }
 }
예제 #11
0
    /**
     * Custom validation.
     *
     * @throws \coding_exception
     * @return void
     */
    protected function validate_data() {
        global $CFG;

        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['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['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.');
            }
        }
    }
 /**
  * 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 validations.
  *
  * @throws \coding_exception
  * @return void
  */
 protected function validate_data()
 {
     parent::validate_data();
     if (!isset($this->context)) {
         throw new \coding_exception('The \'context\' must be set.');
     }
     if (!isset($this->objectid)) {
         throw new \coding_exception('The \'objectid\' must be set.');
     }
     if (!isset($this->other['courseid'])) {
         throw new \coding_exception('The \'courseid\' value must be set in other.');
     }
 }
예제 #14
0
 /**
  * Custom validation.
  *
  * @throws \coding_exception
  * @return void
  */
 protected function validate_data()
 {
     if (self::$preventcreatecall) {
         throw new \coding_exception('cannot call all_submissions_downloaded::create() directly, use all_submissions_downloaded::create_from_assign() instead.');
     }
     parent::validate_data();
 }
예제 #15
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['messagetable'])) {
         throw new \coding_exception('The \'messagetable\' value must be set in other.');
     }
     if (!isset($this->other['messageid'])) {
         throw new \coding_exception('The \'messageid\' value must be set in other.');
     }
     if (!isset($this->other['useridfrom'])) {
         throw new \coding_exception('The \'useridfrom\' value must be set in other.');
     }
     if (!isset($this->other['useridto'])) {
         throw new \coding_exception('The \'useridto\' value must be set in other.');
     }
 }
 /**
  * custom validations
  *
  * 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('The \'modulename\' value must be set in other.');
     }
     if (!isset($this->other['instanceid'])) {
         throw new \coding_exception('The \'instanceid\' value must be set in other.');
     }
     if (!isset($this->other['name'])) {
         throw new \coding_exception('The \'name\' value must be set in other.');
     }
 }
예제 #17
0
 /**
  * Custom validation.
  *
  * @throws \coding_exception
  * @return void
  */
 protected function validate_data()
 {
     if (self::$preventcreatecall) {
         throw new \coding_exception('cannot call statement_accepted::create() directly, use statement_accepted::create_from_submission() instead.');
     }
     parent::validate_data();
 }
 /**
  * Custom validation.
  *
  * @throws \coding_exception
  */
 protected function validate_data()
 {
     if (self::$preventcreatecall) {
         throw new \coding_exception('cannot call reveal_identities_confirmation_page_viewed::create() directly, use reveal_identities_confirmation_page_viewed::create_from_grade() instead.');
     }
     parent::validate_data();
     if (!isset($this->other['seplid'])) {
         throw new \coding_exception('The \'seplid\' value must be set in other.');
     }
 }
 /**
  * Custom validation.
  *
  * @throws \coding_exception
  * @return void
  */
 protected function validate_data()
 {
     parent::validate_data();
     if ($this->contextlevel != CONTEXT_COURSE) {
         throw new \coding_exception('Context passed must be course context.');
     }
     if (empty($this->relateduserid)) {
         throw new \coding_exception('The \'relateduserid\' must be set.');
     }
     // Make sure this class is never used without proper object details.
     if (!isset($this->other['mode'])) {
         throw new \coding_exception('The \'mode\' value must be set in other.');
     }
 }
 /**
  * Custom validation.
  *
  * @throws \coding_exception
  */
 protected function validate_data()
 {
     if (self::$preventcreatecall) {
         throw new \coding_exception('cannot call marker_updated::create() directly, use marker_updated::create_from_marker() instead.');
     }
     parent::validate_data();
     if (!isset($this->relateduserid)) {
         throw new \coding_exception('The \'relateduserid\' must be set.');
     }
     if (!isset($this->other['markerid'])) {
         throw new \coding_exception('The \'markerid\' value must be set in other.');
     }
 }
 /**
  * Custom validation.
  *
  * @throws \coding_exception
  * @return void
  */
 protected function validate_data()
 {
     if (self::$preventcreatecall) {
         throw new \coding_exception('cannot call batch_set_marker_allocation_viewed::create() directly, use batch_set_marker_allocation_viewed::create_from_assign() instead.');
     }
     parent::validate_data();
     if (!isset($this->other['assignid'])) {
         throw new \coding_exception('The \'assignid\' value must be set in other.');
     }
 }
예제 #22
0
 /**
  * Custom validations.
  *
  * @throws \coding_exception
  * @return void
  */
 protected function validate_data()
 {
     parent::validate_data();
     if (!isset($this->other['q'])) {
         throw new \coding_exception('\'other\'[\'q\'] must be set.');
     }
     if (!isset($this->other['page'])) {
         throw new \coding_exception('\'other\'[\'page\'] must be set.');
     }
 }
예제 #23
0
 /**
  * Custom validation.
  *
  * To be overwritten by child classes.
  */
 protected function validate_data()
 {
     parent::validate_data();
 }
 /**
  * Custom validation.
  *
  * It is recommended to set the properties:
  * - $other['tokenid']
  * - $other['username']
  *
  * However they are not mandatory as they are not always known.
  *
  * Please note that the token CANNOT be specified, it is considered
  * as a password and should never be displayed.
  *
  * @throws \coding_exception
  * @return void
  */
 protected function validate_data()
 {
     parent::validate_data();
     if (!isset($this->other['reason'])) {
         throw new \coding_exception('The \'reason\' value must be set in other.');
     } else {
         if (!isset($this->other['method'])) {
             throw new \coding_exception('The \'method\' value must be set in other.');
         } else {
             if (isset($this->other['token'])) {
                 throw new \coding_exception('The \'token\' value must not be set in other.');
             }
         }
     }
 }
예제 #25
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['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.');
     }
 }
예제 #26
0
 /**
  * Custom validation.
  *
  * @throws \coding_exception
  * @return void
  */
 protected function validate_data() {
     parent::validate_data();
     if (!isset($this->other['userenrolment'])) {
         throw new \coding_exception('User enrolment must be set in $other.');
     }
     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.');
     }
 }
예제 #27
0
 /**
  * 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;
     }
     if (!isset($this->other['username'])) {
         throw new \coding_exception('The \'username\' value must be set in other.');
     }
     if (!isset($this->other['email'])) {
         throw new \coding_exception('The \'email\' value must be set in other.');
     }
     if (!isset($this->other['idnumber'])) {
         throw new \coding_exception('The \'idnumber\' value must be set in other.');
     }
     if (!isset($this->other['picture'])) {
         throw new \coding_exception('The \'picture\' value must be set in other.');
     }
     if (!isset($this->other['mnethostid'])) {
         throw new \coding_exception('The \'mnethostid\' value must be set in other.');
     }
 }
 /**
  * Custom validation.
  *
  * @throws \coding_exception
  */
 protected function validate_data()
 {
     if (self::$preventcreatecall) {
         throw new \coding_exception('cannot call submission_locked::create() directly, use submission_locked::create_from_user() instead.');
     }
     parent::validate_data();
     if (!isset($this->relateduserid)) {
         throw new \coding_exception('The \'relateduserid\' must be set.');
     }
 }
 /**
  * Custom validation.
  *
  * @throws \coding_exception
  * @return void
  */
 protected function validate_data()
 {
     if (self::$preventcreatecall) {
         throw new \coding_exception('cannot call identities_revealed::create() directly, use identities_revealed::create_from_sepl() instead.');
     }
     parent::validate_data();
 }
예제 #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.');
     }
     // Check that the 'relateduserid' value is set in other as well. This is because we introduced this in 2.6
     // and some observers may be relying on this value to be present.
     if (!isset($this->other['relateduserid'])) {
         throw new \coding_exception('The \'relateduserid\' value must be set in other.');
     }
 }