﻿<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Collabolator_model extends MY_Model
{
	
	protected $table_name = 'tblcollabolator';
	protected $id_name = 'id';

	function __construct()
	{
		parent::__construct();
	}
	function getCollaborator($data)
        {
            $sql="SELECT * FROM tblcollaborator";
            $data['keyword']='';

            if ($data['keyword'])
            {
            $sql.=" WHERE (full_name LIKE '%".$data['keyword']."%' OR login_name LIKE '%".$data['keyword']."%')";
            }
            return $this->db->query($sql." LIMIT ".$data['start'].", ".$data['perpage']."")->result_array();

        }
        function countCollaborator($data)
        {
            $sql="SELECT COUNT(id) as total FROM tblcollaborator";
            if (isset($data['keyword']))
            {
            $sql.=" WHERE (full_name LIKE '%".$data['keyword']."%' OR login_name LIKE '%".$data['keyword']."%')";
            }

            return $this->db->query($sql)->row_array()['total'];
            
        }
}