class CRM_Core_Selector_Controller

This class is a generic class to be used when we want to display a list of rows along with a set of associated actions

Centralizing this code enables us to write a generic lister and enables us to automate the export process. To use this class, the object has to implement the Selector/Api.interface.php class

Constants

SESSION

TEMPLATE

TRANSFER

EXPORT

SCREEN

PDF

Properties

protected object $_object A CRM Object that implements CRM_Core_Selector_API.
protected CRM_Utils_Sort $_sort
protected int $_sortID The current column to sort on
protected array $_sortOrder The sortOrder array
protected CRM_Utils_Pager $_pager
protected int $_pageID The pageID
protected int $_pagerOffset Offset
protected int $_pagerRowCount Number of rows to return
protected int $_total Total number of rows
protected $_action The objectAction for the WebObject
protected string $_content This caches the content for the display system
protected bool $_embedded Is this object being embedded in another object. If so the display routine needs to not do any work. (The parent object takes care of the display)
protected bool $_print Are we in print mode? if so we need to modify the display functionality to do a minimal display :)
protected Object $_store The storage object (typically a form or a page)
protected int $_output Output target, session, template or both?
protected int $_prefix Prefif for the selector variables
static CRM_Core_Smarty $_template Cache the smarty template for efficiency reasons
static array $_properties Array of properties that the controller dumps into the output object
protected bool $_dynamicAction Should we compute actions dynamically (since they are quite verbose)

Methods

__construct(CRM_Core_Selector_API $object, int $pageID, int $sortID, int $action, CRM_Core_Page|CRM_Core_Form $store = NULL, int $output = self::TEMPLATE, null $prefix = NULL, null $case = NULL)

Class constructor.

bool
hasChanged(int $reset)

Have the GET vars changed, i.e. pageId or sortId that forces us to recompute the search values

void
run()

Heart of the Controller. This is where all the action takes place

array
getRows(CRM_Core_Form $form)

Retrieve rows.

string
getQill()

Default function for qill, if needed to be implemented, we expect the subclass to do it

mixed
getSummary()

No description

getPager()

Getter for pager.

getSort()

Getter for sort.

void
moveFromSessionToTemplate()

Move the variables from the session to the template.

void
setEmbedded(bool $embedded)

Setter for embedded.

bool
getEmbedded()

Getter for embedded.

void
setPrint(bool $print)

Setter for print.

bool
getPrint()

Getter for print.

setDynamicAction($value)

No description

bool
getDynamicAction()

No description

Details

at line 196
CRM_Core_Selector_Controller __construct(CRM_Core_Selector_API $object, int $pageID, int $sortID, int $action, CRM_Core_Page|CRM_Core_Form $store = NULL, int $output = self::TEMPLATE, null $prefix = NULL, null $case = NULL)

Class constructor.

Parameters

CRM_Core_Selector_API $object An object that implements the selector API.
int $pageID Default pageID.
int $sortID Default sortID.
int $action The actions to potentially support.
CRM_Core_Page|CRM_Core_Form $store place in session to store some values
int $output What do we so with the output, session/template//both.
null $prefix
null $case

Return Value

CRM_Core_Selector_Controller

at line 264
bool hasChanged(int $reset)

Have the GET vars changed, i.e. pageId or sortId that forces us to recompute the search values

Parameters

int $reset Are we being reset.

Return Value

bool if the GET params are different from the session params

at line 302
void run()

Heart of the Controller. This is where all the action takes place

  • The rows are fetched and stored depending on the type of output needed

    • For export/printing all rows are selected.

    • for displaying on screen paging parameters are used to display the required rows.

    • also depending on output type of session or template rows are appropriately stored in session or template variables are updated.

Return Value

void

at line 408
array getRows(CRM_Core_Form $form)

Retrieve rows.

Parameters

CRM_Core_Form $form

Return Value

array Array of rows

at line 427
string getQill()

Default function for qill, if needed to be implemented, we expect the subclass to do it

Return Value

string the status message

at line 434
mixed getSummary()

Return Value

mixed

at line 443
CRM_Utils_Pager getPager()

Getter for pager.

Return Value

CRM_Utils_Pager

at line 452
CRM_Utils_Sort getSort()

Getter for sort.

Return Value

CRM_Utils_Sort

at line 461
void moveFromSessionToTemplate()

Move the variables from the session to the template.

Return Value

void

at line 505
void setEmbedded(bool $embedded)

Setter for embedded.

Parameters

bool $embedded

Return Value

void

at line 515
bool getEmbedded()

Getter for embedded.

Return Value

bool return the embedded value

at line 526
void setPrint(bool $print)

Setter for print.

Parameters

bool $print

Return Value

void

at line 536
bool getPrint()

Getter for print.

Return Value

bool return the print value

at line 543
setDynamicAction($value)

Parameters

$value

at line 550
bool getDynamicAction()

Return Value

bool