Merge pull request #17927 from monishdeb/core-785
[civicrm-core.git] / CRM / Contact / Form / Search / Interface.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
5 | |
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 |
9 +--------------------------------------------------------------------+
10 */
11
12 /**
13 *
14 * @package CRM
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
16 */
17 interface CRM_Contact_Form_Search_Interface {
18
19 /**
20 * The constructor gets the submitted form values.
21 *
22 * @param array $formValues
23 */
24 public function __construct(&$formValues);
25
26 /**
27 * Builds the list of tasks or actions that a searcher can perform on a result set.
28 *
29 * @param CRM_Core_Form_Search $form
30 * @return array
31 */
32 public function buildTaskList(CRM_Core_Form_Search $form);
33
34 /**
35 * Builds the quickform for this search.
36 *
37 * @param CRM_Core_Form $form
38 */
39 public function buildForm(&$form);
40
41 /**
42 * Builds the search query for various cases. We break it down into finer cases
43 * since you can optimize each query independently. All the functions below return
44 * a sql clause with only SELECT, FROM, WHERE sub-parts. The ORDER BY and LIMIT is
45 * added at a later stage
46 */
47
48 /**
49 * Count of records that match the current input parameters.
50 *
51 * Used by pager.
52 */
53 public function count();
54
55 /**
56 * Summary information for the query that can be displayed in the template.
57 *
58 * This is useful to pass total / sub total information if needed
59 */
60 public function summary();
61
62 /**
63 * List of contact ids that match the current input parameters.
64 *
65 * Used by different tasks. Will be also used to optimize the
66 * 'all' query below to avoid excessive LEFT JOIN blowup
67 *
68 * @param int $offset
69 * @param int $rowcount
70 * @param null $sort
71 */
72 public function contactIDs($offset = 0, $rowcount = 0, $sort = NULL);
73
74 /**
75 * Retrieve all the values that match the current input parameters.
76 *
77 * Used by the selector
78 *
79 * @param int $offset
80 * @param int $rowcount
81 * @param null $sort
82 * @param bool $includeContactIDs
83 * @param bool $justIDs
84 */
85 public function all($offset = 0, $rowcount = 0, $sort = NULL, $includeContactIDs = FALSE, $justIDs = FALSE);
86
87 /**
88 * The below two functions (from and where) are ONLY used if you want to
89 * expose a custom group as a smart group and be able to send a mailing
90 * to them via CiviMail. civicrm_email should be part of the from clause
91 * The from clause should be a valid sql from clause including the word FROM
92 * CiviMail will pick up the contacts where the email is primary and
93 * is not on hold / opt out / do not email
94 */
95
96 /**
97 * The from clause for the query.
98 */
99 public function from();
100
101 /**
102 * The where clause for the query.
103 *
104 * @param bool $includeContactIDs
105 */
106 public function where($includeContactIDs = FALSE);
107
108 /**
109 * The template FileName to use to display the results.
110 */
111 public function templateFile();
112
113 /**
114 * Returns an array of column headers and field names and sort options.
115 */
116 public function &columns();
117
118 }