summaryrefslogtreecommitdiff
path: root/html_form.class
diff options
context:
space:
mode:
authorUrban Müller2007-07-26 13:02:24 +0000
committerUrban Müller2007-07-26 13:02:24 +0000
commit806a5297e7e99d455b97a4f0acaba2f40f470584 (patch)
treeb9fc43ef227da87d873cf3676c08c49fa0dc1240 /html_form.class
parentc3cba034c8009b65c25dd4ef5f54b18d9c8ee7d4 (diff)
downloaditools-806a5297e7e99d455b97a4f0acaba2f40f470584.tar.gz
itools-806a5297e7e99d455b97a4f0acaba2f40f470584.tar.bz2
itools-806a5297e7e99d455b97a4f0acaba2f40f470584.zip
renamed files for autoloader
Diffstat (limited to 'html_form.class')
-rw-r--r--html_form.class166
1 files changed, 0 insertions, 166 deletions
diff --git a/html_form.class b/html_form.class
deleted file mode 100644
index 03497e3..0000000
--- a/html_form.class
+++ /dev/null
@@ -1,166 +0,0 @@
-<?php
-/*
-** $Id$
-**
-** ITools - the Internet Tools Library
-**
-** Copyright (C) 1995-2003 by the ITools Authors.
-** This program is free software; you can redistribute it and/or
-** modify it under the terms of either the GNU General Public License
-** or the GNU Lesser General Public License, as published by the Free
-** Software Foundation. See http://www.gnu.org/licenses/ for details.
-**
-** class it_html_form - Generic HTML Form
-*/
-
-
-/**
- * Functions to facilitate creation of HTML forms
- */
-class it_html_form
-{
- var $name; /* Name of form */
-
-/**
- * Constructor: set action, name and method (echo <FORM> 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 '<form method="'.$method.'" action="'.$action.'"';
-
- if ($target)
- echo " target=\"$target\"";
-
- if ($name)
- echo " name=\"$name\"";
-
- echo '>';
-}
-
-
-/**
- * Close the form (echo </FORM> tag)
- */
-function close()
-{
- echo "</form>";
-}
-
-
-/**
- * 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 = "<input type=\"hidden\" name=\"$name\" value=\"" . htmlspecialchars($value) . "\">";
- 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 "<textarea name=\"$name\" rows=\"$rows\" cols=\"$cols\">".htmlspecialchars($value)."</textarea>";
- }
- else
- echo "<input type=\"text\" name=\"$name\" size=\"$size\" maxlength=\"$maxlength\" value=\"".htmlspecialchars($value)."\">";
-}
-
-
-/**
- * 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 "<input type=\"password\" name=\"$name\" size=\"$size\" maxlength=\"$maxlength\" value=\"".htmlspecialchars($value)."\">";
-}
-
-
-/**
- * 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 '<select name="'.$name.'">';
- foreach($options as $value => $text)
- {
- $sel = ($value == $selected) ? ' selected' : '';
- echo '<option value="'.htmlspecialchars($value).'"'.$sel.'>'.$text.'</option>';
- }
- echo '</select>';
-}
-
-
-/**
- * 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."<input type=\"file\" name=\"$name\" size=\"$size\" maxlength=\"$maxlength\" value=\"".htmlspecialchars($value)."\">";
-}
-
-/**
- * Create a Submit button
- * @param $label button label
- * @param $name button name
- */
-function submit($label="", $name="")
-{
- if (!$label)
- $label = T('Button-Save');
-
- echo "<input type=\"submit\" value=\"$label\"";
- if ($name) echo " name=\"$name\"";
- echo ">";
-}
-
-} /* End class html_form */
-?>