summaryrefslogtreecommitdiff
path: root/protected/components/Html.php
diff options
context:
space:
mode:
authorccwn <tzur@ccwn.org>2012-04-24 18:49:57 +0200
committerccwn <tzur@ccwn.org>2012-04-24 18:49:57 +0200
commitc98745edd2c7b2f48bc3493c4dd9a061376c4720 (patch)
treeca1b559f220ec28c3f263d02a8b832613493471f /protected/components/Html.php
parent314328f527e8cae759d496f528a1472d7970c137 (diff)
- Database setup
- Database schema - Database dev data - config for new database setup - Update in AngebotVerein - Update in Speis&Trank - Update in Verein - Update in Kategorie
Diffstat (limited to 'protected/components/Html.php')
-rw-r--r--protected/components/Html.php21
1 files changed, 19 insertions, 2 deletions
diff --git a/protected/components/Html.php b/protected/components/Html.php
index c4a246c..08fc6d9 100644
--- a/protected/components/Html.php
+++ b/protected/components/Html.php
@@ -1,6 +1,5 @@
<?php
-class Html extends CHtml
-{
+class Html extends CHtml {
/**
* Makes the given URL relative to the /image directory
*/
@@ -19,5 +18,23 @@ class Html extends CHtml
public static function jsUrl($url) {
return Yii::app()->baseUrl.'/js/'.$url;
}
+
+ public static function enumItem($model, $attribute) {
+ $attr = $attribute;
+ self::resolveName($model, $attr);
+ preg_match('/\((.*)\)/', $model->tableSchema->columns[$attr]->dbType, $matches);
+ foreach (explode(',', $matches[1]) as $value) {
+ $value = str_replace("'", null, $value);
+ $values[$value] = Yii::t('enumItem', $value);
+ }
+
+ return $values;
+ }
+
+ public static function enumDropDownList($model, $attribute, $htmlOptions = array()) {
+ return CHtml::activeDropDownList($model, $attribute, Html::enumItem($model, $attribute), $htmlOptions);
+ }
+
+
}
?> \ No newline at end of file