Some more refactoring in Form classes.
[timetracker.git] / WEB-INF / lib / form / Submit.class.php
index d621850..91123c5 100644 (file)
 import('form.FormElement');
        
 class Submit extends FormElement {
-       var $cClassName = "Submit";
 
-       function Submit($name,$value="")
-       {
-               $this->mName                    = $name;
-               $this->mValue                   = $value;
-       }
+  function __construct($name, $value = '')
+  {
+    $this->class = 'Submit';
+    $this->name = $name;
+    $this->value = $value;
+  }
 
-       function toStringControl()      {
-               if (!$this->isRenderable()) return "";
+  function getHtml() {
            
-           if ($this->mId=="") $this->mId = $this->mName;
+           if ($this->id=="") $this->id = $this->name;
            
                $html = "\n\t<input";
-               $html .= " type=\"submit\" name=\"$this->mName\" id=\"$this->mId\"";
+               $html .= " type=\"submit\" name=\"$this->name\" id=\"$this->id\"";
                
-               if (!$this->isEnable()) {
+               if (!$this->isEnabled()) {
                        $html .= " disabled=\"true\"";
                }
                
-               $html .= " value=\"$this->mValue\"";
+               $html .= " value=\"$this->value\"";
                
-               if ($this->mOnClick) {
-                       $html .= " onclick=\"".$this->mOnClick."\"";
+               if ($this->on_click) {
+                    $html .= " onclick=\"".$this->on_click."\"";
                }
                
                $html .= ">";
@@ -60,4 +59,3 @@ class Submit extends FormElement {
                return $html;
        }
 }
-?>
\ No newline at end of file