CRM_Utils_Sort
class CRM_Utils_Sort
Base class to provide generic sort functionality.
Note that some ideas have been borrowed from the drupal tablesort.inc code.
Also note that since the Pager and Sort class are similar, do match the function names if introducing additional functionality
Constants
ASCENDING |
Constants to determine what direction each variable is to be sorted |
DESCENDING |
Constants to determine what direction each variable is to be sorted |
DONTCARE |
Constants to determine what direction each variable is to be sorted |
SORT_ID |
Constants to determine what direction each variable is to be sorted |
SORT_DIRECTION |
Constants to determine what direction each variable is to be sorted |
SORT_ORDER |
Constants to determine what direction each variable is to be sorted |
Properties
protected string | $_name | Name of the sort function. Used to isolate session variables | |
array | $_vars | Array of variables that influence the query | |
protected string | $_link | The newly formulated base url to be used as links for various table elements | |
protected string | $_urlVar | What's the name of the sort variable in a REQUEST | |
protected string | $_currentSortID | What variable are we currently sorting on | |
protected string | $_currentSortDirection | What direction are we sorting on | |
array | $_response | The output generated for the current form |
Methods
The constructor takes an assoc array key names of variable (which should be the same as the column name) value: ascending or descending
Function returns the string for the order by clause.
Create the sortID string to be used in the GET param.
Init the sort ID values in the object.
Init the object.
Getter for currentSortID.
Getter for currentSortDirection.
Universal callback function for sorting by weight, id, title or name
Details
at line 118
CRM_Utils_Sort
__construct(mixed $vars, string $defaultSortOrder = NULL)
The constructor takes an assoc array key names of variable (which should be the same as the column name) value: ascending or descending
at line 146
string
orderBy()
Function returns the string for the order by clause.
at line 174
static string
sortIDValue(int $index, int $dir)
Create the sortID string to be used in the GET param.
at line 184
initSortID(string $defaultSortOrder)
Init the sort ID values in the object.
at line 219
initialize(string $defaultSortOrder)
Init the object.
at line 253
int
getCurrentSortID()
Getter for currentSortID.
at line 263
int
getCurrentSortDirection()
Getter for currentSortDirection.
at line 276
static int
cmpFunc($a, $b)
Universal callback function for sorting by weight, id, title or name