PageRenderTime 42ms CodeModel.GetById 17ms RepoModel.GetById 1ms app.codeStats 0ms

/campsite/src/include/pear/HTML/QuickForm/link.php

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