copyright and version fixes
[civicrm-core.git] / CRM / Core / Selector / API.php
CommitLineData
6a488035
TO
1<?php
2/*
3 +--------------------------------------------------------------------+
06b69b18 4 | CiviCRM version 4.5 |
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 +--------------------------------------------------------------------+
26*/
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 */
42interface 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 *
54 * @param string action the action being performed
55 * @param array params the array that the pagerParams will be inserted into
56 *
57 * @return void
58 *
59 * @access public
60 *
61 */
62 function getPagerParams($action, &$params);
63
64 /**
65 * returns the sort order array for the given action
66 *
67 * @param string action the action being performed
68 *
69 * @return array the elements that can be sorted along with their properties
70 * @access public
71 *
72 */
73 function &getSortOrder($action);
74
75 /**
76 * returns the column headers as an array of tuples:
77 * (name, sortName (key to the sort array))
78 *
79 * @param string $action the action being performed
80 * @param enum $type what should the result set include (web/email/csv)
81 *
82 * @return array the column headers that need to be displayed
83 * @access public
84 */
85 function &getColumnHeaders($action = NULL, $type = NULL);
86
87 /**
88 * returns the number of rows for this action
89 *
90 * @param string action the action being performed
91 *
92 * @return int the total number of rows for this action
93 *
94 * @access public
95 *
96 */
97 function getTotalCount($action);
98
99 /**
100 * returns all the rows in the given offset and rowCount
101 *
102 * @param enum $action the action being performed
103 * @param int $offset the row number to start from
104 * @param int $rowCount the number of rows to return
105 * @param string $sort the sql string that describes the sort order
106 * @param enum $type what should the result set include (web/email/csv)
107 *
108 * @return int the total number of rows for this action
109 * @access public
110 */
111 function &getRows($action, $offset, $rowCount, $sort, $type = NULL);
112
113 /**
114 * return the template (.tpl) filename
115 *
116 * @param string $action the action being performed
117 *
118 * @return string
119 * @access public
120 *
121 */
122 function getTemplateFileName($action = NULL);
123
124 /**
125 * return the filename for the exported CSV
126 *
127 * @param string type the type of export required: csv/xml/foaf etc
128 *
129 * @return string the fileName which we will munge to skip spaces and
130 * special characters to avoid various browser issues
131 *
132 */
133 function getExportFileName($type = 'csv');
134}
135