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