本文整理汇总了PHP中CRM_Batch_BAO_Batch::getBatchListSelector方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Batch_BAO_Batch::getBatchListSelector方法的具体用法?PHP CRM_Batch_BAO_Batch::getBatchListSelector怎么用?PHP CRM_Batch_BAO_Batch::getBatchListSelector使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Batch_BAO_Batch
的用法示例。
在下文中一共展示了CRM_Batch_BAO_Batch::getBatchListSelector方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getBatchList
/**
* Retrieve records.
*/
public static function getBatchList()
{
$sortMapper = array(0 => 'batch.title', 1 => 'batch.type_id', 2 => '', 3 => 'batch.total', 4 => 'batch.status_id', 5 => '');
$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';
$context = isset($_REQUEST['context']) ? CRM_Utils_Type::escape($_REQUEST['context'], 'String') : NULL;
$params = $_REQUEST;
if ($sort && $sortOrder) {
$params['sortBy'] = $sort . ' ' . $sortOrder;
}
$params['page'] = $offset / $rowCount + 1;
$params['rp'] = $rowCount;
if ($context != 'financialBatch') {
// data entry status batches
$params['status_id'] = CRM_Core_OptionGroup::getValue('batch_status', 'Data Entry', 'name');
}
$params['context'] = $context;
// get batch list
$batches = CRM_Batch_BAO_Batch::getBatchListSelector($params);
$iFilteredTotal = $iTotal = $params['total'];
if ($context == 'financialBatch') {
$selectorElements = array('check', 'batch_name', 'payment_instrument', 'item_count', 'total', 'status', 'created_by', 'links');
} else {
$selectorElements = array('batch_name', 'type', 'item_count', 'total', 'status', 'created_by', 'links');
}
CRM_Utils_System::setHttpHeader('Content-Type', 'application/json');
echo CRM_Utils_JSON::encodeDataTableSelector($batches, $sEcho, $iTotal, $iFilteredTotal, $selectorElements);
CRM_Utils_System::civiExit();
}