<?php   

class ModuleCurrency extends Controller {

	function fetch() {
//ini_set("display_errors", "On");
error_reporting(0);
		$config   =& $this->locator->get('config');

		$currency =& $this->locator->get('currency');

		$database =& $this->locator->get('database');

		$language =& $this->locator->get('language');		

		$request  =& $this->locator->get('request');

		$response =& $this->locator->get('response');

		$url      =& $this->locator->get('url');

		if ($request->has('currency')) {

      			$currency->set($request->get('currency'));

  				$response->redirect($request->get('action'));
		}

		$language->load('extension/module/currency.php');		

		$template = $this->locator->create('template');		

   		$template->set('heading_title', $language->get('heading_title'));
   			
		$template->set('action', $url->getCurUrl()); 

   		$template->set('text_currency', $language->get('text_currency'));

   		$template->set('entry_currency', $language->get('entry_currency'));   		

        $template->set('currency_info', $database->getRow($database->parse("select icon,code from currency where code='?'",$currency->getCode())));   		
            	
   		$template->set('currencies', $database->cache('currency', "select * from currency order by title")); 

   		return $template->fetch('module/currency.tpl'); 	

	} 

}

?>