image.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <?php
  2. /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
  3. /**
  4. * HTML class for an <input type="image" /> element
  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: image.php,v 1.6 2009/04/04 21:34:03 avb Exp $
  21. * @link http://pear.php.net/package/HTML_QuickForm
  22. */
  23. /**
  24. * HTML class for an <input type="image" /> element
  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 1.0
  32. */
  33. class HTML_QuickForm_image extends HTML_QuickForm_input
  34. {
  35. // {{{ constructor
  36. /**
  37. * Class constructor
  38. *
  39. * @param string $elementName (optional)Element name attribute
  40. * @param string $src (optional)Image source
  41. * @param mixed $attributes (optional)Either a typical HTML attribute string
  42. * or an associative array
  43. * @since 1.0
  44. * @access public
  45. * @return void
  46. */
  47. public function __construct($elementName=null, $src='', $attributes=null)
  48. {
  49. parent::__construct($elementName, null, $attributes);
  50. $this->setType('image');
  51. $this->setSource($src);
  52. } // end class constructor
  53. // }}}
  54. // {{{ setSource()
  55. /**
  56. * Sets source for image element
  57. *
  58. * @param string $src source for image element
  59. * @since 1.0
  60. * @access public
  61. * @return void
  62. */
  63. function setSource($src)
  64. {
  65. $this->updateAttributes(array('src' => $src));
  66. } // end func setSource
  67. // }}}
  68. // {{{ setBorder()
  69. /**
  70. * Sets border size for image element
  71. *
  72. * @param string $border border for image element
  73. * @since 1.0
  74. * @access public
  75. * @return void
  76. */
  77. function setBorder($border)
  78. {
  79. $this->updateAttributes(array('border' => $border));
  80. }
  81. /**
  82. * Sets alignment for image element
  83. *
  84. * @param string $align alignment for image element
  85. * @since 1.0
  86. * @access public
  87. * @return void
  88. */
  89. function setAlign($align)
  90. {
  91. $this->updateAttributes(array('align' => $align));
  92. }
  93. /**
  94. * Freeze the element so that only its value is returned
  95. *
  96. * @access public
  97. * @return void
  98. */
  99. function freeze()
  100. {
  101. return false;
  102. }
  103. }