<?php
class ControllerextensionModuleyskills 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['colorall'] = $setting['colorall'];
		$data['colorone'] = $setting['colorone'];
		$data['colortwo'] = $setting['colortwo'];
		$data['colorthree'] = $setting['colorthree'];
		$data['colortitle'] = $setting['colortitle'];
		$data['describe'] = $setting['describe'];
		$data['acordionbj'] = $setting['acordionbj'];
		$data['acordionbjhover'] = $setting['acordionbjhover'];
		$data['acordiontit'] = $setting['acordiontit'];
		$data['acordiontithover'] = $setting['acordiontithover'];
		$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['title1'][$this->config->get('config_language_id')])) {
					$service_info['title1'] = trim($service['title1'][$this->config->get('config_language_id')]);
				} else {
					$service_info['title1'] = '';
				}
				if (isset($service['text1'][$this->config->get('config_language_id')])) {
					$service_info['text1'] = trim($service['text1'][$this->config->get('config_language_id')]);
				} else {
					$service_info['tex1t'] = '';
				}
				if (isset($service['qiehuan1'][$this->config->get('config_language_id')])) {
					$service_info['qiehuan1'] = trim($service['qiehuan1'][$this->config->get('config_language_id')]);
				} else {
					$service_info['qiehuan1'] = '';
				}
				if (isset($service['skill1'][$this->config->get('config_language_id')])) {
					$service_info['skill1'] = trim($service['skill1'][$this->config->get('config_language_id')]);
				} else {
					$service_info['skill1'] = '';
				}
				if (isset($service['number1'][$this->config->get('config_language_id')])) {
					$service_info['number1'] = trim($service['number1'][$this->config->get('config_language_id')]);
				} else {
					$service_info['number1'] = '';
				}

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

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

	}
}