3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
16 * @copyright CiviCRM LLC https://civicrm.org/licensing
20 * This class generates form components for processing Event
23 class CRM_Event_Form_Registration_ThankYou
extends CRM_Event_Form_Registration
{
26 * Set variables up before form is built.
30 public function preProcess() {
32 $this->_params
= $this->get('params');
33 $this->_lineItem
= $this->get('lineItem');
34 $this->_part
= $this->get('part');
35 $this->_totalAmount
= $this->get('totalAmount');
36 $this->_receiveDate
= $this->get('receiveDate');
37 $this->_trxnId
= $this->get('trxnId');
38 $finalAmount = $this->get('finalAmount');
39 $this->assign('finalAmount', $finalAmount);
40 $participantInfo = $this->get('participantInfo');
41 $this->assign('part', $this->_part
);
42 $this->assign('participantInfo', $participantInfo);
43 $customGroup = $this->get('customProfile');
44 $this->assign('customProfile', $customGroup);
45 $this->assign('individual', $this->get('individual'));
47 CRM_Event_Form_Registration_Confirm
::assignProfiles($this);
49 CRM_Utils_System
::setTitle(CRM_Utils_Array
::value('thankyou_title', $this->_values
['event']));
53 * Overwrite action, since we are only showing elements in frozen mode
54 * no help display needed
58 public function getAction() {
59 if ($this->_action
& CRM_Core_Action
::PREVIEW
) {
60 return CRM_Core_Action
::VIEW | CRM_Core_Action
::PREVIEW
;
63 return CRM_Core_Action
::VIEW
;
68 * Build the form object.
72 public function buildQuickForm() {
73 // Assign the email address from a contact id lookup as in CRM_Event_BAO_Event->sendMail()
74 $primaryContactId = $this->get('primaryContactId');
75 if ($primaryContactId) {
76 list($displayName, $email) = CRM_Contact_BAO_Contact_Location
::getEmailDetails($primaryContactId);
77 $this->assign('email', $email);
79 $this->assignToTemplate();
81 $invoicing = CRM_Invoicing_Utils
::isInvoicingEnabled();
84 $lineItemForTemplate = [];
85 if (!empty($this->_lineItem
) && is_array($this->_lineItem
)) {
86 foreach ($this->_lineItem
as $key => $value) {
87 if (!empty($value) && $value != 'skip') {
88 $lineItemForTemplate[$key] = $value;
90 foreach ($value as $v) {
91 if (isset($v['tax_amount']) ||
isset($v['tax_rate'])) {
92 $taxAmount +
= $v['tax_amount'];
100 if ($this->_priceSetId
&&
101 !CRM_Core_DAO
::getFieldValue('CRM_Price_DAO_PriceSet', $this->_priceSetId
, 'is_quick_config') &&
102 !empty($lineItemForTemplate)
104 $this->assignLineItemsToTemplate($lineItemForTemplate);
108 $this->assign('totalTaxAmount', $taxAmount);
110 $this->assign('totalAmount', $this->_totalAmount
);
112 $hookDiscount = $this->get('hookDiscount');
114 $this->assign('hookDiscount', $hookDiscount);
117 $this->assign('receive_date', $this->_receiveDate
);
118 $this->assign('trxn_id', $this->_trxnId
);
120 //cosider total amount.
121 $this->assign('isAmountzero', $this->_totalAmount
<= 0);
123 $this->assign('defaultRole', FALSE);
124 if (CRM_Utils_Array
::value('defaultRole', $this->_params
[0]) == 1) {
125 $this->assign('defaultRole', TRUE);
129 if (!empty($this->_fields
)) {
130 foreach ($this->_fields
as $name => $dontCare) {
134 $fields['state_province'] = $fields['country'] = $fields['email'] = 1;
135 foreach ($fields as $name => $dontCare) {
136 if (isset($this->_params
[0][$name])) {
137 $defaults[$name] = $this->_params
[0][$name];
138 if (substr($name, 0, 7) == 'custom_') {
139 $timeField = "{$name}_time";
140 if (isset($this->_params
[0][$timeField])) {
141 $defaults[$timeField] = $this->_params
[0][$timeField];
144 elseif (in_array($name, CRM_Contact_BAO_Contact
::$_greetingTypes)
145 && !empty($this->_params
[0][$name . '_custom'])
147 $defaults[$name . '_custom'] = $this->_params
[0][$name . '_custom'];
152 $this->_submitValues
= array_merge($this->_submitValues
, $defaults);
154 $this->setDefaults($defaults);
156 $params['entity_id'] = $this->_eventId
;
157 $params['entity_table'] = 'civicrm_event';
159 CRM_Friend_BAO_Friend
::retrieve($params, $data);
160 if (!empty($data['is_active'])) {
161 $friendText = $data['title'];
162 $this->assign('friendText', $friendText);
163 if ($this->_action
& CRM_Core_Action
::PREVIEW
) {
164 $url = CRM_Utils_System
::url('civicrm/friend',
165 "eid={$this->_eventId}&reset=1&action=preview&pcomponent=event"
169 $url = CRM_Utils_System
::url('civicrm/friend',
170 "eid={$this->_eventId}&reset=1&pcomponent=event"
173 $this->assign('friendURL', $url);
176 $this->assign('iCal', CRM_Event_BAO_Event
::getICalLinks($this->_eventId
));
180 //lets give meaningful status message, CRM-4320.
181 $isOnWaitlist = $isRequireApproval = FALSE;
182 if ($this->_allowWaitlist
&& !$this->_allowConfirmation
) {
183 $isOnWaitlist = TRUE;
185 if ($this->_requireApproval
&& !$this->_allowConfirmation
) {
186 $isRequireApproval = TRUE;
188 $this->assign('isOnWaitlist', $isOnWaitlist);
189 $this->assign('isRequireApproval', $isRequireApproval);
192 $dao = new CRM_PCP_DAO_PCPBlock();
193 $dao->entity_table
= 'civicrm_event';
194 $dao->entity_id
= $this->_eventId
;
199 $this->assign('pcpLink', CRM_Utils_System
::url('civicrm/contribute/campaign', 'action=add&reset=1&pageId=' . $this->_eventId
. '&component=event'));
200 $this->assign('pcpLinkText', $dao->link_text
);
203 // Assign Participant Count to Lineitem Table
204 $this->assign('pricesetFieldsCount', CRM_Price_BAO_PriceSet
::getPricesetCount($this->_priceSetId
));
206 // can we blow away the session now to prevent hackery
207 $this->controller
->reset();
211 * Process the form submission.
216 public function postProcess() {
220 * Return a descriptive name for the page, used in wizard header
224 public function getTitle() {
225 return ts('Thank You Page');