Location: PHPKode > projects > HikaShop > back/types/currency.php
<?php
/**
 * @package		HikaShop for Joomla!
 * @version		1.4.3
 * @author		hikashop.com
 * @copyright	(C) 2010 HIKARI SOFTWARE. All rights reserved.
 * @license		GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?>
<?php
class hikashopCurrencyType{
	var $displayType = 'auto';
	function load($value){
		$config =& hikashop::config();
		$forced=array();
		$this->values = array();
		$forced[] = (int)$config->get('main_currency');
		$filters = array('currency_published=1');
		if($this->displayType=='auto'){
			$app = JFactory::getApplication();
			if($app->isAdmin()){
				$forced[]=(int)$value;
			}else{
				$filters[]='currency_displayed = 1';
			}
			$filters[]='currency_id IN ('.implode(',',$forced).')';
		}elseif($this->displayType=='all'){
			$filters[]='currency_displayed = 1';
			$this->values[] = JHTML::_('select.option', 0,JText::_('HIKA_NONE'));
		}
		$query = 'SELECT currency_code,currency_symbol,currency_id FROM '.hikashop::table('currency').' WHERE  '.implode(' OR ',$filters);
		$db =& JFactory::getDBO();
		$db->setQuery($query);
		$currencies = $db->loadObjectList('currency_id');
		if(!empty($currencies)){
			foreach($currencies as $currency){
				$this->values[] = JHTML::_('select.option', (int)$currency->currency_id, $currency->currency_symbol.' '.$currency->currency_code );
			}
		}
	}
	function display($map,$value,$options=''){
		if(empty($this->values)){
			$this->load($value);
		}
		return JHTML::_('select.genericlist',   $this->values, $map, 'class="inputbox" size="1" '.$options, 'value', 'text', (int)$value );
	}
}
Return current item: HikaShop