File: //home/cafsindia/allyindian_com/backend/application/models/Boarding_point_model.php
<?php
class Boarding_point_model extends CI_Model
{
public function search($search,$rows = 0,$limit_from= 0,$sort='board_point_id',$order='asc')
{
$this->db->select('*');
$this->db->from('boarding_point');
$this->db->group_start();
$this->db->like('board_point_id',$search);
$this->db->or_like('boarding_name',$search);
$this->db->group_end();
$this->db->order_by('board_point_id',$order);
if($rows>0)
{
$this->db->limit($rows, $limit_from);
}
return $this->db->get();
}
public function GetInfo($board_point_id)
{
$this->db->from('boarding_point');
$this->db->where('board_point_id',$board_point_id);
$a=$this->db->get();
if($a->num_rows() === 1)
{
return $a->row();
}
else
{
foreach ($this->db->list_fields('boarding_point') as $field)
{
$PersonObj->field= '';
}
return $PersonObj;
}
}
public function get_found_rows($search)
{
$this->db->select('*');
$this->db->from('boarding_point');
$this->db->where('status',1);
return $this->db->get()->num_rows();
}
public function exist($board_point_data)
{
$this->db->from('boarding_point');
$boarding_name = array('boarding_name'=>$board_point_data['boarding_name']);
$this->db->where($boarding_name);
return $this->db->get()->num_rows();
}
public function SaveCode(&$board_point_data,$board_point_id= FALSE)
{
if(!$this->present($board_point_id,'True')||!$board_point_id)
{
if($this->db->insert('boarding_point',$board_point_data))
{
$BankData['board_point_id']=$this->db->insert_id();
return true;
}
return False;
}
$board_point_data['updated_by'] = $this->session->userdata('emp_id');
$board_point_data['updated_date'] = date('Y-m-d h:i:s');
$this->db->where('board_point_id',$board_point_id);
return $this->db->update('boarding_point',$board_point_data);
}
public function present($board_point_id)
{
$this->db->from('boarding_point');
$this->db->where('board_point_id',$board_point_id);
return $this->db->get()->num_rows();
}
public function delete_list($board_ids)
{
$this->db->where_in('board_point_id',$board_ids);
return $this->db->update('boarding_point',array('status'=>0,'deleted_by' => $this->session->userdata('emp_id'),'deleted_date' => date('Y-m-d h:i:s')));
}
}
?>