]> wagnertech.de Git - timetracker.git/commitdiff
Finished refactoring of the FormElement class.
authoranuko <support@anuko.com>
Wed, 1 Mar 2017 20:40:18 +0000 (20:40 +0000)
committeranuko <support@anuko.com>
Wed, 1 Mar 2017 20:40:18 +0000 (20:40 +0000)
18 files changed:
WEB-INF/lib/form/Calendar.class.php
WEB-INF/lib/form/Checkbox.class.php
WEB-INF/lib/form/CheckboxGroup.class.php
WEB-INF/lib/form/Combobox.class.php
WEB-INF/lib/form/DateField.class.php
WEB-INF/lib/form/Form.class.php
WEB-INF/lib/form/FormElement.class.php
WEB-INF/lib/form/Hidden.class.php
WEB-INF/lib/form/Submit.class.php
WEB-INF/lib/form/Table.class.php
WEB-INF/lib/form/TextArea.class.php
WEB-INF/lib/form/TextField.class.php
WEB-INF/lib/form/UploadFile.class.php
WEB-INF/templates/footer.tpl
mobile/user_add.php
mobile/user_edit.php
user_add.php
user_edit.php

index f4a50a81929ac64cc48663a5075e78bc900d9e7e..dbe29981abad01f77a2bf192e50ccdf215c59ae3 100644 (file)
@@ -222,7 +222,7 @@ class Calendar extends FormElement {
       return $str;
     }
 
