[ Index ] |
|
Code source de phpMyVisites 2.3 |
1 <?php 2 /* vim: set expandtab tabstop=4 shiftwidth=4: */ 3 // +----------------------------------------------------------------------+ 4 // | PHP version 4.0 | 5 // +----------------------------------------------------------------------+ 6 // | Copyright (c) 1997, 1998, 1999, 2000, 2001 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: Adam Daniel <adaniel1@eesus.jnj.com> | 17 // | Bertrand Mansion <bmansion@mamasam.com> | 18 // +----------------------------------------------------------------------+ 19 // 20 // $Id: input.php,v 1.1 2005/12/06 01:50:39 matthieu_ Exp $ 21 22 require_once("Html/QuickForm/element.php"); 23 24 /** 25 * Base class for input form elements 26 * 27 * @author Adam Daniel <adaniel1@eesus.jnj.com> 28 * @author Bertrand Mansion <bmansion@mamasam.com> 29 * @version 1.0 30 * @since PHP4.04pl1 31 * @access public 32 * @abstract 33 */ 34 class HTML_QuickForm_input extends HTML_QuickForm_element 35 { 36 // {{{ constructor 37 38 /** 39 * Class constructor 40 * 41 * @param string Input field name attribute 42 * @param mixed Label(s) for the input field 43 * @param mixed Either a typical HTML attribute string or an associative array 44 * @since 1.0 45 * @access public 46 * @return void 47 */ 48 function HTML_QuickForm_input($elementName=null, $elementLabel=null, $attributes=null) 49 { 50 $this->HTML_QuickForm_element($elementName, $elementLabel, $attributes); 51 } //end constructor 52 53 // }}} 54 // {{{ setType() 55 56 /** 57 * Sets the element type 58 * 59 * @param string $type Element type 60 * @since 1.0 61 * @access public 62 * @return void 63 */ 64 function setType($type) 65 { 66 $this->_type = $type; 67 $this->updateAttributes(array('type'=>$type)); 68 } // end func setType 69 70 // }}} 71 // {{{ setName() 72 73 /** 74 * Sets the input field name 75 * 76 * @param string $name Input field name attribute 77 * @since 1.0 78 * @access public 79 * @return void 80 */ 81 function setName($name) 82 { 83 $this->updateAttributes(array('name'=>$name)); 84 } //end func setName 85 86 // }}} 87 // {{{ getName() 88 89 /** 90 * Returns the element name 91 * 92 * @since 1.0 93 * @access public 94 * @return string 95 */ 96 function getName() 97 { 98 return $this->getAttribute('name'); 99 } //end func getName 100 101 // }}} 102 // {{{ setValue() 103 104 /** 105 * Sets the value of the form element 106 * 107 * @param string $value Default value of the form element 108 * @since 1.0 109 * @access public 110 * @return void 111 */ 112 function setValue($value) 113 { 114 $this->updateAttributes(array('value'=>$value)); 115 } // end func setValue 116 117 // }}} 118 // {{{ getValue() 119 120 /** 121 * Returns the value of the form element 122 * 123 * @since 1.0 124 * @access public 125 * @return string 126 */ 127 function getValue() 128 { 129 return $this->getAttribute('value'); 130 } // end func getValue 131 132 // }}} 133 // {{{ toHtml() 134 135 /** 136 * Returns the input field in HTML 137 * 138 * @since 1.0 139 * @access public 140 * @return string 141 */ 142 function toHtml() 143 { 144 if ($this->_flagFrozen) { 145 return $this->getFrozenHtml(); 146 } else { 147 return $this->_getTabs() . '<input' . $this->_getAttrString($this->_attributes) . ' />'; 148 } 149 } //end func toHtml 150 151 // }}} 152 // {{{ onQuickFormEvent() 153 154 /** 155 * Called by HTML_QuickForm whenever form event is made on this element 156 * 157 * @param string $event Name of event 158 * @param mixed $arg event arguments 159 * @param object $caller calling object 160 * @since 1.0 161 * @access public 162 * @return void 163 * @throws 164 */ 165 function onQuickFormEvent($event, $arg, &$caller) 166 { 167 // do not use submit values for button-type elements 168 $type = $this->getType(); 169 if (('updateValue' != $event) || 170 ('submit' != $type && 'reset' != $type && 'image' != $type && 'button' != $type)) { 171 parent::onQuickFormEvent($event, $arg, $caller); 172 } else { 173 $value = $this->_findValue($caller->_constantValues); 174 if (null === $value) { 175 $value = $this->_findValue($caller->_defaultValues); 176 } 177 if (null !== $value) { 178 $this->setValue($value); 179 } 180 } 181 return true; 182 } // end func onQuickFormEvent 183 184 // }}} 185 // {{{ exportValue() 186 187 /** 188 * We don't need values from button-type elements (except submit) and files 189 */ 190 function exportValue(&$submitValues, $assoc = false) 191 { 192 $type = $this->getType(); 193 if ('reset' == $type || 'image' == $type || 'button' == $type || 'file' == $type) { 194 return null; 195 } else { 196 return parent::exportValue($submitValues, $assoc); 197 } 198 } 199 200 // }}} 201 } // end class HTML_QuickForm_element 202 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 14:10:01 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |