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


PHP CRM_Contact_BAO_Group::memberCount方法代码示例

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


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

示例1: civicrm_api3_group_get

/**
 * Returns array of groups matching a set of one or more Group properties.
 *
 * @param array $params
 *   Array of properties. If empty, all records will be returned.
 *
 * @return array
 *   Array of matching groups
 */
function civicrm_api3_group_get($params)
{
    $options = _civicrm_api3_get_options_from_params($params, TRUE, 'Group', 'get');
    if (empty($options['return']) || !in_array('member_count', $options['return'])) {
        return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, TRUE, 'Group');
    }
    $groups = _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, FALSE, 'Group');
    foreach ($groups as $id => $group) {
        $groups[$id]['member_count'] = CRM_Contact_BAO_Group::memberCount($id);
    }
    return civicrm_api3_create_success($groups, $params, 'Group', 'get');
}
开发者ID:rajeshrhino,项目名称:civicrm-core,代码行数:21,代码来源:Group.php

示例2: preProcess

 /**
  * Set up variables to build the form.
  *
  * @return void
  * @acess protected
  */
 public function preProcess()
 {
     // TODO: quit if user can't access any registration groups (remove from nav menu?)
     // CRM_Core_Error::statusBounce(ts("You do not have sufficient permission to change settings for this reserved group."));
     $this->_id = $this->get('id');
     if ($this->_id) {
         $breadCrumb = array(array('title' => ts('Manage Teams'), 'url' => CRM_Utils_System::url('civicrm/tournament/team', 'reset=1')));
         CRM_Utils_System::appendBreadCrumb($breadCrumb);
         $this->_groupValues = array();
         $params = array('id' => $this->_id);
         $this->_group = CRM_Contact_BAO_Group::retrieve($params, $this->_groupValues);
         $this->_title = $this->_groupValues['title'];
     }
     $this->assign('action', $this->_action);
     $this->assign('showBlockJS', TRUE);
     if ($this->_action == CRM_Core_Action::DELETE) {
         if (isset($this->_id)) {
             $this->assign('title', $this->_title);
             $this->assign('count', CRM_Contact_BAO_Group::memberCount($this->_id));
             CRM_Utils_System::setTitle(ts('Confirm Group Delete'));
         }
         if ($this->_groupValues['is_reserved'] == 1 && !CRM_Core_Permission::check('administer reserved groups')) {
             CRM_Core_Error::statusBounce(ts("You do not have sufficient permission to delete this reserved group."));
         }
     } else {
         if ($this->_groupValues['is_reserved'] == 1 && !CRM_Core_Permission::check('administer reserved groups')) {
             CRM_Core_Error::statusBounce(ts("You do not have sufficient permission to change settings for this reserved group."));
         }
         if (isset($this->_id)) {
             $groupValues = array('id' => $this->_id, 'title' => $this->_title, 'saved_search_id' => isset($this->_groupValues['saved_search_id']) ? $this->_groupValues['saved_search_id'] : '');
             if (isset($this->_groupValues['saved_search_id'])) {
                 $groupValues['mapping_id'] = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_SavedSearch', $this->_groupValues['saved_search_id'], 'mapping_id');
                 $groupValues['search_custom_id'] = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_SavedSearch', $this->_groupValues['saved_search_id'], 'search_custom_id');
             }
             if (!empty($this->_groupValues['created_id'])) {
                 $groupValues['created_by'] = CRM_Core_DAO::getFieldValue("CRM_Contact_DAO_Contact", $this->_groupValues['created_id'], 'sort_name', 'id');
             }
             if (!empty($this->_groupValues['modified_id'])) {
                 $groupValues['modified_by'] = CRM_Core_DAO::getFieldValue("CRM_Contact_DAO_Contact", $this->_groupValues['modified_id'], 'sort_name', 'id');
             }
             $this->assign_by_ref('group', $groupValues);
             CRM_Utils_System::setTitle(ts('Team Settings: %1', array(1 => $this->_title)));
         }
         $session = CRM_Core_Session::singleton();
         $session->pushUserContext(CRM_Utils_System::url('civicrm/tournament/team', 'reset=1'));
     }
     //build custom data
     CRM_Custom_Form_CustomData::preProcess($this, NULL, NULL, 1, 'Group', $this->_id);
 }
开发者ID:agloa,项目名称:tournament,代码行数:55,代码来源:Edit.php

示例3: civicrm_api3_group_get

