2 /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
 
   5  * Hidden select pseudo-element
 
   9  * LICENSE: This source file is subject to version 3.01 of the PHP license
 
  10  * that is available through the world-wide-web at the following URI:
 
  11  * http://www.php.net/license/3_01.txt If you did not receive a copy of
 
  12  * the PHP License and are unable to obtain it through the web, please
 
  13  * send a note to license@php.net so we can mail you a copy immediately.
 
  16  * @package     HTML_QuickForm
 
  17  * @author      Isaac Shepard <ishepard@bsiweb.com>
 
  18  * @copyright   2001-2011 The PHP Group
 
  19  * @license     http://www.php.net/license/3_01.txt PHP License 3.01
 
  21  * @link        http://pear.php.net/package/HTML_QuickForm
 
  25  * Class for <select></select> elements
 
  27 require_once 'HTML/QuickForm/select.php';
 
  30  * Hidden select pseudo-element
 
  32  * This class takes the same arguments as a select element, but instead
 
  33  * of creating a select ring it creates hidden elements for all values
 
  34  * already selected with setDefault or setConstant.  This is useful if
 
  35  * you have a select ring that you don't want visible, but you need all
 
  36  * selected values to be passed.
 
  39  * @package     HTML_QuickForm
 
  40  * @author      Isaac Shepard <ishepard@bsiweb.com>
 
  41  * @version     Release: 3.2.16
 
  44 class HTML_QuickForm_hiddenselect extends HTML_QuickForm_select
 
  51      * @param     string    Select name attribute
 
  52      * @param     mixed     Label(s) for the select (not used)
 
  53      * @param     mixed     Data to be used to populate options
 
  54      * @param     mixed     Either a typical HTML attribute string or an associative array (not used)
 
  59     function HTML_QuickForm_hiddenselect($elementName=null, $elementLabel=null, $options=null, $attributes=null)
 
  61         HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel, $attributes);
 
  62         $this->_persistantFreeze = true;
 
  63         $this->_type = 'hiddenselect';
 
  64         if (isset($options)) {
 
  65             $this->load($options);
 
  73      * Returns the SELECT in HTML
 
  82         if (empty($this->_values)) {
 
  86         $tabs    = $this->_getTabs();
 
  87         $name    = $this->getPrivateName();
 
  90         foreach ($this->_values as $key => $val) {
 
  91             for ($i = 0, $optCount = count($this->_options); $i < $optCount; $i++) {
 
  92                 if ($val == $this->_options[$i]['attr']['value']) {
 
  93                     $strHtml .= $tabs . '<input' . $this->_getAttrString(array(
 
 109     * This is essentially a hidden element and should be rendered as one  
 
 111     * @param HTML_QuickForm_Renderer    renderer object
 
 112     * @param bool $sc1                  unused, for signature compatibility
 
 113     * @param bool $sc2                  unused, for signature compatibility
 
 115     function accept(&$renderer, $sc1 = false, $sc2 = null)
 
 117         $renderer->renderHidden($this);
 
 121 } //end class HTML_QuickForm_hiddenselect