Merge remote-tracking branch 'upstream/4.6' into 4.6-master-2015-08-12-15-44-44
[civicrm-core.git] / CRM / Custom / Page / AJAX.php
index 1571dce983dd0955a336308b6b1563565e687b79..eabe16f097f1ec00e46ef4abb7fe1307949e2257 100644 (file)
@@ -43,23 +43,9 @@ class CRM_Custom_Page_AJAX {
   public static function getOptionList() {
     $params = $_REQUEST;
 
-    $sortMapper = array(
-      0 => 'options.label',
-      1 => 'options.value',
-      2 => '',
-      3 => '',
-      4 => '',
-    );
-
     $sEcho = CRM_Utils_Type::escape($_REQUEST['sEcho'], 'Integer');
     $offset = isset($_REQUEST['iDisplayStart']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayStart'], 'Integer') : 0;
     $rowCount = isset($_REQUEST['iDisplayLength']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayLength'], 'Integer') : 25;
-    $sort = isset($_REQUEST['iSortCol_0']) ? CRM_Utils_Array::value(CRM_Utils_Type::escape($_REQUEST['iSortCol_0'], 'Integer'), $sortMapper) : NULL;
-    $sortOrder = isset($_REQUEST['sSortDir_0']) ? CRM_Utils_Type::escape($_REQUEST['sSortDir_0'], 'String') : 'asc';
-
-    if ($sort && $sortOrder) {
-      $params['sortBy'] = $sort . ' ' . $sortOrder;
-    }
 
     $params['page'] = ($offset / $rowCount) + 1;
     $params['rp'] = $rowCount;
@@ -76,7 +62,7 @@ class CRM_Custom_Page_AJAX {
       'class',
     );
 
-    header('Content-Type: application/json');
+    CRM_Utils_System::setHttpHeader('Content-Type', 'application/json');
     echo CRM_Utils_JSON::encodeDataTableSelector($options, $sEcho, $iTotal, $iFilteredTotal, $selectorElements);
     CRM_Utils_System::civiExit();
   }
@@ -85,7 +71,6 @@ class CRM_Custom_Page_AJAX {
    * Fix Ordering of options
    *
    */
-
   public static function fixOrdering() {
     $params = $_REQUEST;
 
@@ -117,6 +102,7 @@ class CRM_Custom_Page_AJAX {
                   OR id = $endid";
     }
     CRM_Core_DAO::executeQuery($updateRows, $queryParams);
+    CRM_Utils_JSON::output(TRUE);
   }
 
 }