当前位置: 首页>>代码示例>>PHP>>正文


PHP CRM_Contact_BAO_Group::getGroupList方法代码示例

本文整理汇总了PHP中CRM_Contact_BAO_Group::getGroupList方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contact_BAO_Group::getGroupList方法的具体用法?PHP CRM_Contact_BAO_Group::getGroupList怎么用?PHP CRM_Contact_BAO_Group::getGroupList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CRM_Contact_BAO_Group的用法示例。


在下文中一共展示了CRM_Contact_BAO_Group::getGroupList方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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;
     }
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:34,代码来源:Group.php

示例2: 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;
     }
 }
开发者ID:rameshrr99,项目名称:civicrm-core,代码行数:62,代码来源:Group.php

示例3: metrics_civicrm_preProcess

/**
 * Functions below this ship commented out. Uncomment as required.
 *
/**
 * Implements hook_civicrm_preProcess().
 *
 * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_preProcess
 *
function metrics_civicrm_preProcess($formName, &$form) {
}
*/
function metrics_metrics_collate(&$data)
{
    /********[ Relationships ] ********/
    $sql = "SELECT COUNT(*) FROM civicrm_relationship";
    $total =& CRM_Core_DAO::singleValueQuery($sql);
    $data[] = array("type" => "relationships", "data" => $total);
    /********[ Activities ] ********/
    $sql = "SELECT COUNT(*) FROM civicrm_activity";
    $total =& CRM_Core_DAO::singleValueQuery($sql);
    $data[] = array("type" => "activities", "data" => $total);
    /********[ Tags ] ********/
    $sql = "SELECT name,COUNT(*) as total FROM civicrm_entity_tag LEFT JOIN civicrm_tag on (civicrm_entity_tag.tag_id = civicrm_tag.id) WHERE civicrm_entity_tag.entity_table = 'civicrm_contact' GROUP BY tag_id";
    $dao =& CRM_Core_DAO::executeQuery($sql);
    $totals = array();
    while ($dao->fetch()) {
        $totals[$dao->name] = $dao->total;
    }
    $data[] = array("type" => "tags", "data" => $totals);
    /********[ Groups ] ********/
    $params = array();
    $groups = CRM_Contact_BAO_Group::getGroupList($params);
    $totals = array();
    foreach ($groups as $group) {
        $totals[$group['title']] = $group['count'];
    }
    $data[] = array("type" => "groups", "data" => $totals);
    /********[ Mail ] ********/
    $mail = array();
    $sql = "SELECT COUNT(*) FROM civicrm_mailing_recipients";
    $mail['total_messages'] =& CRM_Core_DAO::singleValueQuery($sql);
    $sql = "SELECT COUNT(*) FROM (SELECT contact_id FROM civicrm_mailing_recipients GROUP BY contact_id)a";
    $mail['unique_recipients'] =& CRM_Core_DAO::singleValueQuery($sql);
    $sql = "SELECT COUNT(*) FROM civicrm_mailing_event_trackable_url_open";
    $mail['click_throughs'] =& CRM_Core_DAO::singleValueQuery($sql);
    $sql = "SELECT COUNT(*) FROM civicrm_mailing_event_opened";
    $mail['opens'] =& CRM_Core_DAO::singleValueQuery($sql);
    $sql = "SELECT COUNT(*) FROM civicrm_mailing_event_bounce";
    $mail['bounces'] =& CRM_Core_DAO::singleValueQuery($sql);
    $data[] = array("type" => "mailings", "data" => $mail);
    /********[ Registered Visits ] ********/
    /********[ Events ] ********/
    $totals = array();
    $sql = "SELECT COUNT(*) FROM civicrm_participant";
    $totals["total_participants"] =& CRM_Core_DAO::singleValueQuery($sql);
    $sql = "SELECT COUNT(*) FROM (SELECT contact_id FROM civicrm_participant GROUP BY contact_id)a";
    $totals["unique_participants"] =& CRM_Core_DAO::singleValueQuery($sql);
    $sql = "SELECT COUNT(*) FROM civicrm_event WHERE is_template = 0";
    $totals["total"] =& CRM_Core_DAO::singleValueQuery($sql);
    $data[] = array("type" => "events", "data" => $totals);
    /********[ Cases ] ********/
    $sql = "SELECT civicrm_option_value.name,civicrm_option_value.value\nFROM civicrm_option_value LEFT JOIN civicrm_option_group ON (option_group_id = civicrm_option_group.id)\nWHERE civicrm_option_group.name = 'case_status'";
    $dao =& CRM_Core_DAO::executeQuery($sql);
    $status = array();
    while ($dao->fetch()) {
        $status[$dao->value] = $dao->name;
    }
    $sql = "SELECT status_id,COUNT(*) as total FROM civicrm_case WHERE is_deleted <> 1 GROUP BY status_id";
    $dao =& CRM_Core_DAO::executeQuery($sql);
    $totals = array();
    while ($dao->fetch()) {
        $totals[$status[$dao->status_id]] = $dao->total;
    }
    $data[] = array("type" => "cases", "data" => $totals);
    /********[ Languages ] ********/
    $total = 1;
    $domain = new CRM_Core_DAO_Domain();
    $domain->find(TRUE);
    if ($domain->locales) {
        $total = substr_count($domain->locales, "_");
    }
    $data[] = array("type" => "languages", "data" => $total);
}
开发者ID:TobiasLounsbury,项目名称:org.ndi.metrics,代码行数:83,代码来源:metrics.php


注:本文中的CRM_Contact_BAO_Group::getGroupList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。