Changeset 1335255
- Timestamp:
- 01/25/2016 04:43:32 AM (10 years ago)
- Location:
- kandy
- Files:
-
- 12 edited
-
tags/2.3.0/admin/AgentRatesList.php (modified) (3 diffs)
-
tags/2.3.0/admin/AgentsTableList.php (modified) (3 diffs)
-
tags/2.3.0/admin/AssignmentTableList.php (modified) (3 diffs)
-
tags/2.3.0/api/kandy-api-class.php (modified) (3 diffs)
-
tags/2.4.2/admin/AgentRatesList.php (modified) (3 diffs)
-
tags/2.4.2/admin/AgentsTableList.php (modified) (3 diffs)
-
tags/2.4.2/admin/AssignmentTableList.php (modified) (3 diffs)
-
tags/2.4.2/api/kandy-api-class.php (modified) (3 diffs)
-
trunk/admin/AgentRatesList.php (modified) (3 diffs)
-
trunk/admin/AgentsTableList.php (modified) (3 diffs)
-
trunk/admin/AssignmentTableList.php (modified) (3 diffs)
-
trunk/api/kandy-api-class.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
kandy/tags/2.3.0/admin/AgentRatesList.php
r1265749 r1335255 66 66 function prepare_items() 67 67 { 68 $data = $this->get_data();69 68 $columns = $this->get_columns(); 70 69 $hidden = array(); … … 73 72 74 73 //pagination 75 $per_page = 5;74 $per_page = 10; 76 75 $current_page = $this->get_pagenum(); 77 $total_items = count($data); 76 $data = $this->get_data($per_page, ($current_page-1)*$per_page); 77 $total_items = KandyApi::totalAgentRates($_GET['id']); 78 78 79 //search80 $searchItem = array_slice(81 $data,82 (($current_page - 1) * $per_page),83 $per_page84 );85 //sorting86 usort($searchItem, array(&$this, 'usort_reorder'));87 79 $this->set_pagination_args( 88 80 array( … … 93 85 ) 94 86 ); 95 $this->items = $ searchItem;87 $this->items = $data; 96 88 } 97 89 -
kandy/tags/2.3.0/admin/AgentsTableList.php
r1265749 r1335255 65 65 function prepare_items() 66 66 { 67 $data = $this->get_data();68 67 $columns = $this->get_columns(); 69 68 $hidden = array(); … … 72 71 73 72 //pagination 74 $per_page = 5;73 $per_page = 10; 75 74 $current_page = $this->get_pagenum(); 76 $total_items = count($data); 75 $data = $this->get_data($per_page, ($current_page-1)*$per_page); 76 $total_items = KandyApi::totalListAgents(); 77 77 78 //search79 $searchItem = array_slice(80 $data,81 (($current_page - 1) * $per_page),82 $per_page83 );84 //sorting85 usort($searchItem, array(&$this, 'usort_reorder'));86 78 $this->set_pagination_args( 87 79 array( … … 92 84 ) 93 85 ); 94 $this->items = $ searchItem;86 $this->items = $data; 95 87 } 96 88 -
kandy/tags/2.3.0/admin/AssignmentTableList.php
r1265749 r1335255 64 64 function prepare_items() 65 65 { 66 $ data = $this->get_data();66 $countUsers = count_users(); 67 67 $columns = $this->get_columns(); 68 68 $hidden = array(); … … 71 71 72 72 //pagination 73 $per_page = 5;73 $per_page = 10; 74 74 $current_page = $this->get_pagenum(); 75 $total_items = count($data); 75 $data = $this->get_data($per_page, ($current_page-1)*$per_page); 76 $total_items = $countUsers['total_users']; 76 77 77 //search78 $searchItem = array_slice(79 $data,80 (($current_page - 1) * $per_page),81 $per_page82 );83 78 //sorting 84 usort($searchItem, array(&$this, 'usort_reorder'));85 79 $this->set_pagination_args( 86 80 array( … … 91 85 ) 92 86 ); 93 $this->items = $ searchItem;87 $this->items = $data; 94 88 } 95 89 -
kandy/tags/2.3.0/api/kandy-api-class.php
r1212258 r1335255 20 20 21 21 // Change the number of rows with the limit() call. 22 $result = get_users(array("number" => $limit, "offset" => $offset ));22 $result = get_users(array("number" => $limit, "offset" => $offset, 'orderby' => 'id')); 23 23 24 24 $rows = array(); … … 611 611 } 612 612 613 613 /** 614 * @return int 615 */ 616 public static function totalListAgents() { 617 global $wpdb; 618 $kandyUserTable = $wpdb->prefix . 'kandy_users'; 619 $mainUserTable = $wpdb->prefix . 'users'; 620 $agentType = KANDY_USER_TYPE_AGENT; 621 $rateTable = $wpdb->prefix . 'kandy_live_chat_rate'; 622 $sql = "SELECT count($kandyUserTable.id) 623 FROM $mainUserTable 624 INNER JOIN $kandyUserTable ON $mainUserTable.ID = $kandyUserTable.main_user_id 625 LEFT JOIN $rateTable ON $mainUserTable.id = $rateTable.main_user_id 626 WHERE $kandyUserTable.type = $agentType"; 627 ; 628 $result = $wpdb->get_var($sql); 629 return (int) $result; 630 } 631 632 /** 633 * @param $limit 634 * @param $offset 635 * 636 * @return mixed 637 */ 614 638 public static function getListAgents($limit, $offset) { 615 639 global $wpdb; … … 663 687 return $users; 664 688 689 } 690 691 /** 692 * @param $agentId 693 * 694 * @return int 695 */ 696 public static function totalAgentRates($agentId) { 697 global $wpdb; 698 $tableRate = $wpdb->prefix . 'kandy_live_chat_rate'; 699 $agentId = intval($agentId); 700 $sql = "SELECT * FROM $tableRate WHERE main_user_id = $agentId ORDER BY rated_time DESC"; 701 $result = $wpdb->get_var($sql); 702 return (int) $result; 665 703 } 666 704 -
kandy/tags/2.4.2/admin/AgentRatesList.php
r1325542 r1335255 66 66 function prepare_items() 67 67 { 68 $data = $this->get_data();69 68 $columns = $this->get_columns(); 70 69 $hidden = array(); … … 73 72 74 73 //pagination 75 $per_page = 5;74 $per_page = 10; 76 75 $current_page = $this->get_pagenum(); 77 $total_items = count($data); 76 $data = $this->get_data($per_page, ($current_page-1)*$per_page); 77 $total_items = KandyApi::totalAgentRates($_GET['id']); 78 78 79 //search80 $searchItem = array_slice(81 $data,82 (($current_page - 1) * $per_page),83 $per_page84 );85 //sorting86 usort($searchItem, array(&$this, 'usort_reorder'));87 79 $this->set_pagination_args( 88 80 array( … … 93 85 ) 94 86 ); 95 $this->items = $ searchItem;87 $this->items = $data; 96 88 } 97 89 -
kandy/tags/2.4.2/admin/AgentsTableList.php
r1325542 r1335255 65 65 function prepare_items() 66 66 { 67 $data = $this->get_data();68 67 $columns = $this->get_columns(); 69 68 $hidden = array(); … … 72 71 73 72 //pagination 74 $per_page = 5;73 $per_page = 10; 75 74 $current_page = $this->get_pagenum(); 76 $total_items = count($data); 75 $data = $this->get_data($per_page, ($current_page-1)*$per_page); 76 $total_items = KandyApi::totalListAgents(); 77 77 78 //search79 $searchItem = array_slice(80 $data,81 (($current_page - 1) * $per_page),82 $per_page83 );84 //sorting85 usort($searchItem, array(&$this, 'usort_reorder'));86 78 $this->set_pagination_args( 87 79 array( … … 92 84 ) 93 85 ); 94 $this->items = $ searchItem;86 $this->items = $data; 95 87 } 96 88 -
kandy/tags/2.4.2/admin/AssignmentTableList.php
r1325542 r1335255 64 64 function prepare_items() 65 65 { 66 $ data = $this->get_data();66 $countUsers = count_users(); 67 67 $columns = $this->get_columns(); 68 68 $hidden = array(); … … 71 71 72 72 //pagination 73 $per_page = 5;73 $per_page = 10; 74 74 $current_page = $this->get_pagenum(); 75 $total_items = count($data); 75 $data = $this->get_data($per_page, ($current_page-1)*$per_page); 76 $total_items = $countUsers['total_users']; 76 77 77 //search78 $searchItem = array_slice(79 $data,80 (($current_page - 1) * $per_page),81 $per_page82 );83 78 //sorting 84 usort($searchItem, array(&$this, 'usort_reorder'));85 79 $this->set_pagination_args( 86 80 array( … … 91 85 ) 92 86 ); 93 $this->items = $ searchItem;87 $this->items = $data; 94 88 } 95 89 -
kandy/tags/2.4.2/api/kandy-api-class.php
r1325542 r1335255 20 20 21 21 // Change the number of rows with the limit() call. 22 $result = get_users(array("number" => $limit, "offset" => $offset ));22 $result = get_users(array("number" => $limit, "offset" => $offset, 'orderby' => 'id')); 23 23 24 24 $rows = array(); … … 611 611 } 612 612 613 /** 614 * @return int 615 */ 616 public static function totalListAgents() { 617 global $wpdb; 618 $kandyUserTable = $wpdb->prefix . 'kandy_users'; 619 $mainUserTable = $wpdb->prefix . 'users'; 620 $agentType = KANDY_USER_TYPE_AGENT; 621 $rateTable = $wpdb->prefix . 'kandy_live_chat_rate'; 622 $sql = "SELECT count($kandyUserTable.id) 623 FROM $mainUserTable 624 INNER JOIN $kandyUserTable ON $mainUserTable.ID = $kandyUserTable.main_user_id 625 LEFT JOIN $rateTable ON $mainUserTable.id = $rateTable.main_user_id 626 WHERE $kandyUserTable.type = $agentType"; 627 ; 628 $result = $wpdb->get_var($sql); 629 return (int) $result; 630 } 613 631 614 632 public static function getListAgents($limit, $offset) { … … 663 681 return $users; 664 682 683 } 684 685 /** 686 * @param $agentId 687 * 688 * @return int 689 */ 690 public static function totalAgentRates($agentId) { 691 global $wpdb; 692 $tableRate = $wpdb->prefix . 'kandy_live_chat_rate'; 693 $agentId = intval($agentId); 694 $sql = "SELECT count(*) FROM $tableRate WHERE main_user_id = $agentId ORDER BY rated_time DESC"; 695 $result = $wpdb->get_var($sql); 696 return (int) $result; 665 697 } 666 698 -
kandy/trunk/admin/AgentRatesList.php
r1265746 r1335255 66 66 function prepare_items() 67 67 { 68 $data = $this->get_data();69 68 $columns = $this->get_columns(); 70 69 $hidden = array(); … … 73 72 74 73 //pagination 75 $per_page = 5;74 $per_page = 10; 76 75 $current_page = $this->get_pagenum(); 77 $total_items = count($data); 76 $data = $this->get_data($per_page, ($current_page-1)*$per_page); 77 $total_items = KandyApi::totalAgentRates($_GET['id']); 78 78 79 //search80 $searchItem = array_slice(81 $data,82 (($current_page - 1) * $per_page),83 $per_page84 );85 //sorting86 usort($searchItem, array(&$this, 'usort_reorder'));87 79 $this->set_pagination_args( 88 80 array( … … 93 85 ) 94 86 ); 95 $this->items = $ searchItem;87 $this->items = $data; 96 88 } 97 89 -
kandy/trunk/admin/AgentsTableList.php
r1265746 r1335255 65 65 function prepare_items() 66 66 { 67 $data = $this->get_data();68 67 $columns = $this->get_columns(); 69 68 $hidden = array(); … … 72 71 73 72 //pagination 74 $per_page = 5;73 $per_page = 10; 75 74 $current_page = $this->get_pagenum(); 76 $total_items = count($data); 75 $data = $this->get_data($per_page, ($current_page-1)*$per_page); 76 $total_items = KandyApi::totalListAgents(); 77 77 78 //search79 $searchItem = array_slice(80 $data,81 (($current_page - 1) * $per_page),82 $per_page83 );84 //sorting85 usort($searchItem, array(&$this, 'usort_reorder'));86 78 $this->set_pagination_args( 87 79 array( … … 92 84 ) 93 85 ); 94 $this->items = $ searchItem;86 $this->items = $data; 95 87 } 96 88 -
kandy/trunk/admin/AssignmentTableList.php
r1265746 r1335255 64 64 function prepare_items() 65 65 { 66 $ data = $this->get_data();66 $countUsers = count_users(); 67 67 $columns = $this->get_columns(); 68 68 $hidden = array(); … … 71 71 72 72 //pagination 73 $per_page = 5;73 $per_page = 10; 74 74 $current_page = $this->get_pagenum(); 75 $total_items = count($data); 75 $data = $this->get_data($per_page, ($current_page-1)*$per_page); 76 $total_items = $countUsers['total_users']; 76 77 77 //search78 $searchItem = array_slice(79 $data,80 (($current_page - 1) * $per_page),81 $per_page82 );83 78 //sorting 84 usort($searchItem, array(&$this, 'usort_reorder'));85 79 $this->set_pagination_args( 86 80 array( … … 91 85 ) 92 86 ); 93 $this->items = $ searchItem;87 $this->items = $data; 94 88 } 95 89 -
kandy/trunk/api/kandy-api-class.php
r1325532 r1335255 20 20 21 21 // Change the number of rows with the limit() call. 22 $result = get_users(array("number" => $limit, "offset" => $offset ));22 $result = get_users(array("number" => $limit, "offset" => $offset, 'orderby' => 'id')); 23 23 24 24 $rows = array(); … … 611 611 } 612 612 613 /** 614 * @return int 615 */ 616 public static function totalListAgents() { 617 global $wpdb; 618 $kandyUserTable = $wpdb->prefix . 'kandy_users'; 619 $mainUserTable = $wpdb->prefix . 'users'; 620 $agentType = KANDY_USER_TYPE_AGENT; 621 $rateTable = $wpdb->prefix . 'kandy_live_chat_rate'; 622 $sql = "SELECT count($kandyUserTable.id) 623 FROM $mainUserTable 624 INNER JOIN $kandyUserTable ON $mainUserTable.ID = $kandyUserTable.main_user_id 625 LEFT JOIN $rateTable ON $mainUserTable.id = $rateTable.main_user_id 626 WHERE $kandyUserTable.type = $agentType"; 627 ; 628 $result = $wpdb->get_var($sql); 629 return (int) $result; 630 } 613 631 614 632 public static function getListAgents($limit, $offset) { … … 663 681 return $users; 664 682 683 } 684 685 /** 686 * @param $agentId 687 * 688 * @return int 689 */ 690 public static function totalAgentRates($agentId) { 691 global $wpdb; 692 $tableRate = $wpdb->prefix . 'kandy_live_chat_rate'; 693 $agentId = intval($agentId); 694 $sql = "SELECT count(*) FROM $tableRate WHERE main_user_id = $agentId ORDER BY rated_time DESC"; 695 $result = $wpdb->get_var($sql); 696 return (int) $result; 665 697 } 666 698
Note: See TracChangeset
for help on using the changeset viewer.