<?php
 
class ControllerModuleEventsScheduler extends Controller {

	public function index() {
		$this->language->load('module/events_scheduler');

$cc=0;
		//	$cc = sprintf($this->request->post['username']);
			 $cc = sprintf($this->customer->getId());  
			  $cc = sprintf($this->customer->getGoId()); 
			  $cc2="cc=$cc";
$url='';
    	
		$this->data['heading_title'] = $this->language->get('heading_title');

		$this->load->model('module/events_scheduler');
		
		if ($this->customer->isLogged()) {
			$this->data['text_no_upcoming'] = $this->language->get('text_no_upcoming');
		} else {
			$this->data['text_no_upcoming'] = $this->language->get('text_login_registered');
		}
		
		$this->data['events'] = array();
		
		if ($this->customer->isLogged()) {
			$results = $this->model_module_events_scheduler->getEvents($this->customer->getId());
			if ($results) {
				foreach ($results as $result) {
					$this->data['events'][] = array(
						'event_id'		=> $result['event_id'],
                        'product_id'		=> $result['product_id'],
						'name'			=> html_entity_decode($result['name'], ENT_QUOTES, 'UTF-8'),
						'start_date'	=> date($this->language->get('date_format_short'), $result['date_time']),
						'start_time'	=> date($this->language->get('time_format'), $result['date_time']),
						'class_days'	=> $result['class_days'],



						'location'		=> nl2br($result['location']),
'href'      => $this->url->link("product/product&$cc2", $url . '&product_id=' . $result['product_id']),
						'telephone'		=> $result['telephone']
					); //array

	 
				}//$results as $results
			}//$results
		}
		
		if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/events_scheduler.tpl')) {
			$this->template = $this->config->get('config_template') . '/template/module/events_scheduler.tpl';
		} else {
			$this->template = 'default/template/module/events_scheduler.tpl';
		}
		
		$this->render();
	}

}

?>
