Ignore:
Timestamp:
Nov 4, 2014 6:48:37 PM (11 years ago)
Author:
namnd
Message:
 
File:
1 edited

Legend:

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

    r397 r408  
    1010        {
    1111                parent::__construct();
     12                $this->vservices->setApiUrl($this->config->item('api_url'));
     13                $this->vservices->setConnection($this->curl);
    1214        }
    1315       
     
    2628                        $sql.=" WHERE (cellphone LIKE '%".$data['keyword']."%' OR collaborator LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%') ";
    2729                }
     30                if ($data['status'] == 1){
     31                        $sql.=" WHERE expire_date > NOW()";
     32                }
     33                if ($data['status'] == 2){
     34                        $sql.=" WHERE expire_date < NOW()";
     35                }
    2836                $order = "";
    2937                if ($data['sorting_order'] != "sorting") {
    30                         $sort = "DESC";
    31                         if ($data['sorting_order'] == "sorting_asc")
    32                                 $sort = "ASC";
    33                         $order = "ORDER BY " . $data['sorting_field'] . " " . $sort;
     38                        if($data['sorting_field'] != "status"){
     39                                $sort = "DESC";
     40                                if ($data['sorting_order'] == "sorting_asc")
     41                                        $sort = "ASC";
     42                                $order = "ORDER BY " . $data['sorting_field'] . " " . $sort;
     43                        }
    3444                }
    3545                return $this->db->query($sql." ".$order." LIMIT ".$data['start'].", ".$data['perpage']." ")->result_array();
     
    3949        {
    4050                $sql="SELECT COUNT(".$this->id_name.") AS total FROM ".$this->table_name;
     51               
     52                if ($data['status'] == 1){
     53                        $sql.=" WHERE expire_date > NOW()";
     54                }
     55                if ($data['status'] == 2){
     56                        $sql.=" WHERE expire_date < NOW()";
     57                }
     58               
    4159                if (isset($data['keyword']))
    4260                {
    43                         $sql.=" WHERE (cellphone LIKE '%".$data['keyword']."%' OR collaborator LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%') ";
     61                        if (strlen($data['keyword'])>0)
     62                                $sql.=" WHERE (cellphone LIKE '%".$data['keyword']."%' OR collaborator LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%') ";
    4463                }
    4564                return $this->db->query($sql)->row_array()['total'];
    4665        }
     66       
     67        function get_user_info($src, $us_id, $token)
     68        {
     69                $data = $this->vservices->actionExecute('getinfo', array('src' => $src, 'us_id' => $us_id, 'token'=>$token), 'user');
     70                return $data;
     71        }
    4772}
Note: See TracChangeset for help on using the changeset viewer.