interface CRM_Core_Selector_API

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

Methods

getPagerParams(string $action, array $params)

Get pager parameters.

array
getSortOrder(string $action)

Returns the sort order array for the given action.

array
getColumnHeaders(string $action = NULL, string $type = NULL)

Returns the column headers as an array of tuples.

int
getTotalCount(string $action)

Returns the number of rows for this action.

int
getRows(string $action, int $offset, int $rowCount, string $sort, string $type = NULL)

Returns all the rows in the given offset and rowCount.

string
getTemplateFileName(string $action = NULL)

Return the template (.tpl) filename.

string
getExportFileName(string $type = 'csv')

Return the filename for the exported CSV.

Details

at line 58
getPagerParams(string $action, array $params)

Get pager parameters.

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

string $action The action being performed.
array $params The array that the pagerParams will be inserted into.

at line 69
array getSortOrder(string $action)

Returns the sort order array for the given action.

Parameters

string $action The action being performed.

Return Value

array the elements that can be sorted along with their properties

at line 84
array getColumnHeaders(string $action = NULL, string $type = NULL)

Returns the column headers as an array of tuples.

(name, sortName (key to the sort array))

Parameters

string $action The action being performed.
string $type What should the result set include (web/email/csv).

Return Value

array the column headers that need to be displayed

at line 95
int getTotalCount(string $action)

Returns the number of rows for this action.

Parameters

string $action The action being performed.

Return Value

int the total number of rows for this action

at line 114
int getRows(string $action, int $offset, int $rowCount, string $sort, string $type = NULL)

Returns all the rows in the given offset and rowCount.

Parameters

string $action The action being performed.
int $offset The row number to start from.
int $rowCount The number of rows to return.
string $sort The sql string that describes the sort order.
string $type What should the result set include (web/email/csv).

Return Value

int the total number of rows for this action

at line 124
string getTemplateFileName(string $action = NULL)

Return the template (.tpl) filename.

Parameters

string $action The action being performed.

Return Value

string

at line 136
string getExportFileName(string $type = 'csv')

Return the filename for the exported CSV.

Parameters

string $type The type of export required: csv/xml/foaf etc.

Return Value

string the fileName which we will munge to skip spaces and special characters to avoid various browser issues