summaryrefslogtreecommitdiff
path: root/protected/components/Html.php
diff options
context:
space:
mode:
authorPatrick Seeger <pseeger@ccwn.org>2012-05-20 16:58:26 +0200
committerPatrick Seeger <pseeger@ccwn.org>2012-05-20 16:58:26 +0200
commit4f959ffc80e64dc9ee8383826a546723d97305d9 (patch)
tree3a0704c0e3a9f44746739ccffa0d64acc5ab172d /protected/components/Html.php
parentacec2b5dc35302147f9a9c73d837dce2f3f9958e (diff)
parent9aad228e1af661b9b39df83700d27e71697dc66f (diff)
Merge branch 'master' of ssh://proxy.ccwn.org:9044/home/ccwn/git-repos/admin.astaf.de
Diffstat (limited to 'protected/components/Html.php')
-rw-r--r--protected/components/Html.php20
1 files changed, 18 insertions, 2 deletions
diff --git a/protected/components/Html.php b/protected/components/Html.php
index 6c7df3c..5d1e3e5 100644
--- a/protected/components/Html.php
+++ b/protected/components/Html.php
@@ -15,8 +15,12 @@ class Html extends CHtml {
/**
* Makes the given URL relative to the /js directory
*/
- public static function jsUrl($url) {
- return Yii::app()->baseUrl.'/js/'.$url;
+ public static function jsUrl($filename) {
+ return Yii::app()->baseUrl.'/js/'.$filename;
+ }
+
+ public static function registerJavascript($filename) {
+ Yii::app()->getClientScript()->registerScriptFile(self::jsUrl($filename));
}
public static function enumItem($model, $attribute) {
@@ -34,5 +38,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