From 806a5297e7e99d455b97a4f0acaba2f40f470584 Mon Sep 17 00:00:00 2001 From: Urban Müller Date: Thu, 26 Jul 2007 13:02:24 +0000 Subject: renamed files for autoloader --- it_html_form.class | 166 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 166 insertions(+) create mode 100644 it_html_form.class (limited to 'it_html_form.class') diff --git a/it_html_form.class b/it_html_form.class new file mode 100644 index 0000000..03497e3 --- /dev/null +++ b/it_html_form.class @@ -0,0 +1,166 @@ + tag) + * @param $action the action to be performed by this form or empty for link to self + * @param $name form name (optional) + * @param $method the method used for the action (defaults to 'post') + * @param $target Target frame of the form (optional) + */ +function it_html_form($action='*', $name='', $method='post', $target='') +{ + if ($action == '*') + $action = $_SERVER['PHP_SELF']; + + $this->name = $name; + + echo '
'; +} + + +/** + * Close the form (echo
tag) + */ +function close() +{ + echo ""; +} + + +/** + * Add a parameter (as a hidden field) + * @param $name parameter name + * @param $value default (?) value + * @param $return_output if true, output will be returned instaed of echoed + */ +function hidden($name, $value="", $return_output=false) +{ + $output = ""; + if ($return_output) + return $output; + else + echo $output; +} + + +/** + * Create a text field or a textarea if size is width:height + * @param $name text field name + * @param $size textfield width[:height] in chars + * @param $maxlength maximum length of input + * @param $value text field value + */ +function text($name, $size=8, $maxlength=255, $value="") +{ + if (strchr($size, ":")) + { + list($cols, $rows) = explode(":", $size); + echo ""; + } + else + echo ""; +} + + +/** + * Create a password field (masked characters) + * @param $name text field name + * @param $size textfield width[:height] in chars + * @param $maxlength maximum length of input + * @param $value text field value + */ +function password($name, $size=8, $maxlength=255, $value="") +{ + echo ""; +} + + +/** + * Create a dropdown menu object + * @param $name dropdown field name + * @param $options array (value => text) of available options or + * string key:val{,key:val} where key will be rawurldecoded so it may contain %2C as comma + * @param $selected currently selected value + */ +function select($name, $options, $selected='') +{ + if (!is_array($options)) + { + $opts = explode(',', $options); + $options = array(); + foreach($opts as $opt) + { + list($key, $value) = explode(':', $opt); + $options[rawurldecode($key)] = $value; + } + } + + echo ''; +} + + +/** + * Create a filename field with browse button + * @param $name file field name + * @param $label label to be echoed before the field + * @param $size file field width in chars + * @param $maxlength maximum length of input + * @param $value text field value + */ +function file($name, $label="", $size=16, $maxlength=255, $value="filename") +{ + echo $label.""; +} + +/** + * Create a Submit button + * @param $label button label + * @param $name button name + */ +function submit($label="", $name="") +{ + if (!$label) + $label = T('Button-Save'); + + echo ""; +} + +} /* End class html_form */ +?> -- cgit v1.2.3