CRM_Contact_Selector
extends CRM_Core_Selector_Base
in package
implements
CRM_Core_Selector_API
Class is to retrieve and display a range of contacts that match the given criteria.
It is specifically for results of advanced search options.
Table of Contents
Interfaces
- CRM_Core_Selector_API
- This interface defines the set of functions a class needs to implement to use the CRM/Selector object.
Constants
- CACHE_SIZE = 500
Properties
- $_columnHeaders : array<string|int, mixed>
- We use desc to remind us what that column is, name is used in the tpl
- $_context : string
- The search context
- $_formValues : array<string|int, mixed>
- FormValues is the array returned by exportValues called on the HTML_QuickForm_Controller for that page.
- $_links : array<string|int, mixed>
- This defines two actions- View and Edit.
- $_params : array<string|int, mixed>
- Params is the array in a value used by the search query creator
- $_properties : array<string|int, mixed>
- Properties of contact we're interested in displaying
- $_action : int
- Represent the type of selector
- $_contextMenu : array<string|int, mixed>
- The contextMenu
- $_fields : array<string|int, mixed>
- The public visible fields to be shown to the user
- $_key : string
- The qfKey of the underlying search
- $_order : array<string|int, mixed>
- The sort order which is computed from the columnHeaders
- $_permission : string
- The permission mask for this selector
- $_query : CRM_Contact_BAO_Query
- Query object for this selector.
- $_returnProperties : array<string|int, mixed>
- The return properties used for search
- $_searchContext : mixed
- $_ufGroupID : int
- Group id
Methods
- __construct() : CRM_Contact_Selector
- Class constructor.
- addActions() : mixed
- alphabetQuery() : CRM_Contact_DAO_Contact
- contactIDQuery() : CRM_Contact_DAO_Contact
- getColHeads() : array<string|int, mixed>
- getColumnHeaders() : array<string|int, mixed>
- Returns the column headers as an array of tuples: (name, sortName (key to the sort array))
- getExportFileName() : string
- Name of export file.
- getKey() : string
- getPagerParams() : mixed
- Getter for array of the parameters required for creating pager.
- getQill() : array<string|int, mixed>
- Get the display text in plain language for the search to display on the results page
- getQILL() : mixed
- getQuery() : CRM_Contact_BAO_Query
- getQueryObject() : CRM_Contact_BAO_Query
- Get the query object for this selector.
- getRows() : int
- Returns all the rows in the given offset and rowCount.
- getSortOrder() : array<string|int, mixed>
- Getter for the sorting direction for the fields which will be displayed on the form.
- getSummary() : null
- getTemplateFileName() : string
- Compose the template file name from the class name.
- getTotalCount() : int
- Returns total number of rows for the query.
- links() : array<string|int, mixed>
- This method returns the links that are given for each search row.
- makeProperties() : array<string|int, mixed>
- removeActions() : mixed
- setKey() : mixed
- This method set cache key, later used in test environment
- setPermission() : mixed
- Setter for permission.
- _getColumnHeaders() : array<string|int, mixed>
- Get colunmn headers for search selector.
- buildPrevNextCache() : string
- fillupPrevNextCache() : mixed
- rebuildPreNextCache() : void
- called to rebuild prev next cache using full sql in case of core search ( excluding custom search)
Constants
CACHE_SIZE
public
mixed
CACHE_SIZE
= 500
Properties
$_columnHeaders
We use desc to remind us what that column is, name is used in the tpl
public
static array<string|int, mixed>
$_columnHeaders
$_context
The search context
public
string
$_context
$_formValues
FormValues is the array returned by exportValues called on the HTML_QuickForm_Controller for that page.
public
array<string|int, mixed>
$_formValues
$_links
This defines two actions- View and Edit.
public
static array<string|int, mixed>
$_links
= \NULL
$_params
Params is the array in a value used by the search query creator
public
array<string|int, mixed>
$_params
$_properties
Properties of contact we're interested in displaying
public
static array<string|int, mixed>
$_properties
= ['contact_id', 'contact_type', 'contact_sub_type', 'contact_is_deleted', 'sort_name', 'street_address', 'city', 'state_province', 'postal_code', 'country', 'geo_code_1', 'geo_code_2', 'is_deceased', 'email', 'on_hold', 'phone', 'status', 'do_not_email', 'do_not_phone', 'do_not_sms', 'do_not_mail']
$_action
Represent the type of selector
protected
int
$_action
$_contextMenu
The contextMenu
protected
array<string|int, mixed>
$_contextMenu
$_fields
The public visible fields to be shown to the user
protected
array<string|int, mixed>
$_fields
$_key
The qfKey of the underlying search
protected
string
$_key
$_order
The sort order which is computed from the columnHeaders
protected
array<string|int, mixed>
$_order
$_permission
The permission mask for this selector
protected
string
$_permission
= \NULL
$_query
Query object for this selector.
protected
CRM_Contact_BAO_Query
$_query
$_returnProperties
The return properties used for search
protected
array<string|int, mixed>
$_returnProperties
$_searchContext
protected
mixed
$_searchContext
$_ufGroupID
Group id
protected
int
$_ufGroupID
Methods
__construct()
Class constructor.
public
__construct(mixed $customSearchClass[, array<string|int, mixed> $formValues = NULL ][, array<string|int, mixed> $params = NULL ][, null $returnProperties = NULL ][, const|int $action = CRM_Core_Action::NONE ][, bool $includeContactIds = FALSE ][, bool $searchDescendentGroups = TRUE ][, string $searchContext = 'search' ][, null $contextMenu = NULL ]) : CRM_Contact_Selector
Parameters
- $customSearchClass : mixed
- $formValues : array<string|int, mixed> = NULL
-
Array of form values imported.
- $params : array<string|int, mixed> = NULL
-
Array of parameters for query.
- $returnProperties : null = NULL
- $action : const|int = CRM_Core_Action::NONE
-
- action of search basic or advanced.
- $includeContactIds : bool = FALSE
- $searchDescendentGroups : bool = TRUE
- $searchContext : string = 'search'
- $contextMenu : null = NULL
Return values
CRM_Contact_SelectoraddActions()
public
addActions(mixed &$rows) : mixed
Parameters
- $rows : mixed
alphabetQuery()
public
alphabetQuery() : CRM_Contact_DAO_Contact
Return values
CRM_Contact_DAO_ContactcontactIDQuery()
public
contactIDQuery(array<string|int, mixed> $params, int $sortID[, null $displayRelationshipType = NULL ][, string $queryOperator = 'AND' ]) : CRM_Contact_DAO_Contact
Parameters
- $params : array<string|int, mixed>
- $sortID : int
- $displayRelationshipType : null = NULL
- $queryOperator : string = 'AND'
Return values
CRM_Contact_DAO_ContactgetColHeads()
public
& getColHeads([null $action = NULL ][, null $output = NULL ]) : array<string|int, mixed>
Parameters
- $action : null = NULL
- $output : null = NULL
Return values
array<string|int, mixed>getColumnHeaders()
Returns the column headers as an array of tuples: (name, sortName (key to the sort array))
public
& getColumnHeaders([string $action = NULL ][, string $output = NULL ]) : array<string|int, mixed>
Parameters
- $action : string = NULL
-
The action being performed.
- $output : 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()
Name of export file.
public
getExportFileName([string $output = 'csv' ]) : string
Parameters
- $output : string = 'csv'
-
Type of output.
Return values
string —name of the file
getKey()
public
getKey() : string
Return values
stringgetPagerParams()
Getter for array of the parameters required for creating pager.
public
getPagerParams(mixed $action, array<string|int, mixed> &$params) : mixed
Parameters
- $action : mixed
- $params : array<string|int, mixed>
getQill()
Get the display text in plain language for the search to display on the results page
public
getQill() : array<string|int, mixed>
FIXME: the current internationalisation is bad, but should more or less work on most of "European" languages
Return values
array<string|int, mixed> —array of strings
getQILL()
public
getQILL() : mixed
Tags
getQuery()
public
getQuery() : CRM_Contact_BAO_Query
Return values
CRM_Contact_BAO_QuerygetQueryObject()
Get the query object for this selector.
public
getQueryObject() : CRM_Contact_BAO_Query
Return values
CRM_Contact_BAO_QuerygetRows()
Returns all the rows in the given offset and rowCount.
public
& getRows(string $action, int $offset, int $rowCount, string $sort[, string $output = 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.
- $output : string = NULL
-
What should the result set include (web/email/csv).
Return values
int —the total number of rows for this action
getSortOrder()
Getter for the sorting direction for the fields which will be displayed on the form.
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
getSummary()
public
getSummary() : null
Return values
nullgetTemplateFileName()
Compose the template file name from the class name.
public
getTemplateFileName([string $action = NULL ]) : string
Parameters
- $action : string = NULL
-
The action being performed.
Return values
string —template file name
getTotalCount()
Returns total number of rows for the query.
public
getTotalCount(int $action) : int
Parameters
- $action : int
Return values
int —Total number of rows
links()
This method returns the links that are given for each search row.
public
static & links() : array<string|int, mixed>
currently the links added for each row are
- View
- Edit
Return values
array<string|int, mixed>makeProperties()
public
& makeProperties(mixed &$returnProperties) : array<string|int, mixed>
Parameters
- $returnProperties : mixed
Return values
array<string|int, mixed>removeActions()
public
removeActions(mixed &$rows) : mixed
Parameters
- $rows : mixed
setKey()
This method set cache key, later used in test environment
public
setKey(string $key) : mixed
Parameters
- $key : string
setPermission()
Setter for permission.
public
setPermission(mixed $permission) : mixed
Parameters
- $permission : mixed
_getColumnHeaders()
Get colunmn headers for search selector.
private
static & _getColumnHeaders() : array<string|int, mixed>
Return values
array<string|int, mixed>buildPrevNextCache()
private
buildPrevNextCache(CRM_Utils_Sort $sort) : string
Parameters
- $sort : CRM_Utils_Sort
Return values
stringfillupPrevNextCache()
private
fillupPrevNextCache(CRM_Utils_Sort $sort, string $cacheKey[, int $start = 0 ][, int $end = self::CACHE_SIZE ]) : mixed
Parameters
- $sort : CRM_Utils_Sort
- $cacheKey : string
- $start : int = 0
- $end : int = self::CACHE_SIZE
Tags
rebuildPreNextCache()
called to rebuild prev next cache using full sql in case of core search ( excluding custom search)
private
rebuildPreNextCache(int $start, int $end, CRM_Utils_Sort $sort, string $cacheKey) : void
Parameters
- $start : int
-
Start for limit clause.
- $end : int
-
End for limit clause.
- $sort : CRM_Utils_Sort
- $cacheKey : string
-
Cache key.