本文整理汇总了PHP中CRM_Core_BAO_Location::getValues方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_Location::getValues方法的具体用法?PHP CRM_Core_BAO_Location::getValues怎么用?PHP CRM_Core_BAO_Location::getValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_BAO_Location
的用法示例。
在下文中一共展示了CRM_Core_BAO_Location::getValues方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: civicrm_api3_domain_get
/**
* Get CiviCRM domain details
* {@getfields domain_create}
* @example DomainGet.php
*/
function civicrm_api3_domain_get($params)
{
$params['version'] = CRM_Utils_Array::value('domain_version', $params);
unset($params['version']);
$bao = new CRM_Core_BAO_Domain();
if (CRM_Utils_Array::value('current_domain', $params)) {
$domainBAO = CRM_Core_Config::domainID();
$params['id'] = $domainBAO;
}
_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'])) {
$values = array();
$locparams = array('contact_id' => $domain['contact_id']);
$values['location'] = CRM_Core_BAO_Location::getValues($locparams, TRUE);
$address_array = array('street_address', 'supplemental_address_1', 'supplemental_address_2', 'city', 'state_province_id', 'postal_code', 'country_id', 'geo_code_1', 'geo_code_2');
if (!empty($values['location']['email'])) {
$domain['domain_email'] = CRM_Utils_Array::value('email', $values['location']['email'][1]);
}
if (!empty($values['location']['phone'])) {
$domain['domain_phone'] = array('phone_type' => CRM_Core_PseudoConstant::getLabel('CRM_Core_BAO_Phone', 'phone_type_id', CRM_Utils_Array::value('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, $values['location']['address'][1]);
}
}
list($domain['from_name'], $domain['from_email']) = CRM_Core_BAO_Domain::getNameAndEmail(TRUE);
$domains[$domain['id']] = array_merge($domains[$domain['id']], $domain);
}
}
return civicrm_api3_create_success($domains, $params, 'domain', 'get', $bao);
}
示例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, $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;
}
示例3: preProcess
/**
* Function to set variables up before form is built
*
* @return void
* @access public
*/
function preProcess()
{
parent::preProcess();
$this->_values = $this->get('values');
if ($this->_id && empty($this->_values)) {
//get location values.
$params = array('entity_id' => $this->_id, 'entity_table' => 'civicrm_event');
$this->_values = CRM_Core_BAO_Location::getValues($params);
//get event values.
$params = array('id' => $this->_id);
CRM_Event_BAO_Event::retrieve($params, $this->_values);
$this->set('values', $this->_values);
}
//location blocks.
CRM_Contact_Form_Location::preProcess($this);
}
示例4: civicrm_domain_get
/**
* Generic file to retrieve all the constants and
* pseudo constants used in CiviCRM
*
*/
function civicrm_domain_get()
{
require_once 'CRM/Core/BAO/Domain.php';
$dao = CRM_Core_BAO_Domain::getDomain();
$values = array();
$params = array('entity_id' => $dao->id, 'entity_table' => 'civicrm_domain');
require_once 'CRM/Core/BAO/Location.php';
$values['location'] = CRM_Core_BAO_Location::getValues($params, true);
$address_array = array('street_address', 'supplemental_address_1', 'supplemental_address_2', 'city', 'state_province_id', 'postal_code', 'country_id', 'geo_code_1', 'geo_code_2');
require_once 'CRM/Core/OptionGroup.php';
$domain[$dao->id] = array('id' => $dao->id, 'domain_name' => $dao->name, 'description' => $dao->description, 'domain_email' => CRM_Utils_Array::value('email', $values['location']['email'][1]), 'domain_phone' => array('phone_type' => CRM_Core_OptionGroup::getLabel('phone_type', CRM_Utils_Array::value('phone_type_id', $values['location']['phone'][1])), 'phone' => CRM_Utils_Array::value('phone', $values['location']['phone'][1])));
foreach ($address_array as $value) {
$domain[$dao->id]['domain_address'][$value] = CRM_Utils_Array::value($value, $values['location']['address'][1]);
}
list($domain[$dao->id]['from_name'], $domain[$dao->id]['from_email']) = CRM_Core_BAO_Domain::getNameAndEmail();
return $domain;
}
示例5: 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;
}
示例6: ON
/**
* function to get the information to map a event
*
* @param $id
*
* @internal param array $ids the list of ids for which we want map info
*
* @return null|string title of the event
* @static
* @access public
*/
static function &getMapInfo(&$id)
{
$sql = "\nSELECT\n civicrm_event.id AS event_id,\n civicrm_event.title AS display_name,\n civicrm_address.street_address AS street_address,\n civicrm_address.city AS city,\n civicrm_address.postal_code AS postal_code,\n civicrm_address.postal_code_suffix AS postal_code_suffix,\n civicrm_address.geo_code_1 AS latitude,\n civicrm_address.geo_code_2 AS longitude,\n civicrm_state_province.abbreviation AS state,\n civicrm_country.name AS country,\n civicrm_location_type.name AS location_type\nFROM\n civicrm_event\n LEFT JOIN civicrm_loc_block ON ( civicrm_event.loc_block_id = civicrm_loc_block.id )\n LEFT JOIN civicrm_address ON ( civicrm_loc_block.address_id = civicrm_address.id )\n LEFT JOIN civicrm_state_province ON ( civicrm_address.state_province_id = civicrm_state_province.id )\n LEFT JOIN civicrm_country ON civicrm_address.country_id = civicrm_country.id\n LEFT JOIN civicrm_location_type ON ( civicrm_location_type.id = civicrm_address.location_type_id )\nWHERE civicrm_address.geo_code_1 IS NOT NULL\n AND civicrm_address.geo_code_2 IS NOT NULL\n AND civicrm_event.id = " . CRM_Utils_Type::escape($id, 'Integer');
$dao = new CRM_Core_DAO();
$dao->query($sql);
$locations = array();
$config = CRM_Core_Config::singleton();
while ($dao->fetch()) {
$location = array();
$location['displayName'] = addslashes($dao->display_name);
$location['lat'] = $dao->latitude;
$location['marker_class'] = 'Event';
$location['lng'] = $dao->longitude;
$params = array('entity_id' => $id, 'entity_table' => 'civicrm_event');
$addressValues = CRM_Core_BAO_Location::getValues($params, TRUE);
$location['address'] = str_replace(array("\r", "\n"), '', addslashes(nl2br($addressValues['address'][1]['display_text'])));
$location['url'] = CRM_Utils_System::url('civicrm/event/register', 'reset=1&id=' . $dao->event_id);
$location['location_type'] = $dao->location_type;
$eventImage = '<img src="' . $config->resourceBase . 'i/contact_org.gif" alt="Organization " height="20" width="15" />';
$location['image'] = $eventImage;
$location['displayAddress'] = str_replace('<br />', ', ', $location['address']);
$locations[] = $location;
}
return $locations;
}
示例7: emailReceipt
/**
* @param array $params
*
* @return mixed
*/
public function emailReceipt(&$params)
{
// email receipt sending
// send message template
if ($this->_component == 'event') {
$eventId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Participant', $this->_id, 'event_id', 'id');
$returnProperties = array('fee_label', 'start_date', 'end_date', 'is_show_location', 'title');
CRM_Core_DAO::commonRetrieveAll('CRM_Event_DAO_Event', 'id', $eventId, $events, $returnProperties);
$event = $events[$eventId];
unset($event['start_date']);
unset($event['end_date']);
$this->assign('event', $event);
$this->assign('isShowLocation', $event['is_show_location']);
if (CRM_Utils_Array::value('is_show_location', $event) == 1) {
$locationParams = array('entity_id' => $eventId, 'entity_table' => 'civicrm_event');
$location = CRM_Core_BAO_Location::getValues($locationParams, TRUE);
$this->assign('location', $location);
}
}
// assign payment info here
$paymentConfig['confirm_email_text'] = CRM_Utils_Array::value('confirm_email_text', $params);
$this->assign('paymentConfig', $paymentConfig);
$isRefund = $this->_paymentType == 'refund' ? TRUE : FALSE;
$this->assign('isRefund', $isRefund);
if ($isRefund) {
$this->assign('totalPaid', $this->_amtPaid);
$this->assign('totalAmount', $this->_amtTotal);
$this->assign('refundAmount', $params['total_amount']);
} else {
$balance = $this->_amtTotal - ($this->_amtPaid + $params['total_amount']);
$paymentsComplete = $balance == 0 ? 1 : 0;
$this->assign('amountOwed', $balance);
$this->assign('totalAmount', $this->_amtTotal);
$this->assign('paymentAmount', $params['total_amount']);
$this->assign('paymentsComplete', $paymentsComplete);
}
$this->assign('contactDisplayName', $this->_contributorDisplayName);
// assign trxn details
$this->assign('trxn_id', CRM_Utils_Array::value('trxn_id', $params));
$this->assign('receive_date', CRM_Utils_Array::value('trxn_date', $params));
$paymentInstrument = CRM_Contribute_PseudoConstant::paymentInstrument();
if (array_key_exists('payment_instrument_id', $params)) {
$this->assign('paidBy', CRM_Utils_Array::value($params['payment_instrument_id'], $paymentInstrument));
}
$this->assign('checkNumber', CRM_Utils_Array::value('check_number', $params));
$sendTemplateParams = array('groupName' => 'msg_tpl_workflow_contribution', 'valueName' => 'payment_or_refund_notification', 'contactId' => $this->_contactId, 'PDFFilename' => ts('notification') . '.pdf');
// try to send emails only if email id is present
// and the do-not-email option is not checked for that contact
if ($this->_contributorEmail && !$this->_toDoNotEmail) {
if (array_key_exists($params['from_email_address'], $this->_fromEmails['from_email_id'])) {
$receiptFrom = $params['from_email_address'];
}
$sendTemplateParams['from'] = $receiptFrom;
$sendTemplateParams['toName'] = $this->_contributorDisplayName;
$sendTemplateParams['toEmail'] = $this->_contributorEmail;
$sendTemplateParams['cc'] = CRM_Utils_Array::value('cc', $this->_fromEmails);
$sendTemplateParams['bcc'] = CRM_Utils_Array::value('bcc', $this->_fromEmails);
}
list($mailSent, $subject, $message, $html) = CRM_Core_BAO_MessageTemplate::sendTemplate($sendTemplateParams);
return $mailSent;
}
示例8: getPrimaryLocationType
/**
* Return the primary location type of a contact.
*
* $params int $contactId contact_id
* $params boolean $isPrimaryExist if true, return primary contact location type otherwise null
* $params boolean $skipDefaultPriamry if true, return primary contact location type otherwise null
*
* @param int $contactId
* @param bool $skipDefaultPriamry
* @param null $block
*
* @return int
* $locationType location_type_id
*/
public static function getPrimaryLocationType($contactId, $skipDefaultPriamry = FALSE, $block = NULL)
{
if ($block) {
$entityBlock = array('contact_id' => $contactId);
$blocks = CRM_Core_BAO_Location::getValues($entityBlock);
foreach ($blocks[$block] as $key => $value) {
if (!empty($value['is_primary'])) {
$locationType = CRM_Utils_Array::value('location_type_id', $value);
}
}
} else {
$query = "\nSELECT\n IF ( civicrm_email.location_type_id IS NULL,\n IF ( civicrm_address.location_type_id IS NULL,\n IF ( civicrm_phone.location_type_id IS NULL,\n IF ( civicrm_im.location_type_id IS NULL,\n IF ( civicrm_openid.location_type_id IS NULL, null, civicrm_openid.location_type_id)\n ,civicrm_im.location_type_id)\n ,civicrm_phone.location_type_id)\n ,civicrm_address.location_type_id)\n ,civicrm_email.location_type_id) as locationType\nFROM civicrm_contact\n LEFT JOIN civicrm_email ON ( civicrm_email.is_primary = 1 AND civicrm_email.contact_id = civicrm_contact.id )\n LEFT JOIN civicrm_address ON ( civicrm_address.is_primary = 1 AND civicrm_address.contact_id = civicrm_contact.id)\n LEFT JOIN civicrm_phone ON ( civicrm_phone.is_primary = 1 AND civicrm_phone.contact_id = civicrm_contact.id)\n LEFT JOIN civicrm_im ON ( civicrm_im.is_primary = 1 AND civicrm_im.contact_id = civicrm_contact.id)\n LEFT JOIN civicrm_openid ON ( civicrm_openid.is_primary = 1 AND civicrm_openid.contact_id = civicrm_contact.id)\nWHERE civicrm_contact.id = %1 ";
$params = array(1 => array($contactId, 'Integer'));
$dao = CRM_Core_DAO::executeQuery($query, $params);
$locationType = NULL;
if ($dao->fetch()) {
$locationType = $dao->locationType;
}
}
if (isset($locationType)) {
return $locationType;
} elseif ($skipDefaultPriamry) {
// if there is no primary contact location then return null
return NULL;
} else {
// if there is no primart contact location, then return default
// location type of the system
$defaultLocationType = CRM_Core_BAO_LocationType::getDefault();
return $defaultLocationType->id;
}
}
示例9: browse
/**
* browse all events
*
* @return void
*/
function browse()
{
$this->_sortByCharacter = CRM_Utils_Request::retrieve('sortByCharacter', 'String', $this);
if ($this->_sortByCharacter == 1 || !empty($_POST)) {
$this->_sortByCharacter = '';
$this->set('sortByCharacter', '');
}
$this->_force = null;
$this->_searchResult = null;
$this->search();
$config =& CRM_Core_Config::singleton();
$params = array();
$this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, false);
$this->_searchResult = CRM_Utils_Request::retrieve('searchResult', 'Boolean', $this);
$whereClause = $this->whereClause($params, false, $this->_force);
$this->pagerAToZ($whereClause, $params);
$params = array();
$whereClause = $this->whereClause($params, true, $this->_force);
$whereClause .= ' AND (is_template = 0 OR is_template IS NULL)';
// because is_template != 1 would be to simple
$this->pager($whereClause, $params);
list($offset, $rowCount) = $this->_pager->getOffsetAndRowCount();
// get all custom groups sorted by weight
$manageEvent = array();
$query = "\n SELECT *\n FROM civicrm_event\n WHERE {$whereClause}\nORDER BY start_date desc\n LIMIT {$offset}, {$rowCount}";
$dao = CRM_Core_DAO::executeQuery($query, $params, true, 'CRM_Event_DAO_Event');
$permissions = CRM_Event_BAO_Event::checkPermission();
while ($dao->fetch()) {
if (in_array($dao->id, $permissions[CRM_Core_Permission::VIEW])) {
$manageEvent[$dao->id] = array();
CRM_Core_DAO::storeValues($dao, $manageEvent[$dao->id]);
// form all action links
$action = array_sum(array_keys($this->links()));
if ($dao->is_active) {
$action -= CRM_Core_Action::ENABLE;
} else {
$action -= CRM_Core_Action::DISABLE;
}
if (!in_array($dao->id, $permissions[CRM_Core_Permission::DELETE])) {
$action -= CRM_Core_Action::DELETE;
}
if (!in_array($dao->id, $permissions[CRM_Core_Permission::EDIT])) {
$action -= CRM_Core_Action::UPDATE;
}
$manageEvent[$dao->id]['action'] = CRM_Core_Action::formLink(self::links(), $action, array('id' => $dao->id));
$params = array('entity_id' => $dao->id, 'entity_table' => 'civicrm_event');
require_once 'CRM/Core/BAO/Location.php';
$defaults['location'] = CRM_Core_BAO_Location::getValues($params, true);
if (isset($defaults['location']['address'][1]['city'])) {
$manageEvent[$dao->id]['city'] = $defaults['location']['address'][1]['city'];
}
if (isset($defaults['location']['address'][1]['state_province_id'])) {
$manageEvent[$dao->id]['state_province'] = CRM_Core_PseudoConstant::stateProvince($defaults['location']['address'][1]['state_province_id']);
}
}
}
$this->assign('rows', $manageEvent);
}
示例10: completeTransaction
//.........这里部分代码省略.........
$logStartDate = CRM_Utils_Date::isoToMysql($logStartDate);
}
$membershipLog['start_date'] = $logStartDate;
$membershipLog['membership_id'] = $membership->id;
$membershipLog['modified_id'] = $membership->contact_id;
$membershipLog['modified_date'] = date('Ymd');
$membershipLog['membership_type_id'] = $membership->membership_type_id;
CRM_Member_BAO_MembershipLog::add($membershipLog, CRM_Core_DAO::$_nullArray);
//update related Memberships.
CRM_Member_BAO_Membership::updateRelatedMemberships($membership->id, $formatedParams);
//update the membership type key of membership relatedObjects array
//if it has changed after membership update
if ($membershipTypeIdKey != $membership->membership_type_id) {
$membershipsUpdate[$membership->membership_type_id] = $membership;
$contribution->_relatedObjects['membership'][$membership->membership_type_id] = $membership;
unset($contribution->_relatedObjects['membership'][$membershipTypeIdKey]);
unset($memberships[$membershipTypeIdKey]);
}
}
}
//update the memberships object with updated membershipTypeId data
//if membershipTypeId has changed after membership update
if (!empty($membershipsUpdate)) {
$memberships = $memberships + $membershipsUpdate;
}
}
} else {
// event
$eventParams = array('id' => $objects['event']->id);
$values['event'] = array();
CRM_Event_BAO_Event::retrieve($eventParams, $values['event']);
//get location details
$locationParams = array('entity_id' => $objects['event']->id, 'entity_table' => 'civicrm_event');
$values['location'] = CRM_Core_BAO_Location::getValues($locationParams);
$ufJoinParams = array('entity_table' => 'civicrm_event', 'entity_id' => $ids['event'], 'module' => 'CiviEvent');
list($custom_pre_id, $custom_post_ids) = CRM_Core_BAO_UFJoin::getUFGroupIds($ufJoinParams);
$values['custom_pre_id'] = $custom_pre_id;
$values['custom_post_id'] = $custom_post_ids;
//for tasks 'Change Participant Status' and 'Batch Update Participants Via Profile' case
//and cases involving status updation through ipn
$values['totalAmount'] = $input['amount'];
$contribution->source = ts('Online Event Registration') . ': ' . $values['event']['title'];
if ($values['event']['is_email_confirm']) {
$contribution->receipt_date = self::$_now;
$values['is_email_receipt'] = 1;
}
if (!CRM_Utils_Array::value('skipComponentSync', $input)) {
$participant->status_id = 1;
}
$participant->save();
}
if (CRM_Utils_Array::value('net_amount', $input, 0) == 0 && CRM_Utils_Array::value('fee_amount', $input, 0) != 0) {
$input['net_amount'] = $input['amount'] - $input['fee_amount'];
}
// This complete transaction function is being overloaded to create new contributions too.
// here we record if it is a new contribution.
// @todo separate the 2 more appropriately.
$isNewContribution = FALSE;
if (empty($contribution->id)) {
$isNewContribution = TRUE;
if (!empty($input['amount']) && $input['amount'] != $contribution->total_amount) {
$contribution->total_amount = $input['amount'];
// The BAO does this stuff but we are actually kinda bypassing it here (bad code! go sit in the corner)
// so we have to handle net_amount in this (naughty) code.
if (isset($input['fee_amount']) && is_numeric($input['fee_amount'])) {
$contribution->fee_amount = $input['fee_amount'];
示例11: array
/**
* Get the location values of a domain
*
* @param NULL
*
* @return array Location::getValues
* @access public
*/
function &getLocationValues()
{
if ($this->_location == null) {
$params = array('entity_id' => $this->id, 'entity_table' => self::getTableName());
$this->_location = CRM_Core_BAO_Location::getValues($params, true);
if (empty($this->_location)) {
$this->_location = null;
}
}
return $this->_location;
}
示例12: postProcess
//.........这里部分代码省略.........
if (!empty($params['send_receipt'])) {
if (array_key_exists($params['from_email_address'], $this->_fromEmails['from_email_id'])) {
$receiptFrom = $params['from_email_address'];
}
$this->assign('module', 'Event Registration');
//use of the message template below requires variables in different format
$event = $events = array();
$returnProperties = array('fee_label', 'start_date', 'end_date', 'is_show_location', 'title');
//get all event details.
CRM_Core_DAO::commonRetrieveAll('CRM_Event_DAO_Event', 'id', $params['event_id'], $events, $returnProperties);
$event = $events[$params['event_id']];
unset($event['start_date']);
unset($event['end_date']);
$role = CRM_Event_PseudoConstant::participantRole();
$participantRoles = CRM_Utils_Array::value('role_id', $params);
if (is_array($participantRoles)) {
$selectedRoles = array();
foreach ($participantRoles as $roleId) {
$selectedRoles[] = $role[$roleId];
}
$event['participant_role'] = implode(', ', $selectedRoles);
} else {
$event['participant_role'] = CRM_Utils_Array::value($participantRoles, $role);
}
$event['is_monetary'] = $this->_isPaidEvent;
if ($params['receipt_text']) {
$event['confirm_email_text'] = $params['receipt_text'];
}
$this->assign('isAmountzero', 1);
$this->assign('event', $event);
$this->assign('isShowLocation', $event['is_show_location']);
if (CRM_Utils_Array::value('is_show_location', $event) == 1) {
$locationParams = array('entity_id' => $params['event_id'], 'entity_table' => 'civicrm_event');
$location = CRM_Core_BAO_Location::getValues($locationParams, TRUE);
$this->assign('location', $location);
}
$status = CRM_Event_PseudoConstant::participantStatus();
if ($this->_isPaidEvent) {
$paymentInstrument = CRM_Contribute_PseudoConstant::paymentInstrument();
if (!$this->_mode) {
if (isset($params['payment_instrument_id'])) {
$this->assign('paidBy', CRM_Utils_Array::value($params['payment_instrument_id'], $paymentInstrument));
}
}
$this->assign('totalAmount', $contributionParams['total_amount']);
if (isset($contributionParams['partial_payment_total'])) {
// balance amount
$balanceAmount = $contributionParams['partial_payment_total'] - $contributionParams['partial_amount_pay'];
$this->assign('balanceAmount', $balanceAmount);
}
$this->assign('isPrimary', 1);
$this->assign('checkNumber', CRM_Utils_Array::value('check_number', $params));
}
if ($this->_mode) {
if (!empty($params['billing_first_name'])) {
$name = $params['billing_first_name'];
}
if (!empty($params['billing_middle_name'])) {
$name .= " {$params['billing_middle_name']}";
}
if (!empty($params['billing_last_name'])) {
$name .= " {$params['billing_last_name']}";
}
$this->assign('billingName', $name);
// assign the address formatted up for display
$addressParts = array("street_address-{$this->_bltID}", "city-{$this->_bltID}", "postal_code-{$this->_bltID}", "state_province-{$this->_bltID}", "country-{$this->_bltID}");
示例13: transitionParticipants
/**
* Function takes participant ids and statuses
* update status from $fromStatusId to $toStatusId
* and send mail + create activities.
*
* @param array $participantIds
* Participant ids.
* @param int $toStatusId
* Update status id.
* @param int $fromStatusId
* From status id.
* @param bool $returnResult
* @param bool $skipCascadeRule
*
* @return array|NULL
*/
public static function transitionParticipants($participantIds, $toStatusId, $fromStatusId = NULL, $returnResult = FALSE, $skipCascadeRule = FALSE)
{
if (!is_array($participantIds) || empty($participantIds) || !$toStatusId) {
return NULL;
}
//thumb rule is if we triggering primary participant need to triggered additional
$allParticipantIds = $primaryANDAdditonalIds = array();
foreach ($participantIds as $id) {
$allParticipantIds[] = $id;
if (self::isPrimaryParticipant($id)) {
//filter additional as per status transition rules, CRM-5403
if ($skipCascadeRule) {
$additionalIds = self::getAdditionalParticipantIds($id);
} else {
$additionalIds = self::getValidAdditionalIds($id, $fromStatusId, $toStatusId);
}
if (!empty($additionalIds)) {
$allParticipantIds = array_merge($allParticipantIds, $additionalIds);
$primaryANDAdditonalIds[$id] = $additionalIds;
}
}
}
//get the unique participant ids,
$allParticipantIds = array_unique($allParticipantIds);
//pull required participants, contacts, events data, if not in hand
static $eventDetails = array();
static $domainValues = array();
static $contactDetails = array();
$contactIds = $eventIds = $participantDetails = array();
$statusTypes = CRM_Event_PseudoConstant::participantStatus();
$participantRoles = CRM_Event_PseudoConstant::participantRole();
$pendingStatuses = CRM_Event_PseudoConstant::participantStatus(NULL, "class = 'Pending'");
//first thing is pull all necessory data from db.
$participantIdClause = '(' . implode(',', $allParticipantIds) . ')';
//get all participants data.
$query = "SELECT * FROM civicrm_participant WHERE id IN {$participantIdClause}";
$dao = CRM_Core_DAO::executeQuery($query);
while ($dao->fetch()) {
$participantDetails[$dao->id] = array('id' => $dao->id, 'role' => $participantRoles[$dao->role_id], 'is_test' => $dao->is_test, 'event_id' => $dao->event_id, 'status_id' => $dao->status_id, 'fee_amount' => $dao->fee_amount, 'contact_id' => $dao->contact_id, 'register_date' => $dao->register_date, 'registered_by_id' => $dao->registered_by_id);
if (!array_key_exists($dao->contact_id, $contactDetails)) {
$contactIds[$dao->contact_id] = $dao->contact_id;
}
if (!array_key_exists($dao->event_id, $eventDetails)) {
$eventIds[$dao->event_id] = $dao->event_id;
}
}
//get the domain values.
if (empty($domainValues)) {
// making all tokens available to templates.
$domain = CRM_Core_BAO_Domain::getDomain();
$tokens = array('domain' => array('name', 'phone', 'address', 'email'), 'contact' => CRM_Core_SelectValues::contactTokens());
foreach ($tokens['domain'] as $token) {
$domainValues[$token] = CRM_Utils_Token::getDomainTokenReplacement($token, $domain);
}
}
//get all required contacts detail.
if (!empty($contactIds)) {
// get the contact details.
list($currentContactDetails) = CRM_Utils_Token::getTokenDetails($contactIds, NULL, FALSE, FALSE, NULL, array(), 'CRM_Event_BAO_Participant');
foreach ($currentContactDetails as $contactId => $contactValues) {
$contactDetails[$contactId] = $contactValues;
}
}
//get all required events detail.
if (!empty($eventIds)) {
foreach ($eventIds as $eventId) {
//retrieve event information
$eventParams = array('id' => $eventId);
CRM_Event_BAO_Event::retrieve($eventParams, $eventDetails[$eventId]);
//get default participant role.
$eventDetails[$eventId]['participant_role'] = CRM_Utils_Array::value($eventDetails[$eventId]['default_role_id'], $participantRoles);
//get the location info
$locParams = array('entity_id' => $eventId, 'entity_table' => 'civicrm_event');
$eventDetails[$eventId]['location'] = CRM_Core_BAO_Location::getValues($locParams, TRUE);
}
}
//now we are ready w/ all required data.
//take a decision as per statuses.
$emailType = NULL;
$toStatus = $statusTypes[$toStatusId];
$fromStatus = CRM_Utils_Array::value($fromStatusId, $statusTypes);
switch ($toStatus) {
case 'Pending from waitlist':
case 'Pending from approval':
//.........这里部分代码省略.........
示例14: cancelParticipant
/**
* Cancel this participant and finish, send cancellation email. At this point no
* auto-cancellation of payment is handled, so payment needs to be manually cancelled
*
* return @void
*/
public function cancelParticipant($params)
{
//set participant record status to Cancelled, refund payment if possible
// send email to participant and admin, and log Activity
$value = array();
$value['id'] = $this->_participant_id;
$cancelledId = array_search('Cancelled', CRM_Event_PseudoConstant::participantStatus(NULL, "class = 'Negative'"));
$value['status_id'] = $cancelledId;
CRM_Event_BAO_Participant::create($value);
$domainValues = array();
$domain = CRM_Core_BAO_Domain::getDomain();
$tokens = array('domain' => array('name', 'phone', 'address', 'email'), 'contact' => CRM_Core_SelectValues::contactTokens());
foreach ($tokens['domain'] as $token) {
$domainValues[$token] = CRM_Utils_Token::getDomainTokenReplacement($token, $domain);
}
$participantRoles = array();
$participantRoles = CRM_Event_PseudoConstant::participantRole();
$participantDetails = array();
$query = "SELECT * FROM civicrm_participant WHERE id = {$this->_participant_id}";
$dao = CRM_Core_DAO::executeQuery($query);
while ($dao->fetch()) {
$participantDetails[$dao->id] = array('id' => $dao->id, 'role' => $participantRoles[$dao->role_id], 'is_test' => $dao->is_test, 'event_id' => $dao->event_id, 'status_id' => $dao->status_id, 'fee_amount' => $dao->fee_amount, 'contact_id' => $dao->contact_id, 'register_date' => $dao->register_date, 'registered_by_id' => $dao->registered_by_id);
}
$eventDetails = array();
$eventParams = array('id' => $this->_event_id);
CRM_Event_BAO_Event::retrieve($eventParams, $eventDetails[$this->_event_id]);
//get default participant role.
$eventDetails[$this->_event_id]['participant_role'] = CRM_Utils_Array::value($eventDetails[$this->_event_id]['default_role_id'], $participantRoles);
//get the location info
$locParams = array('entity_id' => $this->_event_id, 'entity_table' => 'civicrm_event');
$eventDetails[$this->_event_id]['location'] = CRM_Core_BAO_Location::getValues($locParams, TRUE);
//get contact details
$contactIds[$this->_contact_id] = $this->_contact_id;
list($currentContactDetails) = CRM_Utils_Token::getTokenDetails($contactIds, NULL, FALSE, FALSE, NULL, array(), 'CRM_Event_BAO_Participant');
foreach ($currentContactDetails as $contactId => $contactValues) {
$contactDetails[$this->_contact_id] = $contactValues;
}
//send a 'cancelled' email to user, and cc the event's cc_confirm email
$mail = CRM_Event_BAO_Participant::sendTransitionParticipantMail($this->_participant_id, $participantDetails[$this->_participant_id], $eventDetails[$this->_event_id], $contactDetails[$this->_contact_id], $domainValues, "Cancelled", "");
$statusMsg = ts('Event registration information for %1 has been updated.', array(1 => $this->_contact_name));
$statusMsg .= ' ' . ts('A cancellation email has been sent to %1.', array(1 => $this->_contact_email));
CRM_Core_Session::setStatus($statusMsg, ts('Saved'), 'success');
$url = CRM_Utils_System::url('civicrm/event/info', "reset=1&id={$this->_event_id}&noFullMsg=true");
CRM_Utils_System::redirect($url);
}
示例15: getEventSummary
/**
* Function to get events Summary
*
* @static
* @return array Array of event summary values
*/
static function getEventSummary()
{
$eventSummary = $eventIds = array();
require_once 'CRM/Core/Config.php';
$config = CRM_Core_Config::singleton();
// We're fetching recent and upcoming events (where start date is 7 days ago OR later)
$query = "SELECT count(id) as total_events\n FROM civicrm_event e\n WHERE e.is_active=1 AND\n ( e.is_template IS NULL OR e.is_template = 0) AND\n e.start_date >= DATE_SUB( NOW(), INTERVAL 7 day );";
$dao =& CRM_Core_DAO::executeQuery($query, CRM_Core_DAO::$_nullArray);
if ($dao->fetch()) {
$eventSummary['total_events'] = $dao->total_events;
}
if (empty($eventSummary) || $dao->total_events == 0) {
return $eventSummary;
}
// Get the Id of Option Group for Event Types
require_once 'CRM/Core/DAO/OptionGroup.php';
$optionGroupDAO = new CRM_Core_DAO_OptionGroup();
$optionGroupDAO->name = 'event_type';
$optionGroupId = null;
if ($optionGroupDAO->find(true)) {
$optionGroupId = $optionGroupDAO->id;
}
$query = "\nSELECT civicrm_event.id as id, civicrm_event.title as event_title, civicrm_event.is_public as is_public,\n civicrm_event.max_participants as max_participants, civicrm_event.start_date as start_date,\n civicrm_event.end_date as end_date, civicrm_event.is_online_registration, civicrm_event.is_monetary, civicrm_event.is_show_location,civicrm_event.is_map as is_map, civicrm_option_value.label as event_type, civicrm_tell_friend.is_active as is_friend_active,\n civicrm_event.summary as summary\nFROM civicrm_event\nLEFT JOIN civicrm_option_value ON (\n civicrm_event.event_type_id = civicrm_option_value.value AND\n civicrm_option_value.option_group_id = %1 )\nLEFT JOIN civicrm_tell_friend ON ( civicrm_tell_friend.entity_id = civicrm_event.id AND civicrm_tell_friend.entity_table = 'civicrm_event' )\nWHERE civicrm_event.is_active = 1 AND\n ( civicrm_event.is_template IS NULL OR civicrm_event.is_template = 0) AND\n civicrm_event.start_date >= DATE_SUB( NOW(), INTERVAL 7 day )\nGROUP BY civicrm_event.id\nORDER BY civicrm_event.start_date ASC\nLIMIT 0, 10\n";
$eventParticipant = array();
$eventParticipant['participants'] = self::getParticipantCount();
$eventParticipant['notCountedParticipants'] = self::getParticipantCount(true, false, true, false);
$eventParticipant['notCountedDueToRole'] = self::getParticipantCount(false, false, true, false);
$eventParticipant['notCountedDueToStatus'] = self::getParticipantCount(true, false, false, false);
$properties = array('eventTitle' => 'event_title', 'isPublic' => 'is_public', 'maxParticipants' => 'max_participants', 'startDate' => 'start_date', 'endDate' => 'end_date', 'eventType' => 'event_type', 'isMap' => 'is_map', 'participants' => 'participants', 'notCountedDueToRole' => 'notCountedDueToRole', 'notCountedDueToStatus' => 'notCountedDueToStatus', 'notCountedParticipants' => 'notCountedParticipants');
$permissions = CRM_Event_BAO_Event::checkPermission();
$params = array(1 => array($optionGroupId, 'Integer'));
$dao = CRM_Core_DAO::executeQuery($query, $params);
while ($dao->fetch()) {
if (in_array($dao->id, $permissions[CRM_Core_Permission::VIEW])) {
foreach ($properties as $property => $name) {
$set = null;
switch ($name) {
case 'is_public':
if ($dao->{$name}) {
$set = 'Yes';
} else {
$set = 'No';
}
$eventSummary['events'][$dao->id][$property] = $set;
break;
case 'is_map':
if ($dao->{$name} && $config->mapAPIKey) {
$params = array();
$values = array();
$ids = array();
$params = array('entity_id' => $dao->id, 'entity_table' => 'civicrm_event');
require_once 'CRM/Core/BAO/Location.php';
$values['location'] = CRM_Core_BAO_Location::getValues($params, true);
if (is_numeric(CRM_Utils_Array::value('geo_code_1', $values['location']['address'][1])) || $config->mapGeoCoding && $values['location']['address'][1]['city'] && $values['location']['address'][1]['state_province_id']) {
$set = CRM_Utils_System::url('civicrm/contact/map/event', "reset=1&eid={$dao->id}");
}
}
$eventSummary['events'][$dao->id][$property] = $set;
if (in_array($dao->id, $permissions[CRM_Core_Permission::EDIT])) {
$eventSummary['events'][$dao->id]['configure'] = CRM_Utils_System::url("civicrm/admin/event", "action=update&id={$dao->id}&reset=1");
}
break;
case 'end_date':
case 'start_date':
$eventSummary['events'][$dao->id][$property] = CRM_Utils_Date::customFormat($dao->{$name}, null, array('d'));
break;
case 'participants':
case 'notCountedDueToRole':
case 'notCountedDueToStatus':
case 'notCountedParticipants':
$propertyCnt = 0;
if (CRM_Utils_Array::value($dao->id, $eventParticipant[$name])) {
$propertyCnt = $eventParticipant[$name][$dao->id];
if ($name == 'participants') {
$set = CRM_Utils_System::url('civicrm/event/search', "reset=1&force=1&event={$dao->id}&status=true&role=true");
} else {
if ($name == 'notCountedParticipants') {
// FIXME : selector fail to search w/ OR operator.
// $set = CRM_Utils_System::url( 'civicrm/event/search',
// "reset=1&force=1&event=$dao->id&status=false&role=false" );
} else {
if ($name == 'notCountedDueToStatus') {
$set = CRM_Utils_System::url('civicrm/event/search', "reset=1&force=1&event={$dao->id}&status=false");
} else {
$set = CRM_Utils_System::url('civicrm/event/search', "reset=1&force=1&event={$dao->id}&role=false");
}
}
}
}
$eventSummary['events'][$dao->id][$property] = $propertyCnt;
$eventSummary['events'][$dao->id][$name . '_url'] = $set;
break;
default:
$eventSummary['events'][$dao->id][$property] = $dao->{$name};
//.........这里部分代码省略.........