summaryrefslogtreecommitdiff
path: root/protected/components
diff options
context:
space:
mode:
Diffstat (limited to 'protected/components')
-rw-r--r--protected/components/DateCompareValidator.php7
-rw-r--r--protected/components/Format.php6
-rw-r--r--protected/components/Html.php12
3 files changed, 21 insertions, 4 deletions
diff --git a/protected/components/DateCompareValidator.php b/protected/components/DateCompareValidator.php
index c013382..efa6763 100644
--- a/protected/components/DateCompareValidator.php
+++ b/protected/components/DateCompareValidator.php
@@ -40,9 +40,10 @@ class DateCompareValidator extends CValidator {
return;
}
- $start = CDateTimeParser::parse($object->$attribute, $this->format);
-
- $end = CDateTimeParser::parse($this->compareValue, $this->format);
+ $start = $object->$attribute;
+ Yii::trace('Input value: '.$start. ' -> output timestamp: '.$object->$attribute, 'ccwn.astaf.format');
+ $end = $this->compareValue;
+ Yii::trace('Input value: '.$end. ' -> output timestamp: '.$this->compareValue, 'ccwn.astaf.format');
//a little php trick - safe than eval and easier than a big switch statement
diff --git a/protected/components/Format.php b/protected/components/Format.php
index 1be259f..a4802e2 100644
--- a/protected/components/Format.php
+++ b/protected/components/Format.php
@@ -8,8 +8,12 @@ class Format {
return Yii::app()->locale->numberFormatter->formatDecimal($value).' '.$einheit;
}
- public static function decimal($value) {
+ public static function decimal($value, $pattern = null) {
+ if ($pattern !== null) {
return Yii::app()->locale->numberFormatter->formatDecimal($value);
+ } else {
+ return Yii::app()->locale->numberFormatter->format($pattern, $value);
+ }
}
public static function percentage($value) {
diff --git a/protected/components/Html.php b/protected/components/Html.php
index 6c7df3c..38128d5 100644
--- a/protected/components/Html.php
+++ b/protected/components/Html.php
@@ -34,5 +34,17 @@ class Html extends CHtml {
public static function enumDropDownList($model, $attribute, $htmlOptions = array()) {
return CHtml::activeDropDownList($model, $attribute, Html::enumItem($model, $attribute), $htmlOptions);
}
+
+ public static function einheitenDropDownList($model, $attribute, $values, $htmlOptions = array()) {
+ $tmpEinheiten = preg_split('/,/', $values);
+ $einheiten = array();
+ foreach ($tmpEinheiten as $einheit) {
+ $einheit = trim($einheit);
+ $einheiten[$einheit] = $einheit;
+ }
+ self::resolveNameID($model, $attribute, $htmlOptions);
+ $selectedValue = self::resolveValue($model, $attribute);
+ return CHtml::dropDownList($htmlOptions['name'], $selectedValue, $einheiten);
+ }
}
?> \ No newline at end of file