Changeset 373 for pro-violet-viettel/sourcecode/application/modules/admin
- Timestamp:
- Nov 3, 2014 10:17:45 AM (11 years ago)
- 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 43 43 } 44 44 if ($this->input->post('keyword')) { 45 $data['search_field']=""; 45 46 $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 46 54 } 47 55 -
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 2 if (!defined('BASEPATH')) 3 exit('No direct script access allowed'); 2 4 3 class Collabolator_model extends MY_Model 4 { 5 6 protected $table_name = 'tblcollaborator'; 7 protected $id_name = 'id'; 5 class Collabolator_model extends MY_Model { 8 6 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'; 17 9 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'] . "%') "; 21 21 } 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; 31 31 } 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 } 34 36 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; 35 43 } 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'] . "%') "; 48 50 } 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 }56 51 57 58 59 } 52 return $this->db->query($sql)->row_array()['total']; 53 } 54 60 55 } -
pro-violet-viettel/sourcecode/application/modules/admin/views/collaborator/listview.php
r372 r373 51 51 <div class="table-responsive"> 52 52 <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" > 54 54 <div class="row"> 55 55 <div class="col-sm-6">
Note: See TracChangeset
for help on using the changeset viewer.