/**
  * 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('value' => array('notEmpty' => array('rule' => array('notEmpty'), 'message' => __d('net_commons', 'Invalid request.'))), 'weight' => array('naturalNumber' => array('rule' => array('naturalNumber', true), 'message' => __d('net_commons', 'Invalid request.')))));
     return parent::beforeValidate($options);
 }
 /**
  * Constructor. Binds the model's database table to the object.
  *
  * @param bool|int|string|array $id Set this ID for this model on startup,
  * can also be an array of options, see above.
  * @param string $table Name of database table to use.
  * @param string $ds DataSource connection name.
  * @see Model::__construct()
  * @SuppressWarnings(PHPMD.BooleanArgumentFlag)
  */
 public function __construct($id = false, $table = null, $ds = null)
 {
     parent::__construct($id, $table, $ds);
     $now = date('Y-m-d H:i:s');
     $this->virtualFields['content_status'] = 'CASE WHEN ' . $this->alias . '.status = \'' . CircularNoticeComponent::CIRCULAR_NOTICE_CONTENT_STATUS_IN_DRAFT . '\' THEN ' . '\'' . CircularNoticeComponent::CIRCULAR_NOTICE_CONTENT_STATUS_IN_DRAFT . '\' ' . 'WHEN ' . $this->alias . '.status = \'' . CircularNoticeComponent::CIRCULAR_NOTICE_CONTENT_STATUS_PUBLISHED . '\' THEN ' . 'CASE WHEN ' . $this->alias . '.publish_start > \'' . $now . '\' THEN ' . '\'' . CircularNoticeComponent::CIRCULAR_NOTICE_CONTENT_STATUS_RESERVED . '\' ' . 'ELSE ' . 'CASE WHEN ' . $this->alias . '.publish_end < \'' . $now . '\' THEN ' . '\'' . CircularNoticeComponent::CIRCULAR_NOTICE_CONTENT_STATUS_CLOSED . '\' ' . 'WHEN ' . $this->alias . '.use_reply_deadline = 1 AND ' . $this->alias . '.reply_deadline < \'' . $now . '\' THEN ' . '\'' . CircularNoticeComponent::CIRCULAR_NOTICE_CONTENT_STATUS_FIXED . '\' ' . 'ELSE ' . '\'' . CircularNoticeComponent::CIRCULAR_NOTICE_CONTENT_STATUS_OPEN . '\' ' . 'END ' . 'END ' . 'END';
 }
 /**
  * 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())
 {
     $displayNumbers = array_keys(self::getDisplayNumberOptions());
     $this->validate = Hash::merge($this->validate, array('frame_key' => array('notEmpty' => array('rule' => array('notEmpty'), 'message' => __d('net_commons', 'Invalid request.'), 'required' => true)), 'display_number' => array('inList' => array('rule' => array('inList', $displayNumbers), 'message' => __d('net_commons', 'Invalid request.')))));
     return parent::beforeValidate($options);
 }
 /**
  * Constructor. Binds the model's database table to the object.
  *
  * @param bool|int|string|array $id Set this ID for this model on startup,
  * can also be an array of options, see above.
  * @param string $table Name of database table to use.
  * @param string $ds DataSource connection name.
  * @see Model::__construct()
  * @SuppressWarnings(PHPMD.BooleanArgumentFlag)
  */
 public function __construct($id = false, $table = null, $ds = null)
 {
     parent::__construct($id, $table, $ds);
     $this->virtualFields['user_status'] = 'CASE WHEN ' . $this->alias . '.read_flag = 0 THEN ' . '\'' . CircularNoticeComponent::CIRCULAR_NOTICE_CONTENT_STATUS_UNREAD . '\' ' . 'WHEN ' . $this->alias . '.read_flag = 1 THEN ' . 'CASE WHEN ' . $this->alias . '.reply_flag = 0 THEN ' . '\'' . CircularNoticeComponent::CIRCULAR_NOTICE_CONTENT_STATUS_READ_YET . '\' ' . 'WHEN ' . $this->alias . '.reply_flag = 1 THEN ' . '\'' . CircularNoticeComponent::CIRCULAR_NOTICE_CONTENT_STATUS_REPLIED . '\' ' . 'ELSE ' . 'NULL ' . 'END ' . 'ELSE ' . 'NULL ' . 'END';
 }
 /**
  * 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('frame_key' => array('notBlank' => array('rule' => array('notBlank'), 'message' => __d('net_commons', 'Invalid request.'), 'required' => true)), 'display_number' => array('number' => array('rule' => array('notBlank'), 'message' => __d('net_commons', 'Invalid request.'), 'required' => true))));
     return parent::beforeValidate($options);
 }
 /**
  * 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());
     return parent::beforeValidate($options);
 }