本文整理汇总了PHP中CRM_Core_BAO_Domain::retrieve方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_Domain::retrieve方法的具体用法?PHP CRM_Core_BAO_Domain::retrieve怎么用?PHP CRM_Core_BAO_Domain::retrieve使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_BAO_Domain
的用法示例。
在下文中一共展示了CRM_Core_BAO_Domain::retrieve方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setDefaultValues
function setDefaultValues()
{
require_once 'CRM/Core/BAO/Domain.php';
$defaults = array();
$params = array();
$locParams = array();
if (isset($this->_id)) {
$params['id'] = $this->_id;
CRM_Core_BAO_Domain::retrieve($params, $defaults);
unset($params['id']);
$locParams = $params + array('entity_id' => $this->_id, 'entity_table' => 'civicrm_domain');
CRM_Core_BAO_Location::getValues($locParams, $defaults, $ids, 3);
$this->_ids = $ids;
}
return $defaults;
}
示例2: setDefaultValues
function setDefaultValues()
{
require_once 'CRM/Core/BAO/Domain.php';
$defaults = array();
$params = array();
$locParams = array();
if (isset($this->_id)) {
$params['id'] = $this->_id;
CRM_Core_BAO_Domain::retrieve($params, $domainDefaults);
//get the default domain from email address. fix CRM-3552
require_once 'CRM/Utils/Mail.php';
require_once 'CRM/Core/OptionValue.php';
$optionValues = array();
$grpParams['name'] = 'from_email_address';
CRM_Core_OptionValue::getValues($grpParams, $optionValues);
foreach ($optionValues as $Id => $value) {
if ($value['is_default'] && $value['is_active']) {
$this->_fromEmailId = $Id;
$domainDefaults['email_name'] = CRM_Utils_Array::value(1, explode('"', $value['label']));
$domainDefaults['email_address'] = CRM_Utils_Mail::pluckEmailFromHeader($value['label']);
break;
}
}
unset($params['id']);
$locParams = $params + array('entity_id' => $this->_id, 'entity_table' => 'civicrm_domain');
require_once 'CRM/Core/BAO/Location.php';
$defaults = CRM_Core_BAO_Location::getValues($locParams);
$config = CRM_Core_Config::singleton();
if (!isset($defaults['address'][1]['country_id'])) {
$defaults['address'][1]['country_id'] = $config->defaultContactCountry;
}
if (!empty($defaults['address'])) {
foreach ($defaults['address'] as $key => $value) {
CRM_Contact_Form_Edit_Address::fixStateSelect($this, "address[{$key}][country_id]", "address[{$key}][state_province_id]", CRM_Utils_Array::value('country_id', $value, $config->defaultContactCountry));
}
}
}
$defaults = array_merge($defaults, $domainDefaults);
return $defaults;
}
示例3: register
static function register($extension)
{
if ($domain_id = CRM_Core_Config::domainID()) {
// Gather information from domain settings
$params = array('id' => $domain_id);
CRM_Core_BAO_Domain::retrieve($params, $domain);
unset($params['id']);
$locParams = $params + array('entity_id' => $domain_id, 'entity_table' => 'civicrm_domain');
$defaults = CRM_Core_BAO_Location::getValues($locParams);
foreach (array('address', 'phone', 'email') as $info) {
$domain[$info] = reset(CRM_Utils_Array::value($info, $defaults));
}
// Create registration parameters
$registration = array('extension' => $extension, 'organization_name' => $domain['name'], 'description' => $domain['description']);
foreach (array('street_address', 'supplemental_address_1', 'supplemental_address_2', 'city', 'postal_code', 'state_province_id', 'country_id') as $field) {
$registration[$field] = CRM_Utils_Array::value($field, $domain['address']);
}
$registration['phone'] = $domain['phone']['phone'];
$registration['email'] = $domain['email']['email'];
return self::_rest_helper('http://my.cividesk.com/register.php', $registration, 'POST');
}
return false;
}
示例4: setDefaultValues
/**
* This virtual function is used to set the default values of.
* various form elements
*
* @return array
* reference to the array of default values
*
*/
public function setDefaultValues()
{
$defaults = array();
$params = array();
if (isset($this->_id)) {
$params['id'] = $this->_id;
CRM_Core_BAO_Domain::retrieve($params, $domainDefaults);
$this->_contactId = $domainDefaults['contact_id'];
//get the default domain from email address. fix CRM-3552
$optionValues = array();
$grpParams['name'] = 'from_email_address';
CRM_Core_OptionValue::getValues($grpParams, $optionValues);
foreach ($optionValues as $Id => $value) {
if ($value['is_default'] && $value['is_active']) {
$this->_fromEmailId = $Id;
$list = explode('"', $value['label']);
$domainDefaults['email_name'] = CRM_Utils_Array::value(1, $list);
$domainDefaults['email_address'] = CRM_Utils_Mail::pluckEmailFromHeader($value['label']);
break;
}
}
unset($params['id']);
$locParams = array('contact_id' => $domainDefaults['contact_id']);
$this->_locationDefaults = $defaults = CRM_Core_BAO_Location::getValues($locParams);
$config = CRM_Core_Config::singleton();
if (!isset($defaults['address'][1]['country_id'])) {
$defaults['address'][1]['country_id'] = $config->defaultContactCountry;
}
if (!isset($defaults['address'][1]['state_province_id'])) {
$defaults['address'][1]['state_province_id'] = $config->defaultContactStateProvince;
}
}
$defaults = array_merge($defaults, $domainDefaults);
return $defaults;
}