Refactoring in UploadFile.class.php to simplify things.
[timetracker.git] / WEB-INF / lib / form / Submit.class.php
index facfffc..5f8da37 100644 (file)
 // +----------------------------------------------------------------------+
 
 import('form.FormElement');
-       
+
 class Submit extends FormElement {
-       var $cClassName = "Submit";
 
-       function __construct($name,$value="")
-       {
-               $this->mName                    = $name;
-               $this->mValue                   = $value;
-       }
+  function __construct($name) {
+    $this->class = 'Submit';
+    $this->name = $name;
+  }
+
+  function getHtml() {
+    if (empty($this->id))
+      $this->id = $this->name;
+
+    // Output HTML.
+    $html = "\n\t<input type=\"submit\" name=\"$this->name\" id=\"$this->id\"";
+    $html .= " value=\"$this->value\"";
+    if ($this->on_click) $html .= " onclick=\"".$this->on_click."\"";
+    if (!$this->isEnabled()) $html .= " disabled";
+    $html .= ">";
 
-       function toStringControl()      {
-               if (!$this->isRenderable()) return "";
-           
-           if ($this->mId=="") $this->mId = $this->mName;
-           
-               $html = "\n\t<input";
-               $html .= " type=\"submit\" name=\"$this->mName\" id=\"$this->mId\"";
-               
-               if (!$this->isEnable()) {
-                       $html .= " disabled=\"true\"";
-               }
-               
-               $html .= " value=\"$this->mValue\"";
-               
-               if ($this->mOnClick) {
-                       $html .= " onclick=\"".$this->mOnClick."\"";
-               }
-               
-               $html .= ">";
-               
-               return $html;
-       }
+    return $html;
+  }
 }