style_submit_button.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <?php
  2. /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
  3. /**
  4. * HTML class for a submit type 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-2007 The PHP Group
  19. * @license http://www.php.net/license/3_01.txt PHP License 3.01
  20. * @version CVS: $Id: submit.php 17344 2008-12-17 08:55:29Z Scara84 $
  21. * @link http://pear.php.net/package/HTML_QuickForm
  22. */
  23. /**
  24. * Base class for <input /> form elements
  25. */
  26. require_once 'style_button.php';
  27. /**
  28. * HTML class for a submit type element
  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.10
  35. * @since 1.0
  36. */
  37. class HTML_QuickForm_stylesubmitbutton extends HTML_QuickForm_stylebutton
  38. {
  39. // {{{ constructor
  40. /**
  41. * Class constructor
  42. *
  43. * @param string Input field name attribute
  44. * @param string Input field value
  45. * @param mixed Either a typical HTML attribute string or an associative array
  46. * @since 1.0
  47. * @access public
  48. * @return void
  49. */
  50. function HTML_QuickForm_stylesubmitbutton($elementName = null, $value = null, $attributes = null, $img = null) {
  51. if (empty($attributes)) {
  52. $attributes = array();
  53. }
  54. if (!isset($attributes['class'])) {
  55. if (is_array($attributes)) {
  56. $attributes['class'] = 'btn';
  57. }
  58. }
  59. HTML_QuickForm_stylebutton::HTML_QuickForm_stylebutton($elementName, null, $attributes, $value, $img);
  60. $this->setValue($value);
  61. $this->setType('submit');
  62. } //end constructor
  63. /**
  64. * Freeze the element so that only its value is returned
  65. *
  66. * @access public
  67. * @return void
  68. */
  69. function freeze() {
  70. return false;
  71. } //end func freeze
  72. // }}}
  73. // {{{ exportValue()
  74. /**
  75. * Only return the value if it is found within $submitValues (i.e. if
  76. * this particular submit button was clicked)
  77. */
  78. function exportValue(&$submitValues, $assoc = false) {
  79. return $this->_prepareValue($this->_findValue($submitValues), $assoc);
  80. }
  81. // }}}
  82. } //end class HTML_QuickForm_submit