PageRenderTime 134ms CodeModel.GetById 94ms RepoModel.GetById 1ms app.codeStats 0ms

/content/code/trunk/administrator/components/com_artofcontent/models/fields/section.php

https://bitbucket.org/eddieajau/the-art-of-joomla-archive
PHP | 55 lines | 20 code | 7 blank | 28 comment | 0 complexity | dcf42bd2a4c5d51a74b768975dc1b015 MD5 | raw file
  1. <?php
  2. /**
  3. * @version $Id: section.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;
  11. jimport('joomla.html.html');
  12. /**
  13. * Form Field class for JXtended Libraries.
  14. *
  15. * @package JXtended.Libraries
  16. * @subpackage Form
  17. * @since 1.1
  18. */
  19. class JFormFieldSection extends JFormFieldList
  20. {
  21. /**
  22. * The field type.
  23. *
  24. * @var string
  25. */
  26. protected $type = 'Section';
  27. /**
  28. * Method to get a list of options for a list input.
  29. *
  30. * @return array An array of JHtml options.
  31. */
  32. protected function _getOptions()
  33. {
  34. // Get a database object.
  35. $db = &JFactory::getDbo();
  36. // Get the user groups from the database.
  37. $db->setQuery(
  38. 'SELECT a.id AS value, a.title AS text' .
  39. ' FROM #__sections AS a' .
  40. ' WHERE scope = '.$db->quote('content') .
  41. ' ORDER BY a.ordering 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. }