本文整理汇总了PHP中CRM_Event_BAO_Participant::update_note方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Event_BAO_Participant::update_note方法的具体用法?PHP CRM_Event_BAO_Participant::update_note怎么用?PHP CRM_Event_BAO_Participant::update_note使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Event_BAO_Participant
的用法示例。
在下文中一共展示了CRM_Event_BAO_Participant::update_note方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: registerParticipant
/**
* @param array $params
* @param $participant
* @param $event
*
* @return mixed
*/
public function registerParticipant($params, &$participant, $event)
{
$transaction = new CRM_Core_Transaction();
// handle register date CRM-4320
$registerDate = date('YmdHis');
$participantParams = array('id' => $participant->id, 'event_id' => $event->id, 'register_date' => $registerDate, 'source' => CRM_Utils_Array::value('participant_source', $params, $this->description), 'is_pay_later' => $this->is_pay_later, 'fee_amount' => CRM_Utils_Array::value('amount', $params, 0), 'fee_currency' => CRM_Utils_Array::value('currencyID', $params));
if ($participant->must_wait) {
$participant_status = 'On waitlist';
} elseif (CRM_Utils_Array::value('is_pay_later', $params, FALSE)) {
$participant_status = 'Pending from pay later';
} else {
$participant_status = 'Registered';
}
$participant_statuses = CRM_Event_PseudoConstant::participantStatus();
$participantParams['status_id'] = array_search($participant_status, $participant_statuses);
$participant_status_label = CRM_Utils_Array::value($participantParams['status_id'], CRM_Event_PseudoConstant::participantStatus(NULL, NULL, 'label'));
$participantParams['participant_status'] = $participant_status_label;
$this->assign('isOnWaitlist', $participant->must_wait);
if ($this->_action & CRM_Core_Action::PREVIEW || CRM_Utils_Array::value('mode', $params) == 'test') {
$participantParams['is_test'] = 1;
} else {
$participantParams['is_test'] = 0;
}
if (self::is_administrator()) {
if (!empty($params['note'])) {
$note_params = array('participant_id' => $participant->id, 'contact_id' => self::getContactID(), 'note' => $params['note']);
CRM_Event_BAO_Participant::update_note($note_params);
}
}
$participant->copyValues($participantParams);
$participant->save();
if (!empty($params['contributionID'])) {
$payment_params = array('participant_id' => $participant->id, 'contribution_id' => $params['contributionID']);
$ids = array();
$paymentParticpant = CRM_Event_BAO_ParticipantPayment::create($payment_params, $ids);
}
$transaction->commit();
$event_values = array();
CRM_Core_DAO::storeValues($event, $event_values);
$location = array();
if (CRM_Utils_Array::value('is_show_location', $event_values) == 1) {
$locationParams = array('entity_id' => $participant->event_id, 'entity_table' => 'civicrm_event');
$location = CRM_Core_BAO_Location::getValues($locationParams, TRUE);
CRM_Core_BAO_Address::fixAddress($location['address'][1]);
}
list($pre_id, $post_id) = CRM_Event_Cart_Form_MerParticipant::get_profile_groups($participant->event_id);
$payer_values = array('email' => '', 'name' => '');
if ($this->payer_contact_id) {
$payer_contact_details = CRM_Contact_BAO_Contact::getContactDetails($this->payer_contact_id);
$payer_values = array('email' => $payer_contact_details[1], 'name' => $payer_contact_details[0]);
}
$values = array('params' => array($participant->id => $participantParams), 'event' => $event_values, 'location' => $location, 'custom_pre_id' => $pre_id, 'custom_post_id' => $post_id, 'payer' => $payer_values);
CRM_Event_BAO_Event::sendMail($participant->contact_id, $values, $participant->id);
return $participant;
}