link.php 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  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. require_once 'HTML/QuickForm/static.php';
  21. /**
  22. * HTML class for a link type field
  23. *
  24. * @author Adam Daniel <adaniel1@eesus.jnj.com>
  25. * @author Bertrand Mansion <bmansion@mamasam.com>
  26. * @version 1.0
  27. * @since PHP4.04pl1
  28. * @access public
  29. */
  30. class HTML_QuickForm_link extends HTML_QuickForm_static
  31. {
  32. // {{{ properties
  33. /**
  34. * Link display text
  35. * @var string
  36. * @since 1.0
  37. * @access private
  38. */
  39. var $_text = "";
  40. // }}}
  41. // {{{ constructor
  42. /**
  43. * Class constructor
  44. *
  45. * @param string $elementLabel (optional)Link label
  46. * @param string $href (optional)Link href
  47. * @param string $text (optional)Link display text
  48. * @param mixed $attributes (optional)Either a typical HTML attribute string
  49. * or an associative array
  50. * @since 1.0
  51. * @access public
  52. * @return void
  53. * @throws
  54. */
  55. function HTML_QuickForm_link($elementName=null, $elementLabel=null, $href=null, $text=null, $attributes=null)
  56. {
  57. HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel, $attributes);
  58. $this->_persistantFreeze = false;
  59. $this->_type = 'link';
  60. $this->setHref($href);
  61. $this->_text = $text;
  62. } //end constructor
  63. // }}}
  64. // {{{ setName()
  65. /**
  66. * Sets the input field name
  67. *
  68. * @param string $name Input field name attribute
  69. * @since 1.0
  70. * @access public
  71. * @return void
  72. * @throws
  73. */
  74. function setName($name)
  75. {
  76. $this->updateAttributes(array('name'=>$name));
  77. } //end func setName
  78. // }}}
  79. // {{{ getName()
  80. /**
  81. * Returns the element name
  82. *
  83. * @since 1.0
  84. * @access public
  85. * @return string
  86. * @throws
  87. */
  88. function getName()
  89. {
  90. return $this->getAttribute('name');
  91. } //end func getName
  92. // }}}
  93. // {{{ setValue()
  94. /**
  95. * Sets value for textarea element
  96. *
  97. * @param string $value Value for password element
  98. * @since 1.0
  99. * @access public
  100. * @return void
  101. * @throws
  102. */
  103. function setValue($value)
  104. {
  105. return;
  106. } //end func setValue
  107. // }}}
  108. // {{{ getValue()
  109. /**
  110. * Returns the value of the form element
  111. *
  112. * @since 1.0
  113. * @access public
  114. * @return void
  115. * @throws
  116. */
  117. function getValue()
  118. {
  119. return;
  120. } // end func getValue
  121. // }}}
  122. // {{{ setHref()
  123. /**
  124. * Sets the links href
  125. *
  126. * @param string $href
  127. * @since 1.0
  128. * @access public
  129. * @return void
  130. * @throws
  131. */
  132. function setHref($href)
  133. {
  134. $this->updateAttributes(array('href'=>$href));
  135. } // end func setHref
  136. // }}}
  137. // {{{ toHtml()
  138. /**
  139. * Returns the textarea element in HTML
  140. *
  141. * @since 1.0
  142. * @access public
  143. * @return string
  144. * @throws
  145. */
  146. function toHtml()
  147. {
  148. $tabs = $this->_getTabs();
  149. $html = "$tabs<a".$this->_getAttrString($this->_attributes).">";
  150. $html .= $this->_text;
  151. $html .= "</a>";
  152. return $html;
  153. } //end func toHtml
  154. // }}}
  155. // {{{ getFrozenHtml()
  156. /**
  157. * Returns the value of field without HTML tags (in this case, value is changed to a mask)
  158. *
  159. * @since 1.0
  160. * @access public
  161. * @return string
  162. * @throws
  163. */
  164. function getFrozenHtml()
  165. {
  166. return;
  167. } //end func getFrozenHtml
  168. // }}}
  169. } //end class HTML_QuickForm_textarea
  170. ?>