48 lines
1.4 KiB
PHP
48 lines
1.4 KiB
PHP
|
<?php
|
||
|
if (!defined('BASEPATH'))
|
||
|
exit('No direct script access allowed');
|
||
|
|
||
|
class Policy_model extends CI_Model {
|
||
|
|
||
|
public function __construct() {
|
||
|
parent::__construct();
|
||
|
}
|
||
|
|
||
|
function list_policies($id=0)
|
||
|
{
|
||
|
$this->db->select('p.*,cm.name as cmpname,ca.name as catname');
|
||
|
$this->db->from('policies as p');
|
||
|
$this->db->join('companies as cm','cm.id=p.company','left');
|
||
|
$this->db->join('categories as ca','ca.id=p.category','left');
|
||
|
$this->db->where(array('p.status'=>1,'cm.status'=>1,'ca.status'=>1));
|
||
|
if($id!=0){ $this->db->where(array('p.id'=>$id)); }
|
||
|
$query = $this->db->get();
|
||
|
//echo $this->db->last_query();exit;
|
||
|
return $query;
|
||
|
}
|
||
|
function get_compare_master($cid)
|
||
|
{
|
||
|
$this->db->select('cm.*');
|
||
|
$this->db->from('category_compare_detail as cd');
|
||
|
$this->db->join('category_compare_master as cm','cm.id=cd.compare','left');
|
||
|
|
||
|
$this->db->where(array('cm.status'=>1,'cd.status'=>1));
|
||
|
$this->db->where(array('cd.category'=>$cid));
|
||
|
$query = $this->db->get();
|
||
|
|
||
|
return $query;
|
||
|
}
|
||
|
function get_polict_compare_details($pid)
|
||
|
{
|
||
|
$this->db->select('cd.*,cm.compare_name');
|
||
|
$this->db->from('policy_compare_details as cd');
|
||
|
$this->db->join('category_compare_master as cm','cm.id=cd.compare','left');
|
||
|
|
||
|
$this->db->where(array('cm.status'=>1,'cd.status'=>1));
|
||
|
$this->db->where(array('cd.policy'=>$pid));
|
||
|
$query = $this->db->get();
|
||
|
// echo $this->db->last_query();exit;
|
||
|
return $query;
|
||
|
}
|
||
|
}
|