<?php
class ControllerextensionModuleservicethree extends Controller {
	private $error = array();

	public function index() {
		$this->load->language('extension/module/servicethree');

		$this->document->setTitle(preg_replace('/<(.*?)strong>/i', '', $this->language->get('heading_title')));

		$this->load->model('extension/module');

		if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
			if (!isset($this->request->get['module_id'])) {
				$this->model_extension_module->addModule('servicethree', $this->request->post);
			} else {
				$this->model_extension_module->editModule($this->request->get['module_id'], $this->request->post);
			}

			$this->session->data['success'] = $this->language->get('text_success');

			$this->response->redirect($this->url->link('extension/extension', 'token=' . $this->session->data['token'] . '&type=module', true));
		}

		$data['heading_title'] = preg_replace('/<(.*?)strong>/i', '', $this->language->get('heading_title'));

		$data['text_edit'] = $this->language->get('text_edit');
		$data['text_enabled'] = $this->language->get('text_enabled');
		$data['text_disabled'] = $this->language->get('text_disabled');
		$data['text_yes'] = $this->language->get('text_yes');
		$data['text_no'] = $this->language->get('text_no');
		$data['text_mainc'] = $this->language->get('text_mainc');
		$data['text_mainfw'] = $this->language->get('text_mainfw');
		$data['text_qq_open_signup'] = $this->language->get('text_qq_open_signup');
		$data['text_cwkj_wxts'] = $this->language->get('text_cwkj_wxts');
		
		$data['entry_status'] = $this->language->get('entry_status');
		$data['entry_name'] = $this->language->get('entry_name');
		$data['entry_sectionid'] = $this->language->get('entry_sectionid');
        $data['entry_sectiontab'] = $this->language->get('entry_sectiontab');	
		$data['entry_titlename'] = $this->language->get('entry_titlename');
		$data['entry_bgcolortitle'] = $this->language->get('entry_bgcolortitle');
		$data['entry_bgcolor'] = $this->language->get('entry_bgcolor');
		$data['entry_bgcolorcss'] = $this->language->get('entry_bgcolorcss');
		$data['entry_titlejbcss'] = $this->language->get('entry_titlejbcss');
		$data['entry_titlecss'] = $this->language->get('entry_titlecss');
		$data['entry_titlesmcss'] = $this->language->get('entry_titlesmcss');
		$data['entry_describe'] = $this->language->get('entry_describe');
		$data['entry_title'] = $this->language->get('entry_title');
		$data['entry_text'] = $this->language->get('entry_text');
		$data['entry_buttonname'] = $this->language->get('entry_buttonname');
		$data['entry_button1'] = $this->language->get('entry_button1');
		$data['entry_button2'] = $this->language->get('entry_button2');
		$data['entry_buttonname1'] = $this->language->get('entry_buttonname1');
		$data['entry_buttonname2'] = $this->language->get('entry_buttonname2');
		$data['entry_qq1'] = $this->language->get('entry_qq1');
		$data['entry_qq2'] = $this->language->get('entry_qq2');
		$data['entry_alww1'] = $this->language->get('entry_alww1');
		$data['entry_alww2'] = $this->language->get('entry_alww2');
		$data['entry_link1'] = $this->language->get('entry_link1');
		$data['entry_link2'] = $this->language->get('entry_link2');
		$data['entry_buttoncolor1'] = $this->language->get('entry_buttoncolor1');
		$data['entry_buttoncolor2'] = $this->language->get('entry_buttoncolor2');
		$data['entry_link'] = $this->language->get('entry_link');
		$data['entry_image'] = $this->language->get('entry_image');
		$data['entry_sort_order'] = $this->language->get('entry_sort_order');

		$data['entry_mm'] = $this->language->get('entry_mm');
		$data['entry_mtitle'] = $this->language->get('entry_mtitle');
		$data['entry_mdescribe'] = $this->language->get('entry_mdescribe');
		$data['entry_mbgcolor'] = $this->language->get('entry_mbgcolor');
		$data['entry_mpa'] = $this->language->get('entry_mpa');
		$data['entry_mborder'] = $this->language->get('entry_mborder');
		$data['entry_mbcolor'] = $this->language->get('entry_mbcolor');
		$data['entry_npadding'] = $this->language->get('entry_npadding');
		$data['entry_stp'] = $this->language->get('entry_stp');
		$data['entry_sbp'] = $this->language->get('entry_sbp');
		$data['help_position'] = $this->language->get('help_position');
		$data['entry_position'] = $this->language->get('entry_position');
		$data['entry_sdtitle'] = $this->language->get('entry_sdtitle');
		$data['entry_sdone'] = $this->language->get('entry_sdone');
		$data['entry_sdtwo'] = $this->language->get('entry_sdtwo');
		$data['entry_sdthree'] = $this->language->get('entry_sdthree');
		$data['entry_button1'] = $this->language->get('entry_button1');
		$data['entry_button2'] = $this->language->get('entry_button2');
		$data['entry_wgdlg'] = $this->language->get('entry_wgdlg');
		$data['help_wgdlg'] = $this->language->get('help_wgdlg');
		$data['entry_wgdlg1'] = $this->language->get('entry_wgdlg1');
		$data['entry_wgdlg2'] = $this->language->get('entry_wgdlg2');
		$data['entry_column'] = $this->language->get('entry_column');
		$data['entry_srow'] = $this->language->get('entry_srow');
		$data['entry_tuwen'] = $this->language->get('entry_tuwen');
		$data['entry_width'] = $this->language->get('entry_width');
		$data['entry_height'] = $this->language->get('entry_height');
		$data['entry_link'] = $this->language->get('entry_link');
		$data['entry_strgba'] = $this->language->get('entry_strgba');

