| Line 20... |
Line 20... |
| 20 |
|
20 |
|
| 21 |
|
21 |
|
| 22 |
}
|
22 |
}
|
| 23 |
public function index()
|
23 |
public function index()
|
| 24 |
{
|
24 |
{
|
| - |
|
25 |
$configdata =array();
|
| - |
|
26 |
$configdata = $this->config->item('home');
|
| - |
|
27 |
$checkConfig = $this->config->item('home');
|
| - |
|
28 |
$cachemodule = array('header','footer','response');
|
| - |
|
29 |
$configdata = getCache($configdata,$cachemodule);
|
| 25 |
$detect = new Mobile_Detect;
|
30 |
$detect = new Mobile_Detect;
|
| 26 |
$deviceType = ($detect->isMobile() ? ($detect->isTablet() ? 'tablet' : 'phone') : 'computer');
|
31 |
$deviceType = ($detect->isMobile() ? ($detect->isTablet() ? 'tablet' : 'phone') : 'computer');
|
| 27 |
$scriptVersion = $detect->getScriptVersion();
|
32 |
$scriptVersion = $detect->getScriptVersion();
|
| 28 |
//echo $detect->getUserAgent();
|
33 |
//echo $detect->getUserAgent();
|
| 29 |
if($detect->isAndroidOS() == 1){
|
34 |
if($detect->isAndroidOS() == 1){
|
| Line 50... |
Line 55... |
| 50 |
$str=explode(';', $str[0]);
|
55 |
$str=explode(';', $str[0]);
|
| 51 |
$str=explode('(', $str[0]);
|
56 |
$str=explode('(', $str[0]);
|
| 52 |
$str=ltrim($str[1]);
|
57 |
$str=ltrim($str[1]);
|
| 53 |
$str=rtrim($str);
|
58 |
$str=rtrim($str);
|
| 54 |
$this->session->set_userdata('mobileBuild',$str);
|
59 |
$this->session->set_userdata('mobileBuild',$str);
|
| - |
|
60 |
}else{
|
| - |
|
61 |
unset($checkConfig['response'][3]);
|
| - |
|
62 |
$recommended_accessories = false;
|
| 55 |
}
|
63 |
}
|
| 56 |
//standard array
|
64 |
//standard array
|
| 57 |
$data = array();
|
65 |
$data = array();
|
| 58 |
//get cache
|
66 |
//get cache
|
| 59 |
$configdata =array();
|
- |
|
| 60 |
$configdata = $this->config->item('home');
|
- |
|
| 61 |
$checkConfig = $this->config->item('home');
|
- |
|
| 62 |
$cachemodule = array('header','footer','response');
|
- |
|
| 63 |
$configdata = getCache($configdata,$cachemodule);
|
- |
|
| 64 |
$newData = array();
|
67 |
$newData = array();
|
| 65 |
foreach ($checkConfig['response'] as $key => $value) {
|
68 |
foreach ($checkConfig['response'] as $key => $value) {
|
| 66 |
if($value != 'recommended_accessories' && $value != 'recharge_icons'){
|
69 |
if($value != 'recommended_accessories' && $value != 'recharge_icons'){
|
| 67 |
$newData[] = $value;
|
70 |
$newData[] = $value;
|
| 68 |
}
|
71 |
}
|
| Line 77... |
Line 80... |
| 77 |
}
|
80 |
}
|
| 78 |
//end of get cache
|
81 |
//end of get cache
|
| 79 |
$this->lessphp->object()->ccompile('assets/css/common.less','assets/css/common.css');
|
82 |
$this->lessphp->object()->ccompile('assets/css/common.less','assets/css/common.css');
|
| 80 |
$data['stylesheet'] = 'common.css';
|
83 |
$data['stylesheet'] = 'common.css';
|
| 81 |
if(isset($api) && $api == 1){
|
84 |
if(isset($api) && $api == 1){
|
| 82 |
$data['response']=$this->home_model->getHome($this->input->get(),$this->input->post(),$this->config->item('home'));
|
85 |
$data['response']=$this->home_model->getHome($this->input->get(),$this->input->post(),$checkConfig);
|
| 83 |
}elseif(!isset($api)){
|
86 |
}elseif(!isset($api)){
|
| 84 |
$data['response']=$this->home_model->getHome($this->input->get(),$this->input->post(),$configdata['module']);
|
87 |
$data['response']=$this->home_model->getHome($this->input->get(),$this->input->post(),$configdata['module']);
|
| 85 |
}
|
88 |
}
|
| 86 |
//print_r($data['response']);
|
89 |
//print_r($data['response']);
|
| 87 |
$tmp = $data['response'];
|
90 |
$tmp = $data['response'];
|
| Line 110... |
Line 113... |
| 110 |
if(!isset($data['response']['response']['home_featured_product']) && empty($data['response']['response']['home_featured_product'])){
|
113 |
if(!isset($data['response']['response']['home_featured_product']) && empty($data['response']['response']['home_featured_product'])){
|
| 111 |
$data['response']['response'] = $this->InsertBeforeKey($data['response']['response'],'home_menu','recharge_icons',$tmp['response']['recharge_icons']);
|
114 |
$data['response']['response'] = $this->InsertBeforeKey($data['response']['response'],'home_menu','recharge_icons',$tmp['response']['recharge_icons']);
|
| 112 |
}else{
|
115 |
}else{
|
| 113 |
$data['response']['response'] = $this->InsertBeforeKey($data['response']['response'],'home_featured_product','recharge_icons',$tmp['response']['recharge_icons']);
|
116 |
$data['response']['response'] = $this->InsertBeforeKey($data['response']['response'],'home_featured_product','recharge_icons',$tmp['response']['recharge_icons']);
|
| 114 |
}
|
117 |
}
|
| - |
|
118 |
if(!isset($recommended_accessories)){
|
| 115 |
$data['response']['response'] = $this->InsertBeforeKey($data['response']['response'],'home_menu','recommended_accessories',$tmp['response']['recommended_accessories']);
|
119 |
$data['response']['response'] = $this->InsertBeforeKey($data['response']['response'],'home_menu','recommended_accessories',$tmp['response']['recommended_accessories']);
|
| - |
|
120 |
}
|
| 116 |
//end of set cache\
|
121 |
//end of set cache\
|
| 117 |
$this->layout->view('home/home_view',$data);
|
122 |
$this->layout->view('home/home_view',$data);
|
| 118 |
}
|
123 |
}
|
| 119 |
public function InsertBeforeKey($originalArray,$originalKey,$insertKey,$insertValue){
|
124 |
public function InsertBeforeKey($originalArray,$originalKey,$insertKey,$insertValue){
|
| 120 |
|
125 |
|