コード例 #1
0
ファイル: badge_archived.php プロジェクト: evltuma/moodle
 /**
  * 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.');
     }
 }
コード例 #2
0
 /**
  * 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
ファイル: badge_viewed.php プロジェクト: janeklb/moodle
 /**
  * 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.');
     }
 }
コード例 #7
0
 /**
  * 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.');
     }
 }
コード例 #8
0
 /**
  * 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.');
     }
 }
コード例 #9
0
 /**
  * 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
ファイル: tag_removed.php プロジェクト: alanaipe2015/moodle
 /**
  * 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
ファイル: user_deleted.php プロジェクト: rwijaya/moodle
    /**
     * 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.');
            }
        }
    }
コード例 #12
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;
     }
 }
コード例 #13
0
 /**
  * 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
ファイル: message_deleted.php プロジェクト: uniedpa/moodle
 /**
  * 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.');
     }
 }
コード例 #16
0
 /**
  * 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.');
     }
 }
コード例 #19
0
 /**
  * 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.');
     }
 }
コード例 #20
0
 /**
  * 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.');
     }
 }
コード例 #21
0
 /**
  * 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();
 }
コード例 #24
0
 /**
  * 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
ファイル: group_member_added.php プロジェクト: evltuma/moodle
 /**
  * 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.');
     }
 }
コード例 #28
0
 /**
  * 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.');
     }
 }
コード例 #29
0
 /**
  * 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
ファイル: course_completed.php プロジェクト: evltuma/moodle
 /**
  * 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.');
     }
 }