		$data['entry_sdione'] = $this->language->get('entry_sdione');	
		$data['entry_sditwo'] = $this->language->get('entry_sditwo');	
		$data['entry_sdithree'] = $this->language->get('entry_sdithree');
		$data['entry_sdifour'] = $this->language->get('entry_sdifour');	
		$data['entry_sdifive'] = $this->language->get('entry_sdifive');	
		$data['entry_sdisix'] = $this->language->get('entry_sdisix');	
		$data['entry_sdtnone'] = $this->language->get('entry_sdtnone');	
		$data['entry_sdtntwo'] = $this->language->get('entry_sdtntwo');	
		$data['entry_sdtnthree'] = $this->language->get('entry_sdtnthree');	
		$data['entry_sdtnfour'] = $this->language->get('entry_sdtnfour');	
		$data['entry_sdtnfive'] = $this->language->get('entry_sdtnfive');	
		$data['entry_sdtnsix'] = $this->language->get('entry_sdtnsix');	
		$data['entry_sddone'] = $this->language->get('entry_sddone');	
		$data['entry_sddtwo'] = $this->language->get('entry_sddtwo');
		$data['entry_sddthree'] = $this->language->get('entry_sddthree');
		$data['entry_sddfour'] = $this->language->get('entry_sddfour');
        $data['entry_sddfive'] = $this->language->get('entry_sddfive');	
        $data['entry_sddsix'] = $this->language->get('entry_sddsix');
        $data['entry_setone'] = $this->language->get('entry_setone');	
		$data['entry_settwo'] = $this->language->get('entry_settwo');	
		$data['entry_setthree'] = $this->language->get('entry_setthree');	
		$data['entry_setfour'] = $this->language->get('entry_setfour');
		$data['entry_setfive'] = $this->language->get('entry_setfive');	
		$data['entry_setsix'] = $this->language->get('entry_setsix');	

		$data['entry_stmiconbj'] = $this->language->get('entry_stmiconbj');
		$data['entry_stmiconcolor'] = $this->language->get('entry_stmiconcolor');
		$data['entry_stmiconround'] = $this->language->get('entry_stmiconround');
		$data['entry_stmiconsize'] = $this->language->get('entry_stmiconsize');
		$data['entry_stmiconborder'] = $this->language->get('entry_stmiconborder');
		$data['entry_stmiconbc'] = $this->language->get('entry_stmiconbc');
		$data['entry_sticonstyle'] = $this->language->get('entry_sticonstyle');
		$data['entry_stboxcolorcss'] = $this->language->get('entry_stboxcolorcss');
		$data['entry_sttccolor'] = $this->language->get('entry_sttccolor');
		$data['entry_stpricecolor'] = $this->language->get('entry_stpricecolor');
		$data['entry_stmiconwidth'] = $this->language->get('entry_stmiconwidth');
        $data['entry_stmiconheight'] = $this->language->get('entry_stmiconheight');
		$data['entry_stcolumn'] = $this->language->get('entry_stcolumn');
		$data['help_stcolumn'] = $this->language->get('help_stcolumn');
		$data['entry_segmentingline'] = $this->language->get('entry_segmentingline');
		$data['entry_slinew'] = $this->language->get('entry_slinew');
		$data['entry_slineh'] = $this->language->get('entry_slineh');
		$data['entry_slinec'] = $this->language->get('entry_slinec');
		$data['entry_autoplay'] = $this->language->get('entry_autoplay');
		$data['entry_main'] = $this->language->get('entry_main');
		$data['entry_imagepicstyle'] = $this->language->get('entry_imagepicstyle');
		$data['entry_speed'] = $this->language->get('entry_speed');
		$data['entry_scroll'] = $this->language->get('entry_scroll');
		$data['entry_strppa'] = $this->language->get('entry_strppa');
		$data['entry_fade'] = $this->language->get('entry_fade');
		$data['entry_buttonstyle'] = $this->language->get('entry_buttonstyle');
		$data['entry_buttonsize'] = $this->language->get('entry_buttonsize');
		$data['entry_buttoninset'] = $this->language->get('entry_buttoninset');
		$data['entry_buttonborder'] = $this->language->get('entry_buttonborder');
		$data['entry_buttonround'] = $this->language->get('entry_buttonround');
		$data['entry_buttonhover'] = $this->language->get('entry_buttonhover');
        $data['entry_buttond'] = $this->language->get('entry_buttond');	
        $data['entry_stwzc'] = $this->language->get('entry_stwzc');			
		
