Ignore:
Timestamp:
Nov 3, 2014 12:25:15 PM (11 years ago)
Author:
namnd
Message:
 
Location:
pro-violet-viettel/sourcecode/application/modules/admin/models
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • pro-violet-viettel/sourcecode/application/modules/admin/models/admin_model.php

    r369 r375  
    3131                return $query->num_rows();
    3232        }
     33       
     34        function get_list_admins($data)
     35        {
     36                $sql="SELECT * FROM ".$this->table_name;
     37                $data['keyword']='';
     38                if ($data['keyword'])
     39                {
     40                        $sql.=" WHERE (login_name LIKE '%".$data['keyword']."%' OR full_name LIKE '%".$data['keyword']."%') ";
     41                }
     42                return $this->db->query($sql." ORDER BY admin_id DESC LIMIT ".$data['start'].", ".$data['perpage']." ")->result_array();
     43        }
     44
     45        function get_total_admins($data)
     46        {
     47                $sql="SELECT COUNT(".$this->id_name.") AS total FROM ".$this->table_name;
     48                if (isset($data['keyword']))
     49                {
     50                        $sql.=" WHERE (login_name LIKE '%".$data['keyword']."%' OR full_name LIKE '%".$data['keyword']."%') ";
     51                }
     52                return $this->db->query($sql)->row_array()['total'];
     53        }
    3354}
  • pro-violet-viettel/sourcecode/application/modules/admin/models/user_model.php

    r369 r375  
    1818                return $query->num_rows();
    1919        }
     20       
     21        function get_list_users($data)
     22        {
     23                $sql="SELECT * FROM ".$this->table_name;
     24                $data['keyword']='';
     25                if ($data['keyword'])
     26                {
     27                        $sql.=" WHERE (cellphone LIKE '%".$data['keyword']."%' OR collaborator LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%') ";
     28                }
     29                return $this->db->query($sql." ORDER BY us_id DESC LIMIT ".$data['start'].", ".$data['perpage']." ")->result_array();
     30        }
    2031
     32        function get_total_users($data)
     33        {
     34                $sql="SELECT COUNT(".$this->id_name.") AS total FROM ".$this->table_name;
     35                if (isset($data['keyword']))
     36                {
     37                        $sql.=" WHERE (cellphone LIKE '%".$data['keyword']."%' OR collaborator LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%') ";
     38                }
     39                return $this->db->query($sql)->row_array()['total'];
     40        }
    2141}
Note: See TracChangeset for help on using the changeset viewer.