| 11805 |
anikendra |
1 |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
|
|
2 |
|
|
|
3 |
class Privatedeals extends MY_Controller {
|
|
|
4 |
|
|
|
5 |
public $layoutName ='';
|
|
|
6 |
function __construct() {
|
|
|
7 |
// Call the CI_controller constructor
|
|
|
8 |
parent::__construct();
|
|
|
9 |
$authorized = $this->session->userdata('authorized');
|
|
|
10 |
if(!isset($authorized) || empty($authorized)){
|
|
|
11 |
redirect(base_url().'auth/login');
|
|
|
12 |
}
|
|
|
13 |
$this->layout->setlayout('layout/layout_main');
|
|
|
14 |
$this->load->model('privatedeal_model');
|
|
|
15 |
$this->load->model('magento_model');
|
|
|
16 |
$this->layoutName= $this->layout->getLayout();
|
|
|
17 |
$this->layoutName =substr($this->layoutName , 0, strrpos($this->layoutName , "/")).'/';
|
|
|
18 |
}
|
|
|
19 |
|
|
|
20 |
public function index()
|
|
|
21 |
{
|
|
|
22 |
$userId = $this->session->userdata['authorized']['Id'];
|
|
|
23 |
$data = array();
|
|
|
24 |
//get cache
|
|
|
25 |
$configdata =array();
|
|
|
26 |
$configdata = $this->config->item('privatedeals');
|
|
|
27 |
$name = $configdata['response'];
|
|
|
28 |
|
|
|
29 |
foreach ($name as $key => $value) {
|
|
|
30 |
$name = $value;
|
|
|
31 |
}
|
|
|
32 |
$cachemodule = array('header','footer');
|
|
|
33 |
$configdata = getCache($configdata,$cachemodule);
|
|
|
34 |
|
|
|
35 |
$data['response']=$this->privatedeal_model->getProducts('',$this->input->post(),$configdata['module'], $userId);
|
|
|
36 |
//set cache to output or renew cache
|
|
|
37 |
if(isset($cachemodule) and !empty($cachemodule))
|
|
|
38 |
{
|
|
|
39 |
foreach($cachemodule as $cm)
|
|
|
40 |
{
|
|
|
41 |
if(isset($configdata[$cm]) and !empty($configdata[$cm]))
|
|
|
42 |
{
|
|
|
43 |
$data['response'][$cm]=$configdata[$cm];
|
|
|
44 |
}
|
|
|
45 |
}
|
|
|
46 |
}
|
|
|
47 |
setCache($configdata['module'],$cachemodule,$data['response']);
|
|
|
48 |
$this->lessphp->object()->ccompile('assets/css/pd-list.less','assets/css/pd-list.css');
|
|
|
49 |
$data['stylesheet'] = 'pd-list.css';
|
|
|
50 |
|
|
|
51 |
$this->layout->view('privatedeals/products_view',$data);
|
|
|
52 |
}
|
|
|
53 |
}
|