diff options
| author | ccwn <tzur@ccwn.org> | 2012-04-24 18:49:57 +0200 |
|---|---|---|
| committer | ccwn <tzur@ccwn.org> | 2012-04-24 18:49:57 +0200 |
| commit | c98745edd2c7b2f48bc3493c4dd9a061376c4720 (patch) | |
| tree | ca1b559f220ec28c3f263d02a8b832613493471f /protected/components/Html.php | |
| parent | 314328f527e8cae759d496f528a1472d7970c137 (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.php | 21 |
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 |
