<?php
/**
 * @package DJ-Catalog2
 * @copyright Copyright (C) DJ-Extensions.com, All rights reserved.
 * @license http://www.gnu.org/licenses GNU/GPL
 * @author url: http://dj-extensions.com
 * @author email contact@dj-extensions.com
 */

defined('_JEXEC') or die();
defined('JPATH_BASE') or die;

JFormHelper::loadFieldClass('list');

class JFormFieldDjcgauge extends JFormFieldList {
	
	protected $type = 'Djcgauge';
	
	protected function getOptions()
	{
		$options = parent::getOptions();
		
		$db = JFactory::getDbo();
		$query = $db->getQuery(true);
		$query->select('id AS value, name as text ');
		$query->from('#__djc2_gauges');
		$query->order('is_default DESC, name ASC');
		$db->setQuery($query);
		$gauges = $db->loadObjectList();
		
		$options = array_merge($options, $gauges);
		
		return $options;
	}
}
?>