Merge pull request #15955 from JMAConsulting/core-1420
[civicrm-core.git] / CRM / Report / 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_Report_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 quickform for this search.
28 *
29 * @param CRM_Core_Form $form
30 */
31 public function buildForm(&$form);
32
33 /**
34 * Builds the search query for various cases. We break it down into finer cases
35 * since you can optimize each query independently. All the functions below return
36 * a sql clause with only SELECT, FROM, WHERE sub-parts. The ORDER BY and LIMIT is
37 * added at a later stage
38 */
39
40 /**
41 * Count of records that match the current input parameters Used by pager.
42 */
43 public function count();
44
45 /**
46 * Summary information for the query that can be displayed in the template.
47 *
48 * This is useful to pass total / sub total information if needed
49 */
50 public function summary();
51
52 /**
53 * Get contact IDs.
54 *
55 * List of contact ids that match the current input parameters
56 * Used by different tasks. Will be also used to optimize the
57 * 'all' query below to avoid excessive LEFT JOIN blowup
58 *
59 * @param int $offset
60 * @param int $rowcount
61 * @param string $sort
62 */
63 public function contactIDs($offset = 0, $rowcount = 0, $sort = NULL);
64
65 /**
66 * Retrieve all the values that match the current input parameters used by the selector.
67 *
68 * @param int $offset
69 * @param int $rowcount
70 * @param string $sort
71 * @param bool $includeContactIDs
72 */
73 public function all(
74 $offset = 0, $rowcount = 0, $sort = NULL,
75 $includeContactIDs = FALSE
76 );
77
78 /**
79 * The below two functions (from and where) are ONLY used if you want to
80 * expose a custom group as a smart group and be able to send a mailing
81 * to them via CiviMail. civicrm_email should be part of the from clause
82 * The from clause should be a valid sql from clause including the word FROM
83 * CiviMail will pick up the contacts where the email is primary and
84 * is not on hold / opt out / do not email
85 */
86
87 /**
88 * The from clause for the query.
89 */
90 public function from();
91
92 /**
93 * The where clause for the query.
94 *
95 * @param bool $includeContactIDs
96 */
97 public function where($includeContactIDs = FALSE);
98
99 /**
100 * The template FileName to use to display the results.
101 */
102 public function templateFile();
103
104 /**
105 * Returns an array of column headers and field names and sort options.
106 */
107 public function &columns();
108
109 }