Ignore:
Timestamp:
Nov 6, 2014 5:31:13 PM (11 years ago)
Author:
namnd
Message:
 
File:
1 edited

Legend:

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

    r328 r426  
    1 <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
     1<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
    22
    33class Smslog_model extends MY_Model
     
    1212        }
    1313       
     14        function get_smslogs($data)
     15        {
     16                $sql = "SELECT * FROM " . $this->table_name;
     17                if ($data['keyword'])
     18                {
     19                        $sql.=" WHERE (sender LIKE '%".$data['keyword']."%' OR mobody LIKE '%".$data['keyword']."%' OR mtbody LIKE '%".$data['keyword']."%') ";
     20                }
     21                $order = "";
     22                if ($data['sorting_order'] != "sorting") {
     23                        $sort = "DESC";
     24                        if ($data['sorting_order'] == "sorting_asc")
     25                                $sort = "ASC";
     26                        $order = "ORDER BY " . $data['sorting_field'] . " " . $sort;
     27                }
     28                return $this->db->query($sql." ".$order." LIMIT ".$data['start'].", ".$data['perpage']." ")->result_array();
     29        }
     30       
     31        function get_total_smslogs($data)
     32        {
     33                $sql="SELECT COUNT(".$this->id_name.") AS total FROM ".$this->table_name;
     34                if (isset($data['keyword']))
     35                {
     36                        if (strlen($data['keyword'])>0)
     37                                $sql.=" WHERE (sender LIKE '%".$data['keyword']."%' OR mobody LIKE '%".$data['keyword']."%' OR mtbody LIKE '%".$data['keyword']."%') ";
     38                }
     39                return $this->db->query($sql)->row_array()['total'];
     40        }
    1441}
Note: See TracChangeset for help on using the changeset viewer.