policybot/application/models/Category_model.php

69 lines
1.9 KiB
PHP
Raw Normal View History

2021-11-30 10:56:55 +00:00
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Category_model extends CI_Model {
public function __construct() {
parent::__construct();
}
function list_cat($id=0)
{
$this->db->select('*');
$this->db->from('categories');
$this->db->where(array('status'=>1));
if($id!=""){ $this->db->where(array('id'=>$id)); }
$query = $this->db->get();
//echo $this->db->last_query();exit;
return $query;
}
function get_compare_master()
{
$this->db->select('*');
$this->db->from('category_compare_master');
$this->db->where(array('status'=>1));
$query = $this->db->get();
//echo $this->db->last_query();exit;
return $query;
}
function get_document_master()
{
$this->db->select('*');
$this->db->from('documents_master');
$this->db->where(array('status'=>1));
$query = $this->db->get();
//echo $this->db->last_query();exit;
return $query;
}
function get_compare_details($id)
{
$this->db->select('cd.*,cm.compare_name');
$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,'category'=>$id));
$query = $this->db->get();
//echo $this->db->last_query();exit;
return $query;
}
function questions_before_quote($id)
{
$this->db->select('*');
$this->db->from('category_questions_before_quote');
$this->db->where(array('status'=>1,'category'=>$id));
$query = $this->db->get();
//echo $this->db->last_query();exit;
return $query;
}
function get_document_details($id)
{
$this->db->select('cd.*,cm.name as docname');
$this->db->from('category_document_details as cd');
$this->db->join('documents_master as cm','cm.id=cd.document','left');
$this->db->where(array('cm.status'=>1,'cd.status'=>1,'category'=>$id));
$query = $this->db->get();
//echo $this->db->last_query();exit;
return $query;
}
}