Subversion Repositories SmartDukaan

Rev

Rev 11169 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 11169 Rev 11395
Line 26... Line 26...
26
		$configdata =array();
26
		$configdata =array();
27
		$configdata = $this->config->item('home');
27
		$configdata = $this->config->item('home');
28
		$checkConfig = $this->config->item('home');
28
		$checkConfig = $this->config->item('home');
29
		$cachemodule = array('header','footer','response');
29
		$cachemodule = array('header','footer','response');
30
		$configdata = getCache($configdata,$cachemodule);
30
		$configdata = getCache($configdata,$cachemodule);
-
 
31
		unset($checkConfig['response'][2]);
-
 
32
		unset($configdata['module']['response'][2]);
-
 
33
		$recommended_accessories = false;
-
 
34
		/*------------------------recomeended accessories-------------------------------- */
31
		$detect = new Mobile_Detect;
35
		// $detect = new Mobile_Detect;
32
		$deviceType = ($detect->isMobile() ? ($detect->isTablet() ? 'tablet' : 'phone') : 'computer');
36
		// $deviceType = ($detect->isMobile() ? ($detect->isTablet() ? 'tablet' : 'phone') : 'computer');
33
		$scriptVersion = $detect->getScriptVersion();
37
		// $scriptVersion = $detect->getScriptVersion();
34
		//echo $detect->getUserAgent();
38
		// //echo $detect->getUserAgent();
35
		if($detect->isAndroidOS() == 1){
39
		// if($detect->isAndroidOS() == 1){
36
			$str=explode('Build', $detect->getUserAgent());
40
		// 	$str=explode('Build', $detect->getUserAgent());
37
			$str=explode(';', $str[0]);
41
		// 	$str=explode(';', $str[0]);
38
			$str = end($str);
42
		// 	$str = end($str);
39
			$str = ltrim($str);
43
		// 	$str = ltrim($str);
40
			$str = rtrim($str);
44
		// 	$str = rtrim($str);
41
			$this->session->set_userdata('mobileBuild',$str);
45
		// 	$this->session->set_userdata('mobileBuild',$str);
42
			//print_r($detect->getUaHttpHeaders());
46
		// 	//print_r($detect->getUaHttpHeaders());
43
		}else if($detect->isIphone() ==1){
47
		// }else if($detect->isIphone() ==1){
44
			$this->session->set_userdata('mobileBuild','iPhone');
48
		// 	$this->session->set_userdata('mobileBuild','iPhone');
45
		}elseif($detect->isWindowsPhoneOS() == 1){
49
		// }elseif($detect->isWindowsPhoneOS() == 1){
46
			if(strpos($detect->getUserAgent(), 'NOKIA') !== false){
50
		// 	if(strpos($detect->getUserAgent(), 'NOKIA') !== false){
47
				$str=explode('NOKIA', $detect->getUserAgent());
51
		// 		$str=explode('NOKIA', $detect->getUserAgent());
48
				$str=explode(';', $str[1]);
52
		// 		$str=explode(';', $str[1]);
49
				$str=str_replace(')','', $str);
53
		// 		$str=str_replace(')','', $str);
50
				$str = ltrim($str[1]);
54
		// 		$str = ltrim($str[1]);
51
				$str=rtrim($str);
55
		// 		$str=rtrim($str);
52
				$this->session->set_userdata('mobileBuild',$str);
56
		// 		$this->session->set_userdata('mobileBuild',$str);
53
			}
57
		// 	}
54
		}elseif($detect->isBlackBerry() == 1){
58
		// }elseif($detect->isBlackBerry() == 1){
55
			$str=explode('Touch', $detect->getUserAgent());
59
		// 	$str=explode('Touch', $detect->getUserAgent());
56
			$str=explode(';', $str[0]);
60
		// 	$str=explode(';', $str[0]);
57
			$str=explode('(', $str[0]);
61
		// 	$str=explode('(', $str[0]);
58
			$str=ltrim($str[1]);
62
		// 	$str=ltrim($str[1]);
59
			$str=rtrim($str);
63
		// 	$str=rtrim($str);
60
			$this->session->set_userdata('mobileBuild',$str);
64
		// 	$this->session->set_userdata('mobileBuild',$str);
61
		}else{
65
		// }else{
62
			unset($checkConfig['response'][2]);
66
		// 	unset($checkConfig['response'][2]);
63
			unset($configdata['module']['response'][2]);
67
		// 	unset($configdata['module']['response'][2]);
64
			$recommended_accessories = false;
68
		// 	$recommended_accessories = false;
65
		}
69
		// }
-
 
70
		/*--------------------------------------------------------------------------------------*/
66
		//standard array
71
		//standard array
67
		$data = array();
72
		$data = array();
68
		//get cache 
73
		//get cache 
69
		$newData = array();
74
		$newData = array();
70
		foreach ($checkConfig['response'] as $key => $value) {
75
		foreach ($checkConfig['response'] as $key => $value) {
Line 117... Line 122...
117
		// if(!isset($data['response']['response']['home_featured_product']) && empty($data['response']['response']['home_featured_product'])){
122
		// if(!isset($data['response']['response']['home_featured_product']) && empty($data['response']['response']['home_featured_product'])){
118
		// 	$data['response']['response'] = $this->InsertBeforeKey($data['response']['response'],'home_menu','recharge_icons',$tmp['response']['recharge_icons']);
123
		// 	$data['response']['response'] = $this->InsertBeforeKey($data['response']['response'],'home_menu','recharge_icons',$tmp['response']['recharge_icons']);
119
		// }else{
124
		// }else{
120
		// 	$data['response']['response'] = $this->InsertBeforeKey($data['response']['response'],'home_featured_product','recharge_icons',$tmp['response']['recharge_icons']);
125
		// 	$data['response']['response'] = $this->InsertBeforeKey($data['response']['response'],'home_featured_product','recharge_icons',$tmp['response']['recharge_icons']);
121
		// }
126
		// }
122
		if(!isset($recommended_accessories)){
127
		// if(!isset($recommended_accessories)){
123
			$data['response']['response'] = $this->InsertBeforeKey($data['response']['response'],'home_menu','recommended_accessories',$tmp['response']['recommended_accessories']);
128
		// 	$data['response']['response'] = $this->InsertBeforeKey($data['response']['response'],'home_menu','recommended_accessories',$tmp['response']['recommended_accessories']);
124
		}
129
		// }
125
		//end of set cache\
130
		//end of set cache\
126
		$this->layout->view('home/home_view',$data);
131
		$this->layout->view('home/home_view',$data);
127
	}
132
	}
128
	public function InsertBeforeKey($originalArray,$originalKey,$insertKey,$insertValue){
133
	public function InsertBeforeKey($originalArray,$originalKey,$insertKey,$insertValue){
129
 
134
 
Line 155... Line 160...
155
        $data = str_replace('[', '', $data);
160
        $data = str_replace('[', '', $data);
156
        $data = str_replace(']', '', $data);
161
        $data = str_replace(']', '', $data);
157
        $data = str_replace('"', '', $data);
162
        $data = str_replace('"', '', $data);
158
        echo json_encode(explode(',', $data));
163
        echo json_encode(explode(',', $data));
159
	}
164
	}
-
 
165
	
160
}
166
}
161
 
167
 
162
/* End of file welcome.php */
168
/* End of file welcome.php */
163
/* Location: ./application/controllers/welcome.php */
169
/* Location: ./application/controllers/welcome.php */
164
170