Exemplo n.º 1
0
 /**
  * beforeValidate
  *
  * @param array $options Options passed from Model::save().
  * @return bool True if validate operation should continue, false to abort
  * @link http://book.cakephp.org/2.0/ja/models/callback-methods.html#beforevalidate
  * @see Model::save()
  */
 public function beforeValidate($options = array())
 {
     if (!parent::beforeValidate($options)) {
         return false;
     }
     if (isset($this->data['BlocksLanguage']['name'])) {
         $this->loadModels(array('BlocksLanguage' => 'Blocks.BlocksLanguage'));
         $this->BlocksLanguage->validate = array('name' => array('notBlank' => array('rule' => array('notBlank'), 'message' => sprintf(__d('net_commons', 'Please input %s.'), __d('videos', 'Channel name')), 'required' => true)));
         $this->BlocksLanguage->set($this->data['BlocksLanguage']);
         if (!$this->BlocksLanguage->validates()) {
             $this->validationErrors = Hash::merge($this->validationErrors, $this->BlocksLanguage->validationErrors);
             return false;
         }
     }
 }
Exemplo n.º 2
0
 /**
  * Called during validation operations, before validation. Please note that custom
  * validation rules can be defined in $validate.
  *
  * @param array $options Options passed from Model::save().
  * @return bool True if validate operation should continue, false to abort
  * @link http://book.cakephp.org/2.0/ja/models/callback-methods.html#beforevalidate
  * @see Model::save()
  */
 public function beforeValidate($options = array())
 {
     /** @see VideoValidationBehavior::setSettingVideo() */
     $this->setSettingVideo(VideoValidationBehavior::IS_FFMPEG_ENABLE, $this->isFfmpegEnable());
     /** @see VideoValidationBehavior::rules() */
     $this->validate = $this->rules($options);
     return parent::beforeValidate($options);
 }
Exemplo n.º 3
0
 /**
  * Called during validation operations, before validation. Please note that custom
  * validation rules can be defined in $validate.
  *
  * @param array $options Options passed from Model::save().
  * @return bool True if validate operation should continue, false to abort
  * @link http://book.cakephp.org/2.0/ja/models/callback-methods.html#beforevalidate
  * @see Model::save()
  */
 public function beforeValidate($options = array())
 {
     $this->validate = Hash::merge($this->validate, array('frame_key' => array('notBlank' => array('rule' => array('notBlank'), 'message' => __d('net_commons', 'Invalid request.'), 'required' => true)), 'display_order' => array('notBlank' => array('rule' => array('notBlank'), 'message' => __d('net_commons', 'Invalid request.'), 'required' => true)), 'display_number' => array('numeric' => array('rule' => array('numeric'), 'message' => __d('net_commons', 'Invalid request.'), 'required' => true))));
     return parent::beforeValidate($options);
 }
Exemplo n.º 4
0
 /**
  * Called during validation operations, before validation. Please note that custom
  * validation rules can be defined in $validate.
  *
  * @param array $options Options passed from Model::save().
  * @return bool True if validate operation should continue, false to abort
  * @link http://book.cakephp.org/2.0/en/models/callback-methods.html#beforevalidate
  * @see Model::save()
  */
 public function beforeValidate($options = array())
 {
     $this->validate = Hash::merge($this->validate, array('block_key' => array('notEmpty' => array('rule' => array('notEmpty'), 'message' => __d('net_commons', 'Invalid request.'))), 'use_like' => array('boolean' => array('rule' => array('boolean'), 'message' => __d('net_commons', 'Invalid request.'))), 'use_unlike' => array('boolean' => array('rule' => array('boolean'), 'message' => __d('net_commons', 'Invalid request.'))), 'use_comment' => array('boolean' => array('rule' => array('boolean'), 'message' => __d('net_commons', 'Invalid request.'))), 'agree' => array('boolean' => array('rule' => array('boolean'), 'message' => __d('net_commons', 'Invalid request.'))), 'mail_notice' => array('boolean' => array('rule' => array('boolean'), 'message' => __d('net_commons', 'Invalid request.'))), 'auto_play' => array('boolean' => array('rule' => array('boolean'), 'message' => __d('net_commons', 'Invalid request.'))), 'comment_agree' => array('boolean' => array('rule' => array('boolean'), 'message' => __d('net_commons', 'Invalid request.'))), 'comment_agree_mail_notice' => array('boolean' => array('rule' => array('boolean'), 'message' => __d('net_commons', 'Invalid request.')))));
     return parent::beforeValidate($options);
 }
Exemplo n.º 5
0
 /**
  * Called during validation operations, before validation. Please note that custom
  * validation rules can be defined in $validate.
  *
  * @param array $options Options passed from Model::save().
  * @return bool True if validate operation should continue, false to abort
  * @link http://book.cakephp.org/2.0/en/models/callback-methods.html#beforevalidate
  * @see Model::save()
  */
 public function beforeValidate($options = array())
 {
     // サムネイル 任意 対応
     if (isset($this->data['Video'][self::THUMBNAIL_FIELD]) && isset($this->data['Video'][self::THUMBNAIL_FIELD]['size']) && $this->data['Video'][self::THUMBNAIL_FIELD]['size'] === 0) {
         unset($this->data['Video'][self::THUMBNAIL_FIELD]);
     }
     if (self::isFfmpegEnable()) {
         $this->validate = $this->rules();
     } else {
         $this->validate = $this->rulesFfmpegOff($options);
     }
     return parent::beforeValidate($options);
 }