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 | /** | |
00252851 | 19 | * This class provides the functionality to save a search. |
20 | * | |
6a488035 TO |
21 | * Saved Searches are used for saving frequently used queries |
22 | */ | |
23 | class CRM_Contact_Form_Task_HookSample extends CRM_Contact_Form_Task { | |
24 | ||
25 | /** | |
fe482240 | 26 | * Build all the data structures needed to build the form. |
6a488035 | 27 | */ |
00be9182 | 28 | public function preProcess() { |
6a488035 TO |
29 | parent::preProcess(); |
30 | ||
31 | // display name and email of all contact ids | |
fe7f4414 | 32 | $contactIDs = implode(',', $this->_contactIds); |
6a488035 TO |
33 | $query = " |
34 | SELECT c.id as contact_id, c.display_name as name, | |
35 | c.contact_type as contact_type, e.email as email | |
36 | FROM civicrm_contact c, civicrm_email e | |
37 | WHERE e.contact_id = c.id | |
38 | AND e.is_primary = 1 | |
39 | AND c.id IN ( $contactIDs )"; | |
40 | ||
be2fb01f | 41 | $rows = []; |
6a488035 TO |
42 | $dao = CRM_Core_DAO::executeQuery($query); |
43 | while ($dao->fetch()) { | |
be2fb01f | 44 | $rows[] = [ |
6a488035 TO |
45 | 'id' => $dao->contact_id, |
46 | 'name' => $dao->name, | |
47 | 'contact_type' => $dao->contact_type, | |
48 | 'email' => $dao->email, | |
be2fb01f | 49 | ]; |
6a488035 TO |
50 | } |
51 | ||
52 | $this->assign('rows', $rows); | |
53 | } | |
54 | ||
55 | /** | |
00252851 | 56 | * Build the form object. |
6a488035 | 57 | */ |
00be9182 | 58 | public function buildQuickForm() { |
6a488035 TO |
59 | $this->addDefaultButtons(ts('Back to Search'), 'done'); |
60 | } | |
61 | ||
62 | /** | |
fe482240 | 63 | * Process the form after the input has been submitted and validated. |
6a488035 | 64 | */ |
6ea503d4 TO |
65 | public function postProcess() { |
66 | } | |
96025800 | 67 | |
6a488035 | 68 | } |