link.php 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. <?php
  2. /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
  3. /**
  4. * HTML class for a link type field
  5. *
  6. * PHP versions 4 and 5
  7. *
  8. * LICENSE: This source file is subject to version 3.01 of the PHP license
  9. * that is available through the world-wide-web at the following URI:
  10. * http://www.php.net/license/3_01.txt If you did not receive a copy of
  11. * the PHP License and are unable to obtain it through the web, please
  12. * send a note to license@php.net so we can mail you a copy immediately.
  13. *
  14. * @category HTML
  15. * @package HTML_QuickForm
  16. * @author Adam Daniel <adaniel1@eesus.jnj.com>
  17. * @author Bertrand Mansion <bmansion@mamasam.com>
  18. * @copyright 2001-2009 The PHP Group
  19. * @license http://www.php.net/license/3_01.txt PHP License 3.01
  20. * @version CVS: $Id: link.php,v 1.4 2009/04/04 21:34:04 avb Exp $
  21. * @link http://pear.php.net/package/HTML_QuickForm
  22. */
  23. /**
  24. * HTML class for a link type field
  25. *
  26. * @category HTML
  27. * @package HTML_QuickForm
  28. * @author Adam Daniel <adaniel1@eesus.jnj.com>
  29. * @author Bertrand Mansion <bmansion@mamasam.com>
  30. * @version Release: 3.2.11
  31. * @since 2.0
  32. */
  33. class HTML_QuickForm_link extends HTML_QuickForm_static
  34. {
  35. // {{{ properties
  36. /**
  37. * Link display text
  38. * @var string
  39. * @since 1.0
  40. * @access private
  41. */
  42. var $_text = "";
  43. // }}}
  44. // {{{ constructor
  45. /**
  46. * Class constructor
  47. *
  48. * @param string $elementLabel (optional)Link label
  49. * @param string $href (optional)Link href
  50. * @param string $text (optional)Link display text
  51. * @param mixed $attributes (optional)Either a typical HTML attribute string
  52. * or an associative array
  53. * @since 1.0
  54. * @access public
  55. * @return void
  56. * @throws
  57. */
  58. public function __construct($elementName=null, $elementLabel=null, $href=null, $text=null, $attributes=null)
  59. {
  60. parent::__construct($elementName, $elementLabel, $attributes);
  61. $this->_persistantFreeze = false;
  62. $this->_type = 'link';
  63. $this->setHref($href);
  64. $this->_text = $text;
  65. } //end constructor
  66. // }}}
  67. // {{{ setName()
  68. /**
  69. * Sets the input field name
  70. *
  71. * @param string $name Input field name attribute
  72. * @since 1.0
  73. * @access public
  74. * @return void
  75. * @throws
  76. */
  77. function setName($name)
  78. {
  79. $this->updateAttributes(array('name'=>$name));
  80. } //end func setName
  81. // }}}
  82. // {{{ getName()
  83. /**
  84. * Returns the element name
  85. *
  86. * @since 1.0
  87. * @access public
  88. * @return string
  89. * @throws
  90. */
  91. function getName()
  92. {
  93. return $this->getAttribute('name');
  94. } //end func getName
  95. // }}}
  96. // {{{ setValue()
  97. /**
  98. * Sets value for textarea element
  99. *
  100. * @param string $value Value for password element
  101. * @since 1.0
  102. * @access public
  103. * @return void
  104. * @throws
  105. */
  106. function setValue($value)
  107. {
  108. return;
  109. } //end func setValue
  110. // }}}
  111. // {{{ getValue()
  112. /**
  113. * Returns the value of the form element
  114. *
  115. * @since 1.0
  116. * @access public
  117. * @return void
  118. * @throws
  119. */
  120. function getValue()
  121. {
  122. return;
  123. } // end func getValue
  124. // }}}
  125. // {{{ setHref()
  126. /**
  127. * Sets the links href
  128. *
  129. * @param string $href
  130. * @since 1.0
  131. * @access public
  132. * @return void
  133. * @throws
  134. */
  135. function setHref($href)
  136. {
  137. $this->updateAttributes(array('href'=>$href));
  138. } // end func setHref
  139. // }}}
  140. // {{{ toHtml()
  141. /**
  142. * Returns the textarea element in HTML
  143. *
  144. * @since 1.0
  145. * @access public
  146. * @return string
  147. * @throws
  148. */
  149. function toHtml()
  150. {
  151. $tabs = $this->_getTabs();
  152. $html = "$tabs<a".$this->_getAttrString($this->_attributes).">";
  153. $html .= $this->_text;
  154. $html .= "</a>";
  155. return $html;
  156. } //end func toHtml
  157. // }}}
  158. // {{{ getFrozenHtml()
  159. /**
  160. * Returns the value of field without HTML tags (in this case, value is changed to a mask)
  161. *
  162. * @since 1.0
  163. * @access public
  164. * @return string
  165. * @throws
  166. */
  167. function getFrozenHtml()
  168. {
  169. return;
  170. }
  171. }