style_submit_button.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?php
  2. /**
  3. * HTML class for a submit type element
  4. *
  5. *
  6. * LICENSE: This source file is subject to version 3.01 of the PHP license
  7. * that is available through the world-wide-web at the following URI:
  8. * http://www.php.net/license/3_01.txt If you did not receive a copy of
  9. * the PHP License and are unable to obtain it through the web, please
  10. * send a note to license@php.net so we can mail you a copy immediately.
  11. *
  12. * @category HTML
  13. * @package HTML_QuickForm
  14. * @author Adam Daniel <adaniel1@eesus.jnj.com>
  15. * @author Bertrand Mansion <bmansion@mamasam.com>
  16. * @copyright 2001-2007 The PHP Group
  17. * @license http://www.php.net/license/3_01.txt PHP License 3.01
  18. * @version CVS: $Id: submit.php 17344 2008-12-17 08:55:29Z Scara84 $
  19. * @link http://pear.php.net/package/HTML_QuickForm
  20. */
  21. /**
  22. * Base class for <input /> form elements
  23. */
  24. //require_once 'style_button.php';
  25. /**
  26. * HTML class for a submit type element
  27. *
  28. * @category HTML
  29. * @package HTML_QuickForm
  30. * @author Adam Daniel <adaniel1@eesus.jnj.com>
  31. * @author Bertrand Mansion <bmansion@mamasam.com>
  32. * @version Release: 3.2.10
  33. * @since 1.0
  34. */
  35. class HTML_QuickForm_stylesubmitbutton extends HTML_QuickForm_stylebutton
  36. {
  37. /**
  38. * Class constructor
  39. *
  40. * @param string Input field name attribute
  41. * @param string Input field value
  42. * @param mixed Either a typical HTML attribute string or an associative array
  43. * @since 1.0
  44. * @access public
  45. * @return void
  46. */
  47. public function HTML_QuickForm_stylesubmitbutton($elementName = null, $value = null, $attributes = null, $img = null)
  48. {
  49. if (empty($attributes)) {
  50. $attributes = array();
  51. }
  52. if (!isset($attributes['class'])) {
  53. if (is_array($attributes)) {
  54. $attributes['class'] = 'btn btn-primary';
  55. }
  56. }
  57. HTML_QuickForm_stylebutton::HTML_QuickForm_stylebutton($elementName, null, $attributes, $value, $img);
  58. $this->setValue($value);
  59. $this->setType('submit');
  60. }
  61. /**
  62. * Freeze the element so that only its value is returned
  63. *
  64. * @access public
  65. * @return void
  66. */
  67. public function freeze()
  68. {
  69. return false;
  70. }
  71. /**
  72. * Only return the value if it is found within $submitValues (i.e. if
  73. * this particular submit button was clicked)
  74. */
  75. public function exportValue(&$submitValues, $assoc = false)
  76. {
  77. return $this->_prepareValue($this->_findValue($submitValues), $assoc);
  78. }
  79. }