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

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

		$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('ocarouselbanner', $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_cwkj_wxts'] = $this->language->get('text_cwkj_wxts');
		$data['text_qq_open_signup'] = $this->language->get('text_qq_open_signup');
		$data['text_yes'] = $this->language->get('text_yes');
		$data['text_no'] = $this->language->get('text_no');
		
		$data['entry_status'] = $this->language->get('entry_status');
		$data['entry_name'] = $this->language->get('entry_name');
        $data['entry_sectiontab'] = $this->language->get('entry_sectiontab');	
		$data['entry_zdybj'] = $this->language->get('entry_zdybj');
		$data['entry_ocrgba'] = $this->language->get('entry_ocrgba');
		$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_titleposition'] = $this->language->get('entry_titleposition');
		$data['entry_titlefontsize'] = $this->language->get('entry_titlefontsize');
		$data['entry_titlejbcss'] = $this->language->get('entry_titlejbcss');
		$data['entry_titlecss'] = $this->language->get('entry_titlecss');
		$data['entry_describebjc'] = $this->language->get('entry_describebjc');
		$data['entry_bordercss'] = $this->language->get('entry_bordercss');
		$data['entry_image'] = $this->language->get('entry_image');
		$data['entry_width'] = $this->language->get('entry_width');
		$data['entry_height'] = $this->language->get('entry_height');
		$data['entry_title'] = $this->language->get('entry_title');
		$data['entry_text'] = $this->language->get('entry_text');
		$data['entry_text1'] = $this->language->get('entry_text1');
		$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_icons1'] = $this->language->get('entry_icons1');
		$data['entry_icons2'] = $this->language->get('entry_icons2');
		$data['entry_buttoncolor1'] = $this->language->get('entry_buttoncolor1');
		$data['entry_buttoncolor2'] = $this->language->get('entry_buttoncolor2');
		$data['entry_image'] = $this->language->get('entry_image');
		$data['entry_sort_order'] = $this->language->get('entry_sort_order');
		$data['entry_buttoncolorcss'] = $this->language->get('entry_buttoncolorcss');
		$data['entry_buttoncss'] = $this->language->get('entry_buttoncss');
		$data['entry_buttonbjcss'] = $this->language->get('entry_buttonbjcss');
		$data['entry_buttontitcss'] = $this->language->get('entry_buttontitcss');
		$data['entry_buttontithover'] = $this->language->get('entry_buttontithover');
		$data['entry_buttonradius'] = $this->language->get('entry_buttonradius');
		$data['entry_ocbr'] = $this->language->get('entry_ocbr');
		$data['entry_buttoncolor1'] = $this->language->get('entry_buttoncolor1');
		$data['entry_buttoncolor2'] = $this->language->get('entry_buttoncolor2');
		$data['entry_ocbw'] = $this->language->get('entry_ocbw');
		$data['entry_ocbwposition'] = $this->language->get('entry_ocbwposition');
		$data['entry_bannerbgc'] = $this->language->get('entry_bannerbgc');
		$data['entry_bannerbgcjb'] = $this->language->get('entry_bannerbgcjb');
		$data['entry_ocbpo'] = $this->language->get('entry_ocbpo');
		$data['entry_ocbpowidth'] = $this->language->get('entry_ocbpowidth');
		$data['entry_ocbheight'] = $this->language->get('entry_ocbheight');
		$data['help_ocbheight'] = $this->language->get('help_ocbheight');
		$data['entry_ocbvh'] = $this->language->get('entry_ocbvh');
		$data['entry_ocbmh'] = $this->language->get('entry_ocbmh');
		$data['entry_ocbpa'] = $this->language->get('entry_ocbpa');
		$data['entry_autoplay'] = $this->language->get('entry_autoplay');
		$data['entry_speed'] = $this->language->get('entry_speed');
		$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_buttonposition'] = $this->language->get('entry_buttonposition');			
		$data['entry_slidestyle'] = $this->language->get('entry_slidestyle');
		$data['entry_slidewidth'] = $this->language->get('entry_slidewidth');
		$data['entry_slideheight'] = $this->language->get('entry_slideheight');
		$data['entry_slideradius'] = $this->language->get('entry_slideradius');
		$data['entry_slidebjcolor'] = $this->language->get('entry_slidebjcolor');
		$data['entry_bjcolorafter'] = $this->language->get('entry_bjcolorafter');
		$data['entry_bjcolorafter'] = $this->language->get('entry_bjcolorafter');
		$data['entry_sliderborder'] = $this->language->get('entry_sliderborder');
		$data['entry_sliderborderw'] = $this->language->get('entry_sliderborderw');
		$data['entry_sliderborderrd'] = $this->language->get('entry_sliderborderrd');
		$data['entry_sliderhkc'] = $this->language->get('entry_sliderhkc');
		$data['entry_sliderpadding'] = $this->language->get('entry_sliderpadding');

		$data['entry_slidestyletwo'] = $this->language->get('entry_slidestyletwo');
		$data['entry_slidewidthtwo'] = $this->language->get('entry_slidewidthtwo');
		$data['entry_slideheighttwo'] = $this->language->get('entry_slideheighttwo');
		$data['entry_slidefsizetwo'] = $this->language->get('entry_slidefsizetwo');
		$data['entry_slideradiustwo'] = $this->language->get('entry_slideradiustwo');
		$data['entry_slidebackgroundtwo'] = $this->language->get('entry_slidebackgroundtwo');
		$data['entry_slidecolortwo'] = $this->language->get('entry_slidecolortwo');
		$data['entry_sliderbordertwo'] = $this->language->get('entry_sliderbordertwo');
		$data['entry_sliderhkctwo'] = $this->language->get('entry_sliderhkctwo');
		$data['entry_slideformtwo'] = $this->language->get('entry_slideformtwo');	
		
		$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'] = '';
		}

		$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/ocarouselbanner', 'token=' . $this->session->data['token'], 'SSL')
		);

		if (!isset($this->request->get['module_id'])) {
			$data['action'] = $this->url->link('extension/module/ocarouselbanner', 'token=' . $this->session->data['token'], 'SSL');
		} else {
			$data['action'] = $this->url->link('extension/module/ocarouselbanner', '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['sectiontab'])) {
			$data['sectiontab'] = $this->request->post['sectiontab'];
		} elseif (!empty($module_info)) {
			$data['sectiontab'] = $module_info['sectiontab'];
		} else {
			$data['sectiontab'] = '';
		}
		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['titleposition'])) {
			$data['titleposition'] = $this->request->post['titleposition'];
		} elseif (!empty($module_info)) {
			$data['titleposition'] = $module_info['titleposition'];
		} else {
			$data['titleposition'] = '';
		}
		if (isset($this->request->post['titlefontsize'])) {
			$data['titlefontsize'] = $this->request->post['titlefontsize'];
		} elseif (!empty($module_info)) {
			$data['titlefontsize'] = $module_info['titlefontsize'];
		} else {
			$data['titlefontsize'] = '';
		}
		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['describebjc'])) {
			$data['describebjc'] = $this->request->post['describebjc'];
		} elseif (!empty($module_info)) {
			$data['describebjc'] = $module_info['describebjc'];
		} else {
			$data['describebjc'] = '';
		}
		if (isset($this->request->post['ocrgba'])) {
			$data['ocrgba'] = $this->request->post['ocrgba'];
		} elseif (!empty($module_info)) {
			$data['ocrgba'] = $module_info['ocrgba'];
		} else {
			$data['ocrgba'] = 'rgba(0,0,0,0.5)';
		}
		if (isset($this->request->post['buttoncss'])) {
			$data['buttoncss'] = $this->request->post['buttoncss'];
		} elseif (!empty($module_info)) {
			$data['buttoncss'] = $module_info['buttoncss'];
		} else {
			$data['buttoncss'] = '';
		}
		if (isset($this->request->post['buttonbjcss'])) {
			$data['buttonbjcss'] = $this->request->post['buttonbjcss'];
		} elseif (!empty($module_info)) {
			$data['buttonbjcss'] = $module_info['buttonbjcss'];
		} else {
			$data['buttonbjcss'] = '';
		}
		if (isset($this->request->post['buttontitcss'])) {
			$data['buttontitcss'] = $this->request->post['buttontitcss'];
		} elseif (!empty($module_info)) {
			$data['buttontitcss'] = $module_info['buttontitcss'];
		} else {
			$data['buttontitcss'] = '';
		}
		if (isset($this->request->post['buttontithover'])) {
			$data['buttontithover'] = $this->request->post['buttontithover'];
		} elseif (!empty($module_info)) {
			$data['buttontithover'] = $module_info['buttontithover'];
		} else {
			$data['buttontithover'] = '';
		}	
		if (isset($this->request->post['buttonradius'])) {
			$data['buttonradius'] = $this->request->post['buttonradius'];
		} elseif (!empty($module_info)) {
			$data['buttonradius'] = $module_info['buttonradius'];
		} else {
			$data['buttonradius'] = '';
		}
		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['icons1'])) {
			$data['icons1'] = $this->request->post['icons1'];
		} elseif (!empty($module_info)) {
			$data['icons1'] = $module_info['icons1'];
		} else {
			$data['icons1'] = 'fa fa-apple';
		}
		if (isset($this->request->post['icons2'])) {
			$data['icons2'] = $this->request->post['icons2'];
		} elseif (!empty($module_info)) {
			$data['icons2'] = $module_info['icons2'];
		} else {
			$data['icons2'] = 'fa fa-android';
		}
		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['ocbr'])) {
			$data['ocbr'] = $this->request->post['ocbr'];
		} elseif (!empty($module_info)) {
			$data['ocbr'] = $module_info['ocbr'];
		} else {
			$data['ocbr'] = '';
		}
		if (isset($this->request->post['ocbpa'])) {
			$data['ocbpa'] = $this->request->post['ocbpa'];
		} elseif (!empty($module_info)) {
			$data['ocbpa'] = $module_info['ocbpa'];
		} else {
			$data['ocbpa'] = '150';
		}
		if (isset($this->request->post['ocbw'])) {
			$data['ocbw'] = $this->request->post['ocbw'];
		} elseif (!empty($module_info)) {
			$data['ocbw'] = $module_info['ocbw'];
		} else {
			$data['ocbw'] = '';
		}
		if (isset($this->request->post['ocbwposition'])) {
			$data['ocbwposition'] = $this->request->post['ocbwposition'];
		} elseif (!empty($module_info)) {
			$data['ocbwposition'] = $module_info['ocbwposition'];
		} else {
			$data['ocbwposition'] = '';
		}	
		if (isset($this->request->post['bannerbgc'])) {
			$data['bannerbgc'] = $this->request->post['bannerbgc'];
		} elseif (!empty($module_info)) {
			$data['bannerbgc'] = $module_info['bannerbgc'];
		} else {
			$data['bannerbgc'] = '';
		}
		if (isset($this->request->post['bannerbgcjb'])) {
			$data['bannerbgcjb'] = $this->request->post['bannerbgcjb'];
		} elseif (!empty($module_info)) {
			$data['bannerbgcjb'] = $module_info['bannerbgcjb'];
		} else {
			$data['bannerbgcjb'] = '';
		}		
		if (isset($this->request->post['ocbpo'])) {
			$data['ocbpo'] = $this->request->post['ocbpo'];
		} elseif (!empty($module_info)) {
			$data['ocbpo'] = $module_info['ocbpo'];
		} else {
			$data['ocbpo'] = '';
		}
		if (isset($this->request->post['ocbpowidth'])) {
			$data['ocbpowidth'] = $this->request->post['ocbpowidth'];
		} elseif (!empty($module_info)) {
			$data['ocbpowidth'] = $module_info['ocbpowidth'];
		} else {
			$data['ocbpowidth'] = '';
		}
		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['ocbvh'])) {
			$data['ocbvh'] = $this->request->post['ocbvh'];
		} elseif (!empty($module_info)) {
			$data['ocbvh'] = $module_info['ocbvh'];
		} else {
			$data['ocbvh'] = '';
		}
		if (isset($this->request->post['ocbmh'])) {
			$data['ocbmh'] = $this->request->post['ocbmh'];
		} elseif (!empty($module_info)) {
			$data['ocbmh'] = $module_info['ocbmh'];
		} else {
			$data['ocbmh'] = '';
		}
		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['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['fade'])) {
			$data['fade'] = $this->request->post['fade'];
		} elseif (!empty($module_info)) {
			$data['fade'] = $module_info['fade'];
		} else {
			$data['fade'] = '';
		}
		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'] = '';
		}
		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['buttonposition'])) {
			$data['buttonposition'] = $this->request->post['buttonposition'];
		} elseif (!empty($module_info)) {
			$data['buttonposition'] = $module_info['buttonposition'];
		} else {
			$data['buttonposition'] = '';
		}
		if (isset($this->request->post['slidewidth'])) {
			$data['slidewidth'] = $this->request->post['slidewidth'];
		} elseif (!empty($module_info)) {
			$data['slidewidth'] = $module_info['slidewidth'];
		} else {
			$data['slidewidth'] = '10';
		}	
		if (isset($this->request->post['slideheight'])) {
			$data['slideheight'] = $this->request->post['slideheight'];
		} elseif (!empty($module_info)) {
			$data['slideheight'] = $module_info['slideheight'];
		} else {
			$data['slideheight'] = '10';
		}		
		if (isset($this->request->post['slideradius'])) {
			$data['slideradius'] = $this->request->post['slideradius'];
		} elseif (!empty($module_info)) {
			$data['slideradius'] = $module_info['slideradius'];
		} else {
			$data['slideradius'] = '';
		}
		if (isset($this->request->post['slidebjcolor'])) {
			$data['slidebjcolor'] = $this->request->post['slidebjcolor'];
		} elseif (!empty($module_info)) {
			$data['slidebjcolor'] = $module_info['slidebjcolor'];
		} else {
			$data['slidebjcolor'] = '#777';
		}
		if (isset($this->request->post['bjcolorafter'])) {
			$data['bjcolorafter'] = $this->request->post['bjcolorafter'];
		} elseif (!empty($module_info)) {
			$data['bjcolorafter'] = $module_info['bjcolorafter'];
		} else {
			$data['bjcolorafter'] = '#f60';
		}
		if (isset($this->request->post['sliderborder'])) {
			$data['sliderborder'] = $this->request->post['sliderborder'];
		} elseif (!empty($module_info)) {
			$data['sliderborder'] = $module_info['sliderborder'];
		} else {
			$data['sliderborder'] = '';
		}
		if (isset($this->request->post['sliderborderrd'])) {
			$data['sliderborderrd'] = $this->request->post['sliderborderrd'];
		} elseif (!empty($module_info)) {
			$data['sliderborderrd'] = $module_info['sliderborderrd'];
		} else {
			$data['sliderborderrd'] = '';
		}
		if (isset($this->request->post['sliderborderw'])) {
			$data['sliderborderw'] = $this->request->post['sliderborderw'];
		} elseif (!empty($module_info)) {
			$data['sliderborderw'] = $module_info['sliderborderw'];
		} else {
			$data['sliderborderw'] = '';
		}
		if (isset($this->request->post['sliderhkc'])) {
			$data['sliderhkc'] = $this->request->post['sliderhkc'];
		} elseif (!empty($module_info)) {
			$data['sliderhkc'] = $module_info['sliderhkc'];
		} else {
			$data['sliderhkc'] = '';
		}
		if (isset($this->request->post['sliderpadding'])) {
			$data['sliderpadding'] = $this->request->post['sliderpadding'];
		} elseif (!empty($module_info)) {
			$data['sliderpadding'] = $module_info['sliderpadding'];
		} else {
			$data['sliderpadding'] = '';
		}
		if (isset($this->request->post['slidewidthtwo'])) {
			$data['slidewidthtwo'] = $this->request->post['slidewidthtwo'];
		} elseif (!empty($module_info)) {
			$data['slidewidthtwo'] = $module_info['slidewidthtwo'];
		} else {
			$data['slidewidthtwo'] = '0';
		}	
		if (isset($this->request->post['slideheighttwo'])) {
			$data['slideheighttwo'] = $this->request->post['slideheighttwo'];
		} elseif (!empty($module_info)) {
			$data['slideheighttwo'] = $module_info['slideheighttwo'];
		} else {
			$data['slideheighttwo'] = '0';
		}		
		if (isset($this->request->post['slideradiustwo'])) {
			$data['slideradiustwo'] = $this->request->post['slideradiustwo'];
		} elseif (!empty($module_info)) {
			$data['slideradiustwo'] = $module_info['slideradiustwo'];
		} else {
			$data['slideradiustwo'] = '';
		}
		if (isset($this->request->post['slidefsizetwo'])) {
			$data['slidefsizetwo'] = $this->request->post['slidefsizetwo'];
		} elseif (!empty($module_info)) {
			$data['slidefsizetwo'] = $module_info['slidefsizetwo'];
		} else {
			$data['slidefsizetwo'] = '';
		}
		if (isset($this->request->post['slidebackgroundtwo'])) {
			$data['slidebackgroundtwo'] = $this->request->post['slidebackgroundtwo'];
		} elseif (!empty($module_info)) {
			$data['slidebackgroundtwo'] = $module_info['slidebackgroundtwo'];
		} else {
			$data['slidebackgroundtwo'] = '';
		}
		if (isset($this->request->post['slidecolortwo'])) {
			$data['slidecolortwo'] = $this->request->post['slidecolortwo'];
		} elseif (!empty($module_info)) {
			$data['slidecolortwo'] = $module_info['slidecolortwo'];
		} else {
			$data['slidecolortwo'] = 'rgba(255,255,255,0)';
		}
		if (isset($this->request->post['sliderbordertwo'])) {
			$data['sliderbordertwo'] = $this->request->post['sliderbordertwo'];
		} elseif (!empty($module_info)) {
			$data['sliderbordertwo'] = $module_info['sliderbordertwo'];
		} else {
			$data['sliderbordertwo'] = '';
		}
		if (isset($this->request->post['sliderhkctwo'])) {
			$data['sliderhkctwo'] = $this->request->post['sliderhkctwo'];
		} elseif (!empty($module_info)) {
			$data['sliderhkctwo'] = $module_info['sliderhkctwo'];
		} else {
			$data['sliderhkctwo'] = '';
		}
		if (isset($this->request->post['slideformtwo'])) {
			$data['slideformtwo'] = $this->request->post['slideformtwo'];
		} elseif (!empty($module_info)) {
			$data['slideformtwo'] = $module_info['slideformtwo'];
		} else {
			$data['slideformtwo'] = '0';
		}		
		$this->load->model('tool/image');

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

		if (is_file(DIR_IMAGE . $data['image'])) {
			$thumb = $data['image'];
		} else {
			$thumb = 'no_image.png';
		}

		$data['thumb'] = $this->model_tool_image->resize($thumb, 100, 100);

		$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'],
				'text1'        => $service['text1'],
				'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/ocarouselbanner.tpl', $data));
	}

	protected function validate() {
		if (!$this->user->hasPermission('modify', 'extension/module/ocarouselbanner')) {
			$this->error['warning'] = $this->language->get('error_permission');
		}

		if ((utf8_strlen($this->request->post['name']) < 2) || (utf8_strlen($this->request->post['name']) > 64)) {
			$this->error['name'] = $this->language->get('error_name');
		}

		return !$this->error;
	}
}