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