PageRenderTime 78ms CodeModel.GetById 30ms RepoModel.GetById 1ms app.codeStats 0ms

/content/code/trunk/administrator/components/com_artofcontent/libraries/jxtended/form/fields/integers.php

https://bitbucket.org/eddieajau/the-art-of-joomla-archive
PHP | 53 lines | 20 code | 7 blank | 26 comment | 1 complexity | 49722846b09a3760846e2f8b8d361499 MD5 | raw file
  1. <?php
  2. /**
  3. * @version $Id: integers.php 484 2010-12-20 23:40:27Z eddieajau $
  4. * @package JXtended.Libraries
  5. * @subpackage Form
  6. * @copyright Copyright 2005 - 2010 New Life in IT Pty Ltd. All rights reserved.
  7. * @license GNU General Public License
  8. * @link http://www.theartofjoomla.com
  9. */
  10. defined('JPATH_BASE') or die('Restricted Access');
  11. jimport('joomla.html.html');
  12. require_once dirname(__FILE__).'/list.php';
  13. /**
  14. * Form Field class for JXtended Libraries.
  15. *
  16. * @package JXtended.Libraries
  17. * @subpackage Form
  18. * @since 1.1
  19. */
  20. class JFormFieldIntegers extends JFormFieldList
  21. {
  22. /**
  23. * The field type.
  24. *
  25. * @var string
  26. */
  27. protected $type = 'Integers';
  28. /**
  29. * Method to get a list of options for a list input.
  30. *
  31. * @return array An array of JHtml options.
  32. */
  33. protected function _getOptions()
  34. {
  35. $first = (int)$this->_element->attributes('first');
  36. $last = (int)$this->_element->attributes('last');
  37. $step = (int)max(1, $this->_element->attributes('step'));
  38. $options = array();
  39. for ($i = $first; $i <= $last; $i += $step) {
  40. $options[] = JHtml::_('select.option', $i);
  41. }
  42. // Merge any additional options in the XML definition.
  43. $options = array_merge(parent::_getOptions(), $options);
  44. return $options;
  45. }
  46. }