本文整理汇总了PHP中CRM_Contact_BAO_Group::getGroupCount方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contact_BAO_Group::getGroupCount方法的具体用法?PHP CRM_Contact_BAO_Group::getGroupCount怎么用?PHP CRM_Contact_BAO_Group::getGroupCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Contact_BAO_Group
的用法示例。
在下文中一共展示了CRM_Contact_BAO_Group::getGroupCount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getGroupListSelector
/**
* wrapper for ajax group selector.
*
* @param array $params
* Associated array for params record id.
*
* @return array
* associated array of group list
* -rp = rowcount
* -page= offset
* @todo there seems little reason for the small number of functions that call this to pass in
* params that then need to be translated in this function since they are coding them when calling
*/
public static function getGroupListSelector(&$params)
{
// format the params
$params['offset'] = ($params['page'] - 1) * $params['rp'];
$params['rowCount'] = $params['rp'];
$params['sort'] = CRM_Utils_Array::value('sortBy', $params);
// get groups
$groups = CRM_Contact_BAO_Group::getGroupList($params);
//skip total if we are making call to show only children
if (empty($params['parent_id'])) {
// add total
$params['total'] = CRM_Contact_BAO_Group::getGroupCount($params);
// get all the groups
$allGroups = CRM_Core_PseudoConstant::allGroup();
}
// format params and add links
$groupList = array();
if (!empty($groups)) {
foreach ($groups as $id => $value) {
$groupList[$id]['group_id'] = $value['id'];
$groupList[$id]['count'] = $value['count'];
$groupList[$id]['group_name'] = $value['title'];
// append parent names if in search mode
if (empty($params['parent_id']) && !empty($value['parents'])) {
$groupIds = explode(',', $value['parents']);
$title = array();
foreach ($groupIds as $gId) {
$title[] = $allGroups[$gId];
}
$groupList[$id]['group_name'] .= '<div class="crm-row-parent-name"><em>' . ts('Child of') . '</em>: ' . implode(', ', $title) . '</div>';
$value['class'] = array_diff($value['class'], array('crm-row-parent'));
}
$value['class'][] = 'crm-entity';
$groupList[$id]['class'] = $value['id'] . ',' . implode(' ', $value['class']);
$groupList[$id]['group_description'] = CRM_Utils_Array::value('description', $value);
if (!empty($value['group_type'])) {
$groupList[$id]['group_type'] = $value['group_type'];
} else {
$groupList[$id]['group_type'] = '';
}
$groupList[$id]['visibility'] = $value['visibility'];
$groupList[$id]['links'] = $value['action'];
$groupList[$id]['org_info'] = CRM_Utils_Array::value('org_info', $value);
$groupList[$id]['created_by'] = CRM_Utils_Array::value('created_by', $value);
$groupList[$id]['is_parent'] = $value['is_parent'];
}
return $groupList;
}
}
示例2: getGroupListSelector
/**
* This function is a wrapper for ajax group selector
*
* @param array $params associated array for params record id.
*
* @return array $groupList associated array of group list
* @access public
*/
public function getGroupListSelector(&$params)
{
// format the params
$params['offset'] = ($params['page'] - 1) * $params['rp'];
$params['rowCount'] = $params['rp'];
$params['sort'] = CRM_Utils_Array::value('sortBy', $params);
// get groups
$groups = CRM_Contact_BAO_Group::getGroupList($params);
// add total
$params['total'] = CRM_Contact_BAO_Group::getGroupCount($params);
// format params and add links
$groupList = array();
if (!empty($groups)) {
foreach ($groups as $id => $value) {
$groupList[$id]['group_id'] = $value['id'];
$groupList[$id]['group_name'] = $value['title'];
$groupList[$id]['group_description'] = CRM_Utils_Array::value('description', $value);
$groupList[$id]['group_type'] = CRM_Utils_Array::value('group_type', $value);
$groupList[$id]['visibility'] = $value['visibility'];
$groupList[$id]['links'] = $value['action'];
$groupList[$id]['org_info'] = $value['org_info'];
$groupList[$id]['class'] = $value['class'];
}
return $groupList;
}
}