Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
bc77d7c0 | 4 | | Copyright CiviCRM LLC. All rights reserved. | |
6a488035 | 5 | | | |
bc77d7c0 TO |
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 | | |
6a488035 | 9 | +--------------------------------------------------------------------+ |
d25dd0ee | 10 | */ |
6a488035 TO |
11 | |
12 | /** | |
13 | * | |
14 | * @package CRM | |
ca5cec67 | 15 | * @copyright CiviCRM LLC https://civicrm.org/licensing |
6a488035 TO |
16 | */ |
17 | ||
18 | /** | |
19 | * This class provides the functionality to save a search | |
20 | * Saved Searches are used for saving frequently used queries | |
21 | */ | |
22 | class CRM_Event_Form_Task_SearchTaskHookSample extends CRM_Event_Form_Task { | |
23 | ||
24 | /** | |
66f9e52b | 25 | * Build all the data structures needed to build the form. |
6a488035 TO |
26 | * |
27 | * @return void | |
6a488035 | 28 | */ |
00be9182 | 29 | public function preProcess() { |
6a488035 | 30 | parent::preProcess(); |
be2fb01f | 31 | $rows = []; |
6a488035 TO |
32 | // display name and participation details of participants |
33 | $participantIDs = implode(',', $this->_participantIds); | |
34 | ||
35 | $query = " | |
36 | SELECT p.fee_amount as amount, | |
37 | p.register_date as register_date, | |
03e04002 | 38 | p.source as source, |
6a488035 TO |
39 | ct.display_name as display_name |
40 | FROM civicrm_participant p | |
41 | INNER JOIN civicrm_contact ct ON ( p.contact_id = ct.id ) | |
42 | WHERE p.id IN ( $participantIDs )"; | |
43 | ||
33621c4f | 44 | $dao = CRM_Core_DAO::executeQuery($query); |
6a488035 | 45 | while ($dao->fetch()) { |
be2fb01f | 46 | $rows[] = [ |
6a488035 TO |
47 | 'display_name' => $dao->display_name, |
48 | 'amount' => $dao->amount, | |
49 | 'register_date' => CRM_Utils_Date::customFormat($dao->register_date), | |
50 | 'source' => $dao->source, | |
be2fb01f | 51 | ]; |
6a488035 TO |
52 | } |
53 | $this->assign('rows', $rows); | |
54 | } | |
55 | ||
56 | /** | |
66f9e52b | 57 | * Build the form object. |
6a488035 | 58 | * |
355ba699 | 59 | * @return void |
6a488035 TO |
60 | */ |
61 | public function buildQuickForm() { | |
be2fb01f | 62 | $this->addButtons([ |
90b461f1 SL |
63 | [ |
64 | 'type' => 'done', | |
65 | 'name' => ts('Done'), | |
66 | 'isDefault' => TRUE, | |
67 | ], | |
68 | ]); | |
6a488035 | 69 | } |
96025800 | 70 | |
6a488035 | 71 | } |