<?php
/**
 * @version		$Id: accesssection.php 256 2009-01-08 07:28:44Z louis $
 * @package		JXtended.Libraries
 * @subpackage	Form
 * @copyright	Copyright (C) 2008 - 2009 JXtended, LLC. All rights reserved.
 * @license		GNU General Public License <http://www.gnu.org/copyleft/gpl.html>
 * @link		http://jxtended.com
 */

defined('JPATH_BASE') or die;

jimport('joomla.html.html');
jximport('jxtended.form.field');
jximport('jxtended.form.fields.list');

/**
 * JXtended Form Field Type Class for an Access Section.
 *
 * @package		JXtended.Libraries
 * @subpackage	Form
 * @version		1.0
 */
class JXFieldTypeAccessSection extends JXFieldTypeList
{
	/**
	 * Field type
	 *
	 * @access	protected
	 * @var		string
	 */
	var	$_type = 'AccessSection';

	function _getOptions(&$node)
	{
		// Get a database object.
		$db = &JFactory::getDBO();

		// Get the user groups from the database.
		$db->setQuery(
			'SELECT `id` AS value, `title` AS text' .
			' FROM `#__access_sections`' .
			' ORDER BY `ordering`, `title` ASC'
		);
		$options = $db->loadObjectList();

		return $options;
	}
}