Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
fee14197 | 4 | | CiviCRM version 5 | |
6a488035 | 5 | +--------------------------------------------------------------------+ |
f299f7db | 6 | | Copyright CiviCRM LLC (c) 2004-2020 | |
6a488035 TO |
7 | +--------------------------------------------------------------------+ |
8 | | This file is a part of CiviCRM. | | |
9 | | | | |
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. | | |
13 | | | | |
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. | | |
18 | | | | |
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 | +--------------------------------------------------------------------+ | |
d25dd0ee | 26 | */ |
6a488035 TO |
27 | |
28 | /** | |
29 | * | |
30 | * @package CRM | |
ca5cec67 | 31 | * @copyright CiviCRM LLC https://civicrm.org/licensing |
6a488035 TO |
32 | * $Id$ |
33 | * | |
34 | */ | |
35 | ||
36 | /** | |
37 | * This class provides the functionality for cancel registration for event participations | |
38 | */ | |
39 | class CRM_Event_Form_Task_Cancel extends CRM_Event_Form_Task { | |
40 | ||
41 | /** | |
66f9e52b | 42 | * Variable to store redirect path. |
90b461f1 | 43 | * @var string |
6a488035 TO |
44 | */ |
45 | protected $_userContext; | |
46 | ||
47 | /** | |
66f9e52b | 48 | * Build all the data structures needed to build the form. |
6a488035 TO |
49 | * |
50 | * @return void | |
6a488035 | 51 | */ |
00be9182 | 52 | public function preProcess() { |
c490a46a | 53 | // initialize the task and row fields |
6a488035 TO |
54 | parent::preProcess(); |
55 | ||
56 | $session = CRM_Core_Session::singleton(); | |
57 | $this->_userContext = $session->readUserContext(); | |
58 | } | |
59 | ||
60 | /** | |
66f9e52b | 61 | * Build the form object. |
6a488035 | 62 | * |
6a488035 TO |
63 | * |
64 | * @return void | |
65 | */ | |
00be9182 | 66 | public function buildQuickForm() { |
6a488035 TO |
67 | CRM_Utils_System::setTitle(ts('Cancel Registration for Event Participation')); |
68 | $session = CRM_Core_Session::singleton(); | |
6b671aca | 69 | $this->addDefaultButtons(ts('Cancel Registrations'), 'done'); |
6a488035 TO |
70 | } |
71 | ||
72 | /** | |
66f9e52b | 73 | * Process the form after the input has been submitted and validated. |
6a488035 | 74 | * |
6a488035 | 75 | * |
355ba699 | 76 | * @return void |
6a488035 TO |
77 | */ |
78 | public function postProcess() { | |
79 | $params = $this->exportValues(); | |
be2fb01f | 80 | $value = []; |
6a488035 TO |
81 | |
82 | foreach ($this->_participantIds as $participantId) { | |
83 | $value['id'] = $participantId; | |
84 | ||
85 | // Cancelled status id = 4 | |
86 | $value['status_id'] = 4; | |
87 | CRM_Event_BAO_Participant::create($value); | |
88 | } | |
89 | } | |
96025800 | 90 | |
6a488035 | 91 | } |