<?php  
class ModuleHeader extends Controller {
	function fetch() {
//ini_set("display_errors", "On");
error_reporting(0);

		$config   =& $this->locator->get('config');
		$customer =& $this->locator->get('customer');
		$language =& $this->locator->get('language');
		$url      =& $this->locator->get('url');
		$database =& $this->locator->get('database');
		$session  =& $this->locator->get('session');
		$currency =& $this->locator->get('currency');
		$request  =& $this->locator->get('request');
		$response =& $this->locator->get('response');
	
		$template =& $this->locator->create('template');
		$module   =& $this->locator->get('module');		
		$tax      =& $this->locator->get('tax');
		$image    =& $this->locator->get('image');
	
		$language->load('extension/module/header.php');			
		
		$template->set('text_cart', $language->get('text_cart')); 
		$template->set('text_account', $language->get('text_account'));    		
		$template->set('text_signin', $language->get('text_signin'));
		$template->set('text_register', $language->get('text_register'));
		$template->set('text_logout', $language->get('text_logout'));    	
    		 		
    	
    		if (!$customer->isLogged()) {
      			$template->set('login', $url->ssl('account_login'));
    		} else {    				 	
    			$customer_info = $database->getRow("select email,vip_rank,current_points from customer where customer_id=".$customer->getId());	
    			$template->set('customer_info', $customer_info );
    			$template->set('vip_info', $database->getRow($database->parse("select discount from vip where vip_rank='?'", $customer_info['vip_rank'])));
      			$template->set('logout', $url->href('account_logout'));
    		}            
     	       		
   			$country_list=$database->getRows("select country_id, name from country");		
			$template->set('country_list',$country_list);		
	
			$template->set('billboard', $config->get('config_billboard'));
			
			// Append currency 
		    $template->set($module->fetchTemplate('currency'));    
		    
		    // Append search 
		    $template->set($module->fetchTemplate('search'));
     		
		    // Append category2 
		    $template->set($module->fetchTemplate('category2'));
		    
		    // Append currency 
		    $template->set($module->fetchTemplate('cart'));
		    
    	    return $template->fetch('module/header.tpl');
		}
	}
?>
