<?php
/*
	Stempora Web Framework
	Copyright (c) 2002-2014 Stempora. 
	All rights reserved.
		web:  www.stempora.com
		mail: support@stempora.com		
*/

// dependencies

/**
* description
*
* @library	
* @author	
* @since	
*/
class CCurrency extends CPlugin{
	
	var $tplvars; 

	function CCurrency() {
		//$this->CPlugin($db, $tables , $templates);
	}

	function DoEvents(){
		global $base, $_CONF, $_TSM , $_VARS , $_USER , $_BASE , $_SESS;

		parent::DoEvents();		


		if ($_GET["mod"] == "currency") {

			$sub = $_GET["sub"];
			$action = $_GET["action"];

			//read the module
			$this->tpl_module = $this->module->plugins["modules"]->LoadDefaultModule("currency");


			switch ($sub) {
				case "landing":					
					$_GET["sub"] = $sub = "rates";
				case "rates":					
					$data = new CSQLAdmin($sub, $this->__parent_templates,$this->db,$this->tables,$extra);
					$this->PrepareFields($data->forms["forms"]);
					return $data->DoEvents();
				break;


			}
		}

	}

	/**
	* description
	*
	* @param
	*
	* @return
	*
	* @access
	*/
	function getDefaultCurrency() {

		$this->tpl_module = $this->module->plugins["modules"]->LoadDefaultModule("currency");

		
		$default = $this->db->QFetchArray(
			"SELECT * FROM {$this->tables['plugin:currency_rates']} WHERE cur_code LIKE '%s'" , 
			array(
				$this->tpl_module["settings"]["set_default"]
			)
		);

		return $default;
	}
	
	
}

?>