<?php
class ControllerCommonFooter extends Controller {
	public function index() {
		$this->load->language('common/footer');

		$this->load->model('catalog/information');

		$data['informations'] = array();

		foreach ($this->model_catalog_information->getInformations() as $result) {
			if ($result['bottom']) {
				$data['informations'][] = array(
					'title' => $result['title'],
					'href'  => $this->url->link('information/information', 'information_id=' . $result['information_id'])
				);
			}
		}

		$data['contact'] = $this->url->link('information/contact');
		$data['return'] = $this->url->link('account/return/add', '', true);
		$data['sitemap'] = $this->url->link('information/sitemap');
		$data['tracking'] = $this->url->link('information/tracking');
		$data['manufacturer'] = $this->url->link('product/manufacturer');
		$data['voucher'] = $this->url->link('account/voucher', '', true);
		$data['affiliate'] = $this->url->link('affiliate/login', '', true);
		$data['special'] = $this->url->link('product/special');
		$data['account'] = $this->url->link('account/account', '', true);
		$data['order'] = $this->url->link('account/order', '', true);
		$data['wishlist'] = $this->url->link('account/wishlist', '', true);
		$data['newsletter'] = $this->url->link('account/newsletter', '', true);

		$data['powered'] = sprintf($this->language->get('text_powered'), $this->config->get('config_name'), date('Y', time()));

				// Plaza Module Postion
					$data['position1'] = $this->load->controller('common/position1');
					$data['position2'] = $this->load->controller('common/position2');
					$data['position3'] = $this->load->controller('common/position3');
					$data['position4'] = $this->load->controller('common/position4');
					$data['position5'] = $this->load->controller('common/position5');
					$data['position6'] = $this->load->controller('common/position6');
					$data['position7'] = $this->load->controller('common/position7');
					$data['position8'] = $this->load->controller('common/position8');
					$data['position9'] = $this->load->controller('common/position9');
					$data['position10'] = $this->load->controller('common/position10');
					$data['address'] = $this->config->get('config_address');
					$data['text_address'] = $this->language->get('text_address');
					$data['telephone'] = $this->config->get('config_telephone');
					$data['text_phone'] = $this->language->get('text_phone');
					$data['email'] = $this->config->get('config_email');
					$data['text_email'] = $this->language->get('text_email');
					$data['text_description_footer'] = $this->language->get('text_description_footer');
					$data['text_signup_newsletter'] = $this->language->get('text_signup_newsletter');
				// End Plaza Module Postion
			

		// Whos Online
		if ($this->config->get('config_customer_online')) {
			$this->load->model('tool/online');

			if (isset($this->request->server['REMOTE_ADDR'])) {
				$ip = $this->request->server['REMOTE_ADDR'];
			} else {
				$ip = '';
			}

			if (isset($this->request->server['HTTP_HOST']) && isset($this->request->server['REQUEST_URI'])) {
				$url = ($this->request->server['HTTPS'] ? 'https://' : 'http://') . $this->request->server['HTTP_HOST'] . $this->request->server['REQUEST_URI'];
			} else {
				$url = '';
			}

			if (isset($this->request->server['HTTP_REFERER'])) {
				$referer = $this->request->server['HTTP_REFERER'];
			} else {
				$referer = '';
			}

			$this->model_tool_online->addOnline($ip, $this->customer->getId(), $url, $referer);
		}

		$data['scripts'] = $this->document->getScripts('footer');
		
		return $this->load->view('common/footer', $data);
	}
}
