/** * This function is a wrapper for ajax batch selector * * @param array $params associated array for params record id. * * @return array $batchList associated array of batch list * @access public */ public function getBatchListSelector(&$params) { // format the params $params['offset'] = ($params['page'] - 1) * $params['rp']; $params['rowCount'] = $params['rp']; $params['sort'] = CRM_Utils_Array::value('sortBy', $params); // get batches $batches = CRM_Core_BAO_Batch::getBatchList($params); // add total $params['total'] = CRM_Core_BAO_Batch::getBatchCount($params); // format params and add links $batchList = array(); if (!empty($batches)) { foreach ($batches as $id => $value) { $batchList[$id]['batch_name'] = $value['title']; $batchList[$id]['batch_type'] = $value['batch_type']; $batchList[$id]['item_count'] = $value['item_count']; $batchList[$id]['total_amount'] = CRM_Utils_Money::format($value['total']); $batchList[$id]['status'] = $value['batch_status']; $batchList[$id]['created_by'] = $value['created_by']; $batchList[$id]['links'] = $value['action']; } return $batchList; } }