本文整理汇总了PHP中CRM_Core_Page_AJAX::defaultSortAndPagerParams方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_Page_AJAX::defaultSortAndPagerParams方法的具体用法?PHP CRM_Core_Page_AJAX::defaultSortAndPagerParams怎么用?PHP CRM_Core_Page_AJAX::defaultSortAndPagerParams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_Page_AJAX
的用法示例。
在下文中一共展示了CRM_Core_Page_AJAX::defaultSortAndPagerParams方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getGroupList
/**
* Get list of groups.
*/
public static function getGroupList()
{
$params = $_GET;
if (isset($params['parent_id'])) {
// requesting child groups for a given parent
$params['page'] = 1;
$params['rp'] = 0;
$groups = CRM_Contact_BAO_Group::getGroupListSelector($params);
CRM_Utils_JSON::output($groups);
} else {
$params = CRM_Core_Page_AJAX::defaultSortAndPagerParams();
$optionalParameters = array('parentsOnly' => 'Integer', 'showOrgInfo' => 'Boolean');
$params += CRM_Core_Page_AJAX::validateParams(array(), $optionalParameters);
// get group list
$groups = CRM_Contact_BAO_Group::getGroupListSelector($params);
// if no groups found with parent-child hierarchy and logged in user say can view child groups only (an ACL case),
// go ahead with flat hierarchy, CRM-12225
if (empty($groups)) {
$groupsAccessible = CRM_Core_PseudoConstant::group();
$parentsOnly = CRM_Utils_Array::value('parentsOnly', $params);
if (!empty($groupsAccessible) && $parentsOnly) {
// recompute group list with flat hierarchy
$params['parentsOnly'] = 0;
$groups = CRM_Contact_BAO_Group::getGroupListSelector($params);
}
}
CRM_Utils_JSON::output($groups);
}
}
示例2: getContactMailings
/**
* Retrieve contact mailings.
*/
public static function getContactMailings()
{
$params = CRM_Core_Page_AJAX::defaultSortAndPagerParams();
$params += CRM_Core_Page_AJAX::validateParams(array('contact_id' => 'Integer'));
// get the contact mailings
$mailings = CRM_Mailing_BAO_Mailing::getContactMailingSelector($params);
CRM_Utils_JSON::output($mailings);
}
示例3: getSoftContributionRows
/**
* Get Soft credit to list in DT
*/
public static function getSoftContributionRows()
{
$requiredParameters = array('cid' => 'Integer', 'context' => 'String');
$optionalParameters = array('entityID' => 'Integer', 'isTest' => 'Integer');
$params = CRM_Core_Page_AJAX::defaultSortAndPagerParams();
$params += CRM_Core_Page_AJAX::validateParams($requiredParameters, $optionalParameters);
$softCreditList = CRM_Contribute_BAO_ContributionSoft::getSoftContributionSelector($params);
if (!empty($_GET['is_unit_test'])) {
return $softCreditList;
}
CRM_Utils_JSON::output($softCreditList);
}
示例4: getContactRelationships
/**
* Retrieve contact relationships.
*/
public static function getContactRelationships()
{
$contactID = CRM_Utils_Type::escape($_GET['cid'], 'Integer');
$context = CRM_Utils_Type::escape($_GET['context'], 'String');
$relationship_type_id = CRM_Utils_Type::escape(CRM_Utils_Array::value('relationship_type_id', $_GET), 'Integer', FALSE);
if (!CRM_Contact_BAO_Contact_Permission::allow($contactID)) {
return CRM_Utils_System::permissionDenied();
}
$params = CRM_Core_Page_AJAX::defaultSortAndPagerParams();
$params['contact_id'] = $contactID;
$params['context'] = $context;
if ($relationship_type_id) {
$params['relationship_type_id'] = $relationship_type_id;
}
// get the contact relationships
$relationships = CRM_Contact_BAO_Relationship::getContactRelationshipSelector($params);
CRM_Utils_JSON::output($relationships);
}
示例5: getMultiRecordFieldList
/**
* Get list of Multi Record Fields.
*
*/
public static function getMultiRecordFieldList()
{
$params = CRM_Core_Page_AJAX::defaultSortAndPagerParams(0, 10);
$params['cid'] = CRM_Utils_Type::escape($_GET['cid'], 'Integer');
$params['cgid'] = CRM_Utils_Type::escape($_GET['cgid'], 'Integer');
$contactType = CRM_Contact_BAO_Contact::getContactType($params['cid']);
$obj = new CRM_Profile_Page_MultipleRecordFieldsListing();
$obj->_pageViewType = 'customDataView';
$obj->_contactId = $params['cid'];
$obj->_customGroupId = $params['cgid'];
$obj->_contactType = $contactType;
$obj->_DTparams['offset'] = ($params['page'] - 1) * $params['rp'];
$obj->_DTparams['rowCount'] = $params['rp'];
if (!empty($params['sortBy'])) {
$obj->_DTparams['sort'] = $params['sortBy'];
}
list($fields, $attributes) = $obj->browse();
// format params and add class attributes
$fieldList = array();
foreach ($fields as $id => $value) {
$field = array();
foreach ($value as $fieldId => &$fieldName) {
if (!empty($attributes[$fieldId][$id]['class'])) {
$fieldName = array('data' => $fieldName, 'cellClass' => $attributes[$fieldId][$id]['class']);
}
if (is_numeric($fieldId)) {
$fName = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField', $fieldId, 'column_name');
CRM_Utils_Array::crmReplaceKey($value, $fieldId, $fName);
}
}
$field = $value;
array_push($fieldList, $field);
}
$totalRecords = !empty($obj->_total) ? $obj->_total : 0;
$multiRecordFields = array();
$multiRecordFields['data'] = $fieldList;
$multiRecordFields['recordsTotal'] = $totalRecords;
$multiRecordFields['recordsFiltered'] = $totalRecords;
if (!empty($_GET['is_unit_test'])) {
return $multiRecordFields;
}
CRM_Utils_JSON::output($multiRecordFields);
}
示例6: getContactActivity
public static function getContactActivity()
{
$requiredParameters = array('cid' => 'Integer');
$optionalParameters = array('context' => 'String', 'activity_type_id' => 'Integer', 'activity_type_exclude_id' => 'Integer');
$params = CRM_Core_Page_AJAX::defaultSortAndPagerParams();
$params += CRM_Core_Page_AJAX::validateParams($requiredParameters, $optionalParameters);
// To be consistent, the cid parameter should be renamed to contact_id in
// the template file, see templates/CRM/Activity/Selector/Selector.tpl
$params['contact_id'] = $params['cid'];
unset($params['cid']);
// get the contact activities
$activities = CRM_Activity_BAO_Activity::getContactActivitySelector($params);
if (!empty($_GET['is_unit_test'])) {
return $activities;
}
foreach ($activities['data'] as $key => $value) {
// Check if recurring activity.
if (!empty($value['is_recurring_activity'])) {
$repeat = $value['is_recurring_activity'];
$activities['data'][$key]['activity_type'] .= '<br/><span class="bold">' . ts('Repeating (%1 of %2)', array(1 => $repeat[0], 2 => $repeat[1])) . '</span>';
}
}
// store the activity filter preference CRM-11761
$session = CRM_Core_Session::singleton();
$userID = $session->get('userID');
if ($userID) {
$activityFilter = array('activity_type_filter_id' => empty($params['activity_type_id']) ? '' : CRM_Utils_Type::escape($params['activity_type_id'], 'Integer'), 'activity_type_exclude_filter_id' => empty($params['activity_type_exclude_id']) ? '' : CRM_Utils_Type::escape($params['activity_type_exclude_id'], 'Integer'));
/**
* @var \Civi\Core\SettingsBag $cSettings
*/
$cSettings = Civi::service('settings_manager')->getBagByContact(CRM_Core_Config::domainID(), $userID);
$cSettings->set('activity_tab_filter', $activityFilter);
}
CRM_Utils_JSON::output($activities);
}