3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.4 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2013 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
32 * @copyright CiviCRM LLC (c) 2004-2013
38 * This class generates form components for processing Event
41 class CRM_Event_Form_Registration_ThankYou
extends CRM_Event_Form_Registration
{
44 * Function to set variables up before form is built
49 function preProcess() {
51 $this->_params
= $this->get('params');
52 $this->_lineItem
= $this->get('lineItem');
53 $this->_part
= $this->get('part');
54 $this->_totalAmount
= $this->get('totalAmount');
55 $this->_receiveDate
= $this->get('receiveDate');
56 $this->_trxnId
= $this->get('trxnId');
57 $finalAmount = $this->get('finalAmount');
58 $this->assign('finalAmount', $finalAmount);
59 $participantInfo = $this->get('participantInfo');
60 $this->assign('part', $this->_part
);
61 $this->assign('participantInfo', $participantInfo);
62 $customGroup = $this->get('customProfile');
63 $this->assign('customProfile', $customGroup);
65 $this->assign('primaryParticipantProfile', $this->get('primaryParticipantProfile'));
66 $this->assign('addParticipantProfile', $this->get('addParticipantProfile'));
68 CRM_Utils_System
::setTitle(CRM_Utils_Array
::value('thankyou_title', $this->_values
['event']));
72 * overwrite action, since we are only showing elements in frozen mode
73 * no help display needed
78 function getAction() {
79 if ($this->_action
& CRM_Core_Action
::PREVIEW
) {
80 return CRM_Core_Action
::VIEW | CRM_Core_Action
::PREVIEW
;
83 return CRM_Core_Action
::VIEW
;
88 * Function to build the form
93 public function buildQuickForm() {
94 // Assign the email address from a contact id lookup as in CRM_Event_BAO_Event->sendMail()
95 $primaryContactId = $this->get('primaryContactId');
96 if ($primaryContactId) {
97 list($displayName, $email) = CRM_Contact_BAO_Contact_Location
::getEmailDetails($primaryContactId);
98 $this->assign('email', $email);
100 $this->assignToTemplate();
102 if ($this->_priceSetId
&& !CRM_Core_DAO
::getFieldValue('CRM_Price_DAO_PriceSet', $this->_priceSetId
, 'is_quick_config')) {
103 $lineItemForTemplate = array();
104 foreach ($this->_lineItem
as $key => $value) {
105 if (!empty($value)) {
106 $lineItemForTemplate[$key] = $value;
109 if (!empty($lineItemForTemplate)) {
110 $this->assign('lineItem', $lineItemForTemplate);
114 $this->assign('totalAmount', $this->_totalAmount
);
116 $hookDiscount = $this->get('hookDiscount');
118 $this->assign('hookDiscount', $hookDiscount);
121 $this->assign('receive_date', $this->_receiveDate
);
122 $this->assign('trxn_id', $this->_trxnId
);
124 //cosider total amount.
125 $this->assign('isAmountzero', ($this->_totalAmount
<= 0) ?
TRUE : FALSE);
127 $this->assign('defaultRole', FALSE);
128 if (CRM_Utils_Array
::value('defaultRole', $this->_params
[0]) == 1) {
129 $this->assign('defaultRole', TRUE);
133 if (!empty($this->_fields
)) {
134 foreach ($this->_fields
as $name => $dontCare) {
138 $fields['state_province'] = $fields['country'] = $fields['email'] = 1;
139 foreach ($fields as $name => $dontCare) {
140 if (isset($this->_params
[0][$name])) {
141 $defaults[$name] = $this->_params
[0][$name];
142 if (substr($name, 0, 7) == 'custom_') {
143 $timeField = "{$name}_time";
144 if (isset($this->_params
[0][$timeField])) {
145 $defaults[$timeField] = $this->_params
[0][$timeField];
148 elseif (in_array($name, CRM_Contact_BAO_Contact
::$_greetingTypes)
149 && !empty($this->_params
[0][$name . '_custom'])
151 $defaults[$name . '_custom'] = $this->_params
[0][$name . '_custom'];
156 $this->_submitValues
= array_merge($this->_submitValues
, $defaults);
158 $this->setDefaults($defaults);
160 $params['entity_id'] = $this->_eventId
;
161 $params['entity_table'] = 'civicrm_event';
163 CRM_Friend_BAO_Friend
::retrieve($params, $data);
164 if (CRM_Utils_Array
::value('is_active', $data)) {
165 $friendText = $data['title'];
166 $this->assign('friendText', $friendText);
167 if ($this->_action
& CRM_Core_Action
::PREVIEW
) {
168 $url = CRM_Utils_System
::url('civicrm/friend',
169 "eid={$this->_eventId}&reset=1&action=preview&pcomponent=event"
173 $url = CRM_Utils_System
::url('civicrm/friend',
174 "eid={$this->_eventId}&reset=1&pcomponent=event"
177 $this->assign('friendURL', $url);
182 //lets give meaningful status message, CRM-4320.
183 $isOnWaitlist = $isRequireApproval = FALSE;
184 if ($this->_allowWaitlist
&& !$this->_allowConfirmation
) {
185 $isOnWaitlist = TRUE;
187 if ($this->_requireApproval
&& !$this->_allowConfirmation
) {
188 $isRequireApproval = TRUE;
190 $this->assign('isOnWaitlist', $isOnWaitlist);
191 $this->assign('isRequireApproval', $isRequireApproval);
194 $dao = new CRM_PCP_DAO_PCPBlock();
195 $dao->entity_table
= 'civicrm_event';
196 $dao->entity_id
= $this->_eventId
;
201 $this->assign('pcpLink', CRM_Utils_System
::url('civicrm/contribute/campaign', 'action=add&reset=1&pageId=' . $this->_eventId
. '&component=event'));
202 $this->assign('pcpLinkText', $dao->link_text
);
205 // Assign Participant Count to Lineitem Table
206 $this->assign('pricesetFieldsCount', CRM_Price_BAO_PriceSet
::getPricesetCount($this->_priceSetId
));
208 // can we blow away the session now to prevent hackery
209 $this->controller
->reset();
213 * Function to process the form
219 public function postProcess() {}
223 * Return a descriptive name for the page, used in wizard header
228 public function getTitle() {
229 return ts('Thank You Page');