submit.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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-2009 The PHP Group
  19. * @license http://www.php.net/license/3_01.txt PHP License 3.01
  20. * @version CVS: $Id: submit.php,v 1.6 2009/04/04 21:34:04 avb Exp $
  21. * @link http://pear.php.net/package/HTML_QuickForm
  22. */
  23. /**
  24. * HTML class for a submit type 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_submit extends HTML_QuickForm_input
  34. {
  35. /**
  36. * Class constructor
  37. *
  38. * @param string Input field name attribute
  39. * @param string Input field value
  40. * @param mixed Either a typical HTML attribute string or an associative array
  41. * @since 1.0
  42. * @access public
  43. * @return void
  44. */
  45. public function __construct($elementName=null, $value=null, $attributes=null)
  46. {
  47. parent::__construct($elementName, null, $attributes);
  48. $this->setValue($value);
  49. $this->setType('submit');
  50. }
  51. /**
  52. * Freeze the element so that only its value is returned
  53. *
  54. * @access public
  55. * @return void
  56. */
  57. function freeze()
  58. {
  59. return false;
  60. }
  61. /**
  62. * Only return the value if it is found within $submitValues (i.e. if
  63. * this particular submit button was clicked)
  64. */
  65. function exportValue(&$submitValues, $assoc = false)
  66. {
  67. return $this->_prepareValue($this->_findValue($submitValues), $assoc);
  68. }
  69. }