2 // +----------------------------------------------------------------------+
 
   3 // | Anuko Time Tracker
 
   4 // +----------------------------------------------------------------------+
 
   5 // | Copyright (c) Anuko International Ltd. (https://www.anuko.com)
 
   6 // +----------------------------------------------------------------------+
 
   7 // | LIBERAL FREEWARE LICENSE: This source code document may be used
 
   8 // | by anyone for any purpose, and freely redistributed alone or in
 
   9 // | combination with other software, provided that the license is obeyed.
 
  11 // | There are only two ways to violate the license:
 
  13 // | 1. To redistribute this code in source form, with the copyright
 
  14 // |    notice or license removed or altered. (Distributing in compiled
 
  15 // |    forms without embedded copyright notices is permitted).
 
  17 // | 2. To redistribute modified versions of this code in *any* form
 
  18 // |    that bears insufficient indications that the modifications are
 
  19 // |    not the work of the original author(s).
 
  21 // | This license applies to this document only, not any other software
 
  22 // | that it may be combined with.
 
  24 // +----------------------------------------------------------------------+
 
  26 // | https://www.anuko.com/time_tracker/credits.htm
 
  27 // +----------------------------------------------------------------------+
 
  29 // FromElement is the base class for controls on forms.
 
  37   // TODO: refactoring ongoing down from here.
 
  41         var $mOnKeyPress        = "";
 
  45         var $mRenderable    = true;
 
  47         var $cClassName         = "FormElement";
 
  50         function __construct() {
 
  53         function getClass()     { return $this->cClassName; }
 
  55         function setName($name) { $this->name = $name; }
 
  56         function getName()      { return $this->name; }
 
  58         function setFormName($name) { $this->form_name = $name; }
 
  59         function getFormName()  { return $this->form_name; }
 
  61         function setValue($value) { $this->value = $value;}
 
  62         function getValue() { return $this->value; }
 
  64         function setValueSafe($value) { $this->value = $value;}
 
  65         function getValueSafe() { return $this->value; }
 
  67         function setId($id) { $this->id = $id;  }
 
  68         function getId() { return $this->id; }
 
  70         function setSize($value) { $this->size = $value; }
 
  71         function getSize() { return $this->size; }
 
  73         function setLabel($label)       { $this->mLabel = $label; }
 
  74         function getLabel() { return $this->mLabel; }
 
  76         function setMaxLength($value) { $this->max_length = $value; }
 
  77         function getMaxLength() { return $this->max_length; }
 
  79         function setStyle($value)       { $this->mStyle = $value; }
 
  80         function getStyle() { return $this->mStyle; }
 
  82         function setRenderable($flag)   { $this->mRenderable = $flag;   }
 
  83         function isRenderable() { return $this->mRenderable; }
 
  85         function setEnable($flag)       { $this->mEnabled = $flag;      }
 
  86         function isEnable()     { return $this->mEnabled; }
 
  88         function setOnChange($str)      { $this->mOnChange = $str; }
 
  89         function setOnClick($str)       { $this->mOnClick = $str; }
 
  90         function setOnSelect($str)      { $this->mOnSelect = $str; }
 
  92         function setLocalization($i18n) {
 
  96         function toStringControl()      {
 
 100         function toStringLabel() {
 
 101             return "<label for=\"" . $this->id . "\">" . $this->mLabel . "</label>";
 
 106                      "label"=>$this->toStringLabel(),
 
 107                      "control"=>$this->toStringControl()