本文整理汇总了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;
}