/content/code/trunk/administrator/components/com_artofcontent/libraries/jxtended/form/fields/integers.php
PHP | 53 lines | 20 code | 7 blank | 26 comment | 1 complexity | 49722846b09a3760846e2f8b8d361499 MD5 | raw file
- <?php
- /**
- * @version $Id: integers.php 484 2010-12-20 23:40:27Z eddieajau $
- * @package JXtended.Libraries
- * @subpackage Form
- * @copyright Copyright 2005 - 2010 New Life in IT Pty Ltd. All rights reserved.
- * @license GNU General Public License
- * @link http://www.theartofjoomla.com
- */
- defined('JPATH_BASE') or die('Restricted Access');
- jimport('joomla.html.html');
- require_once dirname(__FILE__).'/list.php';
- /**
- * Form Field class for JXtended Libraries.
- *
- * @package JXtended.Libraries
- * @subpackage Form
- * @since 1.1
- */
- class JFormFieldIntegers extends JFormFieldList
- {
- /**
- * The field type.
- *
- * @var string
- */
- protected $type = 'Integers';
- /**
- * Method to get a list of options for a list input.
- *
- * @return array An array of JHtml options.
- */
- protected function _getOptions()
- {
- $first = (int)$this->_element->attributes('first');
- $last = (int)$this->_element->attributes('last');
- $step = (int)max(1, $this->_element->attributes('step'));
- $options = array();
- for ($i = $first; $i <= $last; $i += $step) {
- $options[] = JHtml::_('select.option', $i);
- }
- // Merge any additional options in the XML definition.
- $options = array_merge(parent::_getOptions(), $options);
- return $options;
- }
- }