Exemple #1
0
 /**
  * 获取“验证环境”验证规则
  * @param mixed $value
  * @return array
  */
 public function getWhenRule($value)
 {
     $enum = DataValidators::getWhenEnum();
     return array('InArray' => new validator\InArrayValidator($value, array_keys($enum), sprintf(Lang::_('SRV_FILTER_BUILDER_FIELD_VALIDATORS_WHEN_INARRAY'), implode(', ', $enum))));
 }
Exemple #2
0
 /**
  * 获取验证时对比值类型
  * @param string $when
  * @return string
  */
 public function getWhenLangByWhen($when)
 {
     $enum = DataValidators::getWhenEnum();
     return isset($enum[$when]) ? $enum[$when] : '';
 }
Exemple #3
0
 /**
  * (non-PHPdoc)
  * @see \library\BaseModel::getElementsRender()
  */
 public function getElementsRender()
 {
     $output = array('validator_id' => array('__tid__' => 'main', 'type' => 'hidden', 'label' => Text::_('MOD_BUILDER_BUILDER_FIELD_VALIDATORS_VALIDATOR_ID_LABEL'), 'hint' => Text::_('MOD_BUILDER_BUILDER_FIELD_VALIDATORS_VALIDATOR_ID_HINT')), 'validator_name' => array('__tid__' => 'main', 'type' => 'select', 'label' => Text::_('MOD_BUILDER_BUILDER_FIELD_VALIDATORS_VALIDATOR_NAME_LABEL'), 'hint' => Text::_('MOD_BUILDER_BUILDER_FIELD_VALIDATORS_VALIDATOR_NAME_HINT'), 'options' => DataValidators::getValidatorNameEnum(), 'value' => 'Integer'), 'field_id' => array('__tid__' => 'main', 'type' => 'hidden', 'label' => Text::_('MOD_BUILDER_BUILDER_FIELD_VALIDATORS_FIELD_ID_LABEL'), 'hint' => Text::_('MOD_BUILDER_BUILDER_FIELD_VALIDATORS_FIELD_ID_HINT')), 'field_name' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_BUILDER_BUILDER_FIELDS_FIELD_NAME_LABEL'), 'readonly' => true), 'options' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_BUILDER_BUILDER_FIELD_VALIDATORS_OPTIONS_LABEL'), 'hint' => Text::_('MOD_BUILDER_BUILDER_FIELD_VALIDATORS_OPTIONS_HINT')), 'option_category' => array('__tid__' => 'main', 'type' => 'radio', 'label' => Text::_('MOD_BUILDER_BUILDER_FIELD_VALIDATORS_OPTION_CATEGORY_LABEL'), 'hint' => Text::_('MOD_BUILDER_BUILDER_FIELD_VALIDATORS_OPTION_CATEGORY_HINT'), 'options' => DataValidators::getOptionCategoryEnum(), 'value' => DataValidators::OPTION_CATEGORY_INTEGER), 'message' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_BUILDER_BUILDER_FIELD_VALIDATORS_MESSAGE_LABEL'), 'hint' => Text::_('MOD_BUILDER_BUILDER_FIELD_VALIDATORS_MESSAGE_HINT'), 'value' => ''), 'sort' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_BUILDER_BUILDER_FIELD_VALIDATORS_SORT_LABEL'), 'hint' => Text::_('MOD_BUILDER_BUILDER_FIELD_VALIDATORS_SORT_HINT'), 'required' => true), 'when' => array('__tid__' => 'main', 'type' => 'radio', 'label' => Text::_('MOD_BUILDER_BUILDER_FIELD_VALIDATORS_WHEN_LABEL'), 'hint' => Text::_('MOD_BUILDER_BUILDER_FIELD_VALIDATORS_WHEN_HINT'), 'options' => DataValidators::getWhenEnum(), 'value' => DataValidators::WHEN_ALL));
     return $output;
 }