本文整理汇总了PHP中CRM_Core_BAO_Block::create方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_Block::create方法的具体用法?PHP CRM_Core_BAO_Block::create怎么用?PHP CRM_Core_BAO_Block::create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_BAO_Block
的用法示例。
在下文中一共展示了CRM_Core_BAO_Block::create方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create
/**
* Function to create various elements of location block
*
* @param array $params (reference ) an assoc array of name/value pairs
* @param boolean $fixAddress true if you need to fix (format) address values
* before inserting in db
*
* @param null $entity
*
* @return array $location
* @access public
* @static
*/
static function create(&$params, $fixAddress = TRUE, $entity = NULL)
{
$location = array();
if (!self::dataExists($params)) {
return $location;
}
// create location blocks.
foreach (self::$blocks as $block) {
if ($block != 'address') {
$location[$block] = CRM_Core_BAO_Block::create($block, $params, $entity);
} else {
$location[$block] = CRM_Core_BAO_Address::create($params, $fixAddress, $entity);
}
}
if ($entity) {
// this is a special case for adding values in location block table
$entityElements = array('entity_table' => $params['entity_table'], 'entity_id' => $params['entity_id']);
$location['id'] = self::createLocBlock($location, $entityElements);
} else {
// when we come from a form which displays all the location elements (like the edit form or the inline block
// elements, we can skip the below check. The below check adds quite a feq queries to an already overloaded
// form
if (!CRM_Utils_Array::value('updateBlankLocInfo', $params, FALSE)) {
// make sure contact should have only one primary block, CRM-5051
self::checkPrimaryBlocks(CRM_Utils_Array::value('contact_id', $params));
}
}
return $location;
}
示例2: postProcess
/**
* Process the form.
*
* @return void
*/
public function postProcess()
{
$params = $this->exportValues();
// Process / save openID
$params['contact_id'] = $this->_contactId;
$params['updateBlankLocInfo'] = TRUE;
CRM_Core_BAO_Block::create('openid', $params);
$this->log();
$this->response();
}
示例3: postProcess
/**
* process the form
*
* @return void
* @access public
*/
public function postProcess()
{
$params = $this->exportValues();
// need to process / save emails
$params['contact_id'] = $this->_contactId;
$params['updateBlankLocInfo'] = TRUE;
// save email changes
CRM_Core_BAO_Block::create('email', $params);
// make entry in log table
CRM_Core_BAO_Log::register($this->_contactId, 'civicrm_contact', $this->_contactId);
$response = array('status' => 'save');
$this->postProcessHook();
echo json_encode($response);
CRM_Utils_System::civiExit();
}
示例4: postProcess
/**
* Process the form.
*/
public function postProcess()
{
$params = $this->exportValues();
// Process / save openID
$params['contact_id'] = $this->_contactId;
$params['updateBlankLocInfo'] = TRUE;
$params['openid']['isIdSet'] = TRUE;
foreach ($this->_openids as $count => $value) {
if (!empty($value['id']) && isset($params['openid'][$count])) {
$params['openid'][$count]['id'] = $value['id'];
}
}
CRM_Core_BAO_Block::create('openid', $params);
$this->log();
$this->response();
}
示例5: postProcess
/**
* Process the form.
*/
public function postProcess()
{
$params = $this->exportValues();
// Process / save emails
$params['contact_id'] = $this->_contactId;
$params['updateBlankLocInfo'] = TRUE;
$params['email']['isIdSet'] = TRUE;
foreach ($this->_emails as $count => $value) {
if (!empty($value['id']) && isset($params['email'][$count])) {
$params['email'][$count]['id'] = $value['id'];
}
}
CRM_Core_BAO_Block::create('email', $params);
// If contact has no name, set primary email as display name
// TODO: This should be handled in the BAO for the benefit of the api, etc.
if (!$this->contactHasName) {
foreach ($params['email'] as $email) {
if ($email['is_primary']) {
CRM_Core_DAO::setFieldValue('CRM_Contact_DAO_Contact', $this->_contactId, 'display_name', $email['email']);
CRM_Core_DAO::setFieldValue('CRM_Contact_DAO_Contact', $this->_contactId, 'sort_name', $email['email']);
$this->ajaxResponse['reloadBlocks'] = array('#crm-contactname-content');
break;
}
}
}
$this->log();
$this->response();
}