/**
 * Returns array of groups matching a set of one or more Group properties.
 *
 * @param array $params
 *   Array of properties. If empty, all records will be returned.
 *
 * @return array
 *   Array of matching groups
 */
function civicrm_api3_group_get($params)
{
    $options = _civicrm_api3_get_options_from_params($params, TRUE, 'Group', 'get');
    if ((empty($options['return']) || !in_array('member_count', $options['return'])) && empty($params['check_permissions'])) {
        return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, TRUE, 'Group');
    }
    $groups = _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, FALSE, 'Group');
    foreach ($groups as $id => $group) {
        if (!empty($params['check_permissions']) && !CRM_Contact_BAO_Group::checkPermission($group['id'])) {
            unset($groups[$id]);
        } elseif (!empty($options['return']) && in_array('member_count', $options['return'])) {
            $groups[$id]['member_count'] = CRM_Contact_BAO_Group::memberCount($id);
        }
    }
    return civicrm_api3_create_success($groups, $params, 'Group', 'get');
}
开发者ID:kidaa30,项目名称:yes,代码行数:25,代码来源:Group.php

示例4: preProcess

 /**
  * set up variables to build the form
  *
  * @return void
  * @acess protected
  */
 function preProcess()
 {
     $this->_id = $this->get('id');
     if ($this->_action == CRM_CORE_ACTION_DELETE) {
         if (isset($this->_id)) {
             $params = array('id' => $this->_id);
             CRM_Contact_BAO_Group::retrieve($params, $defaults);
             $this->_title = $defaults['title'];
             $this->assign('name', $this->_title);
             $this->assign('count', CRM_Contact_BAO_Group::memberCount($this->_id));
             CRM_Utils_System::setTitle(ts('Confirm Group Delete'));
         }
     } else {
         if (isset($this->_id)) {
             $params = array('id' => $this->_id);
             CRM_Contact_BAO_Group::retrieve($params, $defaults);
             $groupValues = array('id' => $this->_id, 'title' => $defaults['title'], 'saved_search_id' => $defaults['saved_search_id']);
             $this->assign_by_ref('group', $groupValues);
             CRM_Utils_System::setTitle(ts('Group Settings: %1', array(1 => $defaults['title'])));
         }
     }
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:28,代码来源:Edit.php

示例5: getGroups

 /**
  * 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
  */
 static function getGroups($params = null, $returnProperties = null)
 {
     $dao =& new CRM_Contact_DAO_Group();
     $dao->is_active = 1;
     if ($params) {
         foreach ($params as $k => $v) {
             if ($k == 'name' || $k == 'title') {
                 $dao->whereAdd($k . ' LIKE "' . CRM_Core_DAO::escapeString($v) . '"');
             } else {
                 if (is_array($v)) {
                     $dao->whereAdd($k . ' IN (' . implode(',', $v) . ')');
                 } else {
                     $dao->{$k} = $v;
                 }
             }
         }
     }
     // return only specific fields if returnproperties are sent
     if (!empty($returnProperties)) {
         $dao->selectAdd();
         $dao->selectAdd(implode(',', $returnProperties));
     }
     $dao->find();
     $flag = $returnProperties && in_array('member_count', $returnProperties) ? 1 : 0;
     $groups = array();
     while ($dao->fetch()) {
         $group =& new CRM_Contact_DAO_Group();
         if ($flag) {
             $dao->member_count = CRM_Contact_BAO_Group::memberCount($dao->id);
         }
         $groups[] = clone $dao;
     }
     return $groups;
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:45,代码来源:Group.php

示例6: getGroups

 /**
  * Returns array of group object(s) matching a set of one or Group properties.
  *
  * @param array $params
  *   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.)
  * @param string $sort
  * @param int $offset
  * @param int $rowCount
  *
  * @return array
  *   Array of group objects.
  *
  *
  * @todo other BAO functions that use returnProperties (e.g. Query Objects) receive the array flipped & filled with 1s and
  * add in essential fields (e.g. id). This should follow a regular pattern like the others
  */
 public static function getGroups($params = NULL, $returnProperties = NULL, $sort = NULL, $offset = NULL, $rowCount = NULL)
 {
     $dao = new CRM_Contact_DAO_Group();
     if (!isset($params['is_active'])) {
         $dao->is_active = 1;
     }
     if ($params) {
         foreach ($params as $k => $v) {
             if ($k == 'name' || $k == 'title') {
                 $dao->whereAdd($k . ' LIKE "' . CRM_Core_DAO::escapeString($v) . '"');
             } elseif ($k == 'group_type') {
                 foreach ((array) $v as $type) {
                     $dao->whereAdd($k . " LIKE '%" . CRM_Core_DAO::VALUE_SEPARATOR . (int) $type . CRM_Core_DAO::VALUE_SEPARATOR . "%'");
                 }
             } elseif (is_array($v)) {
                 foreach ($v as &$num) {
                     $num = (int) $num;
                 }
                 $dao->whereAdd($k . ' IN (' . implode(',', $v) . ')');
             } else {
                 $dao->{$k} = $v;
             }
         }
     }
     if ($offset || $rowCount) {
         $offset = $offset > 0 ? $offset : 0;
         $rowCount = $rowCount > 0 ? $rowCount : 25;
         $dao->limit($offset, $rowCount);
     }
     if ($sort) {
         $dao->orderBy($sort);
     }
     // return only specific fields if returnproperties are sent
     if (!empty($returnProperties)) {
         $dao->selectAdd();
         $dao->selectAdd(implode(',', $returnProperties));
     }
     $dao->find();
     $flag = $returnProperties && in_array('member_count', $returnProperties) ? 1 : 0;
     $groups = array();
     while ($dao->fetch()) {
         $group = new CRM_Contact_DAO_Group();
         if ($flag) {
             $dao->member_count = CRM_Contact_BAO_Group::memberCount($dao->id);
         }
         $groups[] = clone $dao;
     }
     return $groups;
 }
开发者ID:rameshrr99,项目名称:civicrm-core,代码行数:68,代码来源:Group.php

示例7: preProcess

 /**
  * set up variables to build the form
  *
  * @return void
  * @acess protected
  */
 function preProcess()
 {
     $this->_id = $this->get('id');
     if ($this->_id) {
         $breadCrumb = array(array('title' => ts('Manage Groups'), 'url' => CRM_Utils_System::url('civicrm/group', 'reset=1')));
         CRM_Utils_System::appendBreadCrumb($breadCrumb);
         $this->_groupValues = array();
         $params = array('id' => $this->_id);
         $this->_group =& CRM_Contact_BAO_Group::retrieve($params, $this->_groupValues);
         $this->_title = $this->_groupValues['title'];
     }
     $this->assign('action', $this->_action);
     $this->assign('showBlockJS', TRUE);
     if ($this->_action == CRM_Core_Action::DELETE) {
         if (isset($this->_id)) {
             $this->assign('title', $this->_title);
             $this->assign('count', CRM_Contact_BAO_Group::memberCount($this->_id));
             CRM_Utils_System::setTitle(ts('Confirm Group Delete'));
         }
     } else {
         if (isset($this->_id)) {
             $groupValues = array('id' => $this->_id, 'title' => $this->_title, 'saved_search_id' => isset($this->_groupValues['saved_search_id']) ? $this->_groupValues['saved_search_id'] : '');
             if (isset($this->_groupValues['saved_search_id'])) {
                 $groupValues['mapping_id'] = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_SavedSearch', $this->_groupValues['saved_search_id'], 'mapping_id');
                 $groupValues['search_custom_id'] = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_SavedSearch', $this->_groupValues['saved_search_id'], 'search_custom_id');
             }
             $this->assign_by_ref('group', $groupValues);
             CRM_Utils_System::setTitle(ts('Group Settings: %1', array(1 => $this->_title)));
         }
         $session = CRM_Core_Session::singleton();
         $session->pushUserContext(CRM_Utils_System::url('civicrm/group', 'reset=1'));
     }
     //build custom data
     CRM_Custom_Form_CustomData::preProcess($this, NULL, NULL, 1, 'Group', $this->_id);
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:41,代码来源:Edit.php

示例8: getGroups

 /**
  * 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 getGroups($params = null, $returnProperties = null)
 {
     $dao =& new CRM_Contact_DAO_Group();
     $dao->is_active = 1;
     if ($params) {
         foreach ($params as $k => $v) {
             if ($k == 'name' || $k == 'title') {
                 $dao->whereAdd($k . ' LIKE "' . addslashes($v) . '"');
             } else {
                 $dao->{$k} = $v;
             }
         }
     }
     $dao->find();
     $flag = $returnProperties && in_array('member_count', $returnProperties) ? 1 : 0;
     $groups = array();
     while ($dao->fetch()) {
         $group =& new CRM_Contact_DAO_Group();
         if ($flag) {
             $dao->member_count = CRM_Contact_BAO_Group::memberCount($dao->id);
         }
         $groups[] = clone $dao;
     }
     return $groups;
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:36,代码来源:Group.php


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