PageRenderTime 48ms CodeModel.GetById 26ms RepoModel.GetById 0ms app.codeStats 0ms

/redirect/code/trunk/administrator/components/com_redirect/libraries/jxtended/form/fields/accesslevel.php

https://bitbucket.org/eddieajau/the-art-of-joomla-archive
PHP | 55 lines | 20 code | 7 blank | 28 comment | 0 complexity | 2d2f4142356ff9a9af5aea13f04e20da MD5 | raw file
  1. <?php
  2. /**
  3. * @version $Id: accesslevel.php 390 2010-11-05 11:35:33Z 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 JFormFieldAccessLevel extends JFormFieldList
  21. {
  22. /**
  23. * The field type.
  24. *
  25. * @var string
  26. */
  27. protected $type = 'AccessLevel';
  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. // Get a database object.
  36. $db = JFactory::getDbo();
  37. // Get the user groups from the database.
  38. $db->setQuery(
  39. 'SELECT a.id AS value, a.name AS text' .
  40. ' FROM #__groups AS a' .
  41. ' ORDER BY a.id ASC'
  42. );
  43. $options = $db->loadObjectList();
  44. // Merge any additional options in the XML definition.
  45. $options = array_merge(parent::_getOptions(), $options);
  46. return $options;
  47. }
  48. }