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