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