X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/timetracker.git/blobdiff_plain/d2df33e87f20af74c9339c15d3a7fbacd9560ded..f7ddb59bfc3e00d5d5e01a14cbe14b36147dada1:/WEB-INF/lib/form/Form.class.php diff --git a/WEB-INF/lib/form/Form.class.php b/WEB-INF/lib/form/Form.class.php index 7814877f..cb2f5203 100644 --- a/WEB-INF/lib/form/Form.class.php +++ b/WEB-INF/lib/form/Form.class.php @@ -26,15 +26,10 @@ // | https://www.anuko.com/time_tracker/credits.htm // +----------------------------------------------------------------------+ -// +----------------------------------------------------------------------+ -// | -// | Class generates elements of specification HTML 4.01 -// | http://www.w3.org/TR/1999/REC-html401-19991224 -// | -// +----------------------------------------------------------------------+ - +// Form class is a container for HTML forms we use in the application. +// It contains an array of $elements - which are individual input controls +// belonging to a form. class Form { - var $name = ''; // Form name. var $elements = array(); // An array of input controls in form. @@ -79,22 +74,20 @@ class Form { if (isset($params['format'])) $el->setFormat($params['format']); break; + case 'textarea': + import('form.TextArea'); + $el = new TextArea($params['name']); + if (isset($params['cols'])) $el->setColumns($params['cols']); + if (isset($params['rows'])) $el->setRows($params['rows']); + if (isset($params['maxlength'])) $el->setMaxLength($params['maxlength']); + break; + + case 'checkbox': + import('form.Checkbox'); + $el = new Checkbox($params['name']); + break; + // TODO: refactoring ongoing down from here. - case "textarea": - import('form.TextArea'); - $el = new TextArea($params["name"]); - $el->setColumns(@$params["cols"]); - $el->setRows(@$params["rows"]); - if (isset($params["maxlength"])) $el->setMaxLength($params["maxlength"]); - break; - - case "checkbox": - import('form.Checkbox'); - $el = new Checkbox($params["name"]); - if (@$params["checked"]) $el->setChecked(true); - $el->setData(@$params["data"]); - break; - case "checkboxgroup": import('form.CheckboxGroup'); $el = new CheckboxGroup($params["name"]);