Source for file range.php

Documentation is available at range.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Platform
  4.  * @subpackage  Form
  5.  *
  6.  * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
  7.  * @license     GNU General Public License version 2 or later; see LICENSE
  8.  */
  9.  
  10. defined('JPATH_PLATFORM') or die;
  11.  
  12.  
  13. /**
  14.  * Form Field class for the Joomla Platform.
  15.  * Provides a horizontal scroll bar to specify a value in a range.
  16.  *
  17.  * @package     Joomla.Platform
  18.  * @subpackage  Form
  19.  * @link        http://www.w3.org/TR/html-markup/input.text.html#input.text
  20.  * @since       3.2
  21.  */
  22. {
  23.     /**
  24.      * The form field type.
  25.      *
  26.      * @var    string 
  27.      * @since  3.2
  28.      */
  29.     protected $type = 'Range';
  30.  
  31.     /**
  32.      * Method to get the field input markup.
  33.      *
  34.      * @return  string  The field input markup.
  35.      *
  36.      * @since   3.2
  37.      */
  38.     protected function getInput()
  39.     {
  40.         // Initialize some field attributes.
  41.         $max      = !empty($this->max) ? ' max="' . $this->max . '"' : '';
  42.         $min      = !empty($this->min) ? ' min="' . $this->min . '"' : '';
  43.         $step     = !empty($this->step) ? ' step="' . $this->step . '"' : '';
  44.         $class    = !empty($this->class) ? ' class="' . $this->class . '"' : '';
  45.         $readonly = $this->readonly ? ' readonly' : '';
  46.         $disabled = $this->disabled ? ' disabled' : '';
  47.  
  48.         $autofocus = $this->autofocus ? ' autofocus' : '';
  49.  
  50.         $value = (float) $this->value;
  51.         $value = empty($value) ? $this->min : $value;
  52.  
  53.         // Initialize JavaScript field attributes.
  54.         $onchange = !empty($this->onchange) ? ' onchange="' . $this->onchange . '"' : '';
  55.  
  56.         // Including fallback code for HTML5 non supported browsers.
  57.         JHtml::_('jquery.framework');
  58.         JHtml::_('script', 'system/html5fallback.js', false, true);
  59.  
  60.         return '<input type="range" name="' . $this->name . '" id="' . $this->id . '"' . ' value="'
  61.             . htmlspecialchars($value, ENT_COMPAT, 'UTF-8') . '"' . $class . $disabled . $readonly
  62.             . $onchange . $max . $step . $min . $autofocus . ' />';
  63.     }
  64. }

Documentation generated on Tue, 19 Nov 2013 15:11:34 +0100 by phpDocumentor 1.4.3