<?php
class ControllerextensionModuleevaluationthree extends Controller {
	public function index($setting) {
		$data['titlename'] = $setting['titlename'];
		$data['bgcolor'] = $setting['bgcolor'];
		$data['bgcolorcss'] = $setting['bgcolorcss'];
		$data['titlecss'] = $setting['titlecss'];
		$data['positioncss'] = $setting['positioncss'];
		$data['titlesmcss'] = $setting['titlesmcss'];
		$data['describe'] = $setting['describe'];
		$data['etncolor'] = $setting['etncolor'];
		$data['edcolor'] = $setting['edcolor'];
		$data['eotop'] = $setting['eotop'];
		$data['eob'] = $setting['eob'];
		$data['column'] = $setting['column'];
		$data['etpa'] = $setting['etpa'];
		$data['etcolor'] = $setting['etcolor'];
		$data['etlinew'] = $setting['etlinew'];
		$data['etlineh'] = $setting['etlineh'];
		$data['etlinec'] = $setting['etlinec'];
		$data['autoplay'] = $setting['autoplay'];
		$data['main'] = $setting['main'];
		$data['speed'] = $setting['speed'];
		$data['scroll'] = $setting['scroll'];
		$data['imground'] = $setting['imground'];
        $data['imgthumb'] = $setting['imgthumb'];	
        $data['imgshadow'] = $setting['imgshadow'];	
		$data['imgpadding'] = $setting['imgpadding'];
        $data['imgborder'] = $setting['imgborder'];	
        $data['imgcolor'] = $setting['imgcolor'];
		$data['slidewidth'] = $setting['slidewidth'];	       
        $data['slideheight'] = $setting['slideheight'];
        $data['slideradius'] = $setting['slideradius'];	
        $data['slidebjcolor'] = $setting['slidebjcolor'];
        $data['bjcolorafter'] = $setting['bjcolorafter'];
        $data['sliderborder'] = $setting['sliderborder'];
        $data['sliderborderw'] = $setting['sliderborderw'];	
        $data['sliderborderrd'] = $setting['sliderborderrd'];			
        $data['sliderhkc'] = $setting['sliderhkc'];
        $data['sliderpadding'] = $setting['sliderpadding'];
		$data['etcolorjbbj'] = $setting['etcolorjbbj'];
		static $module = 0;

		$this->load->model('tool/image');

		if (is_file(DIR_IMAGE . $setting['image'])) {
			$image = $setting['image'];
		} else {
			$image = 'placeholder.png';
		}

		$data['image'] = $this->model_tool_image->resize($image, $setting['width'], $setting['height']);
		
		$data['services'] = array();

		if (isset($setting['service']) && $setting['service']) {
			$this->load->model('tool/image');

			$services = $setting['service'];

			$sort_order = array();

			foreach ($services as $key => $value) {
				$sort_order[$key] = $value['sort_order'];
			}

			array_multisort($sort_order, SORT_ASC, $services);

			foreach ($services as $service) {
				$service_info = array();
				if (isset($service['title'][$this->config->get('config_language_id')])) {
					$service_info['title'] = trim($service['title'][$this->config->get('config_language_id')]);
				} else {
					$service_info['title'] = '';
				}

				if (isset($service['other'][$this->config->get('config_language_id')])) {
					$service_info['other'] = trim($service['other'][$this->config->get('config_language_id')]);
				} else {
					$service_info['other'] = '';
				}
				if (isset($service['text'][$this->config->get('config_language_id')])) {
					$service_info['text'] = trim($service['text'][$this->config->get('config_language_id')]);
				} else {
					$service_info['text'] = '';
				}
				if (isset($service['link'][$this->config->get('config_language_id')])) {
					$service_info['link'] = trim($service['link']);
				} else {
					$service_info['link'] = '';
				}

				if (isset($service['image']) && is_file(DIR_IMAGE . $service['image'])) {
					$service_info['image'] = $this->model_tool_image->resize($service['image'], $setting['imagewidth'], $setting['imageheight']);
				} else {
					$service_info['image'] = $this->model_tool_image->resize('', $setting['imagewidth'], $setting['imageheight']);
				}

				$data['services'][] = $service_info;
			}
		}

		if ($data['services']) {
			if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . 'extension/module/evaluationthree.tpl')) {
				return $this->load->view($this->config->get('config_template') . 'extension/module/evaluationthree.tpl', $data);
			} else {
				return $this->load->view('extension/module/evaluationthree.tpl', $data);
			}
		}

	}
}