summaryrefslogtreecommitdiff
path: root/framework/Web/UI/WebControls/TCompareValidator.php
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Web/UI/WebControls/TCompareValidator.php')
-rw-r--r--framework/Web/UI/WebControls/TCompareValidator.php35
1 files changed, 3 insertions, 32 deletions
diff --git a/framework/Web/UI/WebControls/TCompareValidator.php b/framework/Web/UI/WebControls/TCompareValidator.php
index 02eddfd4..eeebb946 100644
--- a/framework/Web/UI/WebControls/TCompareValidator.php
+++ b/framework/Web/UI/WebControls/TCompareValidator.php
@@ -104,7 +104,7 @@ class TCompareValidator extends TBaseValidator
}
/**
- * @return string the comparison operation to perform (Equal, NotEqual, GreaterThan, GreaterThanEqual, LessThan, LessThanEqual, DataTypeCheck). Defaults to Equal.
+ * @return string the comparison operation to perform (Equal, NotEqual, GreaterThan, GreaterThanEqual, LessThan, LessThanEqual). Defaults to Equal.
*/
public function getOperator()
{
@@ -112,12 +112,12 @@ class TCompareValidator extends TBaseValidator
}
/**
- * Sets the comparison operation to perform (Equal, NotEqual, GreaterThan, GreaterThanEqual, LessThan, LessThanEqual, DataTypeCheck)
+ * Sets the comparison operation to perform (Equal, NotEqual, GreaterThan, GreaterThanEqual, LessThan, LessThanEqual)
* @param string the comparison operation
*/
public function setOperator($value)
{
- $this->setViewState('Operator',TPropertyValue::ensureEnum($value,'Equal','NotEqual','GreaterThan','GreaterThanEqual','LessThan','LessThanEqual','DataTypeCheck'),'Equal');
+ $this->setViewState('Operator',TPropertyValue::ensureEnum($value,'Equal','NotEqual','GreaterThan','GreaterThanEqual','LessThan','LessThanEqual'),'Equal');
}
/**
@@ -149,9 +149,6 @@ class TCompareValidator extends TBaseValidator
if(($value=$this->getValidationValue($this->getValidationTarget()))==='')
return true;
- if($this->getOperator()==='DataTypeCheck')
- return $this->evaluateDataTypeCheck($value);
-
if(($controlToCompare=$this->getControlToCompare())!=='')
{
if(($control2=$this->findControl($controlToCompare))===null)
@@ -183,32 +180,6 @@ class TCompareValidator extends TBaseValidator
}
/**
- * Determine if the given value is of a particular type using RegExp.
- * @param string value to check
- * @return boolean true if value fits the type expression.
- */
- protected function evaluateDataTypeCheck($value)
- {
- switch($this->getValueType())
- {
- case 'Integer':
- return preg_match('/^[-+]?[0-9]+$/',trim($value));
- case 'Float':
- case 'Double':
- return preg_match('/^[-+]?([0-9]*\.)?[0-9]+([eE][-+]?[0-9]+)?$/',trim($value));
- case 'Currency':
- return preg_match('/[-+]?([0-9]*\.)?[0-9]+([eE][-+]?[0-9]+)?$/',trim($value));
- case 'Date':
- $dateFormat = $this->getDateFormat();
- if(strlen($dateFormat))
- return pradoParseDate($value, $dateFormat) !== null;
- else
- return strtotime($value) > 0;
- }
- return true;
- }
-
- /**
* Parse the pair of values into the appropriate value type.
* @param string value one
* @param string second value