HTML_Form
[ class tree: HTML_Form ] [ index: HTML_Form ] [ all elements ]

Source for file Form.php

Documentation is available at Form.php

  1. <?php
  2.  
  3. // +----------------------------------------------------------------------+
  4. // | PHP version 4                                                        |
  5. // +----------------------------------------------------------------------+
  6. // | Copyright (c) 1997-2004 The PHP Group                                |
  7. // +----------------------------------------------------------------------+
  8. // | This source file is subject to version 2.0 of the PHP license,       |
  9. // | that is bundled with this package in the file LICENSE, and is        |
  10. // | available at through the world-wide-web at                           |
  11. // | http://www.php.net/license/2_02.txt.                                 |
  12. // | If you did not receive a copy of the PHP license and are unable to   |
  13. // | obtain it through the world-wide-web, please send a note to          |
  14. // | license@php.net so we can mail you a copy immediately.               |
  15. // +----------------------------------------------------------------------+
  16. // | Authors: Stig Bakken <ssb@fast.no>                                   |
  17. // |          Urs Gehrig <urs@circle.ch>                                  |
  18. // |          Daniel Convissor <danielc@php.net>                          |
  19. // +----------------------------------------------------------------------+
  20. //
  21. // $Id: Form.php,v 1.12 2004/06/15 19:38:05 danielc Exp $
  22. //
  23. // HTML form utility functions.
  24.  
  25.  
  26. if (!defined('HTML_FORM_TEXT_SIZE')) {
  27.     define('HTML_FORM_TEXT_SIZE'20);
  28. }
  29.  
  30. if (!defined('HTML_FORM_MAX_FILE_SIZE')) {
  31.     define('HTML_FORM_MAX_FILE_SIZE'1048576)// 1 MB
  32. }
  33.  
  34. if (!defined('HTML_FORM_PASSWD_SIZE')) {
  35.     define('HTML_FORM_PASSWD_SIZE'8);
  36. }
  37.  
  38. if (!defined('HTML_FORM_TEXTAREA_WT')) {
  39.     define('HTML_FORM_TEXTAREA_WT'40);
  40. }
  41.  
  42. if (!defined('HTML_FORM_TEXTAREA_HT')) {
  43.     define('HTML_FORM_TEXTAREA_HT'5);
  44. }
  45.  
  46. /**
  47.  * HTML form utility functions
  48.  *
  49.  * @category HTML
  50.  * @package  HTML_Form
  51.  * @author   Stig Bakken <ssb@fast.no>
  52.  * @author   Urs Gehrig <urs@circle.ch>
  53.  * @author   Daniel Convissor <danielc@php.net>
  54.  * @version  $Id: Form.php,v 1.12 2004/06/15 19:38:05 danielc Exp $
  55.  * @access   public
  56.  */
  57. class HTML_Form
  58. {
  59.     // {{{ properties
  60.  
  61.     /**
  62.      * ACTION attribute of <form> tag
  63.      * @var string 
  64.      */
  65.     var $action;
  66.  
  67.     /**
  68.      * METHOD attribute of <form> tag
  69.      * @var string 
  70.      */
  71.     var $method;
  72.  
  73.     /**
  74.      * NAME attribute of <form> tag
  75.      * @var string 
  76.      */
  77.     var $name;
  78.  
  79.     /**
  80.      * an array of entries for this form
  81.      * @var array 
  82.      */
  83.     var $fields;
  84.  
  85.     /**
  86.      * DB_storage object, if tied to one
  87.      */
  88.     var $storageObject;
  89.  
  90.     /**
  91.      * TARGET attribute of <form> tag
  92.      * @var string 
  93.      */
  94.     var $target;
  95.  
  96.     /**
  97.      * ENCTYPE attribute of <form> tag
  98.      * @var string 
  99.      */
  100.     var $enctype;
  101.  
  102.     /**
  103.      * additional attributes for <form> tag
  104.      *
  105.      * @var string 
  106.      * @since Property available since Release 1.1.0
  107.      */
  108.     var $attr;
  109.  
  110.  
  111.     // }}}
  112.     // {{{ constructor
  113.  
  114.     /**
  115.      * Constructor
  116.      *
  117.      * @param string $action  the string naming file or URI to which the form
  118.      *                          should be submitted
  119.      * @param string $method  a string indicating the submission method
  120.      *                          ('get' or 'post')
  121.      * @param string $name    a string used in the <form>'s 'name' attribute
  122.      * @param string $target  a string used in the <form>'s 'target' attribute
  123.      * @param string $enctype a string indicating the submission's encoding
  124.      * @param string $attr    a string of additional attributes to be put
  125.      *                          in the element (example: 'id="foo"')
  126.      * @return void 
  127.      *
  128.      * @access public
  129.      */
  130.     function HTML_Form($action$method 'get'$name ''$target '',
  131.                        $enctype ''$attr '')
  132.     {
  133.         $this->action  = $action;
  134.         $this->method  = $method;
  135.         $this->name    = $name;
  136.         $this->fields  = array();
  137.         $this->target  = $target;
  138.         $this->enctype = $enctype;
  139.         $this->attr    = $attr;
  140.     }
  141.  
  142.  
  143.     // ===========  ADD  ===========
  144.  
  145.     // }}}
  146.     // {{{ addText()
  147.  
  148.     /**
  149.      * Adds a text input to the list of fields to be processed by display()
  150.      *
  151.      * @param string $name      the string used in the 'name' attribute
  152.      * @param string $title     the string used as the label
  153.      * @param mixed  $default   a default value for the element
  154.      * @param int    $size      an integer used in the 'size' attribute
  155.      * @param int    $maxlength an integer used in the 'maxlength' attribute
  156.      * @param string $attr      a string of additional attributes to be put
  157.      *                            in the element (example: 'id="foo"')
  158.      * @param string $thattr    a string of additional attributes to be put
  159.      *                            in the <th> element (example: 'class="foo"')
  160.      * @param string $tdattr    a string of additional attributes to be put
  161.      *                            in the <td> element (example: 'class="foo"')
  162.      * @return void 
  163.      *
  164.      * @access public
  165.      * @see HTML_Form::display(),
  166.      *       HTML_Form::displayText(), HTML_Form::displayTextRow(),
  167.      *       HTML_Form::returnText(), HTML_Form::returnTextRow()
  168.      */
  169.     function addText($name$title$default '',
  170.                      $size = HTML_FORM_TEXT_SIZE$maxlength = 0,
  171.                      $attr ''$thattr 'align="right"'$tdattr '')
  172.     {
  173.         $this->fields[= array('text'$name$title$default$size,
  174.                                 $maxlength$attr$thattr$tdattr);
  175.     }
  176.  
  177.     // }}}
  178.     // {{{ addPassword()
  179.  
  180.     /**
  181.      * Adds a password input to the list of fields to be processed by display()
  182.      *
  183.      * @param string $name      the string used in the 'name' attribute
  184.      * @param string $title     the string used as the label
  185.      * @param mixed  $default   a default value for the element
  186.      * @param int    $size      an integer used in the 'size' attribute
  187.      * @param int    $maxlength an integer used in the 'maxlength' attribute
  188.      * @param string $attr      a string of additional attributes to be put
  189.      *                            in the element (example: 'id="foo"')
  190.      * @param string $thattr    a string of additional attributes to be put
  191.      *                            in the <th> element (example: 'class="foo"')
  192.      * @param string $tdattr    a string of additional attributes to be put
  193.      *                            in the <td> element (example: 'class="foo"')
  194.      * @return void 
  195.      *
  196.      * @access public
  197.      * @see HTML_Form::display(),
  198.      *       HTML_Form::displayPassword(), HTML_Form::displayPasswordRow(),
  199.      *       HTML_Form::returnPassword(), HTML_Form::returnPasswordRow()
  200.      */
  201.     function addPassword($name$title$default '',
  202.                          $size = HTML_FORM_PASSWD_SIZE,
  203.                          $maxlength = 0$attr ''$thattr 'align="right"',
  204.                          $tdattr '')
  205.     {
  206.         $this->fields[= array('password'$name$title$default$size,
  207.                                 $maxlength$attr$thattr$tdattr);
  208.     }
  209.  
  210.     // }}}
  211.     // {{{ addCheckbox()
  212.  
  213.     /**
  214.      * Adds a checkbox input to the list of fields to be processed by display()
  215.      *
  216.      * @param string $name      the string used in the 'name' attribute
  217.      * @param string $title     the string used as the label
  218.      * @param bool   $default   a bool indicating if item should be checked
  219.      * @param string $attr      a string of additional attributes to be put
  220.      *                            in the element (example: 'id="foo"')
  221.      * @param string $thattr    a string of additional attributes to be put
  222.      *                            in the <th> element (example: 'class="foo"')
  223.      * @param string $tdattr    a string of additional attributes to be put
  224.      *                            in the <td> element (example: 'class="foo"')
  225.      * @return void 
  226.      *
  227.      * @access public
  228.      * @see HTML_Form::display(),
  229.      *       HTML_Form::displayCheckbox(), HTML_Form::displayCheckboxRow(),
  230.      *       HTML_Form::returnCheckbox(), HTML_Form::returnCheckboxRow()
  231.      */
  232.     function addCheckbox($name$title$default = false$attr '',
  233.                          $thattr 'align="right"'$tdattr '')
  234.     {
  235.         $this->fields[= array('checkbox'$name$title$default$attr,
  236.                                 $thattr$tdattr);
  237.     }
  238.  
  239.     // }}}
  240.     // {{{ addTextarea()
  241.  
  242.     /**
  243.      * Adds a textarea input to the list of fields to be processed by display()
  244.      *
  245.      * @param string $name      the string used in the 'name' attribute
  246.      * @param string $title     the string used as the label
  247.      * @param mixed  $default   a default value for the element
  248.      * @param int    $width     an integer saying how many characters wide
  249.      *                            the item should be
  250.      * @param int    $height    an integer saying how many rows tall the
  251.      *                            item should be
  252.      * @param int    $maxlength an integer used in the 'maxlength' attribute
  253.      * @param string $attr      a string of additional attributes to be put
  254.      *                            in the element (example: 'id="foo"')
  255.      * @param string $thattr    a string of additional attributes to be put
  256.      *                            in the <th> element (example: 'class="foo"')
  257.      * @param string $tdattr    a string of additional attributes to be put
  258.      *                            in the <td> element (example: 'class="foo"')
  259.      * @return void 
  260.      *
  261.      * @access public
  262.      * @see HTML_Form::display(),
  263.      *       HTML_Form::displayTextarea(), HTML_Form::displayTextareaRow(),
  264.      *       HTML_Form::returnTextarea(), HTML_Form::returnTextareaRow()
  265.      */
  266.     function addTextarea($name$title$default '',
  267.                          $width = HTML_FORM_TEXTAREA_WT,
  268.                          $height = HTML_FORM_TEXTAREA_HT$maxlength = 0,
  269.                          $attr ''$thattr 'align="right"'$tdattr '')
  270.     {
  271.         $this->fields[= array('textarea'$name$title$default$width,
  272.                                 $height$maxlength$attr$thattr$tdattr);
  273.     }
  274.  
  275.     // }}}
  276.     // {{{ addSubmit()
  277.  
  278.     /**
  279.      * Adds a submit button to the list of fields to be processed by display()
  280.      *
  281.      * @param string $name      a string used in the 'name' attribute
  282.      * @param string $title     a string that appears on the button
  283.      * @param string $attr      a string of additional attributes to be put
  284.      *                            in the element (example: 'id="foo"')
  285.      * @param string $thattr    a string of additional attributes to be put
  286.      *                            in the <th> element (example: 'class="foo"')
  287.      * @param string $tdattr    a string of additional attributes to be put
  288.      *                            in the <td> element (example: 'class="foo"')
  289.      * @return void 
  290.      *
  291.      * @access public
  292.      * @see HTML_Form::display(),
  293.      *       HTML_Form::displaySubmit(), HTML_Form::displaySubmitRow(),
  294.      *       HTML_Form::returnSubmit(), HTML_Form::returnSubmitRow()
  295.      */
  296.     function addSubmit($name 'submit'$title 'Submit Changes',
  297.                        $attr ''$thattr 'align="right"'$tdattr '')
  298.     {
  299.         $this->fields[= array('submit'$name$title$attr$thattr,
  300.                                 $tdattr);
  301.     }
  302.  
  303.     // }}}
  304.     // {{{ addReset()
  305.  
  306.     /**
  307.      * Adds a reset button to the list of fields to be processed by display()
  308.      *
  309.      * NOTE: Unusual parameter order.
  310.      *
  311.      * @param string $title     a string that appears on the button
  312.      * @param string $attr      a string of additional attributes to be put
  313.      *                            in the element (example: 'id="foo"')
  314.      * @param string $thattr    a string of additional attributes to be put
  315.      *                            in the <th> element (example: 'class="foo"')
  316.      * @param string $tdattr    a string of additional attributes to be put
  317.      *                            in the <td> element (example: 'class="foo"')
  318.      * @return void 
  319.      *
  320.      * @access public
  321.      * @see HTML_Form::display(),
  322.      *       HTML_Form::displayReset(), HTML_Form::displayResetRow(),
  323.      *       HTML_Form::returnReset(), HTML_Form::returnResetRow()
  324.      */
  325.     function addReset($title 'Discard Changes'$attr '',
  326.                       $thattr 'align="right"'$tdattr '')
  327.     {
  328.         $this->fields[= array('reset'$title$attr$thattr$tdattr);
  329.     }
  330.  
  331.     // }}}
  332.     // {{{ addSelect()
  333.  
  334.     /**
  335.      * Adds a select list to the list of fields to be processed by display()
  336.      *
  337.      * @param string $name      the string used in the 'name' attribute
  338.      * @param string $title     the string used as the label
  339.      * @param array  $entries   an array containing the <options> to be listed.
  340.      *                            The array's keys become the option values and
  341.      *                            the array's values become the visible text.
  342.      * @param mixed  $default   a default value for the element
  343.      * @param int    $size      an integer saying how many rows should be
  344.      * @param string $blank     if this string is present, an <option> will be
  345.      *                            added to the top of the list that will contain
  346.      *                            the given text in the visible portion and an
  347.      *                            empty string as the value
  348.      * @param bool   $multiple  a bool saying if multiple choices are allowed
  349.      * @param string $attr      a string of additional attributes to be put
  350.      *                            in the element (example: 'id="foo"')
  351.      * @param string $thattr    a string of additional attributes to be put
  352.      *                            in the <th> element (example: 'class="foo"')
  353.      * @param string $tdattr    a string of additional attributes to be put
  354.      *                            in the <td> element (example: 'class="foo"')
  355.      * @return void 
  356.      *
  357.      * @access public
  358.      * @see HTML_Form::display(),
  359.      *       HTML_Form::displaySelect(), HTML_Form::displaySelectRow(),
  360.      *       HTML_Form::returnSelect(), HTML_Form::returnSelectRow()
  361.      */
  362.     function addSelect($name$title$entries$default ''$size = 1,
  363.                        $blank ''$multiple = false$attr '',
  364.                        $thattr 'align="right"'$tdattr '')
  365.     {
  366.         $this->fields[= array('select'$name$title$entries$default,
  367.                                 $size$blank$multiple$attr$thattr,
  368.                                 $tdattr);
  369.     }
  370.  
  371.     // }}}
  372.     // {{{ addRadio()
  373.  
  374.     /**
  375.      * Adds a radio input to the list of fields to be processed by display()
  376.      *
  377.      * @param string $name      the string used in the 'name' attribute
  378.      * @param string $title     the string used as the label
  379.      * @param string $value     the string used for the item's value
  380.      * @param bool   $default   a bool indicating if item should be checked
  381.      * @param string $attr      a string of additional attributes to be put
  382.      *                            in the element (example: 'id="foo"')
  383.      * @param string $thattr    a string of additional attributes to be put
  384.      *                            in the <th> element (example: 'class="foo"')
  385.      * @param string $tdattr    a string of additional attributes to be put
  386.      *                            in the <td> element (example: 'class="foo"')
  387.      * @return void 
  388.      *
  389.      * @access public
  390.      * @see HTML_Form::display(),
  391.      *       HTML_Form::displayRadio(), HTML_Form::displayRadioRow(),
  392.      *       HTML_Form::returnRadio(), HTML_Form::returnRadioRow()
  393.      */
  394.     function addRadio($name$title$value$default = false$attr '',
  395.                       $thattr 'align="right"'$tdattr '')
  396.     {
  397.         $this->fields[= array('radio'$name$title$value$default,
  398.                                 $attr$thattr$tdattr);
  399.     }
  400.  
  401.     // }}}
  402.     // {{{ addImage()
  403.  
  404.     /**
  405.      * Adds an image input to the list of fields to be processed by display()
  406.      *
  407.      * @param string $name      the string used in the 'name' attribute
  408.      * @param string $title     the string used as the label
  409.      * @param string $src       the string denoting the path to the image.
  410.      *                            Can be a relative path or full URI.
  411.      * @param string $attr      a string of additional attributes to be put
  412.      *                            in the element (example: 'id="foo"')
  413.      * @param string $thattr    a string of additional attributes to be put
  414.      *                            in the <th> element (example: 'class="foo"')
  415.      * @param string $tdattr    a string of additional attributes to be put
  416.      *                            in the <td> element (example: 'class="foo"')
  417.      * @return void 
  418.      *
  419.      * @access public
  420.      * @see HTML_Form::display(),
  421.      *       HTML_Form::displayImage(), HTML_Form::displayImageRow(),
  422.      *       HTML_Form::returnImage(), HTML_Form::returnImageRow()
  423.      */
  424.     function addImage($name$title$src$attr '',
  425.                       $thattr 'align="right"'$tdattr '')
  426.     {
  427.         $this->fields[= array('image'$name$title$src$attr$thattr,
  428.                                 $tdattr);
  429.     }
  430.  
  431.     // }}}
  432.     // {{{ addHidden()
  433.  
  434.     /**
  435.      * Adds a hiden input to the list of fields to be processed by display()
  436.      *
  437.      * @param string $name      the string used in the 'name' attribute
  438.      * @param string $value     the string used for the item's value
  439.      * @param string $attr      a string of additional attributes to be put
  440.      *                            in the element (example: 'id="foo"')
  441.      * @return void 
  442.      *
  443.      * @access public
  444.      * @see HTML_Form::display(),
  445.      *       HTML_Form::displayHidden(), HTML_Form::returnHidden()
  446.      */
  447.     function addHidden($name$value$attr '')
  448.     {
  449.         $this->fields[= array('hidden'$name$value$attr);
  450.     }
  451.  
  452.     // }}}
  453.     // {{{ addBlank()
  454.  
  455.     /**
  456.      * Adds a blank row to the list of fields to be processed by display()
  457.      *
  458.      * @param int    $i         the number of rows to create.  Ignored if
  459.      *                            $title is used.
  460.      * @param string $title     a string to be used as the label for the row
  461.      * @param string $thattr    a string of additional attributes to be put
  462.      *                            in the <th> element (example: 'class="foo"')
  463.      * @param string $tdattr    a string of additional attributes to be put
  464.      *                            in the <td> element (example: 'class="foo"')
  465.      * @return void 
  466.      *
  467.      * @access public
  468.      * @see HTML_Form::display(),
  469.      *       HTML_Form::displayBlank(), HTML_Form::displayBlankRow(),
  470.      *       HTML_Form::returnBlank(), HTML_Form::returnBlankRow()
  471.      */
  472.     function addBlank($i$title ''$thattr 'align="right"'$tdattr '')
  473.     {
  474.         $this->fields[= array('blank'$i$title$thattr$tdattr);
  475.     }
  476.  
  477.     // }}}
  478.     // {{{ addFile
  479.  
  480.     /**
  481.      * Adds a file upload input to the list of fields to be processed by display()
  482.      *
  483.      * @param string $name      the string used in the 'name' attribute
  484.      * @param string $title     the string used as the label
  485.      * @param int    $maxsize   an integer determining how large (in bytes) a
  486.      *                            submitted file can be.
  487.      * @param int    $size      an integer used in the 'size' attribute
  488.      * @param string $accept    a string saying which MIME types are allowed
  489.      * @param string $attr      a string of additional attributes to be put
  490.      *                            in the element (example: 'id="foo"')
  491.      * @param string $thattr    a string of additional attributes to be put
  492.      *                            in the <th> element (example: 'class="foo"')
  493.      * @param string $tdattr    a string of additional attributes to be put
  494.      *                            in the <td> element (example: 'class="foo"')
  495.      * @return void 
  496.      *
  497.      * @access public
  498.      * @see HTML_Form::display(),
  499.      *       HTML_Form::displayFile(), HTML_Form::displayFileRow(),
  500.      *       HTML_Form::returnFile(), HTML_Form::returnFileRow(),
  501.      *       HTML_Form::returnMultipleFiles()
  502.      */
  503.     function addFile($name$title$maxsize = HTML_FORM_MAX_FILE_SIZE,
  504.                      $size = HTML_FORM_TEXT_SIZE$accept ''$attr '',
  505.                      $thattr 'align="right"'$tdattr '')
  506.     {
  507.         $this->enctype = "multipart/form-data";
  508.         $this->fields[= array('file'$name$title$maxsize$size,
  509.                                 $accept$attr$thattr$tdattr);
  510.     }
  511.  
  512.     // }}}
  513.     // {{{ addPlaintext()
  514.  
  515.     /**
  516.      * Adds a row of text to the list of fields to be processed by display()
  517.      *
  518.      * @param string $title     the string used as the label
  519.      * @param string $text      a string to be displayed
  520.      * @param string $thattr    a string of additional attributes to be put
  521.      *                            in the <th> element (example: 'class="foo"')
  522.      * @param string $tdattr    a string of additional attributes to be put
  523.      *                            in the <td> element (example: 'class="foo"')
  524.      * @return void 
  525.      *
  526.      * @access public
  527.      * @see HTML_Form::display(),
  528.      *       HTML_Form::displayPlaintext(), HTML_Form::displayPlaintextRow(),
  529.      *       HTML_Form::returnPlaintext(), HTML_Form::returnPlaintextRow()
  530.      */
  531.     function addPlaintext($title$text '&nbsp;',
  532.                           $thattr 'align="right" valign="top"'$tdattr '')
  533.     {
  534.         $this->fields[= array('plaintext'$title$text$thattr$tdattr);
  535.     }
  536.  
  537.  
  538.     // ===========  DISPLAY  ===========
  539.  
  540.     // }}}
  541.     // {{{ start()
  542.  
  543.     /**
  544.      * Prints the opening tags for the form and table
  545.      *
  546.      * NOTE: can NOT be called statically.
  547.      *
  548.      * @param bool $multipartformdata  a bool indicating if the form should
  549.      *                                   be submitted in multipart format
  550.      * @return void 
  551.      *
  552.      * @access public
  553.      * @see HTML_Form::display(), HTML_Form::end(), HTML_Form::returnStart()
  554.      */
  555.     function start($multipartformdata = false)
  556.     {
  557.         print $this->returnStart($multipartformdata);
  558.     }
  559.  
  560.     // }}}
  561.     // {{{ end()
  562.  
  563.     /**
  564.      * Prints the ending tags for the table and form
  565.      *
  566.      * NOTE: can NOT be called statically.
  567.      *
  568.      * @return void 
  569.      *
  570.      * @access public
  571.      * @see HTML_Form::display(), HTML_Form::start(), HTML_Form::returnEnd()
  572.      */
  573.     function end()
  574.     {
  575.         print $this->returnEnd();
  576.     }
  577.  
  578.     // }}}
  579.     // {{{ displayText()
  580.  
  581.     /**
  582.      * Prints a text input element
  583.      *
  584.      * @param string $name      the string used in the 'name' attribute
  585.      * @param mixed  $default   a default value for the element
  586.      * @param int    $size      an integer used in the 'size' attribute
  587.      * @param int    $maxlength an integer used in the 'maxlength' attribute
  588.      * @param string $attr      a string of additional attributes to be put
  589.      *                            in the element (example: 'id="foo"')
  590.      * @return void 
  591.      *
  592.      * @access public
  593.      * @static
  594.      * @see HTML_Form::displayTextRow(), HTML_Form::addText(),
  595.      *       HTML_Form::returnText(), HTML_Form::returnTextRow()
  596.      */
  597.     function displayText($name$default ''$size = HTML_FORM_TEXT_SIZE,
  598.                          $maxlength = 0$attr '')
  599.     {
  600.         print HTML_Form::returnText($name$default$size$maxlength$attr);
  601.     }
  602.  
  603.     // }}}
  604.     // {{{ displayTextRow()
  605.  
  606.     /**
  607.      * Prints a text input element inside a table row
  608.      *
  609.      * @param string $name      the string used in the 'name' attribute
  610.      * @param string $title     the string used as the label
  611.      * @param mixed  $default   a default value for the element
  612.      * @param int    $size      an integer used in the 'size' attribute
  613.      * @param int    $maxlength an integer used in the 'maxlength' attribute
  614.      * @param string $attr      a string of additional attributes to be put
  615.      *                            in the element (example: 'id="foo"')
  616.      * @param string $thattr    a string of additional attributes to be put
  617.      *                            in the <th> element (example: 'class="foo"')
  618.      * @param string $tdattr    a string of additional attributes to be put
  619.      *                            in the <td> element (example: 'class="foo"')
  620.      * @return void 
  621.      *
  622.      * @access public
  623.      * @static
  624.      * @see HTML_Form::displayText(), HTML_Form::addText(),
  625.      *       HTML_Form::returnText(), HTML_Form::returnTextRow()
  626.      */
  627.     function displayTextRow($name$title$default '',
  628.                             $size = HTML_FORM_TEXT_SIZE$maxlength = 0,
  629.                             $attr ''$thattr 'align="right"'$tdattr '')
  630.     {
  631.         print HTML_Form::returnTextRow($name$title$default$size,
  632.                                        $maxlength$attr$thattr$tdattr);
  633.     }
  634.  
  635.     // }}}
  636.     // {{{ displayPassword()
  637.  
  638.     /**
  639.      * Prints a password input
  640.      *
  641.      * @param string $name      the string used in the 'name' attribute
  642.      * @param mixed  $default   a default value for the element
  643.      * @param int    $size      an integer used in the 'size' attribute
  644.      * @param int    $maxlength an integer used in the 'maxlength' attribute
  645.      * @param string $attr      a string of additional attributes to be put
  646.      *                            in the element (example: 'id="foo"')
  647.      * @return void 
  648.      *
  649.      * @access public
  650.      * @static
  651.      * @see HTML_Form::displayPasswordRow(), HTML_Form::addPassword(),
  652.      *       HTML_Form::returnPassword(), HTML_Form::returnPasswordRow()
  653.      */
  654.     function displayPassword($name$default '',
  655.                              $size = HTML_FORM_PASSWD_SIZE,
  656.                              $maxlength = 0$attr '')
  657.     {
  658.         print HTML_Form::returnPassword($name$default$size$maxlength,
  659.                                         $attr);
  660.     }
  661.  
  662.     // }}}
  663.     // {{{ displayPasswordRow()
  664.  
  665.     /**
  666.      * Prints a combined password input and password
  667.      * confirmation input inside a table row
  668.      *
  669.      * @param string $name      the string used in the 'name' attribute
  670.      * @param string $title     the string used as the label
  671.      * @param mixed  $default   a default value for the element
  672.      * @param int    $size      an integer used in the 'size' attribute
  673.      * @param int    $maxlength an integer used in the 'maxlength' attribute
  674.      * @param string $attr      a string of additional attributes to be put
  675.      *                            in the element (example: 'id="foo"')
  676.      * @param string $thattr    a string of additional attributes to be put
  677.      *                            in the <th> element (example: 'class="foo"')
  678.      * @param string $tdattr    a string of additional attributes to be put
  679.      *                            in the <td> element (example: 'class="foo"')
  680.      * @return void 
  681.      *
  682.      * @access public
  683.      * @static
  684.      * @see HTML_Form::displayPassword(), HTML_Form::addPassword(),
  685.      *       HTML_Form::returnPassword(), HTML_Form::returnPasswordRow()
  686.      */
  687.     function displayPasswordRow($name$title$default '',
  688.                                 $size = HTML_FORM_PASSWD_SIZE,
  689.                                 $maxlength = 0$attr '',
  690.                                 $thattr 'align="right"'$tdattr '')
  691.     {
  692.         print HTML_Form::returnPasswordRow($name$title$default,
  693.                                            $size$maxlength$attr$thattr,
  694.                                            $tdattr);
  695.     }
  696.  
  697.     // }}}
  698.     // {{{ displayCheckbox()
  699.  
  700.     /**
  701.      * Prints a checkbox input
  702.      *
  703.      * @param string $name      the string used in the 'name' attribute
  704.      * @param bool   $default   a bool indicating if item should be checked
  705.      * @param string $attr      a string of additional attributes to be put
  706.      *                            in the element (example: 'id="foo"')
  707.      * @return void 
  708.      *
  709.      * @access public
  710.      * @static
  711.      * @see HTML_Form::displayCheckboxRow(), HTML_Form::addCheckbox(),
  712.      *       HTML_Form::returnCheckbox(), HTML_Form::returnCheckboxRow()
  713.      */
  714.     function displayCheckbox($name$default = false$attr '')
  715.     {
  716.         print HTML_Form::returnCheckbox($name$default$attr);
  717.     }
  718.  
  719.     // }}}
  720.     // {{{ displayCheckboxRow()
  721.  
  722.     /**
  723.      * Prints a checkbox input inside a table row
  724.      *
  725.      * @param string $name      the string used in the 'name' attribute
  726.      * @param string $title     the string used as the label
  727.      * @param bool   $default   a bool indicating if item should be checked
  728.      * @param string $attr      a string of additional attributes to be put
  729.      *                            in the element (example: 'id="foo"')
  730.      * @param string $thattr    a string of additional attributes to be put
  731.      *                            in the <th> element (example: 'class="foo"')
  732.      * @param string $tdattr    a string of additional attributes to be put
  733.      *                            in the <td> element (example: 'class="foo"')
  734.      * @return void 
  735.      *
  736.      * @access public
  737.      * @static
  738.      * @see HTML_Form::displayCheckboxRow(), HTML_Form::addCheckbox(),
  739.      *       HTML_Form::returnCheckbox(), HTML_Form::returnCheckboxRow()
  740.      */
  741.     function displayCheckboxRow($name$title$default = false$attr '',
  742.                                 $thattr 'align="right"'$tdattr '')
  743.     {
  744.         print HTML_Form::returnCheckboxRow($name$title$default$attr,
  745.                                            $thattr$tdattr);
  746.     }
  747.  
  748.     // }}}
  749.     // {{{ displayTextarea()
  750.  
  751.     /**
  752.      * Prints a textarea input
  753.      *
  754.      * @param string $name      the string used in the 'name' attribute
  755.      * @param mixed  $default   a default value for the element
  756.      * @param int    $width     an integer saying how many characters wide
  757.      *                            the item should be
  758.      * @param int    $height    an integer saying how many rows tall the
  759.      *                            item should be
  760.      * @param int    $maxlength an integer used in the 'maxlength' attribute
  761.      * @param string $attr      a string of additional attributes to be put
  762.      *                            in the element (example: 'id="foo"')
  763.      * @return void 
  764.      *
  765.      * @access public
  766.      * @static
  767.      * @see HTML_Form::displayTextareaRow(), HTML_Form::addTextarea(),
  768.      *       HTML_Form::returnTextarea(), HTML_Form::returnTextareaRow()
  769.      */
  770.     function displayTextarea($name$default ''$width = 40,
  771.                              $height = 5$maxlength  ''$attr '')
  772.     {
  773.         print HTML_Form::returnTextarea($name$default$width$height,
  774.                                         $maxlength$attr);
  775.     }
  776.  
  777.     // }}}
  778.     // {{{ displayTextareaRow()
  779.  
  780.     /**
  781.      * Prints a textarea input inside a table row
  782.      *
  783.      * @param string $name      the string used in the 'name' attribute
  784.      * @param string $title     the string used as the label
  785.      * @param mixed  $default   a default value for the element
  786.      * @param int    $width     an integer saying how many characters wide
  787.      *                            the item should be
  788.      * @param int    $height    an integer saying how many rows tall the
  789.      *                            item should be
  790.      * @param int    $maxlength an integer used in the 'maxlength' attribute
  791.      * @param string $attr      a string of additional attributes to be put
  792.      *                            in the element (example: 'id="foo"')
  793.      * @param string $thattr    a string of additional attributes to be put
  794.      *                            in the <th> element (example: 'class="foo"')
  795.      * @param string $tdattr    a string of additional attributes to be put
  796.      *                            in the <td> element (example: 'class="foo"')
  797.      * @return void 
  798.      *
  799.      * @access public
  800.      * @static
  801.      * @see HTML_Form::displayTextareaRow(), HTML_Form::addTextarea(),
  802.      *       HTML_Form::returnTextarea(), HTML_Form::returnTextareaRow()
  803.      */
  804.     function displayTextareaRow($name$title$default ''$width = 40,
  805.                                 $height = 5$maxlength = 0$attr '',
  806.                                 $thattr 'align="right"'$tdattr '')
  807.     {
  808.         print HTML_Form::returnTextareaRow($name$title$default$width,
  809.                                            $height$maxlength$attr$thattr,
  810.                                            $tdattr);
  811.     }
  812.  
  813.     // }}}
  814.     // {{{ displaySubmit()
  815.  
  816.     /**
  817.      * Prints a submit button
  818.      *
  819.      * NOTE: Unusual parameter order.
  820.      *
  821.      * @param string $title     a string that appears on the button
  822.      * @param string $name      a string used in the 'name' attribute
  823.      * @param string $attr      a string of additional attributes to be put
  824.      *                            in the element (example: 'id="foo"')
  825.      * @return void 
  826.      *
  827.      * @access public
  828.      * @static
  829.      * @see HTML_Form::displaySubmit(), HTML_Form::addSubmit(),
  830.      *       HTML_Form::returnSubmit(), HTML_Form::returnSubmitRow()
  831.      */
  832.     function displaySubmit($title 'Submit Changes'$name 'submit',
  833.                            $attr '')
  834.     {
  835.         print HTML_Form::returnSubmit($title$name$attr);
  836.     }
  837.  
  838.     // }}}
  839.     // {{{ displaySubmitRow()
  840.  
  841.     /**
  842.      * Prints a submit button inside a table row
  843.      *
  844.      * @param string $name      a string used in the 'name' attribute
  845.      * @param string $title     a string that appears on the button
  846.      * @param string $attr      a string of additional attributes to be put
  847.      *                            in the element (example: 'id="foo"')
  848.      * @param string $thattr    a string of additional attributes to be put
  849.      *                            in the <th> element (example: 'class="foo"')
  850.      * @param string $tdattr    a string of additional attributes to be put
  851.      *                            in the <td> element (example: 'class="foo"')
  852.      * @return void 
  853.      *
  854.      * @access public
  855.      * @static
  856.      * @see HTML_Form::displaySubmit(), HTML_Form::addSubmit(),
  857.      *       HTML_Form::returnSubmit(), HTML_Form::returnSubmitRow()
  858.      */
  859.     function displaySubmitRow($name 'submit'$title 'Submit Changes',
  860.                               $attr ''$thattr 'align="right"'$tdattr '')
  861.     {
  862.         print HTML_Form::returnSubmitRow($name$title$attr$thattr$tdattr);
  863.     }
  864.  
  865.     // }}}
  866.     // {{{ displayReset()
  867.  
  868.     /**
  869.      * Prints a reset button
  870.      *
  871.      * NOTE: Unusual parameter order.
  872.      *
  873.      * @param string $title     a string that appears on the button
  874.      * @param string $attr      a string of additional attributes to be put
  875.      *                            in the element (example: 'id="foo"')
  876.      * @return void 
  877.      *
  878.      * @access public
  879.      * @static
  880.      * @see HTML_Form::displayResetRow(), HTML_Form::addReset(),
  881.      *       HTML_Form::returnReset(), HTML_Form::returnResetRow()
  882.      */
  883.     function displayReset($title 'Clear contents'$attr '')
  884.     {
  885.         print HTML_Form::returnReset($title$attr);
  886.     }
  887.  
  888.     // }}}
  889.     // {{{ displayResetRow()
  890.  
  891.     /**
  892.      * Prints a reset button inside a table row
  893.      *
  894.      * NOTE: Unusual parameter order.
  895.      *
  896.      * @param string $title     a string that appears on the button
  897.      * @param string $attr      a string of additional attributes to be put
  898.      *                            in the element (example: 'id="foo"')
  899.      * @param string $thattr    a string of additional attributes to be put
  900.      *                            in the <th> element (example: 'class="foo"')
  901.      * @param string $tdattr    a string of additional attributes to be put
  902.      *                            in the <td> element (example: 'class="foo"')
  903.      * @return void 
  904.      *
  905.      * @access public
  906.      * @static
  907.      * @see HTML_Form::displayReset(), HTML_Form::addReset(),
  908.      *       HTML_Form::returnReset(), HTML_Form::returnResetRow()
  909.      */
  910.     function displayResetRow($title 'Clear contents'$attr '',
  911.                              $thattr 'align="right"'$tdattr '')
  912.     {
  913.         print HTML_Form::returnResetRow($title$attr$thattr$tdattr);
  914.     }
  915.  
  916.     // }}}
  917.     // {{{ displaySelect()
  918.  
  919.     /**
  920.      * Prints a select list
  921.      *
  922.      * @param string $name      the string used in the 'name' attribute
  923.      * @param array  $entries   an array containing the <options> to be listed.
  924.      *                            The array's keys become the option values and
  925.      *                            the array's values become the visible text.
  926.      * @param mixed  $default   a default value for the element
  927.      * @param int    $size      an integer saying how many rows should be
  928.      * @param string $blank     if this string is present, an <option> will be
  929.      *                            added to the top of the list that will contain
  930.      *                            the given text in the visible portion and an
  931.      *                            empty string as the value
  932.      * @param bool   $multiple  a bool saying if multiple choices are allowed
  933.      * @param string $attr      a string of additional attributes to be put
  934.      *                            in the element (example: 'id="foo"')
  935.      * @return void 
  936.      *
  937.      * @access public
  938.      * @static
  939.      * @see HTML_Form::displaySelectRow(), HTML_Form::addSelect(),
  940.      *       HTML_Form::returnSelect(), HTML_Form::returnSelectRow()
  941.      */
  942.     function displaySelect($name$entries$default ''$size = 1,
  943.                            $blank ''$multiple = false$attr '')
  944.     {
  945.         print HTML_Form::returnSelect($name$entries$default$size,
  946.                                       $blank$multiple$attr);
  947.     }
  948.  
  949.     // }}}
  950.     // {{{ displaySelectRow()
  951.  
  952.     /**
  953.      * Prints a select list inside a table row
  954.      *
  955.      * @param string $name      the string used in the 'name' attribute
  956.      * @param string $title     the string used as the label
  957.      * @param array  $entries   an array containing the <options> to be listed.
  958.      *                            The array's keys become the option values and
  959.      *                            the array's values become the visible text.
  960.      * @param mixed  $default   a default value for the element
  961.      * @param int    $size      an integer saying how many rows should be
  962.      * @param string $blank     if this string is present, an <option> will be
  963.      *                            added to the top of the list that will contain
  964.      *                            the given text in the visible portion and an
  965.      *                            empty string as the value
  966.      * @param bool   $multiple  a bool saying if multiple choices are allowed
  967.      * @param string $attr      a string of additional attributes to be put
  968.      *                            in the element (example: 'id="foo"')
  969.      * @param string $thattr    a string of additional attributes to be put
  970.      *                            in the <th> element (example: 'class="foo"')
  971.      * @param string $tdattr    a string of additional attributes to be put
  972.      *                            in the <td> element (example: 'class="foo"')
  973.      * @return void 
  974.      *
  975.      * @access public
  976.      * @static
  977.      * @see HTML_Form::displaySelect(), HTML_Form::addSelect(),
  978.      *       HTML_Form::returnSelect(), HTML_Form::returnSelectRow()
  979.      */
  980.     function displaySelectRow($name$title$entries$default '',
  981.                               $size = 1$blank ''$multiple = false,
  982.                               $attr ''$thattr 'align="right"'$tdattr '')
  983.     {
  984.         print HTML_Form::returnSelectRow($name$title$entries$default,
  985.                                          $size$blank$multiple$attr,
  986.                                          $thattr$tdattr);
  987.     }
  988.  
  989.     // }}}
  990.     // {{{ displayImage()
  991.  
  992.     /**
  993.      * Prints an image input
  994.      *
  995.      * @param string $name      the string used in the 'name' attribute
  996.      * @param string $src       the string denoting the path to the image.
  997.      *                            Can be a relative path or full URI.
  998.      * @param string $attr      a string of additional attributes to be put
  999.      *                            in the element (example: 'id="foo"')
  1000.      * @return void 
  1001.      *
  1002.      * @access public
  1003.      * @static
  1004.      * @see HTML_Form::displayImageRow(), HTML_Form::addImage(),
  1005.      *       HTML_Form::returnImage(), HTML_Form::returnImageRow()
  1006.      * @since Method available since Release 1.1.0
  1007.      */
  1008.     function displayImage($name$src$attr '')
  1009.     {
  1010.         print HTML_Form::returnImage($name$src$attr);
  1011.     }
  1012.  
  1013.     // }}}
  1014.     // {{{ displayImageRow()
  1015.  
  1016.     /**
  1017.      * Prints an image input inside a table row
  1018.      *
  1019.      * @param string $name      the string used in the 'name' attribute
  1020.      * @param string $title     the string used as the label
  1021.      * @param string $src       the string denoting the path to the image.
  1022.      *                            Can be a relative path or full URI.
  1023.      * @param string $attr      a string of additional attributes to be put
  1024.      *                            in the element (example: 'id="foo"')
  1025.      * @param string $thattr    a string of additional attributes to be put
  1026.      *                            in the <th> element (example: 'class="foo"')
  1027.      * @param string $tdattr    a string of additional attributes to be put
  1028.      *                            in the <td> element (example: 'class="foo"')
  1029.      * @return void 
  1030.      *
  1031.      * @access public
  1032.      * @static
  1033.      * @see HTML_Form::displayImage(), HTML_Form::addImage(),
  1034.      *       HTML_Form::returnImage(), HTML_Form::returnImageRow()
  1035.      * @since Method available since Release 1.1.0
  1036.      */
  1037.     function displayImageRow($name$title$src$attr '',
  1038.                              $thattr 'align="right"'$tdattr '')
  1039.     {
  1040.         print HTML_Form::returnImageRow($name$title$src$attr$thattr,
  1041.                                         $tdattr);
  1042.     }
  1043.  
  1044.     // }}}
  1045.     // {{{ displayHidden()
  1046.  
  1047.     /**
  1048.      * Prints a hiden input
  1049.      *
  1050.      * @param string $name      the string used in the 'name' attribute
  1051.      * @param string $value     the string used for the item's value
  1052.      * @param string $attr      a string of additional attributes to be put
  1053.      *                            in the element (example: 'id="foo"')
  1054.      * @return void 
  1055.      *
  1056.      * @access public
  1057.      * @static
  1058.      * @see HTML_Form::returnHidden(), HTML_Form::addHidden()
  1059.      */
  1060.     function displayHidden($name$value$attr '')
  1061.     {
  1062.         print HTML_Form::returnHidden($name$value$attr);
  1063.     }
  1064.  
  1065.     // }}}
  1066.  
  1067.     // assuming that $default is the 'checked' attribut of the radio tag
  1068.  
  1069.     // {{{ displayRadio()
  1070.  
  1071.     /**
  1072.      * Prints a radio input
  1073.      *
  1074.      * @param string $name      the string used in the 'name' attribute
  1075.      * @param string $value     the string used for the item's value
  1076.      * @param bool   $default   a bool indicating if item should be checked
  1077.      * @param string $attr      a string of additional attributes to be put
  1078.      *                            in the element (example: 'id="foo"')
  1079.      * @return void 
  1080.      *
  1081.      * @access public
  1082.      * @static
  1083.      * @see HTML_Form::displayRadioRow(), HTML_Form::addRadio(),
  1084.      *       HTML_Form::returnRadio(), HTML_Form::returnRadioRow()
  1085.      */
  1086.     function displayRadio($name$value$default = false$attr '')
  1087.     {
  1088.         print HTML_Form::returnRadio($name$value$default$attr);
  1089.     }
  1090.  
  1091.     // }}}
  1092.     // {{{ displayRadioRow()
  1093.  
  1094.     /**
  1095.      * Prints a radio input inside a table row
  1096.      *
  1097.      * @param string $name      the string used in the 'name' attribute
  1098.      * @param string $title     the string used as the label
  1099.      * @param string $value     the string used for the item's value
  1100.      * @param bool   $default   a bool indicating if item should be checked
  1101.      * @param string $attr      a string of additional attributes to be put
  1102.      *                            in the element (example: 'id="foo"')
  1103.      * @param string $thattr    a string of additional attributes to be put
  1104.      *                            in the <th> element (example: 'class="foo"')
  1105.      * @param string $tdattr    a string of additional attributes to be put
  1106.      *                            in the <td> element (example: 'class="foo"')
  1107.      * @return void 
  1108.      *
  1109.      * @access public
  1110.      * @static
  1111.      * @see HTML_Form::displayRadio(), HTML_Form::addRadio(),
  1112.      *       HTML_Form::returnRadio(), HTML_Form::returnRadioRow()
  1113.      */
  1114.     function displayRadioRow($name$title$value$default = false,
  1115.                              $attr ''$thattr 'align="right"'$tdattr '')
  1116.     {
  1117.         print HTML_Form::returnRadioRow($name$title$value$default,
  1118.                                         $attr$thattr$tdattr);
  1119.     }
  1120.  
  1121.     // }}}
  1122.     // {{{ displayBlank()
  1123.  
  1124.     /**
  1125.      * Prints &nbsp;
  1126.      *
  1127.      * @return void 
  1128.      *
  1129.      * @access public
  1130.      * @static
  1131.      * @see HTML_Form::displayBlankRow(), HTML_Form::addBlank(),
  1132.      *       HTML_Form::returnBlank(), HTML_Form::returnBlankRow()
  1133.      */
  1134.     function displayBlank()
  1135.     {
  1136.         print HTML_Form::returnBlank();
  1137.     }
  1138.  
  1139.     // }}}
  1140.     // {{{ displayBlankRow()
  1141.  
  1142.     /**
  1143.      * Prints a blank row in the table
  1144.      *
  1145.      * @param int    $i         the number of rows to create.  Ignored if
  1146.      *                            $title is used.
  1147.      * @param string $title     a string to be used as the label for the row
  1148.      * @param string $thattr    a string of additional attributes to be put
  1149.      *                            in the <th> element (example: 'class="foo"')
  1150.      * @param string $tdattr    a string of additional attributes to be put
  1151.      *                            in the <td> element (example: 'class="foo"')
  1152.      * @return void 
  1153.      *
  1154.      * @access public
  1155.      * @static
  1156.      * @see HTML_Form::displayBlank(), HTML_Form::addBlank(),
  1157.      *       HTML_Form::returnBlank(), HTML_Form::returnBlankRow()
  1158.      */
  1159.     function displayBlankRow($i$title''$thattr 'align="right"',
  1160.                              $tdattr '')
  1161.     {
  1162.         print HTML_Form::returnBlankRow($i$title$thattr$tdattr);
  1163.     }
  1164.  
  1165.     // }}}
  1166.     // {{{ displayFile()
  1167.  
  1168.     /**
  1169.      * Prints a file upload input
  1170.      *
  1171.      * @param string $name      the string used in the 'name' attribute
  1172.      * @param int    $maxsize   an integer determining how large (in bytes) a
  1173.      *                            submitted file can be.
  1174.      * @param int    $size      an integer used in the 'size' attribute
  1175.      * @param string $accept    a string saying which MIME types are allowed
  1176.      * @param string $attr      a string of additional attributes to be put
  1177.      *                            in the element (example: 'id="foo"')
  1178.      * @return void 
  1179.      *
  1180.      * @access public
  1181.      * @static
  1182.      * @see HTML_Form::displayFileRow(), HTML_Form::addFile(),
  1183.      *       HTML_Form::returnFile(), HTML_Form::returnFileRow(),
  1184.      *       HTML_Form::returnMultipleFiles()
  1185.      */
  1186.     function displayFile($name$maxsize = HTML_FORM_MAX_FILE_SIZE,
  1187.                          $size = HTML_FORM_TEXT_SIZE$accept '',
  1188.                          $attr '')
  1189.     {
  1190.         print HTML_Form::returnFile($name$maxsize$size$accept$attr);
  1191.     }
  1192.  
  1193.     // }}}
  1194.     // {{{ displayFileRow()
  1195.  
  1196.     /**
  1197.      * Prints a file upload input inside a table row
  1198.      *
  1199.      * @param string $name      the string used in the 'name' attribute
  1200.      * @param string $title     the string used as the label
  1201.      * @param int    $maxsize   an integer determining how large (in bytes) a
  1202.      *                            submitted file can be.
  1203.      * @param int    $size      an integer used in the 'size' attribute
  1204.      * @param string $accept    a string saying which MIME types are allowed
  1205.      * @param string $attr      a string of additional attributes to be put
  1206.      *                            in the element (example: 'id="foo"')
  1207.      * @param string $thattr    a string of additional attributes to be put
  1208.      *                            in the <th> element (example: 'class="foo"')
  1209.      * @param string $tdattr    a string of additional attributes to be put
  1210.      *                            in the <td> element (example: 'class="foo"')
  1211.      * @return void 
  1212.      *
  1213.      * @access public
  1214.      * @static
  1215.      * @see HTML_Form::displayFile(), HTML_Form::addFile(),
  1216.      *       HTML_Form::returnFile(), HTML_Form::returnFileRow(),
  1217.      *       HTML_Form::returnMultipleFiles()
  1218.      */
  1219.     function displayFileRow($name$title$maxsize = HTML_FORM_MAX_FILE_SIZE,
  1220.                             $size = HTML_FORM_TEXT_SIZE$accept '',
  1221.                             $attr ''$thattr 'align="right"'$tdattr '')
  1222.     {
  1223.         print HTML_Form::returnFileRow($name$title$maxsize,
  1224.                                        $size$accept$attr$thattr$tdattr);
  1225.     }
  1226.  
  1227.     // }}}
  1228.     // {{{ displayPlaintext()
  1229.  
  1230.     /**
  1231.      * Prints the text provided
  1232.      *
  1233.      * @param string $text      a string to be displayed
  1234.      *
  1235.      * @return void 
  1236.      *
  1237.      * @access public
  1238.      * @static
  1239.      * @see HTML_Form::displayPlaintextRow(), HTML_Form::addPlaintext(),
  1240.      *       HTML_Form::returnPlaintext(), HTML_Form::returnPlaintextRow()
  1241.      */
  1242.     function displayPlaintext($text '&nbsp;')
  1243.     {
  1244.         print $text;
  1245.     }
  1246.  
  1247.     // }}}
  1248.     // {{{ displayPlaintextRow()
  1249.  
  1250.     /**
  1251.      * Prints the text provided inside a table row
  1252.      *
  1253.      * @param string $title     the string used as the label
  1254.      * @param string $text      a string to be displayed
  1255.      * @param string $thattr    a string of additional attributes to be put
  1256.      *                            in the <th> element (example: 'class="foo"')
  1257.      * @param string $tdattr    a string of additional attributes to be put
  1258.      *                            in the <td> element (example: 'class="foo"')
  1259.      * @return void 
  1260.      *
  1261.      * @access public
  1262.      * @static
  1263.      * @see HTML_Form::displayPlaintext(), HTML_Form::addPlaintext(),
  1264.      *       HTML_Form::returnPlaintext(), HTML_Form::returnPlaintextRow()
  1265.      */
  1266.     function displayPlaintextRow($title$text '&nbsp;',
  1267.                                  $thattr 'align="right valign="top""',
  1268.                                  $tdattr '')
  1269.     {
  1270.         print HTML_Form::returnPlaintextRow($title$text$thattr$tdattr);
  1271.     }
  1272.  
  1273.  
  1274.     // ===========  RETURN  ===========
  1275.  
  1276.     // }}}
  1277.     // {{{ returnText()
  1278.  
  1279.     /**
  1280.      * Produce a string containing a text input
  1281.      *
  1282.      * @param string $name      the string used in the 'name' attribute
  1283.      * @param mixed  $default   a default value for the element
  1284.      * @param int    $size      an integer used in the 'size' attribute
  1285.      * @param int    $maxlength an integer used in the 'maxlength' attribute
  1286.      * @param string $attr      a string of additional attributes to be put
  1287.      *                            in the element (example: 'id="foo"')
  1288.      * @return string 
  1289.      *
  1290.      * @access public
  1291.      * @static
  1292.      * @see HTML_Form::displayText(), HTML_Form::displayTextRow(),
  1293.      *       HTML_Form::returnTextRow(), HTML_Form::addText()
  1294.      */
  1295.     function returnText($name$default ''$size = HTML_FORM_TEXT_SIZE,
  1296.                         $maxlength = 0$attr '')
  1297.     {
  1298.         $str  '<input type="text" name="' $name '" ';
  1299.         $str .= 'size="' $size '" value="' $default '" ';
  1300.         if ($maxlength{
  1301.             $str .= 'maxlength="' $maxlength'" ';
  1302.         }
  1303.         return $str $attr "/>\n";
  1304.     }
  1305.  
  1306.     // }}}
  1307.     // {{{ returnTextRow()
  1308.  
  1309.     /**
  1310.      * Produce a string containing a text input inside a table row
  1311.      *
  1312.      * @param string $name      the string used in the 'name' attribute
  1313.      * @param string $title     the string used as the label
  1314.      * @param mixed  $default   a default value for the element
  1315.      * @param int    $size      an integer used in the 'size' attribute
  1316.      * @param int    $maxlength an integer used in the 'maxlength' attribute
  1317.      * @param string $attr      a string of additional attributes to be put
  1318.      *                            in the element (example: 'id="foo"')
  1319.      * @param string $thattr    a string of additional attributes to be put
  1320.      *                            in the <th> element (example: 'class="foo"')
  1321.      * @param string $tdattr    a string of additional attributes to be put
  1322.      *                            in the <td> element (example: 'class="foo"')
  1323.      * @return string 
  1324.      *
  1325.      * @access public
  1326.      * @static
  1327.      * @see HTML_Form::displayText(), HTML_Form::displayTextRow(),
  1328.      *       HTML_Form::returnText(), HTML_Form::addText()
  1329.      */
  1330.     function returnTextRow($name$title$default '',
  1331.                            $size = HTML_FORM_TEXT_SIZE$maxlength = 0,
  1332.                            $attr ''$thattr 'align="right"'$tdattr '')
  1333.     {
  1334.         $str  " <tr>\n";
  1335.         $str .= '  <th ' $thattr '>' $title "</th>\n";
  1336.         $str .= '  <td ' $tdattr ">\n   ";
  1337.         $str .= HTML_Form::returnText($name$default$size$maxlength,
  1338.                                       $attr);
  1339.         $str .= "  </td>\n";
  1340.         $str .= " </tr>\n";
  1341.  
  1342.         return $str;
  1343.     }
  1344.  
  1345.     // }}}
  1346.     // {{{ returnPassword()
  1347.  
  1348.     /**
  1349.      * Produce a string containing a password input
  1350.      *
  1351.      * @param string $name      the string used in the 'name' attribute
  1352.      * @param mixed  $default   a default value for the element
  1353.      * @param int    $size      an integer used in the 'size' attribute
  1354.      * @param int    $maxlength an integer used in the 'maxlength' attribute
  1355.      * @param string $attr      a string of additional attributes to be put
  1356.      *                            in the element (example: 'id="foo"')
  1357.      * @return string 
  1358.      *
  1359.      * @access public
  1360.      * @static
  1361.      * @see HTML_Form::displayPassword(), HTML_Form::displayPasswordRow(),
  1362.      *       HTML_Form::returnPasswordRow(), HTML_Form::addPassword()
  1363.      */
  1364.     function returnPassword($name$default '',
  1365.                             $size = HTML_FORM_PASSWD_SIZE,
  1366.                             $maxlength = 0$attr '')
  1367.     {
  1368.         $str  '<input type="password" name="' $name '" ';
  1369.         $str .= 'size="' $size '" value="' $default '" ';
  1370.         if ($maxlength{
  1371.             $str .= 'maxlength="' $maxlength'" ';
  1372.         }
  1373.         return $str $attr "/>\n";
  1374.     }
  1375.  
  1376.     // }}}
  1377.     // {{{ returnPasswordRow()
  1378.  
  1379.     /**
  1380.      * Produce a string containing a combined password input and password
  1381.      * confirmation input inside a table row
  1382.      *
  1383.      * @param string $name      the string used in the 'name' attribute
  1384.      * @param string $title     the string used as the label
  1385.      * @param mixed  $default   a default value for the element
  1386.      * @param int    $size      an integer used in the 'size' attribute
  1387.      * @param int    $maxlength an integer used in the 'maxlength' attribute
  1388.      * @param string $attr      a string of additional attributes to be put
  1389.      *                            in the element (example: 'id="foo"')
  1390.      * @param string $thattr    a string of additional attributes to be put
  1391.      *                            in the <th> element (example: 'class="foo"')
  1392.      * @param string $tdattr    a string of additional attributes to be put
  1393.      *                            in the <td> element (example: 'class="foo"')
  1394.      * @return string 
  1395.      *
  1396.      * @access public
  1397.      * @static
  1398.      * @see HTML_Form::displayPassword(), HTML_Form::displayPasswordRow(),
  1399.      *       HTML_Form::returnPassword(), HTML_Form::addPassword()
  1400.      */
  1401.     function returnPasswordRow($name$title$default '',
  1402.                                $size = HTML_FORM_PASSWD_SIZE,
  1403.                                $maxlength = 0$attr '',
  1404.                                $thattr 'align="right"'$tdattr '')
  1405.     {
  1406.         $str  " <tr>\n";
  1407.         $str .= '  <th ' $thattr '>' $title "</th>\n";
  1408.         $str .= '  <td ' $tdattr ">\n   ";
  1409.         $str .= HTML_Form::returnPassword($name$default$size,
  1410.                                           $maxlength$attr);
  1411.         $str .= "   repeat: ";
  1412.         $str .= HTML_Form::returnPassword($name.'2'$default$size,
  1413.                                           $maxlength$attr);
  1414.         $str .= "  </td>\n";
  1415.         $str .= " </tr>\n";
  1416.  
  1417.         return $str;
  1418.     }
  1419.  
  1420.     // }}}
  1421.     // {{{ returnCheckbox()
  1422.  
  1423.     /**
  1424.      * Produce a string containing a checkbox input
  1425.      *
  1426.      * @param string $name      the string used in the 'name' attribute
  1427.      * @param bool   $default   a bool indicating if item should be checked
  1428.      * @param string $attr      a string of additional attributes to be put
  1429.      *                            in the element (example: 'id="foo"')
  1430.      * @return string 
  1431.      *
  1432.      * @access public
  1433.      * @static
  1434.      * @see HTML_Form::displayCheckbox(), HTML_Form::displayCheckboxRow(),
  1435.      *       HTML_Form::returnCheckboxRow(), HTML_Form::addCheckbox()
  1436.      */
  1437.     function returnCheckbox($name$default = false$attr '')
  1438.     {
  1439.         $str = "<input type=\"checkbox\" name=\"$name\"";
  1440.         if ($default && $default !== 'off'{
  1441.             $str .= ' checked="checked"';
  1442.         }
  1443.         return $str ' ' $attr "/>\n";
  1444.     }
  1445.  
  1446.     // }}}
  1447.     // {{{ returnCheckboxRow()
  1448.  
  1449.     /**
  1450.      * Produce a string containing a checkbox input inside a table row
  1451.      *
  1452.      * @param string $name      the string used in the 'name' attribute
  1453.      * @param string $title     the string used as the label
  1454.      * @param bool   $default   a bool indicating if item should be checked
  1455.      * @param string $attr      a string of additional attributes to be put
  1456.      *                            in the element (example: 'id="foo"')
  1457.      * @param string $thattr    a string of additional attributes to be put
  1458.      *                            in the <th> element (example: 'class="foo"')
  1459.      * @param string $tdattr    a string of additional attributes to be put
  1460.      *                            in the <td> element (example: 'class="foo"')
  1461.      * @return string 
  1462.      *
  1463.      * @access public
  1464.      * @static
  1465.      * @see HTML_Form::displayCheckbox(), HTML_Form::displayCheckboxRow(),
  1466.      *       HTML_Form::returnCheckbox(), HTML_Form::addCheckbox()
  1467.      */
  1468.     function returnCheckboxRow($name$title$default = false$attr '',
  1469.                                $thattr 'align="right"'$tdattr '')
  1470.     {
  1471.         $str  " <tr>\n";
  1472.         $str .= '  <th ' $thattr '>' $title "</th>\n";
  1473.         $str .= '  <td ' $tdattr ">\n   ";
  1474.         $str .= HTML_Form::returnCheckbox($name$default$attr);
  1475.         $str .= "  </td>\n";
  1476.         $str .= " </tr>\n";
  1477.  
  1478.         return $str;
  1479.     }
  1480.  
  1481.     // }}}
  1482.     // {{{ returnTextarea()
  1483.  
  1484.     /**
  1485.      * Produce a string containing a textarea input
  1486.      *
  1487.      * @param string $name      the string used in the 'name' attribute
  1488.      * @param mixed  $default   a default value for the element
  1489.      * @param int    $width     an integer saying how many characters wide
  1490.      *                            the item should be
  1491.      * @param int    $height    an integer saying how many rows tall the
  1492.      *                            item should be
  1493.      * @param int    $maxlength an integer used in the 'maxlength' attribute
  1494.      * @param string $attr      a string of additional attributes to be put
  1495.      *                            in the element (example: 'id="foo"')
  1496.      * @return string 
  1497.      *
  1498.      * @access public
  1499.      * @static
  1500.      * @see HTML_Form::displayTextarea(), HTML_Form::displayTextareaRow(),
  1501.      *       HTML_Form::returnTextareaRow(), HTML_Form::addTextarea()
  1502.      */
  1503.     function returnTextarea($name$default ''$width = 40$height = 5,
  1504.                             $maxlength = 0$attr '')
  1505.     {
  1506.         $str  '<textarea name="' $name '" cols="' $width '"';
  1507.         $str .= ' rows="' $height '" ';
  1508.         if ($maxlength{
  1509.             $str .= 'maxlength="' $maxlength'" ';
  1510.         }
  1511.         $str .=  $attr '>';
  1512.         $str .= $default;
  1513.         $str .= "</textarea>\n";
  1514.  
  1515.         return $str;
  1516.     }
  1517.  
  1518.     // }}}
  1519.     // {{{ returnTextareaRow()
  1520.  
  1521.     /**
  1522.      * Produce a string containing a textarea input inside a table row
  1523.      *
  1524.      * @param string $name      the string used in the 'name' attribute
  1525.      * @param string $title     the string used as the label
  1526.      * @param mixed  $default   a default value for the element
  1527.      * @param int    $width     an integer saying how many characters wide
  1528.      *                            the item should be
  1529.      * @param int    $height    an integer saying how many rows tall the
  1530.      *                            item should be
  1531.      * @param int    $maxlength an integer used in the 'maxlength' attribute
  1532.      * @param string $attr      a string of additional attributes to be put
  1533.      *                            in the element (example: 'id="foo"')
  1534.      * @param string $thattr    a string of additional attributes to be put
  1535.      *                            in the <th> element (example: 'class="foo"')
  1536.      * @param string $tdattr    a string of additional attributes to be put
  1537.      *                            in the <td> element (example: 'class="foo"')
  1538.      * @return string 
  1539.      *
  1540.      * @access public
  1541.      * @static
  1542.      * @see HTML_Form::displayTextarea(), HTML_Form::displayTextareaRow(),
  1543.      *       HTML_Form::returnTextareaRow(), HTML_Form::addTextarea()
  1544.      */
  1545.     function returnTextareaRow($name$title$default ''$width = 40,
  1546.                                $height = 5$maxlength = 0$attr '',
  1547.                                $thattr 'align="right"'$tdattr '')
  1548.     {
  1549.         $str  " <tr>\n";
  1550.         $str .= '  <th ' $thattr '>' $title "</th>\n";
  1551.         $str .= '  <td ' $tdattr ">\n   ";
  1552.         $str .= HTML_Form::returnTextarea($name$default$width$height,
  1553.                                       $maxlength$attr);
  1554.         $str .= "  </td>\n";
  1555.         $str .= " </tr>\n";
  1556.  
  1557.         return $str;
  1558.     }
  1559.  
  1560.     // }}}
  1561.     // {{{ returnSubmit()
  1562.  
  1563.     /**
  1564.      * Produce a string containing a submit button
  1565.      *
  1566.      * NOTE: Unusual parameter order.
  1567.      *
  1568.      * @param string $title     a string that appears on the button
  1569.      * @param string $name      a string used in the 'name' attribute
  1570.      * @param string $attr      a string of additional attributes to be put
  1571.      *                            in the element (example: 'id="foo"')
  1572.      * @return string 
  1573.      *
  1574.      * @access public
  1575.      * @static
  1576.      * @see HTML_Form::displaySubmit(), HTML_Form::displaySubmitRow(),
  1577.      *       HTML_Form::returnSubmitRow(), HTML_Form::addSubmit()
  1578.      */
  1579.     function returnSubmit($title 'Submit Changes'$name 'submit',
  1580.                           $attr '')
  1581.     {
  1582.         return '<input type="submit" name="' $name '"'
  1583.                . ' value="' $title '" ' $attr "/>\n";
  1584.     }
  1585.  
  1586.     // }}}
  1587.     // {{{ returnSubmitRow()
  1588.  
  1589.     /**
  1590.      * Produce a string containing a submit button inside a table row
  1591.      *
  1592.      * @param string $name      a string used in the 'name' attribute
  1593.      * @param string $title     a string that appears on the button
  1594.      * @param string $attr      a string of additional attributes to be put
  1595.      *                            in the element (example: 'id="foo"')
  1596.      * @param string $thattr    a string of additional attributes to be put
  1597.      *                            in the <th> element (example: 'class="foo"')
  1598.      * @param string $tdattr    a string of additional attributes to be put
  1599.      *                            in the <td> element (example: 'class="foo"')
  1600.      * @return string 
  1601.      *
  1602.      * @access public
  1603.      * @static
  1604.      * @see HTML_Form::displaySubmit(), HTML_Form::displaySubmitRow(),
  1605.      *       HTML_Form::returnSubmit(), HTML_Form::addSubmit()
  1606.      */
  1607.     function returnSubmitRow($name 'submit'$title 'Submit Changes',
  1608.                              $attr ''$thattr 'align="right"'$tdattr '')
  1609.     {
  1610.         $str  " <tr>\n";
  1611.         $str .= '  <th ' $thattr ">&nbsp;</td>\n";
  1612.         $str .= '  <td ' $tdattr ">\n   ";
  1613.         $str .= HTML_Form::returnSubmit($title$name$attr);
  1614.         $str .= "  </td>\n";
  1615.         $str .= " </tr>\n";
  1616.  
  1617.         return $str;
  1618.     }
  1619.  
  1620.     // }}}
  1621.     // {{{ returnReset()
  1622.  
  1623.     /**
  1624.      * Produce a string containing a reset button
  1625.      *
  1626.      * NOTE: Unusual parameter order.
  1627.      *
  1628.      * @param string $title     a string that appears on the button
  1629.      * @param string $attr      a string of additional attributes to be put
  1630.      *                            in the element (example: 'id="foo"')
  1631.      * @return string 
  1632.      *
  1633.      * @access public
  1634.      * @static
  1635.      * @see HTML_Form::displayReset(), HTML_Form::displayResetRow(),
  1636.      *       HTML_Form::returnResetRow(), HTML_Form::addReset()
  1637.      */
  1638.     function returnReset($title 'Clear contents'$attr '')
  1639.     {
  1640.         return '<input type="reset"'
  1641.                . ' value="' $title '" ' $attr "/>\n";
  1642.     }
  1643.  
  1644.     // }}}
  1645.     // {{{ returnResetRow()
  1646.  
  1647.     /**
  1648.      * Produce a string containing a reset button inside a table row
  1649.      *
  1650.      * NOTE: Unusual parameter order.
  1651.      *
  1652.      * @param string $title     a string that appears on the button
  1653.      * @param string $attr      a string of additional attributes to be put
  1654.      *                            in the element (example: 'id="foo"')
  1655.      * @param string $thattr    a string of additional attributes to be put
  1656.      *                            in the <th> element (example: 'class="foo"')
  1657.      * @param string $tdattr    a string of additional attributes to be put
  1658.      *                            in the <td> element (example: 'class="foo"')
  1659.      * @return string 
  1660.      *
  1661.      * @access public
  1662.      * @static
  1663.      * @see HTML_Form::displayReset(), HTML_Form::displayResetRow(),
  1664.      *       HTML_Form::returnReset(), HTML_Form::addReset()
  1665.      */
  1666.     function returnResetRow($title 'Clear contents'$attr '',
  1667.                             $thattr 'align="right"'$tdattr '')
  1668.     {
  1669.         $str  " <tr>\n";
  1670.         $str .= '  <th ' $thattr ">&nbsp;</td>\n";
  1671.         $str .= '  <td ' $tdattr ">\n   ";
  1672.         $str .= HTML_Form::returnReset($title$attr);
  1673.         $str .= "  </td>\n";
  1674.         $str .= " </tr>\n";
  1675.  
  1676.         return $str;
  1677.     }
  1678.  
  1679.     // }}}
  1680.     // {{{ returnSelect()
  1681.  
  1682.     /**
  1683.      * Produce a string containing a select list
  1684.      *
  1685.      * @param string $name      the string used in the 'name' attribute
  1686.      * @param array  $entries   an array containing the <options> to be listed.
  1687.      *                            The array's keys become the option values and
  1688.      *                            the array's values become the visible text.
  1689.      * @param mixed  $default   a default value for the element
  1690.      * @param int    $size      an integer saying how many rows should be
  1691.      * @param string $blank     if this string is present, an <option> will be
  1692.      *                            added to the top of the list that will contain
  1693.      *                            the given text in the visible portion and an
  1694.      *                            empty string as the value
  1695.      * @param bool   $multiple  a bool saying if multiple choices are allowed
  1696.      * @param string $attr      a string of additional attributes to be put
  1697.      *                            in the element (example: 'id="foo"')
  1698.      * @return string 
  1699.      *
  1700.      * @access public
  1701.      * @static
  1702.      * @see HTML_Form::displaySelect(), HTML_Form::displaySelectRow(),
  1703.      *       HTML_Form::returnSelectRow(), HTML_Form::addSelect()
  1704.      */
  1705.     function returnSelect($name$entries$default ''$size = 1,
  1706.                           $blank ''$multiple = false$attr '')
  1707.     {
  1708.         if ($multiple && substr($name-2!= '[]'{
  1709.             $name .= '[]';
  1710.         }
  1711.         $str '   <select name="' $name '"';
  1712.         if ($size{
  1713.             $str .= ' size="' $size '"';
  1714.         }
  1715.         if ($multiple{
  1716.             $str .= ' multiple="multiple"';
  1717.         }
  1718.         $str .= ' ' $attr ">\n";
  1719.         if ($blank{
  1720.             $str .= '    <option value="">' $blank '</option>' "\n";
  1721.         }
  1722.  
  1723.         foreach ($entries as $val => $text{
  1724.             $str .= '    <option ';
  1725.                 if ($default{
  1726.                     if ($multiple && is_array($default)) {
  1727.                         if ((is_string(key($default)) && $default[$val]||
  1728.                             (is_int(key($default)) && in_array($val$default))) {
  1729.                             $str .= 'selected="selected" ';
  1730.                         }
  1731.                     elseif ($default == $val{
  1732.                         $str .= 'selected="selected" ';
  1733.                     }
  1734.                 }
  1735.             $str .= 'value="' $val '">' $text "</option>\n";
  1736.         }
  1737.         $str .= "   </select>\n";
  1738.  
  1739.         return $str;
  1740.     }
  1741.  
  1742.     // }}}
  1743.     // {{{ returnSelectRow()
  1744.  
  1745.     /**
  1746.      * Produce a string containing a select list inside a table row
  1747.      *
  1748.      * @param string $name      the string used in the 'name' attribute
  1749.      * @param string $title     the string used as the label
  1750.      * @param array  $entries   an array containing the <options> to be listed.
  1751.      *                            The array's keys become the option values and
  1752.      *                            the array's values become the visible text.
  1753.      * @param mixed  $default   a default value for the element
  1754.      * @param int    $size      an integer saying how many rows should be
  1755.      * @param string $blank     if this string is present, an <option> will be
  1756.      *                            added to the top of the list that will contain
  1757.      *                            the given text in the visible portion and an
  1758.      *                            empty string as the value
  1759.      * @param bool   $multiple  a bool saying if multiple choices are allowed
  1760.      * @param string $attr      a string of additional attributes to be put
  1761.      *                            in the element (example: 'id="foo"')
  1762.      * @param string $thattr    a string of additional attributes to be put
  1763.      *                            in the <th> element (example: 'class="foo"')
  1764.      * @param string $tdattr    a string of additional attributes to be put
  1765.      *                            in the <td> element (example: 'class="foo"')
  1766.      * @return string 
  1767.      *
  1768.      * @access public
  1769.      * @static
  1770.      * @see HTML_Form::displaySelect(), HTML_Form::displaySelectRow(),
  1771.      *       HTML_Form::returnSelect(), HTML_Form::addSelect()
  1772.      */
  1773.     function returnSelectRow($name$title$entries$default ''$size = 1,
  1774.                              $blank ''$multiple = false$attr '',
  1775.                              $thattr 'align="right"'$tdattr '')
  1776.     {
  1777.         $str  " <tr>\n";
  1778.         $str .= '  <th ' $thattr '>' $title "</th>\n";
  1779.         $str .= '  <td ' $tdattr ">\n";
  1780.         $str .= HTML_Form::returnSelect($name$entries$default$size,
  1781.                                         $blank$multiple$attr);
  1782.         $str .= "  </td>\n";
  1783.         $str .= " </tr>\n";
  1784.  
  1785.         return $str;
  1786.     }
  1787.  
  1788.     // }}}
  1789.     // {{{ returnRadio()
  1790.  
  1791.     /**
  1792.      * Produce a string containing a radio input
  1793.      *
  1794.      * @param string $name      the string used in the 'name' attribute
  1795.      * @param string $value     the string used for the item's value
  1796.      * @param bool   $default   a bool indicating if item should be checked
  1797.      * @param string $attr      a string of additional attributes to be put
  1798.      *                            in the element (example: 'id="foo"')
  1799.      * @return string 
  1800.      *
  1801.      * @access public
  1802.      * @static
  1803.      * @see HTML_Form::displayRadio(), HTML_Form::displayRadioRow(),
  1804.      *       HTML_Form::returnRadioRow(), HTML_Form::addRadio()
  1805.      * @since Method available since Release 1.1.0
  1806.      */
  1807.     function returnRadio($name$value$default = false$attr '')
  1808.     {
  1809.         return '<input type="radio" name="' $name '"' .
  1810.                ' value="' $value '"' .
  1811.                ($default ' checked="checked"' ''.
  1812.                ' ' $attr "/>\n";
  1813.     }
  1814.  
  1815.     // }}}
  1816.     // {{{ returnRadioRow()
  1817.  
  1818.     /**
  1819.      * Produce a string containing a radio input inside a table row
  1820.      *
  1821.      * @param string $name      the string used in the 'name' attribute
  1822.      * @param string $title     the string used as the label
  1823.      * @param string $value     the string used for the item's value
  1824.      * @param bool   $default   a bool indicating if item should be checked
  1825.      * @param string $attr      a string of additional attributes to be put
  1826.      *                            in the element (example: 'id="foo"')
  1827.      * @param string $thattr    a string of additional attributes to be put
  1828.      *                            in the <th> element (example: 'class="foo"')
  1829.      * @param string $tdattr    a string of additional attributes to be put
  1830.      *                            in the <td> element (example: 'class="foo"')
  1831.      * @return string 
  1832.      *
  1833.      * @access public
  1834.      * @static
  1835.      * @see HTML_Form::displayRadio(), HTML_Form::displayRadioRow(),
  1836.      *       HTML_Form::returnRadio(), HTML_Form::addRadio()
  1837.      * @since Method available since Release 1.1.0
  1838.      */
  1839.     function returnRadioRow($name$title$value$default = false,
  1840.                             $attr ''$thattr 'align="right"'$tdattr '')
  1841.     {
  1842.         return " <tr>\n" .
  1843.                '  <th ' $thattr '>' $title "</th>\n" .
  1844.                '  <td ' $tdattr ">\n   " .
  1845.                HTML_Form::returnRadio($name$value$default$attr.
  1846.                "  </td>\n" .
  1847.                " </tr>\n";
  1848.     }
  1849.  
  1850.     // }}}
  1851.     // {{{ returnImage()
  1852.  
  1853.     /**
  1854.      * Produce a string containing an image input
  1855.      *
  1856.      * @param string $name      the string used in the 'name' attribute
  1857.      * @param string $src       the string denoting the path to the image.
  1858.      *                            Can be a relative path or full URI.
  1859.      * @param string $attr      a string of additional attributes to be put
  1860.      *                            in the element (example: 'id="foo"')
  1861.      * @return string 
  1862.      *
  1863.      * @access public
  1864.      * @static
  1865.      * @see HTML_Form::displayImage(), HTML_Form::displayImageRow(),
  1866.      *       HTML_Form::returnImageRow(), HTML_Form::addImage()
  1867.      * @since Method available since Release 1.1.0
  1868.      */
  1869.     function returnImage($name$src$attr '')
  1870.     {
  1871.         return '<input type="image" name="' $name '"' .
  1872.                ' src="' $src '" ' $attr "/>\n";
  1873.     }
  1874.  
  1875.     // }}}
  1876.     // {{{ returnImageRow()
  1877.  
  1878.     /**
  1879.      * Produce a string containing an image input inside a table row
  1880.      *
  1881.      * @param string $name      the string used in the 'name' attribute
  1882.      * @param string $title     the string used as the label
  1883.      * @param string $src       the string denoting the path to the image.
  1884.      *                            Can be a relative path or full URI.
  1885.      * @param string $attr      a string of additional attributes to be put
  1886.      *                            in the element (example: 'id="foo"')
  1887.      * @param string $thattr    a string of additional attributes to be put
  1888.      *                            in the <th> element (example: 'class="foo"')
  1889.      * @param string $tdattr    a string of additional attributes to be put
  1890.      *                            in the <td> element (example: 'class="foo"')
  1891.      * @return string 
  1892.      *
  1893.      * @access public
  1894.      * @static
  1895.      * @see HTML_Form::displayImage(), HTML_Form::displayImageRow(),
  1896.      *       HTML_Form::returnImage(), HTML_Form::addImage()
  1897.      * @since Method available since Release 1.1.0
  1898.      */
  1899.     function returnImageRow($name$title$src$attr '',
  1900.                             $thattr 'align="right"'$tdattr '')
  1901.     {
  1902.         return " <tr>\n" .
  1903.                '  <th ' $thattr '>' $title "</th>\n" .
  1904.                '  <td ' $tdattr ">\n   " .
  1905.                HTML_Form::returnImage($name$src$attr.
  1906.                "  </td>\n" .
  1907.                " </tr>\n";
  1908.     }
  1909.  
  1910.     // }}}
  1911.     // {{{ returnHidden()
  1912.  
  1913.     /**
  1914.      * Produce a string containing a hiden input
  1915.      *
  1916.      * @param string $name      the string used in the 'name' attribute
  1917.      * @param string $value     the string used for the item's value
  1918.      * @param string $attr      a string of additional attributes to be put
  1919.      *                            in the element (example: 'id="foo"')
  1920.      * @return string 
  1921.      *
  1922.      * @access public
  1923.      * @static
  1924.      * @see HTML_Form::displayHidden(), HTML_Form::addHidden()
  1925.      */
  1926.     function returnHidden($name$value$attr '')
  1927.     {
  1928.         return '<input type="hidden" name="' $name '"'
  1929.                . ' value="' $value '" ' $attr "/>\n";
  1930.     }
  1931.  
  1932.     // }}}
  1933.     // {{{ returnBlank()
  1934.  
  1935.     /**
  1936.      * Produce a string containing &nbsp;
  1937.      *
  1938.      * @return string 
  1939.      *
  1940.      * @access public
  1941.      * @static
  1942.      * @see HTML_Form::displayBlank(), HTML_Form::displayBlankRow(),
  1943.      *       HTML_Form::returnBlankRow(), HTML_Form::addBlank()
  1944.      * @since Method available since Release 1.1.0
  1945.      */
  1946.     function returnBlank()
  1947.     {
  1948.         return '&nbsp;';
  1949.     }
  1950.  
  1951.     // }}}
  1952.     // {{{ returnBlankRow()
  1953.  
  1954.     /**
  1955.      * Produce a string containing a blank row in the table
  1956.      *
  1957.      * @param int    $i         the number of rows to create.  Ignored if
  1958.      *                            $title is used.
  1959.      * @param string $title     a string to be used as the label for the row
  1960.      * @param string $thattr    a string of additional attributes to be put
  1961.      *                            in the <th> element (example: 'class="foo"')
  1962.      * @param string $tdattr    a string of additional attributes to be put
  1963.      *                            in the <td> element (example: 'class="foo"')
  1964.      * @return string 
  1965.      *
  1966.      * @access public
  1967.      * @static
  1968.      * @see HTML_Form::displayBlank(), HTML_Form::displayBlankRow(),
  1969.      *       HTML_Form::returnBlank(), HTML_Form::addBlank()
  1970.      * @since Method available since Release 1.1.0
  1971.      */
  1972.     function returnBlankRow($i$title''$thattr 'align="right"',
  1973.                             $tdattr '')
  1974.     {
  1975.         if (!$title{
  1976.             $str '';
  1977.             for ($j = 0; $j $i$j++{
  1978.                 $str .= " <tr>\n";
  1979.                 $str .= '  <th ' $thattr ">&nbsp;</th>\n";
  1980.                 $str .= '  <td ' $tdattr '>' HTML_Form::returnBlank("</td>\n";
  1981.                 $str .= " </tr>\n";
  1982.             }
  1983.             return $str;
  1984.         else {
  1985.             return " <tr>\n" .
  1986.                    '  <th ' $thattr '>' $title "</th>\n" .
  1987.                    '  <td ' $tdattr '>' HTML_Form::returnBlank("</td>\n" .
  1988.                    " </tr>\n";
  1989.         }
  1990.     }
  1991.  
  1992.     // }}}
  1993.     // {{{ returnFile()
  1994.  
  1995.     /**
  1996.      * Produce a string containing a file upload input
  1997.      *
  1998.      * @param string $name      the string used in the 'name' attribute
  1999.      * @param int    $maxsize   an integer determining how large (in bytes) a
  2000.      *                            submitted file can be.
  2001.      * @param int    $size      an integer used in the 'size' attribute
  2002.      * @param string $accept    a string saying which MIME types are allowed
  2003.      * @param string $attr      a string of additional attributes to be put
  2004.      *                            in the element (example: 'id="foo"')
  2005.      * @return string 
  2006.      *
  2007.      * @access public
  2008.      * @static
  2009.      * @see HTML_Form::displayFile(), HTML_Form::displayFileRow(),
  2010.      *       HTML_Form::returnFileRow(), HTML_Form::addFile(),
  2011.      *       HTML_Form::returnMultipleFiles()
  2012.      */
  2013.     function returnFile($name 'userfile',
  2014.                         $maxsize = HTML_FORM_MAX_FILE_SIZE,
  2015.                         $size = HTML_FORM_TEXT_SIZE,
  2016.                         $accept ''$attr '')
  2017.     {
  2018.         $str  '   <input type="hidden" name="MAX_FILE_SIZE" value="';
  2019.         $str .= $maxsize "\" />\n";
  2020.         $str .= '   <input type="file" name="' $name '"';
  2021.         $str .= ' size="' $size '" ';
  2022.         if ($accept{
  2023.             $str .= 'accept="' $accept '" ';
  2024.         }
  2025.         return $str $attr "/>\n";
  2026.     }
  2027.  
  2028.     // }}}
  2029.     // {{{ returnFileRow()
  2030.  
  2031.     /**
  2032.      * Produce a string containing a file upload input inside a table row
  2033.      *
  2034.      * @param string $name      the string used in the 'name' attribute
  2035.      * @param string $title     the string used as the label
  2036.      * @param int    $maxsize   an integer determining how large (in bytes) a
  2037.      *                            submitted file can be.
  2038.      * @param int    $size      an integer used in the 'size' attribute
  2039.      * @param string $accept    a string saying which MIME types are allowed
  2040.      * @param string $attr      a string of additional attributes to be put
  2041.      *                            in the element (example: 'id="foo"')
  2042.      * @param string $thattr    a string of additional attributes to be put
  2043.      *                            in the <th> element (example: 'class="foo"')
  2044.      * @param string $tdattr    a string of additional attributes to be put
  2045.      *                            in the <td> element (example: 'class="foo"')
  2046.      * @return string 
  2047.      *
  2048.      * @access public
  2049.      * @static
  2050.      * @see HTML_Form::displayFile(), HTML_Form::displayFileRow(),
  2051.      *       HTML_Form::returnFile(), HTML_Form::addFile(),
  2052.      *       HTML_Form::returnMultipleFiles()
  2053.      */
  2054.     function returnFileRow($name$title$maxsize = HTML_FORM_MAX_FILE_SIZE,
  2055.                            $size = HTML_FORM_TEXT_SIZE,
  2056.                            $accept ''$attr ''$thattr 'align="right"',
  2057.                            $tdattr '')
  2058.     {
  2059.         $str  " <tr>\n";
  2060.         $str .= '  <th ' $thattr '>' $title "</th>\n";
  2061.         $str .= '  <td ' $tdattr ">\n";
  2062.         $str .= HTML_Form::returnFile($name$maxsize$size$accept,
  2063.                                       $attr);
  2064.         $str .= "  </td>\n";
  2065.         $str .= " </tr>\n";
  2066.  
  2067.         return $str;
  2068.     }
  2069.  
  2070.     // }}}
  2071.     // {{{ returnMultipleFiles()
  2072.  
  2073.     /**
  2074.      * Produce a string containing a file upload input
  2075.      *
  2076.      * @param string $name      the string used in the 'name' attribute
  2077.      * @param int    $maxsize   an integer determining how large (in bytes) a
  2078.      *                            submitted file can be.
  2079.      * @param int    $files     an integer of how many file inputs to show
  2080.      * @param int    $size      an integer used in the 'size' attribute
  2081.      * @param string $accept    a string saying which MIME types are allowed
  2082.      * @param string $attr      a string of additional attributes to be put
  2083.      *                            in the element (example: 'id="foo"')
  2084.      * @return string 
  2085.      *
  2086.      * @access public
  2087.      * @static
  2088.      * @see HTML_Form::displayFile(), HTML_Form::displayFileRow(),
  2089.      *       HTML_Form::returnFile(), HTML_Form::returnFileRow(),
  2090.      *       HTML_Form::addFile()
  2091.      */
  2092.     function returnMultipleFiles($name 'userfile[]',
  2093.                                  $maxsize = HTML_FORM_MAX_FILE_SIZE,
  2094.                                  $files = 3,
  2095.                                  $size = HTML_FORM_TEXT_SIZE,
  2096.                                  $accept ''$attr '')
  2097.     {
  2098.         $str  '<input type="hidden" name="MAX_FILE_SIZE" value="';
  2099.         $str .= $maxsize "\" />\n";
  2100.  
  2101.         for($i=0; $i $files$i++{
  2102.             $str .= '<input type="file" name="' $name '"';
  2103.             $str .= ' size="' $size '" ';
  2104.             if ($accept{
  2105.                 $str .= 'accept="' $accept '" ';
  2106.             }
  2107.             $str .= $attr "/><br />\n";
  2108.         }
  2109.         return $str;
  2110.     }
  2111.  
  2112.     // }}}
  2113.     // {{{ returnStart()
  2114.  
  2115.     /**
  2116.      * Produces a string containing the opening tags for the form and table
  2117.      *
  2118.      * NOTE: can NOT be called statically.
  2119.      *
  2120.      * @param bool $multipartformdata  a bool indicating if the form should
  2121.      *                                   be submitted in multipart format
  2122.      * @return string 
  2123.      *
  2124.      * @access public
  2125.      * @see HTML_Form::display(), HTML_Form::returnEnd(), HTML_Form::start()
  2126.      */
  2127.     function returnStart($multipartformdata = false)
  2128.     {
  2129.         $str "<form action=\"" $this->action . "\" method=\"$this->method\"";
  2130.         if ($this->name{
  2131.             $str .= " name=\"$this->name\"";
  2132.         }
  2133.         if ($this->target{
  2134.             $str .= " target=\"$this->target\"";
  2135.         }
  2136.         if ($this->enctype{
  2137.             $str .= " enctype=\"$this->enctype\"";
  2138.         }
  2139.         if ($multipartformdata{
  2140.             $str .= " enctype=\"multipart/form-data\"";
  2141.         }
  2142.  
  2143.         return $str ' ' $this->attr . ">\n";
  2144.     }
  2145.  
  2146.     // }}}
  2147.     // {{{ returnEnd()
  2148.  
  2149.     /**
  2150.      * Produces a string containing the opening tags for the form and table
  2151.      *
  2152.      * NOTE: can NOT be called statically.
  2153.      *
  2154.      * @return string 
  2155.      *
  2156.      * @access public
  2157.      * @see HTML_Form::display(), HTML_Form::returnStart(), HTML_Form::start()
  2158.      */
  2159.     function returnEnd()
  2160.     {
  2161.         $fields = array();
  2162.         foreach ($this->fields as $i => $data{
  2163.             switch ($data[0]{
  2164.                 case 'reset':
  2165.                 case 'blank':
  2166.                 case 'plaintext':
  2167.                     continue 2;
  2168.             }
  2169.             $fields[$data[1]] = true;
  2170.         }
  2171.         $ret HTML_Form::returnHidden('_fields',
  2172.                                        implode(':'array_keys($fields)));
  2173.         $ret .= "</form>\n\n";
  2174.         return $ret;
  2175.     }
  2176.  
  2177.     // }}}
  2178.     // {{{ returnPlaintext()
  2179.  
  2180.     /**
  2181.      * Produce a string containing the text provided
  2182.      *
  2183.      * @param string $text      a string to be displayed
  2184.      *
  2185.      * @return string 
  2186.      *
  2187.      * @access public
  2188.      * @static
  2189.      * @see HTML_Form::displayPlaintext(), HTML_Form::displayPlaintextRow(),
  2190.      *       HTML_Form::returnPlaintextRow(), HTML_Form::addPlaintext()
  2191.      */
  2192.     function returnPlaintext($text '&nbsp;')
  2193.     {
  2194.         return $text;
  2195.     }
  2196.  
  2197.     // }}}
  2198.     // {{{ returnPlaintextRow()
  2199.  
  2200.     /**
  2201.      * Produce a string containing the text provided inside a table row
  2202.      *
  2203.      * @param string $title     the string used as the label
  2204.      * @param string $text      a string to be displayed
  2205.      * @param string $thattr    a string of additional attributes to be put
  2206.      *                            in the <th> element (example: 'class="foo"')
  2207.      * @param string $tdattr    a string of additional attributes to be put
  2208.      *                            in the <td> element (example: 'class="foo"')
  2209.      * @return string 
  2210.      *
  2211.      * @access public
  2212.      * @static
  2213.      * @see HTML_Form::displayPlaintext(), HTML_Form::displayPlaintextRow(),
  2214.      *       HTML_Form::returnPlaintext(), HTML_Form::addPlaintext()
  2215.      */
  2216.     function returnPlaintextRow($title$text '&nbsp;',
  2217.                                 $thattr 'align="right" valign="top"',
  2218.                                 $tdattr '')
  2219.     {
  2220.         $str  " <tr>\n";
  2221.         $str .= '  <th ' $thattr '>' $title "</th>\n";
  2222.         $str .= '  <td ' $tdattr ">\n  ";
  2223.         $str .= HTML_Form::returnPlaintext($text"\n";
  2224.         $str .= "  </td>\n";
  2225.         $str .= " </tr>\n";
  2226.  
  2227.         return $str;
  2228.     }
  2229.  
  2230.     // }}}
  2231.     // {{{ display()
  2232.  
  2233.     /**
  2234.      * Prints a complete form with all fields you specified via
  2235.      * the add*() methods
  2236.      *
  2237.      * If the $_GET/$_POST supreglobal don't exist, then
  2238.      * $HTTP_GET_VARS/$HTTP_POST_VARS is used.
  2239.      *
  2240.      * NOTE: can NOT be called statically.
  2241.      *
  2242.      * @param string $attr     a string of additional attributes to be put
  2243.      *                           in the <table> tag (example: 'class="foo"')
  2244.      * @param string $caption  if present, a <caption> is added to the table
  2245.      * @param string $capattr  a string of additional attributes to be put
  2246.      *                           in the <caption> tag (example: 'class="foo"')
  2247.      * @return void 
  2248.      *
  2249.      * @access public
  2250.      * @see HTML_Form::end(), HTML_Form::end()
  2251.      */
  2252.     function display($attr ''$caption ''$capattr '')
  2253.     {
  2254.         $arrname '_' strtoupper($this->method);
  2255.         if (isset($$arrname)) {
  2256.             $arr =$$arrname;
  2257.         else {
  2258.             $arrname 'HTTP' $arrname '_VARS';
  2259.             if (isset($GLOBALS[$arrname])) {
  2260.                 $arr =$GLOBALS[$arrname];
  2261.             else {
  2262.                 $arr = array();
  2263.             }
  2264.         }
  2265.  
  2266.         $this->start();
  2267.         print '<table ' .  $attr ">\n";
  2268.  
  2269.         if ($caption{
  2270.             print ' <caption ' $capattr ">\n  " $caption;
  2271.             print "\n </caption>\n";
  2272.         }
  2273.  
  2274.         $hidden = array();
  2275.         foreach ($this->fields as $i => $data{
  2276.             /*
  2277.              * $params = the number of arguments the add*() methods have
  2278.              * $defind = the number of them that have default values 
  2279.              */
  2280.             switch ($data[0]{
  2281.                 case 'hidden':
  2282.                     $hidden[$i;
  2283.                     $defind = 1;
  2284.                     continue 2;
  2285.                 case 'reset':
  2286.                     $params = 4;
  2287.                     $defind = 4;
  2288.                     break;
  2289.                 case 'submit':
  2290.                     $params = 5;
  2291.                     $defind = 5;
  2292.                     break;
  2293.                 case 'blank':
  2294.                     $params = 4;
  2295.                     $defind = 3;
  2296.                     break;
  2297.                 case 'image':
  2298.                     $params = 6;
  2299.                     $defind = 3;
  2300.                     break;
  2301.                 case 'checkbox':
  2302.                     $params = 6;
  2303.                     $defind = 4;
  2304.                     break;
  2305.                 case 'file':
  2306.                 case 'text':
  2307.                     $params = 8;
  2308.                     $defind = 6;
  2309.                     break;
  2310.                 case 'password':
  2311.                     $params = 8;
  2312.                     $defind = 5;
  2313.                     break;
  2314.                 case 'radio':
  2315.                     $params = 7;
  2316.                     $defind = 4;
  2317.                     break;
  2318.                 case 'textarea':
  2319.                     $params = 9;
  2320.                     $defind = 6;
  2321.                     break;
  2322.                 case 'select':
  2323.                     $params = 10;
  2324.                     $defind = 7;
  2325.                     break;
  2326.                 case 'plaintext':
  2327.                     $params = 4;
  2328.                     $defind = 3;
  2329.                     break;
  2330.                 default:
  2331.                     // unknown field type
  2332.                     continue 2;
  2333.             }
  2334.             $str '$this->display' ucfirst($data[0]'Row(';
  2335.             for ($i = 1; $i <= $params$i++{
  2336.                 if ($i == $defind && $data[$defind=== null &&
  2337.                     isset($arr[$data[1]]))
  2338.                 {
  2339.                     $str .= '$arr[\'' $data[1'\']';
  2340.                 else {
  2341.                     $str .= '$data[' $i ']';
  2342.                 }
  2343.                 if ($i $params$str .= ', ';
  2344.             }
  2345.             $str .= ');';
  2346.             eval($str);
  2347.         }
  2348.         print "</table>\n";
  2349.         for ($i = 0; $i sizeof($hidden)$i++{
  2350.             $this->displayHidden($this->fields[$hidden[$i]][1],
  2351.                                  $this->fields[$hidden[$i]][2],
  2352.                                  $this->fields[$hidden[$i]][3]);
  2353.         }
  2354.         $this->end();
  2355.     }
  2356.  
  2357.     // }}}
  2358. }
  2359.  
  2360. /*
  2361.  * Local variables:
  2362.  * tab-width: 4
  2363.  * c-basic-offset: 4
  2364.  * End:
  2365.  */
  2366.  
  2367. ?>

Documentation generated on Mon, 11 Mar 2019 13:51:35 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.