File: //home/cafsindia/crm_cafsindia_com/application/controllers/Open_leads.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
require_once("Secure_Controller.php");
class Open_leads extends Secure_Controller{
public function __construct(){
parent::__construct('open_leads');
$this->load->model('Open_leads_model');
$this->load->model('Customer');
}
public function index(){
if(!$this->Appconfig->isAppvalid()){
redirect('config');
}
$data['table_headers'] = $this->xss_clean(get_open_leads_table_headers());
$this->load->view('open_leads/manage',$data);
}
public function search(){
$search = $this->input->get('search');
$limit = $this->input->get('limit');
$offset = $this->input->get('offset');
$sort = $this->input->get('sort');
$order = $this->input->get('order');
$filters = array('start_date' => $this->input->get('start_date'),
'end_date' => $this->input->get('end_date'),
'General_Insurance' => FALSE,
'Portfolio' => FALSE,
'Health_Insurance' => FALSE,
'Mutual_Funds' => FALSE,
'Term_Plan' => FALSE );
$filledup = array_fill_keys($this->input->get('filters'), TRUE);
$filters = array_merge($filters, $filledup);
$all_leads = $this->Open_leads_model->search($search, $filters, $limit, $offset, $sort, $order);
$total_rows = $this->Open_leads_model->get_found_rows($search, $filters);
$data_rows = array();
foreach($all_leads->result() as $leads){
$data_rows[] = get_all_leads_data_row($leads, $this);
}
echo json_encode(array('total' => $total_rows, 'rows' => $data_rows));
}
}
?>