<?php
/*
Fungsi : Model Group
Create By : Rony
Date : 16-03-2014

Last Change By :
Last Date Change :
*/
class Group_model extends CI_Model {
	/**
	 * Constructor
	 */
	function group_model()
	{
		parent::__construct();
	} 
	
	/* Insialiasi nama table */
	var $table_grouping			= 'm_cab';
	var $table_reminder			= 'reminder_events';
	
	
	/* =========== Model Master Data Group ==========*/
	
	/* Insert data group */
   		function add_group($group)
		{
			$this->db->insert($this->table_grouping, $group);
		}
		
	/* Get Data Group */
	function get_groupdata($id)
	{
		$this->db->select('*');
		$this->db->where('idcab', $id);
		$query = $this->db->get($this->table_grouping);
  		return $query;
	}
	
	/* List group paging */
	function get_paging_group($limit, $offset)
	{		
		if(!empty($search)) {
  		$this->db->like('idcab',$search);
		$this->db->or_like('desc',$search);
		}
		$this->db->order_by('idcab', 'ASC');
		$this->db->limit($limit, $offset);
  		return $this->db->get($this->table_grouping);
		
	}
	
	/* Total data group */
	function count_rows_group()
	{
		if(!empty($search)) {
  		$this->db->like('idcab',$search);
		$this->db->or_like('desc',$search);
		}
		$this->db->order_by('idcab','ASC');
		return $this->db->count_all_results($this->table_grouping);
	}
	
	/* Update Master Data Group */
	function update_group($id, $group)
	{
		$this->db->where('idcab', $id);
		$this->db->update($this->table_grouping, $group);
	}
	
	/* ================================================= */
	
}