Documentation

CRM_Core_Selector_Controller
in package

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

Tags
copyright

CiviCRM LLC https://civicrm.org/licensing

Table of Contents

Constants

EXPORT  = 8
Constants to determine if we should store the output in the session or template
PDF  = 32
Constants to determine if we should store the output in the session or template
SCREEN  = 16
Constants to determine if we should store the output in the session or template
SESSION  = 1
Constants to determine if we should store the output in the session or template
TEMPLATE  = 2
Constants to determine if we should store the output in the session or template
TRANSFER  = 4
Constants to determine if we should store the output in the session or template

Properties

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

Methods

__construct()  : CRM_Core_Selector_Controller
Class constructor.
getDynamicAction()  : bool
getEmbedded()  : bool
Getter for embedded.
getPager()  : CRM_Utils_Pager
Getter for pager.
getPrint()  : int|string
Getter for print.
getQill()  : string
Default function for qill, if needed to be implemented, we expect the subclass to do it
getRows()  : array<string|int, mixed>
Retrieve rows.
getSort()  : CRM_Utils_Sort
Getter for sort.
getSummary()  : mixed
hasChanged()  : bool
Have the GET vars changed, i.e. pageId or sortId that forces us to recompute the search values
moveFromSessionToTemplate()  : void
Move the variables from the session to the template.
run()  : void
Heart of the Controller. This is where all the action takes place
setDynamicAction()  : mixed
setEmbedded()  : void
Setter for embedded.
setPrint()  : void
Setter for print.

Constants

EXPORT

Constants to determine if we should store the output in the session or template

public int EXPORT = 8

PDF

Constants to determine if we should store the output in the session or template

public int PDF = 32

SCREEN

Constants to determine if we should store the output in the session or template

public int SCREEN = 16

SESSION

Constants to determine if we should store the output in the session or template

public int SESSION = 1

TEMPLATE

Constants to determine if we should store the output in the session or template

public int TEMPLATE = 2

TRANSFER

Constants to determine if we should store the output in the session or template

public int TRANSFER = 4

Properties

$_properties

Array of properties that the controller dumps into the output object

public static array<string|int, mixed> $_properties = ['columnHeaders', 'rows', 'rowsEmpty']

$_action

The objectAction for the WebObject

protected int $_action

$_content

This caches the content for the display system

protected string $_content

$_dynamicAction

Should we compute actions dynamically (since they are quite verbose)

protected bool $_dynamicAction = \FALSE

$_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 $_embedded = \FALSE

$_object

A CRM Object that implements CRM_Core_Selector_API.

protected object $_object

$_output

Output target, session, template or both?

protected int $_output

$_pagerOffset

Offset

protected int $_pagerOffset

$_pagerRowCount

Number of rows to return

protected int $_pagerRowCount

$_prefix

Prefif for the selector variables

protected int $_prefix

$_print

Are we in print mode? if so we need to modify the display functionality to do a minimal display :)

protected int|string $_print = 0

Should match a CRM_Core_Smarty::PRINT_* constant, or equal 0 if not in print mode

$_sortID

The current column to sort on

protected int $_sortID

$_sortOrder

The sortOrder array

protected array<string|int, mixed> $_sortOrder

$_store

The storage object (typically a form or a page)

protected object $_store

$_total

Total number of rows

protected int $_total

Methods

__construct()

Class constructor.

public __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 ]) : CRM_Core_Selector_Controller
Parameters
$object : CRM_Core_Selector_API

An object that implements the selector API.

$pageID : int

Default pageID.

$sortID : int

Default sortID.

$action : int

The actions to potentially support.

$store : CRM_Core_Page|CRM_Core_Form = NULL

place in session to store some values

$output : int = self::TEMPLATE

What do we so with the output, session/template//both.

$prefix : null = NULL
$case : null = NULL
Return values
CRM_Core_Selector_Controller

getDynamicAction()

public getDynamicAction() : bool
Return values
bool

getEmbedded()

Getter for embedded.

public getEmbedded() : bool
Return values
bool

return the embedded value

getPrint()

Getter for print.

public getPrint() : int|string
Return values
int|string

Value matching a CRM_Core_Smarty::PRINT_* constant, or 0 if not in print mode

getQill()

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

public getQill() : string
Return values
string

the status message

getRows()

Retrieve rows.

public getRows(CRM_Core_Form $form) : array<string|int, mixed>
Parameters
$form : CRM_Core_Form
Return values
array<string|int, mixed>

Array of rows

hasChanged()

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

public hasChanged(int $reset) : bool
Parameters
$reset : int

Are we being reset.

Return values
bool

if the GET params are different from the session params

moveFromSessionToTemplate()

Move the variables from the session to the template.

public moveFromSessionToTemplate() : void

run()

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

public run() : void
  • 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.

setDynamicAction()

public setDynamicAction(mixed $value) : mixed
Parameters
$value : mixed

setEmbedded()

Setter for embedded.

public setEmbedded(bool $embedded) : void
Parameters
$embedded : bool

setPrint()

Setter for print.

public setPrint(int|string $print) : void
Parameters
$print : int|string

Should match a CRM_Core_Smarty::PRINT_* constant, or equal 0 if not in print mode


        
On this page

Search results