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 text field
  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_text extends HTML_QuickForm_input
  34  {
  35                  
  36      // {{{ constructor
  37  
  38      /**
  39       * Class constructor
  40       * 
  41       * @param     string    $elementName    (optional)Input field name attribute
  42       * @param     string    $elementLabel   (optional)Input field label
  43       * @param     mixed     $attributes     (optional)Either a typical HTML attribute string 
  44       *                                      or an associative array
  45       * @since     1.0
  46       * @access    public
  47       * @return    void
  48       */
  49      public function __construct($elementName=null, $elementLabel=null, $attributes=null) {
  50          parent::__construct($elementName, $elementLabel, $attributes);
  51          $this->_persistantFreeze = true;
  52          $this->setType('text');
  53      } //end constructor
  54  
  55      /**
  56       * Old syntax of class constructor. Deprecated in PHP7.
  57       *
  58       * @deprecated since Moodle 3.1
  59       */
  60      public function HTML_QuickForm_text($elementName=null, $elementLabel=null, $attributes=null) {
  61          debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
  62          self::__construct($elementName, $elementLabel, $attributes);
  63      }
  64          
  65      // }}}
  66      // {{{ setSize()
  67  
  68      /**
  69       * Sets size of text field
  70       * 
  71       * @param     string    $size  Size of text field
  72       * @since     1.3
  73       * @access    public
  74       * @return    void
  75       */
  76      function setSize($size)
  77      {
  78          $this->updateAttributes(array('size'=>$size));
  79      } //end func setSize
  80  
  81      // }}}
  82      // {{{ setMaxlength()
  83  
  84      /**
  85       * Sets maxlength of text field
  86       * 
  87       * @param     string    $maxlength  Maximum length of text field
  88       * @since     1.3
  89       * @access    public
  90       * @return    void
  91       */
  92      function setMaxlength($maxlength)
  93      {
  94          $this->updateAttributes(array('maxlength'=>$maxlength));
  95      } //end func setMaxlength
  96  
  97      // }}}
  98      
  99  } //end class HTML_QuickForm_text
 100  ?>