Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
fee14197 | 4 | | CiviCRM version 5 | |
6a488035 | 5 | +--------------------------------------------------------------------+ |
6b83d5bd | 6 | | Copyright CiviCRM LLC (c) 2004-2019 | |
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 | |
6b83d5bd | 31 | * @copyright CiviCRM LLC (c) 2004-2019 |
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. |
6a488035 TO |
43 | */ |
44 | protected $_userContext; | |
45 | ||
46 | /** | |
66f9e52b | 47 | * Build all the data structures needed to build the form. |
6a488035 TO |
48 | * |
49 | * @return void | |
6a488035 | 50 | */ |
00be9182 | 51 | public function preProcess() { |
c490a46a | 52 | // initialize the task and row fields |
6a488035 TO |
53 | parent::preProcess(); |
54 | ||
55 | $session = CRM_Core_Session::singleton(); | |
56 | $this->_userContext = $session->readUserContext(); | |
57 | } | |
58 | ||
59 | /** | |
66f9e52b | 60 | * Build the form object. |
6a488035 | 61 | * |
6a488035 TO |
62 | * |
63 | * @return void | |
64 | */ | |
00be9182 | 65 | public function buildQuickForm() { |
6a488035 TO |
66 | CRM_Utils_System::setTitle(ts('Cancel Registration for Event Participation')); |
67 | $session = CRM_Core_Session::singleton(); | |
6b671aca | 68 | $this->addDefaultButtons(ts('Cancel Registrations'), 'done'); |
6a488035 TO |
69 | } |
70 | ||
71 | /** | |
66f9e52b | 72 | * Process the form after the input has been submitted and validated. |
6a488035 | 73 | * |
6a488035 | 74 | * |
355ba699 | 75 | * @return void |
6a488035 TO |
76 | */ |
77 | public function postProcess() { | |
78 | $params = $this->exportValues(); | |
79 | $value = array(); | |
80 | ||
81 | foreach ($this->_participantIds as $participantId) { | |
82 | $value['id'] = $participantId; | |
83 | ||
84 | // Cancelled status id = 4 | |
85 | $value['status_id'] = 4; | |
86 | CRM_Event_BAO_Participant::create($value); | |
87 | } | |
88 | } | |
96025800 | 89 | |
6a488035 | 90 | } |