<?php
class ControllerExtensionModulepricecss extends Controller {
	public function index($setting) {
		$data['titlename'] = $setting['titlename'];
		$data['linew'] = $setting['linew'];
		$data['lineh'] = $setting['lineh'];
		$data['linec'] = $setting['linec'];
		$data['describe'] = $setting['describe'];
		$data['sectionbj'] = $setting['sectionbj'];		
		$data['sectionjbbj'] = $setting['sectionjbbj'];
		$data['sectiontitle'] = $setting['sectiontitle'];
		$data['sectiondescribe'] = $setting['sectiondescribe'];
		$data['sectionptop'] = $setting['sectionptop'];
		$data['sectionpbuttom'] = $setting['sectionpbuttom'];
		$data['boxlinewidth'] = $setting['boxlinewidth'];
		$data['boxline'] = $setting['boxline'];	
		$data['boxbs'] = $setting['boxbs'];	
		$data['tcone'] = $setting['tcone'];
		$data['tctwo'] = $setting['tctwo'];
		$data['tcthree'] = $setting['tcthree'];	
		$data['tcfour'] = $setting['tcfour'];	
		$data['iccolor'] = $setting['iccolor'];	
		$data['tccolor'] = $setting['tccolor'];			
		$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['taocan1'][$this->config->get('config_language_id')])) {
					$service_info['taocan1'] = trim($service['taocan1'][$this->config->get('config_language_id')]);
				} else {
					$service_info['taocan1'] = '';
				}
				if (isset($service['taocan2'][$this->config->get('config_language_id')])) {
					$service_info['taocan2'] = trim($service['taocan2'][$this->config->get('config_language_id')]);
				} else {
					$service_info['taocan2'] = '';
				}				
				if (isset($service['taocan3'][$this->config->get('config_language_id')])) {
					$service_info['taocan3'] = trim($service['taocan3'][$this->config->get('config_language_id')]);
				} else {
					$service_info['taocan3'] = '';
				}
				if (isset($service['taocan4'][$this->config->get('config_language_id')])) {
					$service_info['taocan4'] = trim($service['taocan4'][$this->config->get('config_language_id')]);
				} else {
					$service_info['taocan4'] = '';
				}


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

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

	}
}