<?php
class ControllerextensionModulepriceone extends Controller {
	public function index($setting) {
		$data['titlename'] = $setting['titlename'];
		$data['linew'] = $setting['linew'];
		$data['lineh'] = $setting['lineh'];
		$data['linec'] = $setting['linec'];
		$data['bgcolor'] = $setting['bgcolor'];
		$data['bgcolorcss'] = $setting['bgcolorcss'];
		$data['titlecss'] = $setting['titlecss'];
		$data['titlesmcss'] = $setting['titlesmcss'];
		$data['describe'] = $setting['describe'];
		$data['mtitle'] = $setting['mtitle'];
		$data['mdescribe'] = $setting['mdescribe'];
		$data['mbgcolor'] = $setting['mbgcolor'];
		$data['mpa'] = $setting['mpa'];
		$data['mborder'] = $setting['mborder'];
		$data['mbcolor'] = $setting['mbcolor'];
		$data['npadding'] = $setting['npadding'];
		$data['stp'] = $setting['stp'];
		$data['sbp'] = $setting['sbp'];
		$data['position'] = $setting['position'];
		$data['main'] = $setting['main'];
		$data['autoplay'] = $setting['autoplay'];
		$data['fade'] = $setting['fade'];
		$data['speed'] = $setting['speed'];
		$data['column'] = $setting['column'];
		$data['rows'] = $setting['rows'];
		$data['scroll'] = $setting['scroll'];	
		$data['sdtitle'] = $setting['sdtitle'];
		$data['sdone'] = $setting['sdone'];
		$data['sdtwo'] = $setting['sdtwo'];
		$data['sdthree'] = $setting['sdthree'];
		$data['wgdlg1'] = $setting['wgdlg1'];
		$data['wgdlg2'] = $setting['wgdlg2'];
		$data['buttonname1'] = $setting['buttonname1'];
		$data['buttonname2'] = $setting['buttonname2'];
		$data['link1'] = $setting['link1'];
		$data['link2'] = $setting['link2'];
		$data['sdione'] = $setting['sdione'];
		$data['sditwo'] = $setting['sditwo'];
		$data['sdithree'] = $setting['sdithree'];
		$data['sdifour'] = $setting['sdifour'];
		$data['sdifive'] = $setting['sdifive'];
		$data['sdisix'] = $setting['sdisix'];		
		$data['sdtnone'] = $setting['sdtnone'];
		$data['sdtntwo'] = $setting['sdtntwo'];
		$data['sdtnthree'] = $setting['sdtnthree'];
		$data['sdtnfour'] = $setting['sdtnfour'];
		$data['sdtnfive'] = $setting['sdtnfive'];
		$data['sdtnsix'] = $setting['sdtnsix'];
		$data['sddone'] = $setting['sddone'];
		$data['sddtwo'] = $setting['sddtwo'];
		$data['sddthree'] = $setting['sddthree'];
		$data['sddfour'] = $setting['sddfour'];
		$data['sddfive'] = $setting['sddfive'];
		$data['sddsix'] = $setting['sddsix'];
		$data['stcolumn'] = $setting['stcolumn'];
		$data['stmiconbj'] = $setting['stmiconbj'];
		$data['stmiconcolor'] = $setting['stmiconcolor'];
		$data['stmiconround'] = $setting['stmiconround'];
		$data['stmiconsize'] = $setting['stmiconsize'];
		$data['stmiconborder'] = $setting['stmiconborder'];
		$data['stmiconbc'] = $setting['stmiconbc'];		
		$data['sttccolor'] = $setting['sttccolor'];
		$data['stpricecolor'] = $setting['stpricecolor'];	
		$data['stmiconwidth'] = $setting['stmiconwidth'];
		$data['stmiconheight'] = $setting['stmiconheight'];	
		$data['boxbg'] = $setting['boxbg'];
		$data['boxjbbj'] = $setting['boxjbbj'];
		$data['boxtitle'] = $setting['boxtitle'];
		$data['boxprice'] = $setting['boxprice'];
		$data['boxpriceyj'] = $setting['boxpriceyj'];
		$data['boxterm'] = $setting['boxterm'];	
		$data['boxlinewidth'] = $setting['boxlinewidth'];
		$data['boxline'] = $setting['boxline'];	
		$data['boxbs'] = $setting['boxbs'];	
		$data['boxmagin'] = $setting['boxmagin'];
		$data['boxpadding'] = $setting['boxpadding'];
		$data['boxborder'] = $setting['boxborder'];
		$data['boxcolor'] = $setting['boxcolor'];	       
        $data['boxround'] = $setting['boxround'];
        $data['boxposition'] = $setting['boxposition'];	
        $data['boxshadow'] = $setting['boxshadow'];
        $data['boxshadowhover'] = $setting['boxshadowhover'];
        $data['buttonprcl'] = $setting['buttonprcl'];			

		$data['buttonsize'] = $setting['buttonsize'];
		$data['buttoninset'] = $setting['buttoninset'];	       
        $data['buttonborder'] = $setting['buttonborder'];
        $data['buttonround'] = $setting['buttonround'];	
        $data['buttonhover'] = $setting['buttonhover'];
        $data['buttond'] = $setting['buttond'];			
		$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['pricebt'][$this->config->get('config_language_id')])) {
					$service_info['pricebt'] = trim($service['pricebt'][$this->config->get('config_language_id')]);
				} else {
					$service_info['pricebt'] = '';
				}
				if (isset($service['priceyj'][$this->config->get('config_language_id')])) {
					$service_info['priceyj'] = trim($service['priceyj'][$this->config->get('config_language_id')]);
				} else {
					$service_info['priceyj'] = '';
				}
				if (isset($service['buttonname'][$this->config->get('config_language_id')])) {
					$service_info['buttonname'] = trim($service['buttonname'][$this->config->get('config_language_id')]);
				} else {
					$service_info['buttonname'] = '';
				}				
				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['text1'] = '';
				}
				if (isset($service['text2'][$this->config->get('config_language_id')])) {
					$service_info['text2'] = trim($service['text2'][$this->config->get('config_language_id')]);
				} else {
					$service_info['text2'] = '';
				}
				if (isset($service['text3'][$this->config->get('config_language_id')])) {
					$service_info['text3'] = trim($service['text3'][$this->config->get('config_language_id')]);
				} else {
					$service_info['text3'] = '';
				}
				if (isset($service['text4'][$this->config->get('config_language_id')])) {
					$service_info['text4'] = trim($service['text4'][$this->config->get('config_language_id')]);
				} else {
					$service_info['text4'] = '';
				}
				if (isset($service['text5'][$this->config->get('config_language_id')])) {
					$service_info['text5'] = trim($service['text5'][$this->config->get('config_language_id')]);
				} else {
					$service_info['text5'] = '';
				}
				if (isset($service['text6'][$this->config->get('config_language_id')])) {
					$service_info['text6'] = trim($service['text6'][$this->config->get('config_language_id')]);
				} else {
					$service_info['text6'] = '';
				}
				if (isset($service['text7'][$this->config->get('config_language_id')])) {
					$service_info['text7'] = trim($service['text7'][$this->config->get('config_language_id')]);
				} else {
					$service_info['text7'] = '';
				}	
				if (isset($service['text8'][$this->config->get('config_language_id')])) {
					$service_info['text8'] = trim($service['text8'][$this->config->get('config_language_id')]);
				} else {
					$service_info['text8'] = '';
				}																											
				if (isset($service['link'])) {
					$service_info['link'] = trim($service['link']);
				} else {
					$service_info['link'] = '';
				}

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

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

	}
}