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

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

		$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('team', $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_qq_open_signup'] = $this->language->get('text_qq_open_signup');
		$data['text_cwkj_wxts'] = $this->language->get('text_cwkj_wxts');
		$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['entry_status'] = $this->language->get('entry_status');
		$data['entry_name'] = $this->language->get('entry_name');
		$data['entry_imagetext'] = $this->language->get('entry_imagetext');
        $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_titlecss'] = $this->language->get('entry_titlecss');
		$data['entry_boxtitlecss'] = $this->language->get('entry_boxtitlecss');
		$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_introduce'] = $this->language->get('entry_introduce');
		$data['entry_contact'] = $this->language->get('entry_contact');
		$data['entry_web'] = $this->language->get('entry_web');
		$data['entry_weibo'] = $this->language->get('entry_weibo');
		$data['entry_other'] = $this->language->get('entry_other');
		$data['entry_link'] = $this->language->get('entry_link');
		$data['entry_weblink'] = $this->language->get('entry_weblink');
		$data['entry_weibolink'] = $this->language->get('entry_weibolink');
		$data['entry_otherlink'] = $this->language->get('entry_otherlink');
		$data['entry_boxbottonn1'] = $this->language->get('entry_boxbottonn1');
		$data['entry_boxbottonn2'] = $this->language->get('entry_boxbottonn2');
		$data['entry_boxbotton'] = $this->language->get('entry_boxbotton');
		$data['entry_image'] = $this->language->get('entry_image');
		$data['entry_sort_order'] = $this->language->get('entry_sort_order');
		$data['entry_ptteam'] = $this->language->get('entry_ptteam');
		$data['entry_pbteam'] = $this->language->get('entry_pbteam');
		$data['entry_segmentingline'] = $this->language->get('entry_segmentingline');
		$data['entry_teamlinew'] = $this->language->get('entry_teamlinew');
		$data['entry_teamlineh'] = $this->language->get('entry_teamlineh');
		$data['entry_teamlinec'] = $this->language->get('entry_teamlinec');
        $data['entry_teamname'] = $this->language->get('entry_teamname');	
		$data['entry_main'] = $this->language->get('entry_main');
		$data['entry_autoplay'] = $this->language->get('entry_autoplay');
		$data['entry_fade'] = $this->language->get('entry_fade');
		$data['entry_speed'] = $this->language->get('entry_speed');
        $data['entry_columns'] = $this->language->get('entry_columns');
        $data['entry_column'] = $this->language->get('entry_column');
		$data['help_column'] = $this->language->get('help_column');	
        $data['entry_wapcolumns'] = $this->language->get('entry_wapcolumns');
        $data['entry_wapcolumn'] = $this->language->get('entry_wapcolumn');
		$data['help_wapcolumn'] = $this->language->get('help_wapcolumn');			
		$data['entry_rows'] = $this->language->get('entry_rows');
		$data['entry_scroll'] = $this->language->get('entry_scroll');	
		$data['entry_box'] = $this->language->get('entry_box');
		$data['entry_boxbg'] = $this->language->get('entry_boxbg');
		$data['entry_boxnum'] = $this->language->get('entry_boxnum');
		$data['entry_boxtitle'] = $this->language->get('entry_boxtitle');
		$data['entry_boxzhiwei'] = $this->language->get('entry_boxzhiwei');
		$data['entry_boxdescribe'] = $this->language->get('entry_boxdescribe');
        $data['entry_boxmagin'] = $this->language->get('entry_boxmagin');
		$data['entry_boxpadding'] = $this->language->get('entry_boxpadding');
		$data['entry_boxptpadding'] = $this->language->get('entry_boxptpadding');
		$data['entry_boxwzbj'] = $this->language->get('entry_boxwzbj');
		$data['entry_boxborder'] = $this->language->get('entry_boxborder');
		$data['entry_boxcolor'] = $this->language->get('entry_boxcolor');
		$data['entry_boxround'] = $this->language->get('entry_boxround');
		$data['entry_boxposition'] = $this->language->get('entry_boxposition');
		$data['entry_boxshadow'] = $this->language->get('entry_boxshadow');
		$data['entry_boxshadowhover'] = $this->language->get('entry_boxshadowhover');
		$data['entry_width'] = $this->language->get('entry_width');
		$data['entry_height'] = $this->language->get('entry_height');
		$data['entry_iconstyle'] = $this->language->get('entry_iconstyle');
		$data['entry_miconbj'] = $this->language->get('entry_miconbj');
		$data['entry_miconcolor'] = $this->language->get('entry_miconcolor');
		$data['entry_hoverbj'] = $this->language->get('entry_hoverbj');
		$data['entry_hovertit'] = $this->language->get('entry_hovertit');
		$data['entry_miconround'] = $this->language->get('entry_miconround');
		$data['entry_miconsize'] = $this->language->get('entry_miconsize');
		$data['entry_miconborder'] = $this->language->get('entry_miconborder');
		$data['entry_miconbc'] = $this->language->get('entry_miconbc');
		$data['entry_miconwidth'] = $this->language->get('entry_miconwidth');
        $data['entry_miconheight'] = $this->language->get('entry_miconheight');
		$data['entry_imagepicstyle'] = $this->language->get('entry_imagepicstyle');

		$data['entry_imgmm'] = $this->language->get('entry_imgmm');
		$data['entry_imground'] = $this->language->get('entry_imground');        
		$data['entry_imgthumb'] = $this->language->get('entry_imgthumb');	
		$data['entry_imgshadow'] = $this->language->get('entry_imgshadow');
		$data['entry_imgpadding'] = $this->language->get('entry_imgpadding');        
		$data['entry_imgborder'] = $this->language->get('entry_imgborder');	
		$data['entry_imgcolor'] = $this->language->get('entry_imgcolor');
		$data['entry_boxbjhover'] = $this->language->get('entry_boxbjhover');
		$data['entry_boxcolorhover'] = $this->language->get('entry_boxcolorhover');

		$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_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_sectionid'] = $this->language->get('entry_sectionid');
        $data['entry_sectiontab'] = $this->language->get('entry_sectiontab');	
		
		$data['entry_slidestyletwo'] = $this->language->get('entry_slidestyletwo');
		$data['entry_slidename'] = $this->language->get('entry_slidename');
		$data['entry_slidewidthtwo'] = $this->language->get('entry_slidewidthtwo');
		$data['entry_slideheighttwo'] = $this->language->get('entry_slideheighttwo');
		$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'] = '';
		}
		if (isset($this->error['sectionid'])) {
			$data['error_sectionid'] = $this->error['sectionid'];
		} else {
			$data['error_sectionid'] = '';
		}
		if (isset($this->error['slidename'])) {
			$data['error_slidename'] = $this->error['slidename'];
		} else {
			$data['error_slidename'] = '';
		}
		if (isset($this->error['boxnum'])) {
			$data['error_boxnum'] = $this->error['boxnum'];
		} else {
			$data['error_boxnum'] = '';
		}
		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/team', 'token=' . $this->session->data['token'], 'SSL')
		);

		if (!isset($this->request->get['module_id'])) {
			$data['action'] = $this->url->link('extension/module/team', 'token=' . $this->session->data['token'], 'SSL');
		} else {
			$data['action'] = $this->url->link('extension/module/team', '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['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['boxtitlecss'])) {
			$data['boxtitlecss'] = $this->request->post['boxtitlecss'];
		} elseif (!empty($module_info)) {
			$data['boxtitlecss'] = $module_info['boxtitlecss'];
		} else {
			$data['boxtitlecss'] = '';
		}
		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['ptteam'])) {
			$data['ptteam'] = $this->request->post['ptteam'];
		} elseif (!empty($module_info)) {
			$data['ptteam'] = $module_info['ptteam'];
		} else {
			$data['ptteam'] = '70';
		}
		if (isset($this->request->post['pbteam'])) {
			$data['pbteam'] = $this->request->post['pbteam'];
		} elseif (!empty($module_info)) {
			$data['pbteam'] = $module_info['pbteam'];
		} else {
			$data['pbteam'] = '70';
		}
		if (isset($this->request->post['teamlinew'])) {
			$data['teamlinew'] = $this->request->post['teamlinew'];
		} elseif (!empty($module_info)) {
			$data['teamlinew'] = $module_info['teamlinew'];
		} else {
			$data['teamlinew'] = '';
		}
		if (isset($this->request->post['teamlineh'])) {
			$data['teamlineh'] = $this->request->post['teamlineh'];
		} elseif (!empty($module_info)) {
			$data['teamlineh'] = $module_info['teamlineh'];
		} else {
			$data['teamlineh'] = '';
		}
		if (isset($this->request->post['teamlinec'])) {
			$data['teamlinec'] = $this->request->post['teamlinec'];
		} elseif (!empty($module_info)) {
			$data['teamlinec'] = $module_info['teamlinec'];
		} else {
			$data['teamlinec'] = '';
		} 
		if (isset($this->request->post['teamname'])) {
			$data['teamname'] = $this->request->post['teamname'];
		} elseif (!empty($module_info)) {
			$data['teamname'] = $module_info['teamname'];
		} else {
			$data['teamname'] = '';
		}
		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['autoplay'])) {
			$data['autoplay'] = $this->request->post['autoplay'];
		} elseif (!empty($module_info)) {
			$data['autoplay'] = $module_info['autoplay'];
		} else {
			$data['autoplay'] = '';
		}
		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['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['column'])) {
			$data['column'] = $this->request->post['column'];
		} elseif (!empty($module_info)) {
			$data['column'] = $module_info['column'];
		} else {
			$data['column'] = '4';
		}
		if (isset($this->request->post['wapcolumn'])) {
			$data['wapcolumn'] = $this->request->post['wapcolumn'];
		} elseif (!empty($module_info)) {
			$data['wapcolumn'] = $module_info['wapcolumn'];
		} else {
			$data['wapcolumn'] = '1';
		}
		if (isset($this->request->post['rows'])) {
			$data['rows'] = $this->request->post['rows'];
		} elseif (!empty($module_info)) {
			$data['rows'] = $module_info['rows'];
		} else {
			$data['rows'] = '1';
		}
		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['boxbg'])) {
			$data['boxbg'] = $this->request->post['boxbg'];
		} elseif (!empty($module_info)) {
			$data['boxbg'] = $module_info['boxbg'];
		} else {
			$data['boxbg'] = '';
		}
		if (isset($this->request->post['boxnum'])) {
			$data['boxnum'] = $this->request->post['boxnum'];
		} elseif (!empty($module_info)) {
			$data['boxnum'] = $module_info['boxnum'];
		} else {
			$data['boxnum'] = '';
		}
		if (isset($this->request->post['boxtitle'])) {
			$data['boxtitle'] = $this->request->post['boxtitle'];
		} elseif (!empty($module_info)) {
			$data['boxtitle'] = $module_info['boxtitle'];
		} else {
			$data['boxtitle'] = '';
		}
		if (isset($this->request->post['boxzhiwei'])) {
			$data['boxzhiwei'] = $this->request->post['boxzhiwei'];
		} elseif (!empty($module_info)) {
			$data['boxzhiwei'] = $module_info['boxzhiwei'];
		} else {
			$data['boxzhiwei'] = '';
		}
		if (isset($this->request->post['boxdescribe'])) {
			$data['boxdescribe'] = $this->request->post['boxdescribe'];
		} elseif (!empty($module_info)) {
			$data['boxdescribe'] = $module_info['boxdescribe'];
		} else {
			$data['boxdescribe'] = '';
		}		
		if (isset($this->request->post['boxmagin'])) {
			$data['boxmagin'] = $this->request->post['boxmagin'];
		} elseif (!empty($module_info)) {
			$data['boxmagin'] = $module_info['boxmagin'];
		} else {
			$data['boxmagin'] = '5';
		}
		if (isset($this->request->post['boxpadding'])) {
			$data['boxpadding'] = $this->request->post['boxpadding'];
		} elseif (!empty($module_info)) {
			$data['boxpadding'] = $module_info['boxpadding'];
		} else {
			$data['boxpadding'] = '20';
		}
		if (isset($this->request->post['width'])) {
			$data['width'] = $this->request->post['width'];
		} elseif (!empty($module_info)) {
			$data['width'] = $module_info['width'];
		} else {
			$data['width'] = 320;
		}

		if (isset($this->request->post['height'])) {
			$data['height'] = $this->request->post['height'];
		} elseif (!empty($module_info)) {
			$data['height'] = $module_info['height'];
		} else {
			$data['height'] = 430;
		}
		if (isset($this->request->post['miconbj'])) {
			$data['miconbj'] = $this->request->post['miconbj'];
		} elseif (!empty($module_info)) {
			$data['miconbj'] = $module_info['miconbj'];
		} else {
			$data['miconbj'] = '';
		}	
		if (isset($this->request->post['miconcolor'])) {
			$data['miconcolor'] = $this->request->post['miconcolor'];
		} elseif (!empty($module_info)) {
			$data['miconcolor'] = $module_info['miconcolor'];
		} else {
			$data['miconcolor'] = '';
		}
		if (isset($this->request->post['hoverbj'])) {
			$data['hoverbj'] = $this->request->post['hoverbj'];
		} elseif (!empty($module_info)) {
			$data['hoverbj'] = $module_info['hoverbj'];
		} else {
			$data['hoverbj'] = '';
		}
		if (isset($this->request->post['hovertit'])) {
			$data['hovertit'] = $this->request->post['hovertit'];
		} elseif (!empty($module_info)) {
			$data['hovertit'] = $module_info['hovertit'];
		} else {
			$data['hovertit'] = '';
		}
		if (isset($this->request->post['miconround'])) {
			$data['miconround'] = $this->request->post['miconround'];
		} elseif (!empty($module_info)) {
			$data['miconround'] = $module_info['miconround'];
		} else {
			$data['miconround'] = '';
		}
		if (isset($this->request->post['miconsize'])) {
			$data['miconsize'] = $this->request->post['miconsize'];
		} elseif (!empty($module_info)) {
			$data['miconsize'] = $module_info['miconsize'];
		} else {
			$data['miconsize'] = '18';
		}	
		if (isset($this->request->post['miconborder'])) {
			$data['miconborder'] = $this->request->post['miconborder'];
		} elseif (!empty($module_info)) {
			$data['miconborder'] = $module_info['miconborder'];
		} else {
			$data['miconborder'] = '0';
		}
		if (isset($this->request->post['miconbc'])) {
			$data['miconbc'] = $this->request->post['miconbc'];
		} elseif (!empty($module_info)) {
			$data['miconbc'] = $module_info['miconbc'];
		} else {
			$data['miconbc'] = '';
		}
		if (isset($this->request->post['miconwidth'])) {
			$data['miconwidth'] = $this->request->post['miconwidth'];
		} elseif (!empty($module_info)) {
			$data['miconwidth'] = $module_info['miconwidth'];
		} else {
			$data['miconwidth'] = '40';
		}
		if (isset($this->request->post['miconheight'])) {
			$data['miconheight'] = $this->request->post['miconheight'];
		} elseif (!empty($module_info)) {
			$data['miconheight'] = $module_info['miconheight'];
		} else {
			$data['miconheight'] = '40';
		}	
		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['imagetext'])) {
			$data['imagetext'] = $this->request->post['imagetext'];
		} elseif (!empty($module_info)) {
			$data['imagetext'] = $module_info['imagetext'];
		} else {
			$data['imagetext'] = '';
		}
		if (isset($this->request->post['imground'])) {
			$data['imground'] = $this->request->post['imground'];
		} elseif (!empty($module_info)) {
			$data['imground'] = $module_info['imground'];
		} else {
			$data['imground'] = '50';
		}
		if (isset($this->request->post['imgthumb'])) {
			$data['imgthumb'] = $this->request->post['imgthumb'];
		} elseif (!empty($module_info)) {
			$data['imgthumb'] = $module_info['imgthumb'];
		} else {
			$data['imgthumb'] = 'img-thumbnail';
		}
		if (isset($this->request->post['imgshadow'])) {
			$data['imgshadow'] = $this->request->post['imgshadow'];
		} elseif (!empty($module_info)) {
			$data['imgshadow'] = $module_info['imgshadow'];
		} else {
			$data['imgshadow'] = '29';
		}
		if (isset($this->request->post['imgpadding'])) {
			$data['imgpadding'] = $this->request->post['imgpadding'];
		} elseif (!empty($module_info)) {
			$data['imgpadding'] = $module_info['imgpadding'];
		} else {
			$data['imgpadding'] = '0';
		}
		if (isset($this->request->post['imgborder'])) {
			$data['imgborder'] = $this->request->post['imgborder'];
		} elseif (!empty($module_info)) {
			$data['imgborder'] = $module_info['imgborder'];
		} else {
			$data['imgborder'] = '3';
		}
		if (isset($this->request->post['imgcolor'])) {
			$data['imgcolor'] = $this->request->post['imgcolor'];
		} elseif (!empty($module_info)) {
			$data['imgcolor'] = $module_info['imgcolor'];
		} else {
			$data['imgcolor'] = '#f8f8f8';
		}	
		if (isset($this->request->post['boxbjhover'])) {
			$data['boxbjhover'] = $this->request->post['boxbjhover'];
		} elseif (!empty($module_info)) {
			$data['boxbjhover'] = $module_info['boxbjhover'];
		} else {
			$data['boxbjhover'] = '';
		}
		if (isset($this->request->post['boxcolorhover'])) {
			$data['boxcolorhover'] = $this->request->post['boxcolorhover'];
		} elseif (!empty($module_info)) {
			$data['boxcolorhover'] = $module_info['boxcolorhover'];
		} else {
			$data['boxcolorhover'] = '';
		}
		if (isset($this->request->post['boxptpadding'])) {
			$data['boxptpadding'] = $this->request->post['boxptpadding'];
		} elseif (!empty($module_info)) {
			$data['boxptpadding'] = $module_info['boxptpadding'];
		} else {
			$data['boxptpadding'] = '';
		}
		if (isset($this->request->post['boxwzbj'])) {
			$data['boxwzbj'] = $this->request->post['boxwzbj'];
		} elseif (!empty($module_info)) {
			$data['boxwzbj'] = $module_info['boxwzbj'];
		} else {
			$data['boxwzbj'] = '20';
		}  		
		if (isset($this->request->post['boxborder'])) {
			$data['boxborder'] = $this->request->post['boxborder'];
		} elseif (!empty($module_info)) {
			$data['boxborder'] = $module_info['boxborder'];
		} else {
			$data['boxborder'] = '1';
		}	
		if (isset($this->request->post['boxcolor'])) {
			$data['boxcolor'] = $this->request->post['boxcolor'];
		} elseif (!empty($module_info)) {
			$data['boxcolor'] = $module_info['boxcolor'];
		} else {
			$data['boxcolor'] = '#F2F2F2';
		}		
		if (isset($this->request->post['boxround'])) {
			$data['boxround'] = $this->request->post['boxround'];
		} elseif (!empty($module_info)) {
			$data['boxround'] = $module_info['boxround'];
		} else {
			$data['boxround'] = '5';
		}
		if (isset($this->request->post['boxposition'])) {
			$data['boxposition'] = $this->request->post['boxposition'];
		} elseif (!empty($module_info)) {
			$data['boxposition'] = $module_info['boxposition'];
		} else {
			$data['boxposition'] = 'center';
		}
		if (isset($this->request->post['boxshadow'])) {
			$data['boxshadow'] = $this->request->post['boxshadow'];
		} elseif (!empty($module_info)) {
			$data['boxshadow'] = $module_info['boxshadow'];
		} else {
			$data['boxshadow'] = '19';
		}
		if (isset($this->request->post['boxshadowhover'])) {
			$data['boxshadowhover'] = $this->request->post['boxshadowhover'];
		} elseif (!empty($module_info)) {
			$data['boxshadowhover'] = $module_info['boxshadowhover'];
		} else {
			$data['boxshadowhover'] = '21';
		}	
		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'] = 'red';
		}
		if (isset($this->request->post['buttoncolor2'])) {
			$data['buttoncolor2'] = $this->request->post['buttoncolor2'];
		} elseif (!empty($module_info)) {
			$data['buttoncolor2'] = $module_info['buttoncolor2'];
		} else {
			$data['buttoncolor2'] = 'black';
		}
		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['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['slidename'])) {
			$data['slidename'] = $this->request->post['slidename'];
		} elseif (!empty($module_info)) {
			$data['slidename'] = $module_info['slidename'];
		} else {
			$data['slidename'] = '';
		}		
		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['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'] = '';
		}
		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'] = '';
		}		
		$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'],
				'introduce'        => $service['introduce'],
				'web'        => $service['web'],
				'weibo'        => $service['weibo'],
				'other'        => $service['other'],
				'boxbottonn1'        => $service['boxbottonn1'],
				'boxbottonn2'        => $service['boxbottonn2'],
				'weblink'        => $service['weblink'],
				'weibolink'        => $service['weibolink'],
				'otherlink'        => $service['otherlink'],
				'image'       => $image,
				'thumb'       => $this->model_tool_image->resize($thumb, 40, 40),
				'sort_order'  => $service['sort_order']
			);
		}

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

		$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/team.tpl', $data));
	}

	protected function validate() {
		if (!$this->user->hasPermission('modify', 'extension/module/team')) {
			$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');
		}
		if ((utf8_strlen($this->request->post['slidename']) < 1) || (utf8_strlen($this->request->post['slidename']) > 64)) {
			$this->error['slidename'] = $this->language->get('error_slidename');
		}
		if ((utf8_strlen($this->request->post['boxnum']) < 1) || (utf8_strlen($this->request->post['boxnum']) > 64)) {
			$this->error['boxnum'] = $this->language->get('error_boxnum');
		}
		if ((utf8_strlen($this->request->post['sectionid']) < 1) || (utf8_strlen($this->request->post['sectionid']) > 64)) {
			$this->error['sectionid'] = $this->language->get('error_name');
		}
		return !$this->error;
	}
}