source: pro-violet-viettel/sourcecode/application/modules/admin/models/collabolator_model.php @ 360

Last change on this file since 360 was 360, checked in by quyenla, 11 years ago

collaborator

File size: 1.1 KB
Line 
1<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
2
3class Collabolator_model extends MY_Model
4{
5       
6        protected $table_name = 'tblcollabolator';
7        protected $id_name = 'id';
8
9        function __construct()
10        {
11                parent::__construct();
12        }
13        function getCollaborator($data)
14        {
15            $sql="SELECT * FROM tblcollaborator";
16            $data['keyword']='';
17
18            if ($data['keyword'])
19            {
20            $sql.=" WHERE (full_name LIKE '%".$data['keyword']."%' OR login_name LIKE '%".$data['keyword']."%')";
21            }
22            return $this->db->query($sql." LIMIT ".$data['start'].", ".$data['perpage']."")->result_array();
23
24        }
25        function countCollaborator($data)
26        {
27            $sql="SELECT COUNT(id) as total FROM tblcollaborator";
28            if (isset($data['keyword']))
29            {
30            $sql.=" WHERE (full_name LIKE '%".$data['keyword']."%' OR login_name LIKE '%".$data['keyword']."%')";
31            }
32
33            return $this->db->query($sql)->row_array()['total'];
34           
35        }
36}
Note: See TracBrowser for help on using the repository browser.