Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
39de6fd5 | 4 | | CiviCRM version 4.6 | |
6a488035 | 5 | +--------------------------------------------------------------------+ |
06b69b18 | 6 | | Copyright CiviCRM LLC (c) 2004-2014 | |
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 | * This interface defines the set of functions a class needs to implement | |
30 | * to use the CRM/Selector object. | |
31 | * | |
32 | * Using this interface allows us to standardize on multiple things including | |
33 | * list display, pagination, sorting and export in multiple formats (CSV is | |
34 | * supported right now, XML support will be added as and when needed | |
35 | * | |
36 | * | |
37 | * @package CRM | |
06b69b18 | 38 | * @copyright CiviCRM LLC (c) 2004-2014 |
6a488035 TO |
39 | * $Id$ |
40 | * | |
41 | */ | |
42 | interface CRM_Core_Selector_API { | |
43 | ||
44 | /** | |
45 | * Based on the action, the GET variables and the session state | |
46 | * it adds various key => value pairs to the params array including | |
47 | * | |
48 | * status - the status message to display. Modifiers will be defined | |
49 | * to integrate the total count and the current state of the | |
50 | * page: e.g. Displaying Page 3 of 5 | |
51 | * csvString - The html string to display for export as csv | |
52 | * rowCount - the number of rows to be included | |
53 | * | |
6c552737 TO |
54 | * @param string $action |
55 | * The action being performed. | |
56 | * @param array $params | |
57 | * The array that the pagerParams will be inserted into. | |
6a488035 TO |
58 | * |
59 | * @return void | |
6a488035 | 60 | */ |
00be9182 | 61 | public function getPagerParams($action, &$params); |
6a488035 TO |
62 | |
63 | /** | |
100fef9d | 64 | * Returns the sort order array for the given action |
6a488035 | 65 | * |
6c552737 TO |
66 | * @param string $action |
67 | * The action being performed. | |
6a488035 | 68 | * |
a6c01b45 CW |
69 | * @return array |
70 | * the elements that can be sorted along with their properties | |
6a488035 | 71 | */ |
00be9182 | 72 | public function &getSortOrder($action); |
6a488035 TO |
73 | |
74 | /** | |
100fef9d | 75 | * Returns the column headers as an array of tuples: |
6a488035 TO |
76 | * (name, sortName (key to the sort array)) |
77 | * | |
6a0b768e TO |
78 | * @param string $action |
79 | * The action being performed. | |
3f8d2862 | 80 | * @param string $type |
6a0b768e | 81 | * What should the result set include (web/email/csv). |
6a488035 | 82 | * |
a6c01b45 CW |
83 | * @return array |
84 | * the column headers that need to be displayed | |
6a488035 | 85 | */ |
00be9182 | 86 | public function &getColumnHeaders($action = NULL, $type = NULL); |
6a488035 TO |
87 | |
88 | /** | |
100fef9d | 89 | * Returns the number of rows for this action |
6a488035 | 90 | * |
6c552737 TO |
91 | * @param string $action |
92 | * The action being performed. | |
6a488035 | 93 | * |
a6c01b45 CW |
94 | * @return int |
95 | * the total number of rows for this action | |
6a488035 | 96 | */ |
00be9182 | 97 | public function getTotalCount($action); |
6a488035 TO |
98 | |
99 | /** | |
100fef9d | 100 | * Returns all the rows in the given offset and rowCount |
6a488035 | 101 | * |
3f8d2862 | 102 | * @param string $action |
6a0b768e TO |
103 | * The action being performed. |
104 | * @param int $offset | |
105 | * The row number to start from. | |
106 | * @param int $rowCount | |
107 | * The number of rows to return. | |
108 | * @param string $sort | |
109 | * The sql string that describes the sort order. | |
3f8d2862 | 110 | * @param string $type |
6a0b768e | 111 | * What should the result set include (web/email/csv). |
6a488035 | 112 | * |
a6c01b45 CW |
113 | * @return int |
114 | * the total number of rows for this action | |
6a488035 | 115 | */ |
00be9182 | 116 | public function &getRows($action, $offset, $rowCount, $sort, $type = NULL); |
6a488035 TO |
117 | |
118 | /** | |
100fef9d | 119 | * Return the template (.tpl) filename |
6a488035 | 120 | * |
6a0b768e TO |
121 | * @param string $action |
122 | * The action being performed. | |
6a488035 TO |
123 | * |
124 | * @return string | |
6a488035 | 125 | */ |
00be9182 | 126 | public function getTemplateFileName($action = NULL); |
6a488035 TO |
127 | |
128 | /** | |
100fef9d | 129 | * Return the filename for the exported CSV |
6a488035 | 130 | * |
6c552737 TO |
131 | * @param string $type |
132 | * The type of export required: csv/xml/foaf etc. | |
6a488035 | 133 | * |
a6c01b45 CW |
134 | * @return string |
135 | * the fileName which we will munge to skip spaces and | |
6a488035 | 136 | * special characters to avoid various browser issues |
6a488035 | 137 | */ |
00be9182 | 138 | public function getExportFileName($type = 'csv'); |
96025800 | 139 | |
6a488035 | 140 | } |