CRM_Core_Selector_API
in
This interface defines the set of functions a class needs to implement to use the CRM/Selector object.
Using this interface allows us to standardize on multiple things including list display, pagination, sorting and export in multiple formats (CSV is supported right now, XML support will be added as and when needed
Tags
Table of Contents
Methods
- getColumnHeaders() : array<string|int, mixed>
- Returns the column headers as an array of tuples.
- getExportFileName() : string
- Return the filename for the exported CSV.
- getPagerParams() : mixed
- Get pager parameters.
- getRows() : int
- Returns all the rows in the given offset and rowCount.
- getSortOrder() : array<string|int, mixed>
- Returns the sort order array for the given action.
- getTemplateFileName() : string
- Return the template (.tpl) filename.
- getTotalCount() : int
- Returns the number of rows for this action.
Methods
getColumnHeaders()
Returns the column headers as an array of tuples.
public
& getColumnHeaders([string $action = NULL ][, string $type = NULL ]) : array<string|int, mixed>
(name, sortName (key to the sort array))
Parameters
- $action : string = NULL
-
The action being performed.
- $type : string = NULL
-
What should the result set include (web/email/csv).
Return values
array<string|int, mixed> —the column headers that need to be displayed
getExportFileName()
Return the filename for the exported CSV.
public
getExportFileName([string $type = 'csv' ]) : string
Parameters
- $type : string = 'csv'
-
The type of export required: csv/xml/foaf etc.
Return values
string —the fileName which we will munge to skip spaces and special characters to avoid various browser issues
getPagerParams()
Get pager parameters.
public
getPagerParams(string $action, array<string|int, mixed> &$params) : mixed
Based on the action, the GET variables and the session state it adds various key => value pairs to the params array including
status - the status message to display. Modifiers will be defined to integrate the total count and the current state of the page: e.g. Displaying Page 3 of 5 csvString - The html string to display for export as csv rowCount - the number of rows to be included
Parameters
- $action : string
-
The action being performed.
- $params : array<string|int, mixed>
-
The array that the pagerParams will be inserted into.
getRows()
Returns all the rows in the given offset and rowCount.
public
& getRows(string $action, int $offset, int $rowCount, string $sort[, string $type = NULL ]) : int
Parameters
- $action : string
-
The action being performed.
- $offset : int
-
The row number to start from.
- $rowCount : int
-
The number of rows to return.
- $sort : string
-
The sql string that describes the sort order.
- $type : string = NULL
-
What should the result set include (web/email/csv).
Return values
int —the total number of rows for this action
getSortOrder()
Returns the sort order array for the given action.
public
& getSortOrder(string $action) : array<string|int, mixed>
Parameters
- $action : string
-
The action being performed.
Return values
array<string|int, mixed> —the elements that can be sorted along with their properties
getTemplateFileName()
Return the template (.tpl) filename.
public
getTemplateFileName([string $action = NULL ]) : string
Parameters
- $action : string = NULL
-
The action being performed.
Return values
stringgetTotalCount()
Returns the number of rows for this action.
public
getTotalCount(string $action) : int
Parameters
- $action : string
-
The action being performed.
Return values
int —the total number of rows for this action