]> wagnertech.de Git - timetracker.git/blobdiff - WEB-INF/lib/form/Combobox.class.php
Refactoring - renamed a couple of variables.
[timetracker.git] / WEB-INF / lib / form / Combobox.class.php
index 778379303a86443b3fc49c3d9b0a7755755efece..4d8df251cbe698ff54a09840ba394c7eaf5f62f1 100644 (file)
@@ -46,10 +46,10 @@ class Combobox extends FormElement {
     var $mDataKeys = array();
     var $cClassName    = "Combobox";
 
-       function Combobox($name,$value="")
+       function __construct($name,$value="")
        {
-               $this->mName                    = $name;
-               $this->mValue                   = $value;
+               $this->name = $name;
+               $this->value = $value;
        }
 
        function setMultiple($value)    { $this->mMultiple = $value; }
@@ -68,13 +68,13 @@ class Combobox extends FormElement {
        function toStringControl()      {
                if (!$this->isRenderable()) return "";
            
-           if ($this->mId=="") $this->mId = $this->mName;
+           if ($this->id=="") $this->id = $this->name;
            
                $html = "\n\t<select";
-               $html .= " name=\"$this->mName\" id=\"$this->mId\"";
+               $html .= " name=\"$this->name\" id=\"$this->id\"";
                
-               if ($this->mSize!="")
-                 $html .= " size=\"$this->mSize\"";
+               if ($this->size!="")
+                 $html .= " size=\"$this->size\"";
                 
                if ($this->mMultiple)
                  $html .= " multiple";
@@ -87,12 +87,15 @@ class Combobox extends FormElement {
                   
                if ($this->mStyle!="")
                   $html .= " style=\"$this->mStyle\"";
+                
+                if (!$this->isEnable())
+                  $html .= " disabled";
                   
                $html .= ">\n";   
                if (is_array($this->mOptionsEmpty) && (count($this->mOptionsEmpty) > 0))
                foreach ($this->mOptionsEmpty as $key=>$value) {
                        $html .= "<option value=\"".$key."\"";
-                       if (($this->mValue == $value) && ($this->mValue != '')) $html .= " selected";
+                       if (($this->value == $value) && ($this->value != '')) $html .= " selected";
                        $html .= ">".$value."</option>\n";
                }
                if (is_array($this->mOptions) && (count($this->mOptions) > 0))
@@ -103,7 +106,7 @@ class Combobox extends FormElement {
                                $value = $value[$this->mDataKeys[1]];
                        }
                        $html .= "<option value=\"".$key."\"";
-                       if (($this->mValue == $key) && ($this->mValue != '')) $html .= " selected";
+                       if (($this->value == $key) && ($this->value != '')) $html .= " selected";
                        $html .= ">".htmlspecialchars($value)."</option>\n";
                }
                
@@ -112,3 +115,4 @@ class Combobox extends FormElement {
                return $html;
        }
 }
+?>
\ No newline at end of file