本文整理汇总了PHP中CRM_Core_PseudoConstant::get方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_PseudoConstant::get方法的具体用法?PHP CRM_Core_PseudoConstant::get怎么用?PHP CRM_Core_PseudoConstant::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_PseudoConstant
的用法示例。
在下文中一共展示了CRM_Core_PseudoConstant::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: browse
/**
* Browse all mail settings.
*
* @return void
*/
public function browse()
{
//get all mail settings.
$allMailSettings = array();
$mailSetting = new CRM_Core_DAO_MailSettings();
$allProtocols = CRM_Core_PseudoConstant::get('CRM_Core_DAO_MailSettings', 'protocol');
//multi-domain support for mail settings. CRM-5244
$mailSetting->domain_id = CRM_Core_Config::domainID();
//find all mail settings.
$mailSetting->find();
while ($mailSetting->fetch()) {
//replace protocol value with name
$mailSetting->protocol = CRM_Utils_Array::value($mailSetting->protocol, $allProtocols);
CRM_Core_DAO::storeValues($mailSetting, $allMailSettings[$mailSetting->id]);
//form all action links
$action = array_sum(array_keys($this->links()));
// disallow the DELETE action for the default set of settings
if ($mailSetting->is_default) {
$action &= ~CRM_Core_Action::DELETE;
}
//add action links.
$allMailSettings[$mailSetting->id]['action'] = CRM_Core_Action::formLink(self::links(), $action, array('id' => $mailSetting->id), ts('more'), FALSE, 'mailSetting.manage.action', 'MailSetting', $mailSetting->id);
}
$this->assign('rows', $allMailSettings);
}
示例2: run
/**
* Run the page.
*
* This method is called after the page is created.
*/
public function run()
{
// get the emails for this contact
$contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE, NULL, $_REQUEST);
$locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id', array('labelColumn' => 'display_name'));
$phoneTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', 'phone_type_id');
$entityBlock = array('contact_id' => $contactId);
$phones = CRM_Core_BAO_Phone::getValues($entityBlock);
if (!empty($phones)) {
foreach ($phones as $key => &$value) {
$value['location_type'] = $locationTypes[$value['location_type_id']];
$value['phone_type'] = $phoneTypes[$value['phone_type_id']];
}
}
$contact = new CRM_Contact_BAO_Contact();
$contact->id = $contactId;
$contact->find(TRUE);
$privacy = array();
foreach (CRM_Contact_BAO_Contact::$_commPrefs as $name) {
if (isset($contact->{$name})) {
$privacy[$name] = $contact->{$name};
}
}
$this->assign('contactId', $contactId);
$this->assign('phone', $phones);
$this->assign('privacy', $privacy);
// check logged in user permission
CRM_Contact_Page_View::checkUserPermission($this, $contactId);
// finally call parent
parent::run();
}
示例3: buildQuickForm
/**
* Build the form object.
*/
public function buildQuickForm()
{
parent::buildQuickForm();
$this->setPageTitle(ts('Mail Account'));
if ($this->_action & CRM_Core_Action::DELETE) {
return;
}
$this->applyFilter('__ALL__', 'trim');
//get the attributes.
$attributes = CRM_Core_DAO::getAttribute('CRM_Core_DAO_MailSettings');
//build setting form
$this->add('text', 'name', ts('Name'), $attributes['name'], TRUE);
$this->add('text', 'domain', ts('Email Domain'), $attributes['domain'], TRUE);
$this->addRule('domain', ts('Email domain must use a valid internet domain format (e.g. \'example.org\').'), 'domain');
$this->add('text', 'localpart', ts('Localpart'), $attributes['localpart']);
$this->add('text', 'return_path', ts('Return-Path'), $attributes['return_path']);
$this->addRule('return_path', ts('Return-Path must use a valid email address format.'), 'email');
$this->add('select', 'protocol', ts('Protocol'), array('' => ts('- select -')) + CRM_Core_PseudoConstant::get('CRM_Core_DAO_MailSettings', 'protocol'), TRUE);
$this->add('text', 'server', ts('Server'), $attributes['server']);
$this->add('text', 'username', ts('Username'), array('autocomplete' => 'off'));
$this->add('password', 'password', ts('Password'), array('autocomplete' => 'off'));
$this->add('text', 'source', ts('Source'), $attributes['source']);
$this->add('checkbox', 'is_ssl', ts('Use SSL?'));
$usedfor = array(1 => ts('Bounce Processing'), 0 => ts('Email-to-Activity Processing'));
$this->add('select', 'is_default', ts('Used For?'), $usedfor);
}
示例4: __construct
/**
*/
public function __construct()
{
$this->_autoIncludeIndexedFieldsAsOrderBys = 1;
// Check if CiviCampaign is a) enabled and b) has active campaigns
$config = CRM_Core_Config::singleton();
$campaignEnabled = in_array("CiviCampaign", $config->enableComponents);
if ($campaignEnabled) {
$getCampaigns = CRM_Campaign_BAO_Campaign::getPermissionedCampaigns(NULL, NULL, TRUE, FALSE, TRUE);
$this->activeCampaigns = $getCampaigns['campaigns'];
asort($this->activeCampaigns);
}
$this->_columns = array('civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array_merge(array('sort_name_linked' => array('title' => ts('Participant Name'), 'required' => TRUE, 'no_repeat' => TRUE, 'dbAlias' => 'contact_civireport.sort_name')), $this->getBasicContactFields(), array('age_at_event' => array('title' => ts('Age at Event'), 'dbAlias' => 'TIMESTAMPDIFF(YEAR, contact_civireport.birth_date, event_civireport.start_date)'))), 'grouping' => 'contact-fields', 'order_bys' => array('sort_name' => array('title' => ts('Last Name, First Name'), 'default' => '1', 'default_weight' => '0', 'default_order' => 'ASC'), 'first_name' => array('name' => 'first_name', 'title' => ts('First Name')), 'gender_id' => array('name' => 'gender_id', 'title' => ts('Gender')), 'birth_date' => array('name' => 'birth_date', 'title' => ts('Birth Date')), 'age_at_event' => array('name' => 'age_at_event', 'title' => ts('Age at Event')), 'contact_type' => array('title' => ts('Contact Type')), 'contact_sub_type' => array('title' => ts('Contact Subtype'))), 'filters' => array('sort_name' => array('title' => ts('Participant Name'), 'operator' => 'like'), 'gender_id' => array('title' => ts('Gender'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id')), 'birth_date' => array('title' => ts('Birth Date'), 'operatorType' => CRM_Report_Form::OP_DATE), 'contact_type' => array('title' => ts('Contact Type')), 'contact_sub_type' => array('title' => ts('Contact Subtype')))), 'civicrm_email' => array('dao' => 'CRM_Core_DAO_Email', 'fields' => array('email' => array('title' => ts('Email'), 'no_repeat' => TRUE)), 'grouping' => 'contact-fields', 'filters' => array('email' => array('title' => ts('Participant E-mail'), 'operator' => 'like'))), 'civicrm_address' => array('dao' => 'CRM_Core_DAO_Address', 'fields' => array('street_address' => NULL, 'supplemental_address_1' => NULL, 'supplemental_address_2' => NULL, 'city' => NULL, 'postal_code' => NULL, 'state_province_id' => array('title' => ts('State/Province')), 'country_id' => array('title' => ts('Country'))), 'grouping' => 'contact-fields'), 'civicrm_participant' => array('dao' => 'CRM_Event_DAO_Participant', 'fields' => array('participant_id' => array('title' => 'Participant ID'), 'participant_record' => array('name' => 'id', 'no_display' => TRUE, 'required' => TRUE), 'event_id' => array('default' => TRUE, 'type' => CRM_Utils_Type::T_STRING), 'status_id' => array('title' => ts('Status'), 'default' => TRUE), 'role_id' => array('title' => ts('Role'), 'default' => TRUE), 'fee_currency' => array('required' => TRUE, 'no_display' => TRUE), 'registered_by_id' => array('title' => ts('Registered by Participant ID')), 'participant_fee_level' => NULL, 'participant_fee_amount' => array('title' => ts('Participant Fee')), 'participant_register_date' => array('title' => ts('Registration Date')), 'total_paid' => array('title' => ts('Total Paid'), 'dbAlias' => 'SUM(ft.total_amount)', 'type' => 1024), 'balance' => array('title' => ts('Balance'), 'dbAlias' => 'participant_civireport.fee_amount - SUM(ft.total_amount)', 'type' => 1024)), 'grouping' => 'event-fields', 'filters' => array('event_id' => array('name' => 'event_id', 'title' => ts('Event'), 'operatorType' => CRM_Report_Form::OP_ENTITYREF, 'type' => CRM_Utils_Type::T_INT, 'attributes' => array('entity' => 'event', 'select' => array('minimumInputLength' => 0))), 'sid' => array('name' => 'status_id', 'title' => ts('Participant Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Event_PseudoConstant::participantStatus(NULL, NULL, 'label')), 'rid' => array('name' => 'role_id', 'title' => ts('Participant Role'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Event_PseudoConstant::participantRole()), 'participant_register_date' => array('title' => 'Registration Date', 'operatorType' => CRM_Report_Form::OP_DATE), 'fee_currency' => array('title' => ts('Fee Currency'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_OptionGroup::values('currencies_enabled'), 'default' => NULL, 'type' => CRM_Utils_Type::T_STRING), 'registered_by_id' => array('title' => ts('Registered by Participant ID'), 'type' => CRM_Utils_Type::T_STRING, 'operator' => 'like')), 'order_bys' => array('participant_register_date' => array('title' => ts('Registration Date'), 'default_weight' => '1', 'default_order' => 'ASC'), 'event_id' => array('title' => ts('Event'), 'default_weight' => '1', 'default_order' => 'ASC'))), 'civicrm_phone' => array('dao' => 'CRM_Core_DAO_Phone', 'fields' => array('phone' => array('title' => ts('Phone'), 'default' => TRUE, 'no_repeat' => TRUE)), 'grouping' => 'contact-fields'), 'civicrm_event' => array('dao' => 'CRM_Event_DAO_Event', 'fields' => array('event_type_id' => array('title' => ts('Event Type')), 'event_start_date' => array('title' => ts('Event Start Date'))), 'grouping' => 'event-fields', 'filters' => array('eid' => array('name' => 'event_type_id', 'title' => ts('Event Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_OptionGroup::values('event_type')), 'event_start_date' => array('title' => ts('Event Start Date'), 'operatorType' => CRM_Report_Form::OP_DATE)), 'order_bys' => array('event_type_id' => array('title' => ts('Event Type'), 'default_weight' => '2', 'default_order' => 'ASC'), 'event_start_date' => array('title' => ts('Event Start Date')))), 'civicrm_contribution' => array('dao' => 'CRM_Contribute_DAO_Contribution', 'fields' => array('contribution_id' => array('name' => 'id', 'no_display' => TRUE, 'required' => TRUE, 'csv_display' => TRUE, 'title' => ts('Contribution ID')), 'financial_type_id' => array('title' => ts('Financial Type')), 'receive_date' => array('title' => ts('Payment Date')), 'contribution_status_id' => array('title' => ts('Contribution Status')), 'payment_instrument_id' => array('title' => ts('Payment Type')), 'contribution_source' => array('name' => 'source', 'title' => ts('Contribution Source')), 'currency' => array('required' => TRUE, 'no_display' => TRUE), 'trxn_id' => NULL, 'fee_amount' => array('title' => ts('Transaction Fee')), 'net_amount' => NULL), 'grouping' => 'contrib-fields', 'filters' => array('receive_date' => array('title' => 'Payment Date', 'operatorType' => CRM_Report_Form::OP_DATE), 'financial_type_id' => array('title' => ts('Financial Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::financialType()), 'currency' => array('title' => ts('Contribution Currency'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_OptionGroup::values('currencies_enabled'), 'default' => NULL, 'type' => CRM_Utils_Type::T_STRING), 'payment_instrument_id' => array('title' => ts('Payment Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::paymentInstrument()), 'contribution_status_id' => array('title' => ts('Contribution Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::contributionStatus(), 'default' => NULL))), 'civicrm_line_item' => array('dao' => 'CRM_Price_DAO_LineItem', 'grouping' => 'priceset-fields', 'filters' => array('price_field_value_id' => array('name' => 'price_field_value_id', 'title' => ts('Fee Level'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->getPriceLevels()))));
$this->_options = array('blank_column_begin' => array('title' => ts('Blank column at the Begining'), 'type' => 'checkbox'), 'blank_column_end' => array('title' => ts('Blank column at the End'), 'type' => 'select', 'options' => array('' => '-select-', 1 => ts('One'), 2 => ts('Two'), 3 => ts('Three'))));
// CRM-17115 avoid duplication of sort_name - would be better to standardise name
// & behaviour across reports but trying for no change at this point.
$this->_columns['civicrm_contact']['fields']['sort_name']['no_display'] = TRUE;
// If we have active campaigns add those elements to both the fields and filters
if ($campaignEnabled && !empty($this->activeCampaigns)) {
$this->_columns['civicrm_participant']['fields']['campaign_id'] = array('title' => ts('Campaign'), 'default' => 'false');
$this->_columns['civicrm_participant']['filters']['campaign_id'] = array('title' => ts('Campaign'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->activeCampaigns);
$this->_columns['civicrm_participant']['order_bys']['campaign_id'] = array('title' => ts('Campaign'));
}
$this->_currencyColumn = 'civicrm_participant_fee_currency';
parent::__construct();
}
示例5: preProcess
/**
* Build all the data structures needed to build the form.
*/
public function preProcess()
{
$this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
// this mean it's a batch action
if (!$this->_id) {
if (!empty($_GET['batch_id'])) {
// validate batch ids
$batchIds = explode(',', $_GET['batch_id']);
foreach ($batchIds as $batchId) {
CRM_Utils_Type::validate($batchId, 'Positive');
}
$this->_batchIds = $_GET['batch_id'];
$this->set('batchIds', $this->_batchIds);
} else {
$this->_batchIds = $this->get('batchIds');
}
if (!empty($_GET['export_format']) && in_array($_GET['export_format'], array('IIF', 'CSV'))) {
$this->_exportFormat = $_GET['export_format'];
}
} else {
$this->_batchIds = $this->_id;
}
$allBatchStatus = CRM_Core_PseudoConstant::get('CRM_Batch_DAO_Batch', 'status_id');
$this->_exportStatusId = CRM_Utils_Array::key('Exported', $allBatchStatus);
// check if batch status is valid, do not allow exported batches to export again
$batchStatus = CRM_Batch_BAO_Batch::getBatchStatuses($this->_batchIds);
foreach ($batchStatus as $batchStatusId) {
if ($batchStatusId == $this->_exportStatusId) {
CRM_Core_Error::fatal(ts('You cannot exported the batches which were exported earlier.'));
}
}
$session = CRM_Core_Session::singleton();
$session->replaceUserContext(CRM_Utils_System::url('civicrm/financial/financialbatches', "reset=1&batchStatus={$this->_exportStatusId}"));
}
示例6: getStore
/**
* Return the proper mail store implementation, based on config settings
*
* @param string $name
* Name of the settings set from civimail_mail_settings to use (null for default).
*
* @throws Exception
* @return object
* mail store implementation for processing CiviMail-bound emails
*/
public static function getStore($name = NULL)
{
$dao = new CRM_Core_DAO_MailSettings();
$dao->domain_id = CRM_Core_Config::domainID();
$name ? $dao->name = $name : ($dao->is_default = 1);
if (!$dao->find(TRUE)) {
throw new Exception("Could not find entry named {$name} in civicrm_mail_settings");
}
$protocols = CRM_Core_PseudoConstant::get('CRM_Core_DAO_MailSettings', 'protocol');
if (empty($protocols[$dao->protocol])) {
throw new Exception("Empty mail protocol");
}
switch ($protocols[$dao->protocol]) {
case 'IMAP':
return new CRM_Mailing_MailStore_Imap($dao->server, $dao->username, $dao->password, (bool) $dao->is_ssl, $dao->source);
case 'POP3':
return new CRM_Mailing_MailStore_Pop3($dao->server, $dao->username, $dao->password, (bool) $dao->is_ssl);
case 'Maildir':
return new CRM_Mailing_MailStore_Maildir($dao->source);
case 'Localdir':
return new CRM_Mailing_MailStore_Localdir($dao->source);
// DO NOT USE the mbox transport for anything other than testing
// in particular, it does not clear the mbox afterwards
// DO NOT USE the mbox transport for anything other than testing
// in particular, it does not clear the mbox afterwards
case 'mbox':
return new CRM_Mailing_MailStore_Mbox($dao->source);
default:
throw new Exception("Unknown protocol {$dao->protocol}");
}
}
示例7: add
/**
* Add the financial items and financial trxn.
*
* @param object $lineItem
* Line item object.
* @param object $contribution
* Contribution object.
* @param bool $taxTrxnID
*
* @return void
*/
public static function add($lineItem, $contribution, $taxTrxnID = FALSE, $trxnId = NULL)
{
$contributionStatuses = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
$financialItemStatus = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_FinancialItem', 'status_id');
$itemStatus = NULL;
if ($contribution->contribution_status_id == array_search('Completed', $contributionStatuses) || $contribution->contribution_status_id == array_search('Pending refund', $contributionStatuses)) {
$itemStatus = array_search('Paid', $financialItemStatus);
} elseif ($contribution->contribution_status_id == array_search('Pending', $contributionStatuses) || $contribution->contribution_status_id == array_search('In Progress', $contributionStatuses)) {
$itemStatus = array_search('Unpaid', $financialItemStatus);
} elseif ($contribution->contribution_status_id == array_search('Partially paid', $contributionStatuses)) {
$itemStatus = array_search('Partially paid', $financialItemStatus);
}
$params = array('transaction_date' => CRM_Utils_Date::isoToMysql($contribution->receive_date), 'contact_id' => $contribution->contact_id, 'amount' => $lineItem->line_total, 'currency' => $contribution->currency, 'entity_table' => 'civicrm_line_item', 'entity_id' => $lineItem->id, 'description' => ($lineItem->qty != 1 ? $lineItem->qty . ' of ' : '') . ' ' . $lineItem->label, 'status_id' => $itemStatus);
if ($taxTrxnID) {
$invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings');
$taxTerm = CRM_Utils_Array::value('tax_term', $invoiceSettings);
$params['amount'] = $lineItem->tax_amount;
$params['description'] = $taxTerm;
$accountRel = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Sales Tax Account is' "));
} else {
$accountRel = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Income Account is' "));
}
if ($lineItem->financial_type_id) {
$searchParams = array('entity_table' => 'civicrm_financial_type', 'entity_id' => $lineItem->financial_type_id, 'account_relationship' => $accountRel);
$result = array();
CRM_Financial_BAO_FinancialTypeAccount::retrieve($searchParams, $result);
$params['financial_account_id'] = CRM_Utils_Array::value('financial_account_id', $result);
}
if (empty($trxnId)) {
$trxn = CRM_Core_BAO_FinancialTrxn::getFinancialTrxnId($contribution->id, 'ASC', TRUE);
$trxnId['id'] = $trxn['financialTrxnId'];
}
return self::create($params, NULL, $trxnId);
}
示例8: preProcess
/**
* Set variables up before form is built.
*
* @return void
*/
public function preProcess()
{
$this->_addProfileBottom = CRM_Utils_Array::value('addProfileBottom', $_GET, FALSE);
$this->_profileBottomNum = CRM_Utils_Array::value('addProfileNum', $_GET, 0);
$this->_addProfileBottomAdd = CRM_Utils_Array::value('addProfileBottomAdd', $_GET, FALSE);
$this->_profileBottomNumAdd = CRM_Utils_Array::value('addProfileNumAdd', $_GET, 0);
parent::preProcess();
$this->assign('addProfileBottom', $this->_addProfileBottom);
$this->assign('profileBottomNum', $this->_profileBottomNum);
$urlParams = "id={$this->_id}&addProfileBottom=1&qfKey={$this->controller->_key}";
$this->assign('addProfileParams', $urlParams);
if ($addProfileBottom = CRM_Utils_Array::value('custom_post_id_multiple', $_POST)) {
foreach (array_keys($addProfileBottom) as $profileNum) {
self::buildMultipleProfileBottom($this, $profileNum);
}
}
$this->assign('perm', 0);
$ufGroups = CRM_Core_PseudoConstant::get('CRM_Core_DAO_UFField', 'uf_group_id');
$ufCreate = CRM_ACL_API::group(CRM_Core_Permission::CREATE, NULL, 'civicrm_uf_group', $ufGroups);
$ufEdit = CRM_ACL_API::group(CRM_Core_Permission::EDIT, NULL, 'civicrm_uf_group', $ufGroups);
$checkPermission = array(array('administer CiviCRM', 'manage event profiles'));
if (CRM_Core_Permission::check($checkPermission) || !empty($ufCreate) || !empty($ufEdit)) {
$this->assign('perm', 1);
}
$this->assign('addProfileBottomAdd', $this->_addProfileBottomAdd);
$this->assign('profileBottomNumAdd', $this->_profileBottomNumAdd);
$urlParamsAdd = "id={$this->_id}&addProfileBottomAdd=1&qfKey={$this->controller->_key}";
$this->assign('addProfileParamsAdd', $urlParamsAdd);
if ($addProfileBottomAdd = CRM_Utils_Array::value('additional_custom_post_id_multiple', $_POST)) {
foreach (array_keys($addProfileBottomAdd) as $profileNum) {
self::buildMultipleProfileBottom($this, $profileNum, 'additional_', ts('Profile for Additional Participants'));
}
}
}
示例9: buildForm
function buildForm(&$form)
{
$this->setTitle(ts('Include / Exclude Search'));
$groups = CRM_Core_PseudoConstant::group();
$tags = CRM_Core_PseudoConstant::get('CRM_Core_DAO_EntityTag', 'tag_id', array('onlyActive' => FALSE));
if (count($groups) == 0 || count($tags) == 0) {
CRM_Core_Session::setStatus(ts("At least one Group and Tag must be present for Custom Group / Tag search."), ts('Missing Group/Tag'));
$url = CRM_Utils_System::url('civicrm/contact/search/custom/list', 'reset=1');
CRM_Utils_System::redirect($url);
}
$inG =& $form->addElement('advmultiselect', 'includeGroups', ts('Include Group(s)') . ' ', $groups, array('size' => 5, 'style' => 'width:240px', 'class' => 'advmultiselect'));
$outG =& $form->addElement('advmultiselect', 'excludeGroups', ts('Exclude Group(s)') . ' ', $groups, array('size' => 5, 'style' => 'width:240px', 'class' => 'advmultiselect'));
$andOr = array('1' => ts('Show contacts that meet the Groups criteria AND the Tags criteria'), '0' => ts('Show contacts that meet the Groups criteria OR the Tags criteria'));
$form->addRadio('andOr', ts('AND/OR'), $andOr, NULL, '<br />', TRUE);
$int =& $form->addElement('advmultiselect', 'includeTags', ts('Include Tag(s)') . ' ', $tags, array('size' => 5, 'style' => 'width:240px', 'class' => 'advmultiselect'));
$outt =& $form->addElement('advmultiselect', 'excludeTags', ts('Exclude Tag(s)') . ' ', $tags, array('size' => 5, 'style' => 'width:240px', 'class' => 'advmultiselect'));
//add/remove buttons for groups
$inG->setButtonAttributes('add', array('value' => ts('Add >>')));
$outG->setButtonAttributes('add', array('value' => ts('Add >>')));
$inG->setButtonAttributes('remove', array('value' => ts('<< Remove')));
$outG->setButtonAttributes('remove', array('value' => ts('<< Remove')));
//add/remove buttons for tags
$int->setButtonAttributes('add', array('value' => ts('Add >>')));
$outt->setButtonAttributes('add', array('value' => ts('Add >>')));
$int->setButtonAttributes('remove', array('value' => ts('<< Remove')));
$outt->setButtonAttributes('remove', array('value' => ts('<< Remove')));
/**
* if you are using the standard template, this array tells the template what elements
* are part of the search criteria
*/
$form->assign('elements', array('includeGroups', 'excludeGroups', 'andOr', 'includeTags', 'excludeTags'));
}
示例10: __construct
function __construct()
{
$this->_columns = array('civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array('sort_name' => array('title' => ts('Contact Name'), 'required' => TRUE, 'no_repeat' => TRUE), 'gender_id' => array('title' => ts('Gender'), 'default' => TRUE), 'birth_date' => array('title' => ts('Birthdate'), 'default' => FALSE), 'id' => array('no_display' => TRUE, 'required' => TRUE)), 'filters' => array('sort_name' => array('title' => ts('Contact Name'), 'operatorType' => CRM_Report_Form::OP_STRING), 'contact_type' => array('title' => ts('Contact Type'), 'operatorType' => CRM_Report_Form::OP_SELECT, 'options' => array('' => ts('-select-'), 'Individual' => ts('Individual'), 'Organization' => ts('Organization'), 'Household' => ts('Household')), 'default' => 'Individual'), 'id' => array('title' => ts('Contact ID'), 'no_display' => TRUE)), 'grouping' => 'contact-fields'), 'civicrm_email' => array('dao' => 'CRM_Core_DAO_Email', 'fields' => array('email' => array('title' => ts('Email'), 'no_repeat' => TRUE)), 'grouping' => 'contact-fields'), 'civicrm_address' => array('dao' => 'CRM_Core_DAO_Address', 'grouping' => 'contact-fields', 'fields' => array('street_address' => array('default' => FALSE), 'city' => array('default' => TRUE), 'postal_code' => NULL, 'state_province_id' => array('title' => ts('State/Province')), 'country_id' => array('title' => ts('Country'), 'default' => FALSE))), 'civicrm_phone' => array('dao' => 'CRM_Core_DAO_Phone', 'fields' => array('phone' => NULL), 'grouping' => 'contact-fields'), 'civicrm_activity' => array('dao' => 'CRM_Activity_DAO_Activity', 'fields' => array('id' => array('title' => ts('Activity ID'), 'no_display' => TRUE, 'required' => TRUE))), 'civicrm_case' => array('dao' => 'CRM_Case_DAO_Case', 'fields' => array('id' => array('title' => ts('Case ID'), 'required' => TRUE), 'start_date' => array('title' => ts('Case Start'), 'required' => TRUE), 'end_date' => array('title' => ts('Case End'), 'required' => TRUE)), 'filters' => array('case_id_filter' => array('name' => 'id', 'title' => ts('Cases?'), 'operatorType' => CRM_Report_Form::OP_SELECT, 'options' => array(1 => ts('Exclude non-case'), 2 => ts('Exclude cases'), 3 => ts('Include Both')), 'default' => 3), 'start_date' => array('title' => ts('Case Start'), 'operatorType' => CRM_Report_Form::OP_DATE), 'end_date' => array('title' => ts('Case End'), 'operatorType' => CRM_Report_Form::OP_DATE))), 'civicrm_group' => array('dao' => 'CRM_Contact_DAO_Group', 'alias' => 'cgroup', 'filters' => array('gid' => array('name' => 'group_id', 'title' => ts('Group'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'group' => TRUE, 'options' => CRM_Core_PseudoConstant::group()))));
$this->_tagFilter = TRUE;
$open_case_val = CRM_Core_OptionGroup::getValue('activity_type', 'Open Case', 'name');
$crmDAO =& CRM_Core_DAO::executeQuery("SELECT cg.table_name, cg.extends AS ext, cf.label, cf.column_name FROM civicrm_custom_group cg INNER JOIN civicrm_custom_field cf ON cg.id = cf.custom_group_id\nwhere (cg.extends='Contact' OR cg.extends='Individual' OR cg.extends_entity_column_value='{$open_case_val}') AND cg.is_active=1 AND cf.is_active=1 ORDER BY cg.table_name");
$curTable = '';
$curExt = '';
$curFields = array();
while ($crmDAO->fetch()) {
if ($curTable == '') {
$curTable = $crmDAO->table_name;
$curExt = $crmDAO->ext;
} elseif ($curTable != $crmDAO->table_name) {
// dummy DAO
$this->_columns[$curTable] = array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => $curFields, 'ext' => $curExt);
$curTable = $crmDAO->table_name;
$curExt = $crmDAO->ext;
$curFields = array();
}
$curFields[$crmDAO->column_name] = array('title' => $crmDAO->label);
}
if (!empty($curFields)) {
// dummy DAO
$this->_columns[$curTable] = array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => $curFields, 'ext' => $curExt);
}
$this->_genders = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id');
parent::__construct();
}
示例11: buildQuickForm
/**
* build the form elements for a phone object
*
* @param CRM_Core_Form $form reference to the form object
* @param int $addressBlockCount block number to build
* @param boolean $blockEdit is it block edit
*
* @return void
* @access public
* @static
*/
static function buildQuickForm(&$form, $addressBlockCount = NULL, $blockEdit = FALSE)
{
// passing this via the session is AWFUL. we need to fix this
if (!$addressBlockCount) {
$blockId = $form->get('Phone_Block_Count') ? $form->get('Phone_Block_Count') : 1;
} else {
$blockId = $addressBlockCount;
}
$form->applyFilter('__ALL__', 'trim');
//phone type select
$form->addElement('select', "phone[{$blockId}][phone_type_id]", ts('Phone'), CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', 'phone_type_id'));
//main phone number with crm_phone class
$form->addElement('text', "phone[{$blockId}][phone]", ts('Phone'), array_merge(CRM_Core_DAO::getAttribute('CRM_Core_DAO_Phone', 'phone'), array('class' => 'crm_phone twelve')));
// phone extension
$form->addElement('text', "phone[{$blockId}][phone_ext]", ts('Extension'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_Phone', 'phone_ext'));
if (isset($form->_contactType) || $blockEdit) {
//Block type select
$form->addElement('select', "phone[{$blockId}][location_type_id]", '', CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'));
//is_Primary radio
$js = array('id' => 'Phone_' . $blockId . '_IsPrimary', 'onClick' => 'singleSelect( this.id );');
$form->addElement('radio', "phone[{$blockId}][is_primary]", '', '', '1', $js);
}
// TODO: set this up as a group, we need a valid phone_type_id if we have a phone number
// $form->addRule( "location[$locationId][phone][$locationId][phone]", ts('Phone number is not valid.'), 'phone' );
}
示例12: __construct
/**
* Class constructor.
*/
public function __construct()
{
$this->_autoIncludeIndexedFieldsAsOrderBys = 1;
// Check if CiviCampaign is a) enabled and b) has active campaigns
$config = CRM_Core_Config::singleton();
$campaignEnabled = in_array("CiviCampaign", $config->enableComponents);
if ($campaignEnabled) {
$getCampaigns = CRM_Campaign_BAO_Campaign::getPermissionedCampaigns(NULL, NULL, TRUE, FALSE, TRUE);
$this->activeCampaigns = $getCampaigns['campaigns'];
asort($this->activeCampaigns);
}
$this->_columns = array('civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => $this->getBasicContactFields(), 'filters' => array('sort_name' => array('title' => ts('Donor Name'), 'operator' => 'like'), 'id' => array('title' => ts('Contact ID'), 'no_display' => TRUE, 'type' => CRM_Utils_Type::T_INT), 'gender_id' => array('title' => ts('Gender'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id')), 'birth_date' => array('title' => ts('Birth Date'), 'operatorType' => CRM_Report_Form::OP_DATE), 'contact_type' => array('title' => ts('Contact Type')), 'contact_sub_type' => array('title' => ts('Contact Subtype'))), 'grouping' => 'contact-fields', 'order_bys' => array('sort_name' => array('title' => ts('Last Name, First Name'), 'default' => '1', 'default_weight' => '0', 'default_order' => 'ASC'), 'first_name' => array('name' => 'first_name', 'title' => ts('First Name')), 'gender_id' => array('name' => 'gender_id', 'title' => ts('Gender')), 'birth_date' => array('name' => 'birth_date', 'title' => ts('Birth Date')), 'contact_type' => array('title' => ts('Contact Type')), 'contact_sub_type' => array('title' => ts('Contact Subtype')))), 'civicrm_email' => array('dao' => 'CRM_Core_DAO_Email', 'fields' => array('email' => array('title' => ts('Donor Email'), 'default' => TRUE)), 'grouping' => 'contact-fields'), 'civicrm_line_item' => array('dao' => 'CRM_Price_DAO_LineItem'), 'civicrm_phone' => array('dao' => 'CRM_Core_DAO_Phone', 'fields' => array('phone' => array('title' => ts('Donor Phone'), 'default' => TRUE, 'no_repeat' => TRUE)), 'grouping' => 'contact-fields'), 'civicrm_contribution' => array('dao' => 'CRM_Contribute_DAO_Contribution', 'fields' => array('contribution_id' => array('name' => 'id', 'no_display' => TRUE, 'required' => TRUE), 'list_contri_id' => array('name' => 'id', 'title' => ts('Contribution ID')), 'financial_type_id' => array('title' => ts('Financial Type'), 'default' => TRUE), 'contribution_status_id' => array('title' => ts('Contribution Status')), 'contribution_page_id' => array('title' => ts('Contribution Page')), 'source' => array('title' => ts('Source')), 'payment_instrument_id' => array('title' => ts('Payment Type')), 'check_number' => array('title' => ts('Check Number')), 'currency' => array('required' => TRUE, 'no_display' => TRUE), 'trxn_id' => NULL, 'receive_date' => array('default' => TRUE), 'receipt_date' => NULL, 'total_amount' => array('title' => ts('Amount'), 'required' => TRUE, 'statistics' => array('sum' => ts('Amount'))), 'fee_amount' => NULL, 'net_amount' => NULL, 'contribution_or_soft' => array('title' => ts('Contribution OR Soft Credit?'), 'dbAlias' => "'Contribution'"), 'soft_credits' => array('title' => ts('Soft Credits'), 'dbAlias' => "NULL"), 'soft_credit_for' => array('title' => ts('Soft Credit For'), 'dbAlias' => "NULL")), 'filters' => array('contribution_or_soft' => array('title' => ts('Contribution OR Soft Credit?'), 'clause' => "(1)", 'operatorType' => CRM_Report_Form::OP_SELECT, 'type' => CRM_Utils_Type::T_STRING, 'options' => array('contributions_only' => ts('Contributions Only'), 'soft_credits_only' => ts('Soft Credits Only'), 'both' => ts('Both'))), 'receive_date' => array('operatorType' => CRM_Report_Form::OP_DATE), 'contribution_source' => array('title' => ts('Source'), 'name' => 'source', 'type' => CRM_Utils_Type::T_STRING), 'currency' => array('title' => ts('Currency'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_OptionGroup::values('currencies_enabled'), 'default' => NULL, 'type' => CRM_Utils_Type::T_STRING), 'financial_type_id' => array('title' => ts('Financial Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Financial_BAO_FinancialType::getAvailableFinancialTypes(), 'type' => CRM_Utils_Type::T_INT), 'contribution_page_id' => array('title' => ts('Contribution Page'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::contributionPage(), 'type' => CRM_Utils_Type::T_INT), 'payment_instrument_id' => array('title' => ts('Payment Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::paymentInstrument(), 'type' => CRM_Utils_Type::T_INT), 'contribution_status_id' => array('title' => ts('Contribution Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::contributionStatus(), 'default' => array(1), 'type' => CRM_Utils_Type::T_INT), 'total_amount' => array('title' => ts('Contribution Amount'))), 'order_bys' => array('financial_type_id' => array('title' => ts('Financial Type')), 'contribution_status_id' => array('title' => ts('Contribution Status')), 'payment_instrument_id' => array('title' => ts('Payment Method')), 'receive_date' => array('title' => ts('Date Received'))), 'grouping' => 'contri-fields'), 'civicrm_contribution_soft' => array('dao' => 'CRM_Contribute_DAO_ContributionSoft', 'fields' => array('soft_credit_type_id' => array('title' => ts('Soft Credit Type'))), 'filters' => array('soft_credit_type_id' => array('title' => ts('Soft Credit Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_OptionGroup::values('soft_credit_type'), 'default' => NULL, 'type' => CRM_Utils_Type::T_STRING))), 'civicrm_batch' => array('dao' => 'CRM_Batch_DAO_EntityBatch', 'grouping' => 'contri-fields', 'fields' => array('batch_id' => array('name' => 'batch_id', 'title' => ts('Batch Name'))), 'filters' => array('bid' => array('title' => ts('Batch Name'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Batch_BAO_Batch::getBatches(), 'type' => CRM_Utils_Type::T_INT, 'dbAlias' => 'batch_civireport.batch_id'))), 'civicrm_contribution_ordinality' => array('dao' => 'CRM_Contribute_DAO_Contribution', 'alias' => 'cordinality', 'filters' => array('ordinality' => array('title' => ts('Contribution Ordinality'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => array(0 => 'First by Contributor', 1 => 'Second or Later by Contributor'), 'type' => CRM_Utils_Type::T_INT))), 'civicrm_note' => array('dao' => 'CRM_Core_DAO_Note', 'fields' => array('contribution_note' => array('name' => 'note', 'title' => ts('Contribution Note'))), 'filters' => array('note' => array('name' => 'note', 'title' => ts('Contribution Note'), 'operator' => 'like', 'type' => CRM_Utils_Type::T_STRING)))) + $this->addAddressFields(FALSE);
// The tests test for this variation of the sort_name field. Don't argue with the tests :-).
$this->_columns['civicrm_contact']['fields']['sort_name']['title'] = ts('Donor Name');
$this->_groupFilter = TRUE;
$this->_tagFilter = TRUE;
// If we have active campaigns add those elements to both the fields and filters
if ($campaignEnabled && !empty($this->activeCampaigns)) {
$this->_columns['civicrm_contribution']['fields']['campaign_id'] = array('title' => ts('Campaign'), 'default' => 'false');
$this->_columns['civicrm_contribution']['filters']['campaign_id'] = array('title' => ts('Campaign'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->activeCampaigns, 'type' => CRM_Utils_Type::T_INT);
$this->_columns['civicrm_contribution']['order_bys']['campaign_id'] = array('title' => ts('Campaign'));
}
$this->_currencyColumn = 'civicrm_contribution_currency';
parent::__construct();
}
示例13: buildQuickForm
/**
* This function provides the HTML form elements that are specific
* to the Individual Contact Type
*
* @param CRM_Core_Form $form form object
* @param int $inlineEditMode ( 1 for contact summary
* top bar form and 2 for display name edit )
*
* @access public
* @return void
*/
public static function buildQuickForm(&$form, $inlineEditMode = NULL)
{
$form->applyFilter('__ALL__', 'trim');
if (!$inlineEditMode || $inlineEditMode == 1) {
$nameFields = CRM_Core_BAO_Setting::valueOptions(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'contact_edit_options', TRUE, NULL, FALSE, 'name', TRUE, 'AND v.filter = 2');
//prefix
$prefix = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'prefix_id');
if (isset($nameFields['Prefix']) && !empty($prefix)) {
$form->addSelect('prefix_id', array('class' => 'four', 'placeholder' => ' '));
}
$attributes = CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact');
if (isset($nameFields['Formal Title'])) {
$form->addElement('text', 'formal_title', ts('Title'), $attributes['formal_title']);
}
// first_name
if (isset($nameFields['First Name'])) {
$form->addElement('text', 'first_name', ts('First Name'), $attributes['first_name']);
}
//middle_name
if (isset($nameFields['Middle Name'])) {
$form->addElement('text', 'middle_name', ts('Middle Name'), $attributes['middle_name']);
}
// last_name
if (isset($nameFields['Last Name'])) {
$form->addElement('text', 'last_name', ts('Last Name'), $attributes['last_name']);
}
// suffix
$suffix = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'suffix_id');
if (isset($nameFields['Suffix']) && $suffix) {
$form->addSelect('suffix_id', array('class' => 'four', 'placeholder' => ' '));
}
}
if (!$inlineEditMode || $inlineEditMode == 2) {
// nick_name
$form->addElement('text', 'nick_name', ts('Nickname'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'nick_name'));
// job title
// override the size for UI to look better
$attributes['job_title']['size'] = 30;
$form->addElement('text', 'job_title', ts('Job Title'), $attributes['job_title'], 'size="30"');
//Current Employer Element
$employerDataURL = CRM_Utils_System::url('civicrm/ajax/rest', 'className=CRM_Contact_Page_AJAX&fnName=getContactList&json=1&context=contact&org=1&employee_id=' . $form->_contactId, FALSE, NULL, FALSE);
$form->assign('employerDataURL', $employerDataURL);
$form->addElement('text', 'current_employer', ts('Current Employer'), '');
$form->addElement('hidden', 'current_employer_id', '', array('id' => 'current_employer_id'));
$form->addElement('text', 'contact_source', ts('Source'), CRM_Utils_Array::value('source', $attributes));
}
if (!$inlineEditMode) {
$checkSimilar = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'contact_ajax_check_similar', NULL, TRUE);
if ($checkSimilar == null) {
$checkSimilar = 0;
}
$form->assign('checkSimilar', $checkSimilar);
//External Identifier Element
$form->add('text', 'external_identifier', ts('External Id'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'external_identifier'), FALSE);
$form->addRule('external_identifier', ts('External ID already exists in Database.'), 'objectExists', array('CRM_Contact_DAO_Contact', $form->_contactId, 'external_identifier'));
$config = CRM_Core_Config::singleton();
CRM_Core_ShowHideBlocks::links($form, 'demographics', '', '');
}
}
示例14: __construct
/**
*/
public function __construct()
{
$this->_autoIncludeIndexedFieldsAsOrderBys = 1;
$this->_columns = array('civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array_merge($this->getBasicContactFields(), array('modified_date' => array('title' => ts('Modified Date'), 'default' => FALSE))), 'filters' => array('sort_name' => array('title' => ts('Contact Name')), 'source' => array('title' => ts('Contact Source'), 'type' => CRM_Utils_Type::T_STRING), 'id' => array('title' => ts('Contact ID'), 'no_display' => TRUE), 'gender_id' => array('title' => ts('Gender'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id')), 'birth_date' => array('title' => ts('Birth Date'), 'operatorType' => CRM_Report_Form::OP_DATE), 'contact_type' => array('title' => ts('Contact Type')), 'contact_sub_type' => array('title' => ts('Contact Subtype')), 'modified_date' => array('title' => ts('Modified Date'), 'operatorType' => CRM_Report_Form::OP_DATE, 'type' => CRM_Utils_Type::T_DATE)), 'grouping' => 'contact-fields', 'order_bys' => array('sort_name' => array('title' => ts('Last Name, First Name'), 'default' => '1', 'default_weight' => '0', 'default_order' => 'ASC'), 'first_name' => array('name' => 'first_name', 'title' => ts('First Name')), 'gender_id' => array('name' => 'gender_id', 'title' => ts('Gender')), 'birth_date' => array('name' => 'birth_date', 'title' => ts('Birth Date')), 'contact_type' => array('title' => ts('Contact Type')), 'contact_sub_type' => array('title' => ts('Contact Subtype')))), 'civicrm_email' => array('dao' => 'CRM_Core_DAO_Email', 'fields' => array('email' => array('title' => ts('Email'), 'no_repeat' => TRUE)), 'grouping' => 'contact-fields', 'order_bys' => array('email' => array('title' => ts('Email')))), 'civicrm_phone' => array('dao' => 'CRM_Core_DAO_Phone', 'fields' => array('phone' => NULL, 'phone_ext' => array('title' => ts('Phone Extension'))), 'grouping' => 'contact-fields')) + $this->getAddressColumns(array('group_by' => FALSE));
$this->_groupFilter = TRUE;
$this->_tagFilter = TRUE;
parent::__construct();
}
示例15: run
/**
* Run the page.
*
* This method is called after the page is created.
*/
public function run()
{
// get the emails for this contact
$contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE, NULL, $_REQUEST);
$locBlockNo = CRM_Utils_Request::retrieve('locno', 'Positive', CRM_Core_DAO::$_nullObject, TRUE, NULL, $_REQUEST);
$addressId = CRM_Utils_Request::retrieve('aid', 'Positive', CRM_Core_DAO::$_nullObject, FALSE, NULL, $_REQUEST);
$address = array();
if ($addressId > 0) {
$locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id', array('labelColumn' => 'display_name'));
$entityBlock = array('id' => $addressId);
$address = CRM_Core_BAO_Address::getValues($entityBlock, FALSE, 'id');
if (!empty($address)) {
foreach ($address as $key => &$value) {
$value['location_type'] = $locationTypes[$value['location_type_id']];
}
}
}
// we just need current address block
$currentAddressBlock['address'][$locBlockNo] = array_pop($address);
if (!empty($currentAddressBlock['address'][$locBlockNo])) {
// get contact name of shared contact names
$sharedAddresses = array();
$shareAddressContactNames = CRM_Contact_BAO_Contact_Utils::getAddressShareContactNames($currentAddressBlock['address']);
foreach ($currentAddressBlock['address'] as $key => $addressValue) {
if (!empty($addressValue['master_id']) && !$shareAddressContactNames[$addressValue['master_id']]['is_deleted']) {
$sharedAddresses[$key]['shared_address_display'] = array('address' => $addressValue['display'], 'name' => $shareAddressContactNames[$addressValue['master_id']]['name']);
}
}
$idValue = $currentAddressBlock['address'][$locBlockNo]['id'];
if (!empty($currentAddressBlock['address'][$locBlockNo]['master_id'])) {
$idValue = $currentAddressBlock['address'][$locBlockNo]['master_id'];
}
// add custom data of type address
$groupTree = CRM_Core_BAO_CustomGroup::getTree('Address', $this, $idValue);
// we setting the prefix to dnc_ below so that we don't overwrite smarty's grouptree var.
$currentAddressBlock['address'][$locBlockNo]['custom'] = CRM_Core_BAO_CustomGroup::buildCustomDataView($this, $groupTree, FALSE, NULL, "dnc_");
$this->assign("dnc_viewCustomData", NULL);
$this->assign('add', $currentAddressBlock['address'][$locBlockNo]);
$this->assign('sharedAddresses', $sharedAddresses);
}
$contact = new CRM_Contact_BAO_Contact();
$contact->id = $contactId;
$contact->find(TRUE);
$privacy = array();
foreach (CRM_Contact_BAO_Contact::$_commPrefs as $name) {
if (isset($contact->{$name})) {
$privacy[$name] = $contact->{$name};
}
}
$this->assign('contactId', $contactId);
$this->assign('locationIndex', $locBlockNo);
$this->assign('addressId', $addressId);
$this->assign('privacy', $privacy);
// check logged in user permission
CRM_Contact_Page_View::checkUserPermission($this, $contactId);
// finally call parent
parent::run();
}