本文整理汇总了PHP中CRM_Contact_BAO_Group::getGroups方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contact_BAO_Group::getGroups方法的具体用法?PHP CRM_Contact_BAO_Group::getGroups怎么用?PHP CRM_Contact_BAO_Group::getGroups使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Contact_BAO_Group
的用法示例。
在下文中一共展示了CRM_Contact_BAO_Group::getGroups方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: crm_get_groups
/**
* Returns array of group object(s) matching a set of one or Group properties.
*
*
* @param array $param Array of one or more valid property_name=>value pairs. Limits the set of groups returned.
* @param array $returnProperties Which properties should be included in the returned group objects. (member_count should be last element.)
*
* @return An array of group objects.
*
* @access public
*/
function crm_get_groups($params = null, $returnProperties = null)
{
_crm_initialize();
if ($returnProperties != null && !is_array($returnProperties)) {
return _crm_error('$returnProperties is not an array');
}
if ($params != null && !is_array($params)) {
return _crm_error('$params is not an array');
}
$groups = array();
$groups = CRM_Contact_BAO_Group::getGroups($params, $returnProperties);
return $groups;
}
示例2: civicrm_group_get
/**
* Returns array of groups matching a set of one or more group properties
*
* @param array $params (referance) Array of one or more valid
* property_name=>value pairs. If $params is set
* as null, all groups will be returned
*
* @return array (referance) Array of matching groups
* @access public
*/
function civicrm_group_get(&$params)
{
_civicrm_initialize();
if (!is_null($params) && !is_array($params)) {
return civicrm_create_error('Params should be array');
}
$returnProperties = array();
foreach ($params as $n => $v) {
if (substr($n, 0, 7) == 'return.') {
$returnProperties[] = substr($n, 7);
}
}
if (!empty($returnProperties)) {
$returnProperties[] = 'id';
}
$groupObjects = CRM_Contact_BAO_Group::getGroups($params, $returnProperties);
if (count($groupObjects) == 0) {
return civicrm_create_error('No such group exists');
}
$groups = array();
foreach ($groupObjects as $group) {
_civicrm_object_to_array($group, $groups[$group->id]);
}
return $groups;
}
示例3: getContainingGroups
/**
* @param int $contactId
* @param int $parentGroupId
*
* @return array
*/
public static function getContainingGroups($contactId, $parentGroupId)
{
$groups = CRM_Contact_BAO_Group::getGroups();
$containingGroups = array();
foreach ($groups as $group) {
if (self::isDescendentGroup($parentGroupId, $group->id)) {
$members = CRM_Contact_BAO_Group::getMember($group->id);
if ($members[$contactId]) {
$containingGroups[] = $group->title;
}
}
}
return $containingGroups;
}
示例4: civimailchimp_civicrm_post_Contact_delete
/**
* Implements hook_civicrm_post for Individual and Organization delete.
*/
function civimailchimp_civicrm_post_Contact_delete($contact_id, &$contact)
{
$params = array("contact_id" => $contact_id);
$contact_groups = CRM_Contact_BAO_Group::getGroups($params);
foreach ($contact_groups as $group) {
civimailchimp_civicrm_contact_removed_from_group($group, $contact);
}
}
示例5: civicrm_api3_group_get
/**
* Returns array of groups matching a set of one or more group properties
*
* @param array $params (referance) Array of one or more valid
* property_name=>value pairs. If $params is set
* as null, all groups will be returned
*
* @return array Array of matching groups
* @example GroupGet.php
* {@getfields group_get}
* @access public
*/
function civicrm_api3_group_get($params)
{
$options = _civicrm_api3_get_options_from_params($params, TRUE, 'group', 'get');
$sort = CRM_Utils_Array::value('sort', $options, NULL);
$offset = CRM_Utils_Array::value('offset', $options);
$rowCount = CRM_Utils_Array::value('limit', $options);
$returnProperties = CRM_Utils_Array::value('return', $options, NULL);
$inputParams = CRM_Utils_Array::value('input_params', $options, array());
if (is_array($returnProperties) && !empty($returnProperties)) {
// group function takes $returnProperties in non standard format & doesn't add id
unset($returnProperties['group_id']);
$returnProperties['id'] = 1;
$returnProperties = array_keys($returnProperties);
}
if (!empty($inputParams['group_id'])) {
$inputParams['id'] = $inputParams['group_id'];
}
$groupObjects = CRM_Contact_BAO_Group::getGroups($inputParams, $returnProperties, $sort, $offset, $rowCount);
if (empty($groupObjects)) {
return civicrm_api3_create_success(FALSE);
}
$groups = array();
foreach ($groupObjects as $group) {
_civicrm_api3_object_to_array($group, $groups[$group->id]);
_civicrm_api3_custom_data_get($groups[$group->id], 'Group', $group->id);
}
return civicrm_api3_create_success($groups, $params, 'group', 'create');
}
示例6: civicrm_api3_group_get
/**
* Returns array of groups matching a set of one or more group properties
*
* @param array $params (referance) Array of one or more valid
* property_name=>value pairs. If $params is set
* as null, all groups will be returned
*
* @return array Array of matching groups
* @example GroupGet.php
* {@getfields group_get}
* @access public
*/
function civicrm_api3_group_get($params)
{
$returnProperties = array();
foreach ($params as $n => $v) {
if (substr($n, 0, 7) == 'return.') {
$returnProperties[] = substr($n, 7);
}
}
if (!empty($returnProperties)) {
$returnProperties[] = 'id';
}
$groupObjects = CRM_Contact_BAO_Group::getGroups($params, $returnProperties);
if (empty($groupObjects)) {
return civicrm_api3_create_success(FALSE);
}
$groups = array();
foreach ($groupObjects as $group) {
_civicrm_api3_object_to_array($group, $groups[$group->id]);
_civicrm_api3_custom_data_get($groups[$group->id], 'Group', $group->id);
}
return civicrm_api3_create_success($groups, $params, 'group', 'create');
}