summaryrefslogtreecommitdiff
path: root/framework/Web/UI/WebControls/TRangeValidator.php
diff options
context:
space:
mode:
authorwei <>2006-04-25 00:27:44 +0000
committerwei <>2006-04-25 00:27:44 +0000
commitfd019bf034ef4dbedfc305c77fed0dbd83a732c4 (patch)
treeafc59b99826308924725074ee34e4f541a1d399a /framework/Web/UI/WebControls/TRangeValidator.php
parent72a75d7d0f5681df3fd98c684ab6f22baefb365c (diff)
Add TListControlValidator. Update client-side validators, datepicker.js, colorpicker.js. Merge to 3.0 if necessary.
Diffstat (limited to 'framework/Web/UI/WebControls/TRangeValidator.php')
-rw-r--r--framework/Web/UI/WebControls/TRangeValidator.php41
1 files changed, 3 insertions, 38 deletions
diff --git a/framework/Web/UI/WebControls/TRangeValidator.php b/framework/Web/UI/WebControls/TRangeValidator.php
index 56cc16bc..b7387522 100644
--- a/framework/Web/UI/WebControls/TRangeValidator.php
+++ b/framework/Web/UI/WebControls/TRangeValidator.php
@@ -29,7 +29,6 @@ Prado::using('System.Web.UI.WebControls.TBaseValidator');
* operation is performed. The following value types are supported:
* - <b>Integer</b> A 32-bit signed integer data type.
* - <b>Float</b> A double-precision floating point number data type.
- * - <b>Currency</b> A decimal data type that can contain currency symbols.
* - <b>Date</b> A date data type. The date format can be specified by
* setting {@link setDateFormat DateFormat} property, which must be recognizable
* by {@link TSimpleDateFormatter}. If the property is not set,
@@ -87,13 +86,13 @@ class TRangeValidator extends TBaseValidator
}
/**
- * Sets the data type (Integer, Float, Currency, Date, String) that the values
- * being compared are converted to before the comparison is made.
+ * 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
*/
public function setDataType($value)
{
- $this->setViewState('DataType',TPropertyValue::ensureEnum($value,'Integer','Float','Date','Currency','String'),'String');
+ $this->setViewState('DataType',TPropertyValue::ensureEnum($value,'Integer','Float','Date','String'),'String');
}
/**
@@ -131,8 +130,6 @@ class TRangeValidator extends TBaseValidator
return $this->isValidInteger($value);
case 'Float':
return $this->isValidFloat($value);
- case 'Currency':
- return $this->isValidCurrency($value);
case 'Date':
return $this->isValidDate($value);
default:
@@ -179,38 +176,6 @@ class TRangeValidator extends TBaseValidator
}
/**
- * Determine if the value is a valid currency range,
- * @param string currency value
- * @return boolean true if within range.
- */
- protected function isValidCurrency($value)
- {
- $minValue=$this->getMinValue();
- $maxValue=$this->getMaxValue();
-
- $valid=true;
- $value = $this->getCurrencyValue($value);
- if($minValue!=='')
- $valid=$valid && ($value>= $this->getCurrencyValue($minValue));
- if($maxValue!=='')
- $valid=$valid && ($value<= $this->getCurrencyValue($minValue));
- return $valid;
- }
-
- /**
- * Parse the string into a currency value, return the float value of the currency.
- * @param string currency as string
- * @return float currency value.
- */
- protected function getCurrencyValue($value)
- {
- if(preg_match('/[-+]?([0-9]*\.)?[0-9]+([eE][-+]?[0-9]+)?/',$value,$matches))
- return floatval($matches[0]);
- else
- return 0.0;
- }
-
- /**
* Determine if the date is within the specified range.
* Uses pradoParseDate and strtotime to get the date from string.
* @param string date as string to validate