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