-    function toStringControl() {
+    function getHtml() {
         return $this->toString();
     }
 
index 8c20288ae29c88e53198f6fe85549ad8016603ba..4c6a9fd77468a873750ab5c49177502ec17d121e 100644 (file)
@@ -45,7 +45,7 @@ class Checkbox extends FormElement {
        function setData($value)        { $this->mOptions = $value; }
        function getData() { return $this->mOptions; }
        
-       function toStringControl() {
+       function getHtml() {
 
            if ($this->id=="") $this->id = $this->name;
            
index 136cc069d7fa844b41ab61b2b1c94c22442ab799..cb7c9f1f4ed4b1d68bae8af4b3df4168bf07139e 100644 (file)
@@ -65,7 +65,7 @@ class CheckboxGroup extends FormElement {
                $this->lSelNone = $i18n->getKey('label.select_none');
        }
                
-       function toStringControl() {
+       function getHtml() {
 
            if ($this->id=="") $this->id = $this->name;
            
index 314f4b74ec5d9b7d00a0559e9590f0826f8c4b36..ce6673963aa4a7af1fea25c9dfa41f2f735b0180 100644 (file)
@@ -65,7 +65,7 @@ class Combobox extends FormElement {
        function getDataKeys() { return $this->mDataKeys; }
        
        
-       function toStringControl() {
+       function getHtml() {
 
            if ($this->id=="") $this->id = $this->name;
            
index 320d5240d498c09c724ecd495e51c6edca64d193..3906db6c895e276d6c751a87b53edd4a3ab76791 100644 (file)
@@ -80,7 +80,7 @@ class DateField extends TextField {
     }
   }
 
-  function toStringControl() {
+  function getHtml() {
 
     if (!$this->isEnabled()) {
       $html = htmlspecialchars($this->getValue()).
index cd506aede47182085e4b45c834a615a7cdfd33e7..f8a32ec55bb68b76e24e3e9a82e88c6e45caf267 100644 (file)
@@ -188,7 +188,7 @@ class Form {
        $html = "\n";
        foreach ($this->elements as $elname=>$el) {
             if (strtolower(get_class($this->elements[$elname]))=="hidden") {
-               $html .= $this->elements[$elname]->toStringControl()."\n";
+                $html .= $this->elements[$elname]->getHtml()."\n";
             }
         }
         $html .= "</form>";
index f3d26a4d27db4530d307263ac9adb3da2b171526..799abf7b16dadd67e75804692592c407380a3866 100644 (file)
@@ -84,30 +84,15 @@ class FormElement {
   function localize($i18n) {} // Localization occurs in derived classes and is dependent on control type.
                               // For example, in calendar control we need to localize day and month names.
 
-  // TODO: refactoring ongoing down from here.
+  // getHtml returns HTML for the element.
+  function getHtml() { return ''; }
 
+  // getLabelHtml returns HTML code for element label.
+  function getLabelHtml() { return '<label for="'.$this->id.'">'.$this->label.'</label>'; }
 
-
-
-
-       
-
-
-
-       
-       function toStringControl()      {
-               return "";
-       }
-
-       function toStringLabel() {
-           return "<label for=\"" . $this->id . "\">" . $this->label . "</label>";
-       }
-       
-       function toArray() {
-           return array(
-                    "label"=>$this->toStringLabel(),
-                    "control"=>$this->toStringControl()
-                  );
-       }
-
+  function toArray() {
+    return array(
+      'label'=>$this->getLabelHtml(),
+      'control'=>$this->getHtml());
+  }
 }
index 57ed9aa2440f2b2a3e9a90bb593f74b18ee16e56..e06466e1f1700f0219fb44c597142582b303a3dc 100644 (file)
@@ -37,7 +37,7 @@ class Hidden extends FormElement {
                $this->value = $value;
        }
 
-       function toStringControl()      {
+       function getHtml()      {
            
            if ($this->id=="") $this->id = $this->name;
            
index 947b368d8bd5db267b488d62bcd029a321183d58..905b26950e2ebaffeeb2cef141d9420295394a2c 100644 (file)
@@ -37,7 +37,7 @@ class Submit extends FormElement {
                $this->value = $value;
        }
 
-       function toStringControl() {
+       function getHtml() {
            
            if ($this->id=="") $this->id = $this->name;
            
index ea0d28e85202b7f5fe75a9f08cbb0381fff91ead..807e2c7cd8f3c00769f51ab678380faca3b3a0b3 100644 (file)
@@ -114,7 +114,7 @@ class Table extends FormElement {
     }
   }
   
-  function toStringControl() {
+  function getHtml() {
     if (!$this->mProccessed) $this->_process();
     
     $html = "";
index 9c779179842f59dabef18ca1a208a913457fc4d5..728f4629d86da66bdb7f6e6145695f41d7e6d96a 100644 (file)
@@ -47,7 +47,7 @@ class TextArea extends FormElement {
        function setRows($value)        { $this->mRows = $value;        }
        function getRows()      { return $this->mRows; }
        
-       function toStringControl() {
+       function getHtml() {
     
            if ($this->id=="") $this->id = $this->mName;
            
index d7e38aeff4db6193f2cd94658fb260dd10dfa713..c9ffaaedfb2974b720b731ac7033d1e614c9be3f 100644 (file)
@@ -41,7 +41,7 @@ class TextField extends FormElement {
        function setAsPassword($name)   { $this->mPassword = $name;     }
        function getAsPassword()        { return $this->mPassword; }
 
-       function toStringControl() {
+       function getHtml() {
                if (!$this->isEnabled()) {
                        $html = "<input name=\"$this->name\" value=\"".htmlspecialchars($this->getValue())."\" readonly>\n";
                } else {
index 7e76d64cbf474d37ffd2fdc0410c3677502a2902..eb24259e97ed4e4f5ce2ee204f1fa190a7108db0 100644 (file)
@@ -41,7 +41,7 @@ class UploadFile extends FormElement {
        function setMaxSize($value)     { $this->mMaxSize = $value;     }
        function getMaxSize()   { return $this->mMaxSize; }
        
-       function toStringControl() {
+       function getHtml() {
 
             if ($this->id=="") $this->id = $this->name;
            
index 14dadd5ab54cc29d7bba41d6a57f10564af643ba..635abc3a1983099e063c42f4e0d8169545507ed4 100644 (file)
@@ -12,7 +12,7 @@
       <br>
       <table cellspacing="0" cellpadding="4" width="100%" border="0">
         <tr>
-          <td align="center">&nbsp;Anuko Time Tracker 1.10.38.3612 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+          <td align="center">&nbsp;Anuko Time Tracker 1.10.38.3613 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
             <a href="https://www.anuko.com/lp/tt_4.htm" target="_blank">{$i18n.footer.credits}</a> |
             <a href="https://www.anuko.com/lp/tt_5.htm" target="_blank">{$i18n.footer.license}</a> |
             <a href="https://www.anuko.com/lp/tt_7.htm" target="_blank">{$i18n.footer.improve}</a>
index eec9662dac52a71b6cfec4a3deaf4f2045774cb3..681ddd5c7bd14c7346406aa934459b08a833db29 100644 (file)
@@ -113,7 +113,7 @@ class RateCellRenderer extends DefaultCellRenderer {
     foreach ($assigned_projects as $p) {
       if ($p['id'] == $table->getValueAtName($row,'id')) $field->setValue($p['rate']);
     }
-    $this->setValue($field->toStringControl());
+    $this->setValue($field->getHtml());
     return $this->toString();
   }
 }
index 96532d908528ada1cdb3c0431d50f115fa03a9a9..06cfdf95e57cdbbb03665013a5d5bef8c186ec84 100644 (file)
@@ -143,7 +143,7 @@ class RateCellRenderer extends DefaultCellRenderer {
     foreach ($assigned_projects as $p) {
       if ($p['id'] == $table->getValueAtName($row,'id')) $field->setValue($p['rate']);
     }
-    $this->setValue($field->toStringControl());
+    $this->setValue($field->getHtml());
     return $this->toString();
   }
 }
index 6b5befe908d34633df59af042d54683c936231e1..82e55cf104c3417f88df7bb1e21f61ac94a94b0a 100644 (file)
@@ -113,7 +113,7 @@ class RateCellRenderer extends DefaultCellRenderer {
     foreach ($assigned_projects as $p) {
       if ($p['id'] == $table->getValueAtName($row,'id')) $field->setValue($p['rate']);
     }
-    $this->setValue($field->toStringControl());
+    $this->setValue($field->getHtml());
     return $this->toString();
   }
 }
index b3f4111662ca418338dcbe4b6220b9bdcf8826e0..5fd3b7ec3868e20ebe2a36a898d60624703f9fe4 100644 (file)
@@ -143,7 +143,7 @@ class RateCellRenderer extends DefaultCellRenderer {
     foreach ($assigned_projects as $p) {
       if ($p['id'] == $table->getValueAtName($row,'id')) $field->setValue($p['rate']);
     }
-    $this->setValue($field->toStringControl());
+    $this->setValue($field->getHtml());
     return $this->toString();
   }
 }