Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.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  require_once("HTML/QuickForm/input.php");
  22  
  23  /**
  24   * HTML class for a image type element
  25   * 
  26   * @author       Adam Daniel <adaniel1@eesus.jnj.com>
  27   * @author       Bertrand Mansion <bmansion@mamasam.com>
  28   * @version      1.0
  29   * @since        PHP4.04pl1
  30   * @access       public
  31   */
  32  class HTML_QuickForm_image extends HTML_QuickForm_input
  33  {
  34      // {{{ constructor
  35  
  36      /**
  37       * Class constructor
  38       * 
  39       * @param     string    $elementName    (optional)Element name attribute
  40       * @param     string    $src            (optional)Image source
  41       * @param     mixed     $attributes     (optional)Either a typical HTML attribute string 
  42       *                                      or an associative array
  43       * @since     1.0
  44       * @access    public
  45       * @return    void
  46       */
  47      public function __construct($elementName=null, $src='', $attributes=null) {
  48          parent::__construct($elementName, null, $attributes);
  49          $this->setType('image');
  50          $this->setSource($src);
  51      } // end class 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_image($elementName=null, $src='', $attributes=null) {
  59          debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
  60          self::__construct($elementName, $src, $attributes);
  61      }
  62  
  63      // }}}
  64      // {{{ setSource()
  65  
  66      /**
  67       * Sets source for image element
  68       * 
  69       * @param     string    $src  source for image element
  70       * @since     1.0
  71       * @access    public
  72       * @return    void
  73       */
  74      function setSource($src)
  75      {
  76          $this->updateAttributes(array('src' => $src));
  77      } // end func setSource
  78  
  79      // }}}
  80      // {{{ setBorder()
  81  
  82      /**
  83       * Sets border size for image element
  84       * 
  85       * @param     string    $border  border for image element
  86       * @since     1.0
  87       * @access    public
  88       * @return    void
  89       */
  90      function setBorder($border)
  91      {
  92          $this->updateAttributes(array('border' => $border));
  93      } // end func setBorder
  94  
  95      // }}}
  96      // {{{ setAlign()
  97  
  98      /**
  99       * Sets alignment for image element
 100       * 
 101       * @param     string    $align  alignment for image element
 102       * @since     1.0
 103       * @access    public
 104       * @return    void
 105       */
 106      function setAlign($align)
 107      {
 108          $this->updateAttributes(array('align' => $align));
 109      } // end func setAlign
 110  
 111      // }}}
 112      // {{{ freeze()
 113  
 114      /**
 115       * Freeze the element so that only its value is returned
 116       * 
 117       * @access    public
 118       * @return    void
 119       */
 120      function freeze()
 121      {
 122          return false;
 123      } //end func freeze
 124  
 125      // }}}
 126  
 127  } // end class HTML_QuickForm_image
 128  ?>