本文整理汇总了PHP中CRM_Core_Page_AJAX::validateParams方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_Page_AJAX::validateParams方法的具体用法?PHP CRM_Core_Page_AJAX::validateParams怎么用?PHP CRM_Core_Page_AJAX::validateParams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_Page_AJAX
的用法示例。
在下文中一共展示了CRM_Core_Page_AJAX::validateParams方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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);
}