Ignore:
Timestamp:
Nov 3, 2014 10:17:45 AM (11 years ago)
Author:
quyenla
Message:

collaborator order sourcecode

Location:
pro-violet-viettel/sourcecode/application/modules/admin
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • pro-violet-viettel/sourcecode/application/modules/admin/controllers/collaborator.php

    r371 r373  
    4343        }
    4444        if ($this->input->post('keyword')) {
     45            $data['search_field']="";
    4546            $data['keyword'] = $this->input->post('keyword');
     47            $data['search_field']="cellphone";
     48           
     49            if (preg_match("/[0-9]/", $data['keyword']))
     50            {
     51               $data['search_field']="cellphone";
     52            }
     53           
    4654        }
    4755       
  • pro-violet-viettel/sourcecode/application/modules/admin/models/collabolator_model.php

    r371 r373  
    1 <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
     1<?php
     2if (!defined('BASEPATH'))
     3    exit('No direct script access allowed');
    24
    3 class Collabolator_model extends MY_Model
    4 {
    5        
    6         protected $table_name = 'tblcollaborator';
    7         protected $id_name = 'id';
     5class Collabolator_model extends MY_Model {
    86
    9         function __construct()
    10         {
    11                 parent::__construct();
    12         }
    13         function getCollaborator($data)
    14         {
    15             $sql="SELECT * FROM ".$this->table_name;
    16             $data['keyword']='';
     7    protected $table_name = 'tblcollaborator';
     8    protected $id_name = 'id';
    179
    18             if ($data['keyword'])
    19             {
    20             $sql.=" WHERE (full_name LIKE '%".$data['keyword']."%' OR login_name LIKE '%".$data['keyword']."%') ";
     10    function __construct() {
     11        parent::__construct();
     12    }
     13
     14    function getCollaborator($data) {
     15        $sql = "SELECT * FROM " . $this->table_name;
     16        if ($data['keyword']) {
     17            if ($data['search_field'] == "cellphone") {
     18                $sql.=" WHERE (cellphone LIKE '%" . $data['keyword'] . "%')";
     19            } else {
     20                $sql.=" WHERE (full_name LIKE '%" . $data['keyword'] . "%' OR login_name LIKE '%" . $data['keyword'] . "%') ";
    2121            }
    22             $order="";
    23             if ($data['sorting_order'] != "sorting")
    24             {
    25                 if ($data['sorting_field'] != "money")
    26                 {
    27                 $sort="DESC";
    28                 if ($data['sorting_order']=="sorting_asc") $sort = "ASC";
    29                 $order="ORDER BY ".$data['sorting_field']." ".$sort;
    30                 }
     22        }
     23
     24        $order = "";
     25        if ($data['sorting_order'] != "sorting") {
     26            if ($data['sorting_field'] != "money") {
     27                $sort = "DESC";
     28                if ($data['sorting_order'] == "sorting_asc")
     29                    $sort = "ASC";
     30                $order = "ORDER BY " . $data['sorting_field'] . " " . $sort;
    3131            }
    32            
    33             return $this->db->query($sql." ".$order." LIMIT ".$data['start'].", ".$data['perpage']." ")->result_array();
     32        }
     33       
     34        return $this->db->query($sql . " " . $order . " LIMIT " . $data['start'] . ", " . $data['perpage'] . " ")->result_array();
     35    }
    3436
     37    function isExist($data) {
     38        $sql = "SELECT COUNT(id) as total FROM " . $this->table_name . " WHERE " . $data['field'] . " = '" . $data['value'] . "' LIMIT 1";
     39        if ($this->db->query($sql)->row_array()['total'] == 1) {
     40            return true;
     41        } else {
     42            return false;
    3543        }
    36         function isExist($data)
    37         {
    38             $sql="SELECT COUNT(id) as total FROM ".$this->table_name." WHERE ".$data['field']." = '".$data['value']."' LIMIT 1";
    39             if ($this->db->query($sql)->row_array()['total']==1)
    40             {
    41                 return true;
    42             }
    43             else
    44             {
    45                 return false;
    46             }
    47            
     44    }
     45
     46    function countCollaborator($data) {
     47        $sql = "SELECT COUNT(id) as total FROM " . $this->table_name;
     48        if (isset($data['keyword'])) {
     49            $sql.=" WHERE (full_name LIKE '%" . $data['keyword'] . "%' OR login_name LIKE '%" . $data['keyword'] . "%') ";
    4850        }
    49         function countCollaborator($data)
    50         {
    51             $sql="SELECT COUNT(id) as total FROM ".$this->table_name;
    52             if (isset($data['keyword']))
    53             {
    54             $sql.=" WHERE (full_name LIKE '%".$data['keyword']."%' OR login_name LIKE '%".$data['keyword']."%') ";
    55             }
    5651
    57             return $this->db->query($sql)->row_array()['total'];
    58            
    59         }
     52        return $this->db->query($sql)->row_array()['total'];
     53    }
     54
    6055}
  • pro-violet-viettel/sourcecode/application/modules/admin/views/collaborator/listview.php

    r372 r373  
    5151            <div class="table-responsive">
    5252                <div role="grid" class="dataTables_wrapper" id="sample-table-2_wrapper">
    53                     <form onsubmit="return false;" id="collaborator" >
     53                    <form autocomplete="off" onsubmit="return false;" id="collaborator" >
    5454                        <div class="row">
    5555                            <div class="col-sm-6">
Note: See TracChangeset for help on using the changeset viewer.