<?php
-
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.5 |
+ | CiviCRM version 4.6 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
* Get CiviCRM domain details
* {@getfields domain_create}
* @example DomainGet.php
+ * @param array $params
+ * @return array
+ * @throws \API_Exception
*/
function civicrm_api3_domain_get($params) {
return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
}
- _civicrm_api3_dao_set_filter($bao, $params, true, 'domain');
- $domains = _civicrm_api3_dao_to_array($bao, $params, true,'domain');
+ _civicrm_api3_dao_set_filter($bao, $params, TRUE, 'domain');
+ $domains = _civicrm_api3_dao_to_array($bao, $params, TRUE, 'domain');
foreach ($domains as $domain) {
- if(!empty($domain['contact_id'])){
+ if (!empty($domain['contact_id'])) {
$values = array();
$locparams = array(
- 'contact_id' => $domain['contact_id']
+ 'contact_id' => $domain['contact_id'],
);
$values['location'] = CRM_Core_BAO_Location::getValues($locparams, TRUE);
'geo_code_1', 'geo_code_2',
);
- if ( !empty( $values['location']['email'] ) ) {
+ if (!empty($values['location']['email'])) {
$domain['domain_email'] = CRM_Utils_Array::value('email', $values['location']['email'][1]);
}
- if ( !empty( $values['location']['phone'] ) ) {
+ if (!empty($values['location']['phone'])) {
$domain['domain_phone'] = array(
'phone_type' => CRM_Core_OptionGroup::getLabel(
'phone_type',
'phone_type_id',
$values['location']['phone'][1]
)
- ),
+ ),
'phone' => CRM_Utils_Array::value(
'phone',
$values['location']['phone'][1]
- )
- );
- }
+ ),
+ );
+ }
- if ( !empty( $values['location']['address'] ) ) {
- foreach ($address_array as $value) {
- $domain['domain_address'][$value] = CRM_Utils_Array::value($value,
+ if (!empty($values['location']['address'])) {
+ foreach ($address_array as $value) {
+ $domain['domain_address'][$value] = CRM_Utils_Array::value($value,
$values['location']['address'][1]
- );
+ );
+ }
}
- }
list($domain['from_name'],
$domain['from_email']
}
}
-
return civicrm_api3_create_success($domains, $params, 'domain', 'get', $bao);
}
* Adjust Metadata for Get action
*
* The metadata is used for setting defaults, documentation & validation
- * @param array $params array or parameters determined by getfields
+ * @param array $params
+ * Array or parameters determined by getfields.
*/
function _civicrm_api3_domain_get_spec(&$params) {
$params['current_domain'] = array('title' => "get loaded domain");
* Adjust Metadata for Create action
*
* The metadata is used for setting defaults, documentation & validation
- * @param array $params array or parameters determined by getfields
+ * @param array $params
+ * Array or parameters determined by getfields.
*/
function _civicrm_api3_domain_create_spec(&$params) {
$params['domain_version'] = $params['version'];
unset($params['version']);
$params['name']['api.required'] = 1;
}
-