<?php
/**
* @version 1.0.0
* @package RSEvents! 1.0.0
* @copyright (C) 2009 www.rsjoomla.com
* @license GPL, http://www.gnu.org/copyleft/gpl.html
*/

defined('_JEXEC') or die();
 
jimport( 'joomla.application.component.model' );

class rseventsModelSettings extends JModel
{
	var $_query;
	var $_data;
	var $_total=null;
	var $_pagination=null;
	var $_componentList=null;
	function _buildQuery()
	{
		
		$this->_query="SELECT IdConfig as RecordId, ConfigName , ConfigValue FROM #__rsevents_config";
		//echo $this->_query;
	}
	function __construct()
	{	
		parent::__construct();
		$this->_buildQuery();
		global $mainframe, $option;

	}
	function getData()
	{
		if (empty($this->_data))
		{
			$this->_data=$this->_getList($this->_query);
		}
		$rseventsConfig = array();
		foreach($this->_data as $i => $objConfig)
		{
			$rseventsConfig[$objConfig->ConfigName] = $objConfig->ConfigValue;
		}
		return $rseventsConfig;
	}
	
	function getConfig()
	{
		$idConfig= JRequest::getVar('cid');
		if(is_array($idConfig)) $idConfig=$idConfig[0];
		$row= & JTable::getInstance('Rsevents_Settings','Table');
		$row->load($idConfig);
		return $row;
	}
	
 
}