Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.
   1  <?php
   2  /* vim: set expandtab tabstop=4 shiftwidth=4: */
   3  // +----------------------------------------------------------------------+
   4  // | PHP version 4.0                                                      |
   5  // +----------------------------------------------------------------------+
   6  // | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group             |
   7  // +----------------------------------------------------------------------+
   8  // | This source file is subject to version 2.0 of the PHP license,       |
   9  // | that is bundled with this package in the file LICENSE, and is        |
  10  // | available at through the world-wide-web at                           |
  11  // | http://www.php.net/license/2_02.txt.                                 |
  12  // | If you did not receive a copy of the PHP license and are unable to   |
  13  // | obtain it through the world-wide-web, please send a note to          |
  14  // | license@php.net so we can mail you a copy immediately.               |
  15  // +----------------------------------------------------------------------+
  16  // | Authors: Adam Daniel <adaniel1@eesus.jnj.com>                        |
  17  // |          Bertrand Mansion <bmansion@mamasam.com>                     |
  18  // +----------------------------------------------------------------------+
  19  //
  20  // $Id$
  21  
  22  require_once("HTML/QuickForm/input.php");
  23  
  24  /**
  25   * HTML class for a submit type element
  26   * 
  27   * @author       Adam Daniel <adaniel1@eesus.jnj.com>
  28   * @author       Bertrand Mansion <bmansion@mamasam.com>
  29   * @version      1.0
  30   * @since        PHP4.04pl1
  31   * @access       public
  32   */
  33  class HTML_QuickForm_submit extends HTML_QuickForm_input
  34  {
  35      // {{{ constructor
  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 __construct($elementName=null, $value=null, $attributes=null) {
  48          parent::__construct($elementName, null, $attributes);
  49          $this->setValue($value);
  50          $this->setType('submit');
  51      } //end constructor
  52  
  53      /**
  54       * Old syntax of class constructor. Deprecated in PHP7.
  55       *
  56       * @deprecated since Moodle 3.1
  57       */
  58      public function HTML_QuickForm_submit($elementName=null, $value=null, $attributes=null) {
  59          debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
  60          self::__construct($elementName, $value, $attributes);
  61      }
  62  
  63      // }}}
  64      // {{{ freeze()
  65  
  66      /**
  67       * Freeze the element so that only its value is returned
  68       * 
  69       * @access    public
  70       * @return    void
  71       */
  72      function freeze()
  73      {
  74          return false;
  75      } //end func freeze
  76  
  77      // }}}
  78      // {{{ exportValue()
  79  
  80     /**
  81      * Only return the value if it is found within $submitValues (i.e. if
  82      * this particular submit button was clicked)
  83      */
  84      function exportValue(&$submitValues, $assoc = false)
  85      {
  86          return $this->_prepareValue($this->_findValue($submitValues), $assoc);
  87      }
  88  
  89      // }}}
  90  } //end class HTML_QuickForm_submit
  91  ?>