		$data['button_save'] = $this->language->get('button_save');
		$data['button_cancel'] = $this->language->get('button_cancel');
		$data['button_add'] = $this->language->get('button_add');
		$data['button_remove'] = $this->language->get('button_remove');

		$data['error_name'] = $this->language->get('error_name');

		if (isset($this->error['warning'])) {
			$data['error_warning'] = $this->error['warning'];
		} else {
			$data['error_warning'] = '';
		}

		if (isset($this->error['name'])) {
			$data['error_name'] = $this->error['name'];
		} else {
			$data['error_name'] = '';
		}
		if (isset($this->error['wgdlg1'])) {
			$data['error_wgdlg1'] = $this->error['wgdlg1'];
		} else {
			$data['error_wgdlg1'] = '';
		}
		if (isset($this->error['wgdlg2'])) {
			$data['error_wgdlg2'] = $this->error['wgdlg2'];
		} else {
			$data['error_wgdlg2'] = '';
		}
		if (isset($this->error['stcolumn'])) {
			$data['error_stcolumn'] = $this->error['stcolumn'];
		} else {
			$data['error_stcolumn'] = '';
		}
		if (isset($this->error['sectionid'])) {
			$data['error_sectionid'] = $this->error['sectionid'];
		} else {
			$data['error_sectionid'] = '';
		}
		if (isset($this->error['describe'])) {
			$data['error_describe'] = $this->error['describe'];
		} else {
			$data['error_describe'] = '';
		}
		$data['breadcrumbs'] = array();

		$data['breadcrumbs'][] = array(
			'text' => $this->language->get('text_home'),
			'href' => $this->url->link('common/dashboard', 'token=' . $this->session->data['token'], 'SSL')
		);

		$data['breadcrumbs'][] = array(
			'text' => $this->language->get('text_module'),
			'href' => $this->url->link('extension/extension', 'token=' . $this->session->data['token'], 'SSL')
		);

		$data['breadcrumbs'][] = array(
			'text' => preg_replace('/<(.*?)strong>/i', '', $this->language->get('heading_title')),
			'href' => $this->url->link('extension/module/servicethree', 'token=' . $this->session->data['token'], 'SSL')
		);

		if (!isset($this->request->get['module_id'])) {
			$data['action'] = $this->url->link('extension/module/servicethree', 'token=' . $this->session->data['token'], 'SSL');
		} else {
			$data['action'] = $this->url->link('extension/module/servicethree', 'token=' . $this->session->data['token'] . '&module_id=' . $this->request->get['module_id'], 'SSL');
		}

		$data['cancel'] = $this->url->link('extension/extension', 'token=' . $this->session->data['token'] . '&type=module', true);

