From 56fee292c37e162c03fab9eeadd6a8b9ab85c251 Mon Sep 17 00:00:00 2001 From: xue <> Date: Mon, 4 Sep 2006 19:15:47 +0000 Subject: merge from 3.0 branch till 1387 --- framework/Web/UI/WebControls/TDataTypeValidator.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'framework/Web/UI/WebControls/TDataTypeValidator.php') diff --git a/framework/Web/UI/WebControls/TDataTypeValidator.php b/framework/Web/UI/WebControls/TDataTypeValidator.php index ec39e8a3..e6cdb30e 100644 --- a/framework/Web/UI/WebControls/TDataTypeValidator.php +++ b/framework/Web/UI/WebControls/TDataTypeValidator.php @@ -47,7 +47,7 @@ class TDataTypeValidator extends TBaseValidator } /** - * @return string the data type that the values being compared are converted to before the comparison is made. Defaults to String. + * @return TValidationDataType the data type that the values being compared are converted to before the comparison is made. Defaults to TValidationDataType::String. */ public function getDataType() { @@ -55,13 +55,12 @@ class TDataTypeValidator extends TBaseValidator } /** - * Sets the data type (Integer, Float, Date, String) that the values being - * compared are converted to before the comparison is made. - * @param string the data type + * Sets the data type that the values being compared are converted to before the comparison is made. + * @param TValidationDataType the data type */ public function setDataType($value) { - $this->setViewState('DataType',TPropertyValue::ensureEnum($value,'Integer','Float','Date','String'),'String'); + $this->setViewState('DataType',TPropertyValue::ensureEnum($value,'TValidationDataType'),TValidationDataType::String); } /** @@ -94,11 +93,11 @@ class TDataTypeValidator extends TBaseValidator switch($this->getDataType()) { - case 'Integer': + case TValidationDataType::Integer: return preg_match('/^[-+]?[0-9]+$/',trim($value)); - case 'Float': + case TValidationDataType::Float: return preg_match('/^[-+]?([0-9]*\.)?[0-9]+([eE][-+]?[0-9]+)?$/',trim($value)); - case 'Date': + case TValidationDataType::Date: $dateFormat = $this->getDateFormat(); if(strlen($dateFormat)) { -- cgit v1.2.3