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


PHP CRM_Core_BAO_Location::getBlocks方法代码示例

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


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

示例1: CRM_Core_BAO_Location

 /**
  * Given the list of params in the params array, fetch the object
  * and store the values in the values array
  *
  * @param array $params        input parameters to find object
  * @param array $values        output values of the object
  * @param array $ids           the array that holds all the db ids
  * @param int   $locationCount number of locations to fetch
  *
  * @return array   array of objects(CRM_Core_BAO_Location)
  * @access public
  * @static
  */
 function &getValues(&$params, &$values, &$ids, $locationCount = 0)
 {
     $location =& new CRM_Core_BAO_Location();
     $location->copyValues($params);
     if ($params['contact_id']) {
         $location->entity_table = 'civicrm_contact';
         $location->entity_id = $params['contact_id'];
     } else {
         if ($params['domain_id']) {
             $location->entity_table = 'civicrm_domain';
             $location->entity_id = $params['domain_id'];
         }
     }
     $flatten = false;
     if (empty($locationCount)) {
         $locationCount = 1;
         $flatten = true;
     } else {
         $values['location'] = array();
         $ids['location'] = array();
     }
     // we first get the primary location due to the order by clause
     $location->orderBy('is_primary desc, id');
     $location->find();
     $locations = array();
     for ($i = 0; $i < $locationCount; $i++) {
         if ($location->fetch()) {
             $params['location_id'] = $location->id;
             if ($flatten) {
                 $ids['location'] = $location->id;
                 CRM_Core_DAO::storeValues($location, $values);
                 CRM_Core_BAO_Location::getBlocks($params, $values, $ids, 0, $location);
             } else {
                 $values['location'][$i + 1] = array();
                 $ids['location'][$i + 1] = array();
                 $ids['location'][$i + 1]['id'] = $location->id;
                 CRM_Core_DAO::storeValues($location, $values['location'][$i + 1]);
                 CRM_Core_BAO_Location::getBlocks($params, $values['location'][$i + 1], $ids['location'][$i + 1], CRM_CONTACT_FORM_LOCATION_BLOCKS, $location);
             }
             $locations[$i + 1] = clone $location;
         }
     }
     return $locations;
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:57,代码来源:Location.php


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