		if (isset($this->request->get['module_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
			$module_info = $this->model_extension_module->getModule($this->request->get['module_id']);
		}

		$data['token'] = $this->session->data['token'];

		if (isset($this->request->post['status'])) {
			$data['status'] = $this->request->post['status'];
		} elseif (!empty($module_info)) {
			$data['status'] = $module_info['status'];
		} else {
			$data['status'] = '';
		}

		if (isset($this->request->post['name'])) {
			$data['name'] = $this->request->post['name'];
		} elseif (!empty($module_info)) {
			$data['name'] = $module_info['name'];
		} else {
			$data['name'] = '';
		}
		if (isset($this->request->post['sectionid'])) {
			$data['sectionid'] = $this->request->post['sectionid'];
		} elseif (!empty($module_info)) {
			$data['sectionid'] = $module_info['sectionid'];
		} else {
			$data['sectionid'] = '';
		}
		if (isset($this->request->post['sectiontab'])) {
			$data['sectiontab'] = $this->request->post['sectiontab'];
		} elseif (!empty($module_info)) {
			$data['sectiontab'] = $module_info['sectiontab'];
		} else {
			$data['sectiontab'] = '';
		}
		if (isset($this->request->post['titlename'])) {
			$data['titlename'] = $this->request->post['titlename'];
		} elseif (!empty($module_info)) {
			$data['titlename'] = $module_info['titlename'];
		} else {
			$data['titlename'] = '';
		}
		if (isset($this->request->post['bgcolor'])) {
			$data['bgcolor'] = $this->request->post['bgcolor'];
		} elseif (!empty($module_info)) {
			$data['bgcolor'] = $module_info['bgcolor'];
		} else {
			$data['bgcolor'] = '';
		}
		if (isset($this->request->post['bgcolorcss'])) {
			$data['bgcolorcss'] = $this->request->post['bgcolorcss'];
		} elseif (!empty($module_info)) {
			$data['bgcolorcss'] = $module_info['bgcolorcss'];
		} else {
			$data['bgcolorcss'] = '';
		}
		if (isset($this->request->post['titlecss'])) {
			$data['titlecss'] = $this->request->post['titlecss'];
		} elseif (!empty($module_info)) {
			$data['titlecss'] = $module_info['titlecss'];
		} else {
			$data['titlecss'] = '';
		}		
		if (isset($this->request->post['titlesmcss'])) {
			$data['titlesmcss'] = $this->request->post['titlesmcss'];
		} elseif (!empty($module_info)) {
			$data['titlesmcss'] = $module_info['titlesmcss'];
		} else {
			$data['titlesmcss'] = '';
		}
		if (isset($this->request->post['describe'])) {
			$data['describe'] = $this->request->post['describe'];
		} elseif (!empty($module_info)) {
			$data['describe'] = $module_info['describe'];
		} else {
			$data['describe'] = '';
		}
		if (isset($this->request->post['mtitle'])) {
			$data['mtitle'] = $this->request->post['mtitle'];
		} elseif (!empty($module_info)) {
			$data['mtitle'] = $module_info['mtitle'];
		} else {
			$data['mtitle'] = '';
		}
		if (isset($this->request->post['mdescribe'])) {
			$data['mdescribe'] = $this->request->post['mdescribe'];
		} elseif (!empty($module_info)) {
			$data['mdescribe'] = $module_info['mdescribe'];
		} else {
			$data['mdescribe'] = '';
		}
		if (isset($this->request->post['mbgcolor'])) {
			$data['mbgcolor'] = $this->request->post['mbgcolor'];
		} elseif (!empty($module_info)) {
			$data['mbgcolor'] = $module_info['mbgcolor'];
		} else {
			$data['mbgcolor'] = '';
		}
		if (isset($this->request->post['mpa'])) {
			$data['mpa'] = $this->request->post['mpa'];
		} elseif (!empty($module_info)) {
			$data['mpa'] = $module_info['mpa'];
		} else {
			$data['mpa'] = '';
		}
		if (isset($this->request->post['mborder'])) {
			$data['mborder'] = $this->request->post['mborder'];
		} elseif (!empty($module_info)) {
			$data['mborder'] = $module_info['mborder'];
		} else {
			$data['mborder'] = '';
		}	
		if (isset($this->request->post['mbcolor'])) {
			$data['mbcolor'] = $this->request->post['mbcolor'];
		} elseif (!empty($module_info)) {
			$data['mbcolor'] = $module_info['mbcolor'];
		} else {
			$data['mbcolor'] = '';
		}
		if (isset($this->request->post['npadding'])) {
			$data['npadding'] = $this->request->post['npadding'];
		} elseif (!empty($module_info)) {
			$data['npadding'] = $module_info['npadding'];
		} else {
			$data['npadding'] = '50';
		}
		if (isset($this->request->post['stp'])) {
			$data['stp'] = $this->request->post['stp'];
		} elseif (!empty($module_info)) {
			$data['stp'] = $module_info['stp'];
		} else {
			$data['stp'] = '70';
		}
		if (isset($this->request->post['sbp'])) {
			$data['sbp'] = $this->request->post['sbp'];
		} elseif (!empty($module_info)) {
			$data['sbp'] = $module_info['sbp'];
		} else {
			$data['sbp'] = '70';
		}
		if (isset($this->request->post['position'])) {
			$data['position'] = $this->request->post['position'];
		} elseif (!empty($module_info)) {
			$data['position'] = $module_info['position'];
		} else {
			$data['position'] = 'left';
		}
		if (isset($this->request->post['buttonname1'])) {
			$data['buttonname1'] = $this->request->post['buttonname1'];
		} elseif (!empty($module_info)) {
			$data['buttonname1'] = $module_info['buttonname1'];
		} else {
			$data['buttonname1'] = '';
		}
		if (isset($this->request->post['buttonname2'])) {
			$data['buttonname2'] = $this->request->post['buttonname2'];
		} elseif (!empty($module_info)) {
			$data['buttonname2'] = $module_info['buttonname2'];
		} else {
			$data['buttonname2'] = '';
		}	
		if (isset($this->request->post['link1'])) {
			$data['link1'] = $this->request->post['link1'];
		} elseif (!empty($module_info)) {
			$data['link1'] = $module_info['link1'];
		} else {
			$data['link1'] = '';
		}
		if (isset($this->request->post['link2'])) {
			$data['link2'] = $this->request->post['link2'];
		} elseif (!empty($module_info)) {
			$data['link2'] = $module_info['link2'];
		} else {
			$data['link2'] = '';
		}
		if (isset($this->request->post['sdtitle'])) {
			$data['sdtitle'] = $this->request->post['sdtitle'];
		} elseif (!empty($module_info)) {
			$data['sdtitle'] = $module_info['sdtitle'];
		} else {
			$data['sdtitle'] = '';
		}
		if (isset($this->request->post['sdone'])) {
			$data['sdone'] = $this->request->post['sdone'];
		} elseif (!empty($module_info)) {
			$data['sdone'] = $module_info['sdone'];
		} else {
			$data['sdone'] = '';
		}
		if (isset($this->request->post['sdtwo'])) {
			$data['sdtwo'] = $this->request->post['sdtwo'];
		} elseif (!empty($module_info)) {
			$data['sdtwo'] = $module_info['sdtwo'];
		} else {
			$data['sdtwo'] = '';
		}
		if (isset($this->request->post['sdthree'])) {
			$data['sdthree'] = $this->request->post['sdthree'];
		} elseif (!empty($module_info)) {
			$data['sdthree'] = $module_info['sdthree'];
		} else {
			$data['sdthree'] = '';
		}
		if (isset($this->request->post['wgdlg1'])) {
			$data['wgdlg1'] = $this->request->post['wgdlg1'];
		} elseif (!empty($module_info)) {
			$data['wgdlg1'] = $module_info['wgdlg1'];
		} else {
			$data['wgdlg1'] = '5';
		}
		if (isset($this->request->post['wgdlg2'])) {
			$data['wgdlg2'] = $this->request->post['wgdlg2'];
		} elseif (!empty($module_info)) {
			$data['wgdlg2'] = $module_info['wgdlg2'];
		} else {
			$data['wgdlg2'] = '7';
		}
		if (isset($this->request->post['column'])) {
			$data['column'] = $this->request->post['column'];
		} elseif (!empty($module_info)) {
			$data['column'] = $module_info['column'];
		} else {
			$data['column'] = '2';
		}
		if (isset($this->request->post['srow'])) {
			$data['srow'] = $this->request->post['srow'];
		} elseif (!empty($module_info)) {
			$data['srow'] = $module_info['srow'];
		} else {
			$data['srow'] = '2';
		}	
		if (isset($this->request->post['width'])) {
			$data['width'] = $this->request->post['width'];
		} elseif (!empty($module_info)) {
			$data['width'] = $module_info['width'];
		} else {
			$data['width'] = 740;
		}

		if (isset($this->request->post['height'])) {
			$data['height'] = $this->request->post['height'];
		} elseif (!empty($module_info)) {
			$data['height'] = $module_info['height'];
		} else {
			$data['height'] = 464;
		}	
		if (isset($this->request->post['sdione'])) {
			$data['sdione'] = $this->request->post['sdione'];
		} elseif (!empty($module_info)) {
			$data['sdione'] = $module_info['sdione'];
		} else {
			$data['sdione'] = '';
		}
		if (isset($this->request->post['sditwo'])) {
			$data['sditwo'] = $this->request->post['sditwo'];
		} elseif (!empty($module_info)) {
			$data['sditwo'] = $module_info['sditwo'];
		} else {
			$data['sditwo'] = '';
		}
		if (isset($this->request->post['sdithree'])) {
			$data['sdithree'] = $this->request->post['sdithree'];
		} elseif (!empty($module_info)) {
			$data['sdithree'] = $module_info['sdithree'];
		} else {
			$data['sdithree'] = '';
		}
		if (isset($this->request->post['sdifour'])) {
			$data['sdifour'] = $this->request->post['sdifour'];
		} elseif (!empty($module_info)) {
			$data['sdifour'] = $module_info['sdifour'];
		} else {
			$data['sdifour'] = '';
		}
		if (isset($this->request->post['sdifive'])) {
			$data['sdifive'] = $this->request->post['sdifive'];
		} elseif (!empty($module_info)) {
			$data['sdifive'] = $module_info['sdifive'];
		} else {
			$data['sdifive'] = '';
		}
		if (isset($this->request->post['sdisix'])) {
			$data['sdisix'] = $this->request->post['sdisix'];
		} elseif (!empty($module_info)) {
			$data['sdisix'] = $module_info['sdisix'];
		} else {
			$data['sdisix'] = '';
		}
		if (isset($this->request->post['sdtnone'])) {
			$data['sdtnone'] = $this->request->post['sdtnone'];
		} elseif (!empty($module_info)) {
			$data['sdtnone'] = $module_info['sdtnone'];
		} else {
			$data['sdtnone'] = '';
		}
		if (isset($this->request->post['sdtntwo'])) {
			$data['sdtntwo'] = $this->request->post['sdtntwo'];
		} elseif (!empty($module_info)) {
			$data['sdtntwo'] = $module_info['sdtntwo'];
		} else {
			$data['sdtntwo'] = '';
		}
		if (isset($this->request->post['sdtnthree'])) {
			$data['sdtnthree'] = $this->request->post['sdtnthree'];
		} elseif (!empty($module_info)) {
			$data['sdtnthree'] = $module_info['sdtnthree'];
		} else {
			$data['sdtnthree'] = '';
		}	
		if (isset($this->request->post['sdtnfour'])) {
			$data['sdtnfour'] = $this->request->post['sdtnfour'];
		} elseif (!empty($module_info)) {
			$data['sdtnfour'] = $module_info['sdtnfour'];
		} else {
			$data['sdtnfour'] = '';
		}
		if (isset($this->request->post['sdtnfive'])) {
			$data['sdtnfive'] = $this->request->post['sdtnfive'];
		} elseif (!empty($module_info)) {
			$data['sdtnfive'] = $module_info['sdtnfive'];
		} else {
			$data['sdtnfive'] = '';
		}
		if (isset($this->request->post['sdtnsix'])) {
			$data['sdtnsix'] = $this->request->post['sdtnsix'];
		} elseif (!empty($module_info)) {
			$data['sdtnsix'] = $module_info['sdtnsix'];
		} else {
			$data['sdtnsix'] = '';
		}
		if (isset($this->request->post['sddone'])) {
			$data['sddone'] = $this->request->post['sddone'];
		} elseif (!empty($module_info)) {
			$data['sddone'] = $module_info['sddone'];
		} else {
			$data['sddone'] = '';
		}
		if (isset($this->request->post['sddtwo'])) {
			$data['sddtwo'] = $this->request->post['sddtwo'];
		} elseif (!empty($module_info)) {
			$data['sddtwo'] = $module_info['sddtwo'];
		} else {
			$data['sddtwo'] = '';
		}
		if (isset($this->request->post['sddthree'])) {
			$data['sddthree'] = $this->request->post['sddthree'];
		} elseif (!empty($module_info)) {
			$data['sddthree'] = $module_info['sddthree'];
		} else {
			$data['sddthree'] = '';
		}
		if (isset($this->request->post['sddfour'])) {
			$data['sddfour'] = $this->request->post['sddfour'];
		} elseif (!empty($module_info)) {
			$data['sddfour'] = $module_info['sddfour'];
		} else {
			$data['sddfour'] = '';
		}
		if (isset($this->request->post['sddfive'])) {
			$data['sddfive'] = $this->request->post['sddfive'];
		} elseif (!empty($module_info)) {
			$data['sddfive'] = $module_info['sddfive'];
		} else {
			$data['sddfive'] = '';
		}
		if (isset($this->request->post['sddsix'])) {
			$data['sddsix'] = $this->request->post['sddsix'];
		} elseif (!empty($module_info)) {
			$data['sddsix'] = $module_info['sddsix'];
		} else {
			$data['sddsix'] = '';
		}
		if (isset($this->request->post['stmiconbj'])) {
			$data['stmiconbj'] = $this->request->post['stmiconbj'];
		} elseif (!empty($module_info)) {
			$data['stmiconbj'] = $module_info['stmiconbj'];
		} else {
			$data['stmiconbj'] = '';
		}	
		if (isset($this->request->post['stmiconcolor'])) {
			$data['stmiconcolor'] = $this->request->post['stmiconcolor'];
		} elseif (!empty($module_info)) {
			$data['stmiconcolor'] = $module_info['stmiconcolor'];
		} else {
			$data['stmiconcolor'] = '';
		}
		if (isset($this->request->post['stmiconround'])) {
			$data['stmiconround'] = $this->request->post['stmiconround'];
		} elseif (!empty($module_info)) {
			$data['stmiconround'] = $module_info['stmiconround'];
		} else {
			$data['stmiconround'] = '';
		}
		if (isset($this->request->post['stmiconsize'])) {
			$data['stmiconsize'] = $this->request->post['stmiconsize'];
		} elseif (!empty($module_info)) {
			$data['stmiconsize'] = $module_info['stmiconsize'];
		} else {
			$data['stmiconsize'] = '';
		}	
		if (isset($this->request->post['stmiconborder'])) {
			$data['miconborder'] = $this->request->post['stmiconborder'];
		} elseif (!empty($module_info)) {
			$data['stmiconborder'] = $module_info['stmiconborder'];
		} else {
			$data['stmiconborder'] = '';
		}
		if (isset($this->request->post['stmiconbc'])) {
			$data['stmiconbc'] = $this->request->post['stmiconbc'];
		} elseif (!empty($module_info)) {
			$data['stmiconbc'] = $module_info['stmiconbc'];
		} else {
			$data['stmiconbc'] = '';
		}
		if (isset($this->request->post['stmiconwidth'])) {
			$data['stmiconwidth'] = $this->request->post['stmiconwidth'];
		} elseif (!empty($module_info)) {
			$data['stmiconwidth'] = $module_info['stmiconwidth'];
		} else {
			$data['stmiconwidth'] = '';
		}
		if (isset($this->request->post['stmiconheight'])) {
			$data['stmiconheight'] = $this->request->post['stmiconheight'];
		} elseif (!empty($module_info)) {
			$data['stmiconheight'] = $module_info['stmiconheight'];
		} else {
			$data['stmiconheight'] = '';
		}
		if (isset($this->request->post['sttccolor'])) {
			$data['sttccolor'] = $this->request->post['sttccolor'];
		} elseif (!empty($module_info)) {
			$data['sttccolor'] = $module_info['sttccolor'];
		} else {
			$data['sttccolor'] = '';
		}
		if (isset($this->request->post['stpricecolor'])) {
			$data['stpricecolor'] = $this->request->post['stpricecolor'];
		} elseif (!empty($module_info)) {
			$data['stpricecolor'] = $module_info['stpricecolor'];
		} else {
			$data['stpricecolor'] = '';
		}
		if (isset($this->request->post['stcolumn'])) {
			$data['stcolumn'] = $this->request->post['stcolumn'];
		} elseif (!empty($module_info)) {
			$data['stcolumn'] = $module_info['stcolumn'];
		} else {
			$data['stcolumn'] = '6';
		}
		if (isset($this->request->post['strgba'])) {
			$data['strgba'] = $this->request->post['strgba'];
		} elseif (!empty($module_info)) {
			$data['strgba'] = $module_info['strgba'];
		} else {
			$data['strgba'] = 'rgba(0,0,0,0.54)';
		}
		if (isset($this->request->post['slinew'])) {
			$data['slinew'] = $this->request->post['slinew'];
		} elseif (!empty($module_info)) {
			$data['slinew'] = $module_info['slinew'];
		} else {
			$data['slinew'] = '';
		}
		if (isset($this->request->post['slineh'])) {
			$data['slineh'] = $this->request->post['slineh'];
		} elseif (!empty($module_info)) {
			$data['slineh'] = $module_info['slineh'];
		} else {
			$data['slineh'] = '';
		}
		if (isset($this->request->post['slinec'])) {
			$data['slinec'] = $this->request->post['slinec'];
		} elseif (!empty($module_info)) {
			$data['slinec'] = $module_info['slinec'];
		} else {
			$data['slinec'] = '';
		}
		if (isset($this->request->post['autoplay'])) {
			$data['autoplay'] = $this->request->post['autoplay'];
		} elseif (!empty($module_info)) {
			$data['autoplay'] = $module_info['autoplay'];
		} else {
			$data['autoplay'] = '';
		}
		if (isset($this->request->post['main'])) {
			$data['main'] = $this->request->post['main'];
		} elseif (!empty($module_info)) {
			$data['main'] = $module_info['main'];
		} else {
			$data['main'] = '';
		}
		if (isset($this->request->post['imagepicstyle'])) {
			$data['imagepicstyle'] = $this->request->post['imagepicstyle'];
		} elseif (!empty($module_info)) {
			$data['imagepicstyle'] = $module_info['imagepicstyle'];
		} else {
			$data['imagepicstyle'] = '';
		}
		if (isset($this->request->post['speed'])) {
			$data['speed'] = $this->request->post['speed'];
		} elseif (!empty($module_info)) {
			$data['speed'] = $module_info['speed'];
		} else {
			$data['speed'] = '3000';
		}
		if (isset($this->request->post['scroll'])) {
			$data['scroll'] = $this->request->post['scroll'];
		} elseif (!empty($module_info)) {
			$data['scroll'] = $module_info['scroll'];
		} else {
			$data['scroll'] = '1';
		}	
		if (isset($this->request->post['strppa'])) {
			$data['strppa'] = $this->request->post['strppa'];
		} elseif (!empty($module_info)) {
			$data['strppa'] = $module_info['strppa'];
		} else {
			$data['strppa'] = '5';
		}
		if (isset($this->request->post['fade'])) {
			$data['fade'] = $this->request->post['fade'];
		} elseif (!empty($module_info)) {
			$data['fade'] = $module_info['fade'];
		} else {
			$data['fade'] = '';
		}
		if (isset($this->request->post['buttonname1'])) {
			$data['buttonname1'] = $this->request->post['buttonname1'];
		} elseif (!empty($module_info)) {
			$data['buttonname1'] = $module_info['buttonname1'];
		} else {
			$data['buttonname1'] = '';
		}
		if (isset($this->request->post['buttonname2'])) {
			$data['buttonname2'] = $this->request->post['buttonname2'];
		} elseif (!empty($module_info)) {
			$data['buttonname2'] = $module_info['buttonname2'];
		} else {
			$data['buttonname2'] = '';
		}
		if (isset($this->request->post['qq1'])) {
			$data['qq1'] = $this->request->post['qq1'];
		} elseif (!empty($module_info)) {
			$data['qq1'] = $module_info['qq1'];
		} else {
			$data['qq1'] = '';
		}
		if (isset($this->request->post['qq2'])) {
			$data['qq2'] = $this->request->post['name'];
		} elseif (!empty($module_info)) {
			$data['qq2'] = $module_info['qq2'];
		} else {
			$data['qq2'] = '';
		}
		if (isset($this->request->post['alww1'])) {
			$data['alww1'] = $this->request->post['alww1'];
		} elseif (!empty($module_info)) {
			$data['alww1'] = $module_info['alww1'];
		} else {
			$data['alww1'] = '';
		}
		if (isset($this->request->post['alww2'])) {
			$data['alww2'] = $this->request->post['alww2'];
		} elseif (!empty($module_info)) {
			$data['alww2'] = $module_info['alww2'];
		} else {
			$data['alww2'] = '';
		}
		if (isset($this->request->post['link1'])) {
			$data['link1'] = $this->request->post['link1'];
		} elseif (!empty($module_info)) {
			$data['link1'] = $module_info['link1'];
		} else {
			$data['link1'] = '';
		}
		if (isset($this->request->post['link2'])) {
			$data['link2'] = $this->request->post['link2'];
		} elseif (!empty($module_info)) {
			$data['link2'] = $module_info['link2'];
		} else {
			$data['link2'] = '';
		}
		if (isset($this->request->post['buttoncolor1'])) {
			$data['buttoncolor1'] = $this->request->post['buttoncolor1'];
		} elseif (!empty($module_info)) {
			$data['buttoncolor1'] = $module_info['buttoncolor1'];
		} else {
			$data['buttoncolor1'] = 'white';
		}
		if (isset($this->request->post['buttoncolor2'])) {
			$data['buttoncolor2'] = $this->request->post['buttoncolor2'];
		} elseif (!empty($module_info)) {
			$data['buttoncolor2'] = $module_info['buttoncolor2'];
		} else {
			$data['buttoncolor2'] = 'white';
		}
		if (isset($this->request->post['buttonsize'])) {
			$data['buttonsize'] = $this->request->post['buttonsize'];
		} elseif (!empty($module_info)) {
			$data['buttonsize'] = $module_info['buttonsize'];
		} else {
			$data['buttonsize'] = 'md';
		}		
		if (isset($this->request->post['buttoninset'])) {
			$data['buttoninset'] = $this->request->post['buttoninset'];
		} elseif (!empty($module_info)) {
			$data['buttoninset'] = $module_info['buttoninset'];
		} else {
			$data['buttoninset'] = '';
		}	
		if (isset($this->request->post['buttonborder'])) {
			$data['buttonborder'] = $this->request->post['buttonborder'];
		} elseif (!empty($module_info)) {
			$data['buttonborder'] = $module_info['buttonborder'];
		} else {
			$data['buttonborder'] = '';
		}		
		if (isset($this->request->post['buttonround'])) {
			$data['buttonround'] = $this->request->post['buttonround'];
		} elseif (!empty($module_info)) {
			$data['buttonround'] = $module_info['buttonround'];
		} else {
			$data['buttonround'] = '50';
		}
		if (isset($this->request->post['buttonhover'])) {
			$data['buttonhover'] = $this->request->post['buttonhover'];
		} elseif (!empty($module_info)) {
			$data['buttonhover'] = $module_info['buttonhover'];
		} else {
			$data['buttonhover'] = '';
		}
		if (isset($this->request->post['buttond'])) {
			$data['buttond'] = $this->request->post['buttond'];
		} elseif (!empty($module_info)) {
			$data['buttond'] = $module_info['buttond'];
		} else {
			$data['buttond'] = '';
		}
		if (isset($this->request->post['stwzc'])) {
			$data['stwzc'] = $this->request->post['stwzc'];
		} elseif (!empty($module_info)) {
			$data['stwzc'] = $module_info['stwzc'];
		} else {
			$data['stwzc'] = '';
		}			
		$this->load->model('localisation/language');

		$data['languages'] = $this->model_localisation_language->getLanguages();

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

		if (isset($this->request->post['service'])) {
			$services = $this->request->post['service'];
		} elseif (isset($module_info['service'])) {
			$services = $module_info['service'];
		} else {
			$services = array();
		}

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

		foreach ($services as $service) {
			if (is_file(DIR_IMAGE . $service['image'])) {
				$image = $service['image'];
				$thumb = $service['image'];
			} else {
				$image = '';
				$thumb = 'no_image.png';
			}

			$data['services'][] = array(
				'title'       => $service['title'],
				'text'        => $service['text'],
				'link'        => $service['link'],
				'image'       => $image,
				'thumb'       => $this->model_tool_image->resize($thumb, 100, 100),
				'sort_order'  => $service['sort_order']
			);
		}

		$data['placeholder'] = $this->model_tool_image->resize('no_image.png', 100, 100);

		$data['header'] = $this->load->controller('common/header');
		$data['column_left'] = $this->load->controller('common/column_left');
		$data['footer'] = $this->load->controller('common/footer');

		$this->response->setOutput($this->load->view('extension/module/servicethree.tpl', $data));
	}

	protected function validate() {
		if (!$this->user->hasPermission('modify', 'extension/module/servicethree')) {
			$this->error['warning'] = $this->language->get('error_permission');
		}
		if ((utf8_strlen($this->request->post['sectionid']) < 1) || (utf8_strlen($this->request->post['sectionid']) > 64)) {
			$this->error['sectionid'] = $this->language->get('error_name');
		}	
		if ((utf8_strlen($this->request->post['name']) < 2) || (utf8_strlen($this->request->post['name']) > 64)) {
			$this->error['name'] = $this->language->get('error_name');
		}
		if ((utf8_strlen($this->request->post['wgdlg1']) < 1) || (utf8_strlen($this->request->post['wgdlg1']) > 64)) {
			$this->error['wgdlg1'] = $this->language->get('error_wgdlg1');
		}
		if ((utf8_strlen($this->request->post['wgdlg2']) < 1) || (utf8_strlen($this->request->post['wgdlg2']) > 64)) {
			$this->error['wgdlg2'] = $this->language->get('error_wgdlg2');
		}
		return !$this->error;
	}
}