2 /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
5 * HTML class for static data
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 Wojciech Gdela <eltehaem@poczta.onet.pl>
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 * Base class for form elements
27 require_once 'HTML/QuickForm/element.php';
30 * HTML class for static data
33 * @package HTML_QuickForm
34 * @author Wojciech Gdela <eltehaem@poczta.onet.pl>
35 * @version Release: 3.2.16
38 class HTML_QuickForm_static extends HTML_QuickForm_element {
55 * @param string $elementLabel (optional)Label
56 * @param string $text (optional)Display text
60 function HTML_QuickForm_static($elementName=null, $elementLabel=null, $text=null)
62 HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel);
63 $this->_persistantFreeze = false;
64 $this->_type = 'static';
72 * Sets the element name
74 * @param string $name Element name
78 function setName($name)
80 $this->updateAttributes(array('name'=>$name));
87 * Returns the element name
94 return $this->getAttribute('name');
103 * @param string $text
107 function setText($text)
109 $this->_text = $text;
110 } // end func setText
116 * Sets the text (uses the standard setValue call to emulate a form element.
118 * @param string $text
122 function setValue($text)
124 $this->setText($text);
125 } // end func setValue
131 * Returns the static text element in HTML
138 return $this->_getTabs() . $this->_text;
142 // {{{ getFrozenHtml()
145 * Returns the value of field without HTML tags
150 function getFrozenHtml()
152 return $this->toHtml();
153 } //end func getFrozenHtml
156 // {{{ onQuickFormEvent()
159 * Called by HTML_QuickForm whenever form event is made on this element
161 * @param string $event Name of event
162 * @param mixed $arg event arguments
163 * @param object &$caller calling object
169 function onQuickFormEvent($event, $arg, &$caller)
173 // do NOT use submitted values for static elements
174 $value = $this->_findValue($caller->_constantValues);
175 if (null === $value) {
176 $value = $this->_findValue($caller->_defaultValues);
178 if (null !== $value) {
179 $this->setValue($value);
183 parent::onQuickFormEvent($event, $arg, $caller);
186 } // end func onQuickFormEvent
192 * We override this here because we don't want any values from static elements
194 function exportValue(&$submitValues, $assoc = false)
200 } //end class HTML_QuickForm_static