EmailReport
extends SaveFile
in package
Leverages the saveFile action to save the SearchDisplay to a file, and then emails one or more contacts with the saved file as an attachment.
Table of Contents
Properties
- $_debugOutput : mixed
- $_actionName : string
- $_apiParams : array{select: array, where: array, having: array, orderBy: array, limit: int, offset: int, checkPermissions: bool, debug: bool}
- $_entityName : string
- $afform : string
- Name of Afform, if this display is embedded (used for permissioning)
- $appendDate : bool
- Whether to append the date to the file name.
- $bcc : string
- Send blind copy to email address (bcc)
- $cc : string
- Send copy to email address (cc)
- $chain : array<string|int, mixed>
- Additional api requests - will be called once per result.
- $checkPermissions : bool
- Whether to enforce acl permissions based on the current user.
- $contactID : string
- A single Contact ID or multiple Contact ID's separated by comma.
- $debug : bool
- Add debugging info to the api result.
- $display : string|array<string|int, mixed>|null
- Either the name of the display or an array containing the display definition (for preview mode)
- $fileName : string
- The name of the file for the report output that is saved to the file system.
- $filterLabels : array<string|int, mixed>
- Filters passed directly into this display via Afform markup will have their labels appended to the Afform title.
- $filters : array<string|int, mixed>
- Search conditions that will be automatically added to the WHERE or HAVING clauses
- $folderName : string
- If provided, the folder name will be used when saving the file.
- $format : string
- Requested file format.
- $language : string
- Preferred language (optional)
- $reportName : string
- The name of the report for the document being created.
- $savedSearch : string|array<string|int, mixed>
- Either the name of the savedSearch or an array containing the savedSearch definition (for preview mode)
- $seed : int
- Integer used as a seed when ordering by RAND().
- $sort : array<string|int, mixed>
- Array of fields to use for ordering the results
- $subject : string
- The subject of the email.
- $templateID : int
- The ID of the message template to be used for the email.
- $toggleColumns : array<string|int, mixed>
- Indices of columns to return
- $version : int
- Api version number; cannot be changed.
- $_joinMap : array<string|int, mixed>
- $_searchEntityFields : array<string|int, mixed>
- $_selectClause : array<string|int, mixed>
- $_selectQuery : Api4SelectQuery
- $formats : mixed
Methods
- __call() : static|mixed
- Magic function to provide automatic getter/setter for params.
- __construct() : mixed
- Action constructor.
- __set() : mixed
- Strictly enforce api parameters
- _run() : mixed
- addChain() : $this
- compareValues() : bool
- entityFields() : array<string|int, mixed>
- Returns schema fields for this entity & action.
- evaluateCondition() : bool
- This function is used internally for evaluating field annotations.
- execute() : SearchDisplayRunResult
- Override execute method to change the result object type
- filterCompare() : bool
- getActionName() : string
- getAfform() : string
- getChain() : array<string|int, mixed>
- getCheckPermissions() : bool
- getDebug() : bool
- getDisplay() : array<string|int, mixed>|string|null
- getEntityName() : string
- getFilters() : array<string|int, mixed>
- getLanguage() : string|null
- getParamInfo() : array<string|int, mixed>
- Get documentation for one or all params
- getParams() : array<string|int, mixed>
- Serialize this object's params into an array
- getPermissions() : array<string|int, mixed>
- getPseudoFields() : array<string|int, array<string|int, mixed>>
- Extra calculated fields provided by SearchKit
- getQueryData() : array<string|int, mixed>
- Get data from the where/having clauses, useful for inferring values to create a new entity
- getSeed() : string
- getSelectClause() : array<string|int, SqlExpression, dataType: string}>
- Returns the select clause enhanced with metadata
- getSort() : array<string|int, mixed>
- getToggleColumns() : array<string|int, mixed>
- offsetExists() : bool
- offsetGet() : mixed
- offsetSet() : void
- offsetUnset() : void
- paramExists() : bool
- reflect() : ReflectionClass
- setAfform() : $this
- setChain() : $this
- setCheckPermissions() : $this
- setDebug() : $this
- setDisplay() : $this
- setFilters() : $this
- setLanguage() : $this
- setSeed() : $this
- setSort() : $this
- setToggleColumns() : $this
- setVersion() : $this
- addCallbackToDebugOutput() : mixed
- When in debug mode, this logs the callback function being used by a Basic*Action class.
- addSelectExpression() : void
- applyFilter() : mixed
- applyFilters() : mixed
- Applies supplied filters to the where clause
- augmentSelectClause() : void
- Adds additional fields to the select clause required to render the display
- checkLinkCondition() : bool
- Evaluate a link condition.
- checkLinkConditions() : bool
- Check if a link should be shown based on its conditions.
- checkPermissionToLoadSearch() : mixed
- Only SearchKit admins can use unsecured "preview mode" and pass an array for savedSearch or display
- checkRequiredFields() : array<string|int, mixed>
- Validates required fields for actions which create a new object.
- filterArray() : array<string|int, mixed>
- filterPrintableColumns() : void
- Checks columns for display and permissions.
- formatColumnValue() : scalar|null
- Returns final formatted column value
- formatEditableColumn() : array{entity: string, action: string, input_type: string, data_type: string, options: bool, serialize: bool, nullable: bool, fk_entity: string, value_key: string, record: array, value_path: string}|null
- formatLink() : array<string|int, mixed>|null
- Format a link to resolve tokens and form the url.
- formatResult() : array<string|int, array{data: array, columns: array, key: int, cssClass: string}>
- Transforms each row into an array of raw data and an array of formatted columns
- formatViewValue() : array<string|int, mixed>|string
- Format raw field value according to data type
- formatWriteValues() : mixed
- Replaces pseudoconstants in input values
- getColumnIcons() : array<string|int, mixed>
- Add icons to a column
- getColumnLabel() : string
- getCssRulesSelect() : array<string|int, mixed>
- Return fields needed for the select clause by a set of css rules
- getCssStyles() : array<string|int, mixed>
- Evaluates conditional style rules
- getCurrencyField() : string|null
- Return the corresponding currency field if a select expression is monetary
- getEditableInfo() : array{entity: string, input_type: string, data_type: string, options: bool, serialize: bool, nullable: bool, fk_entity: string, value_key: string, value_path: string, id_key: string, id_path: string, explicit_join: string, grouping_fields: array}|null
- getField() : array<string|int, mixed>|null
- Returns field definition for a given field or NULL if not found
- getIconsSelect() : array<string|int, mixed>
- Return fields needed for calculating a column's icons
- getIdKeyName() : string
- Given an entity name, returns the data fieldName used to identify it.
- getJoin() : array{entity: string, alias: string, table: string, bridge: string|null}|null
- getJoinFromAlias() : string
- Given an alias like Contact_Email_01_location_type_id this will return Contact_Email_01.location_type_id
- getJoinLabel() : string
- getJoins() : array<string|int, array{entity: string, alias: string, table: string, on: array, bridge: string|null}>
- getLanguageOptions() : array<string|int, mixed>
- Get available preferred languages.
- getMagicProperties() : array<string|int, mixed>
- Get a list of class properties for which magic methods are supported.
- getOrderByFromSort() : array<string|int, mixed>
- Transforms the SORT param (which is expected to be an array of arrays) to the ORDER BY clause (which is an associative array of [field => DIR]
- getParamDefaults() : array<string|int, mixed>
- getRowKeyName() : string
- getRuleCondition() : array<string|int, mixed>
- Returns the condition of a cssRules
- getSelectAliases() : array<string|int, string>
- Returns an array of field names or aliases + allowed suffixes from the SELECT clause
- getSelectExpression() : SqlExpression, dataType: string}|null
- getTokens() : array<string|int, mixed>
- Search a string for all square bracket tokens and return their contents (without the brackets)
- hasValue() : bool
- Checks if a filter contains a non-empty value
- isColumnEnabled() : bool
- limitArray() : array<string|int, mixed>
- loadSavedSearch() : mixed
- If SavedSearch is supplied as a string, this will load it as an array
- loadSearchDisplay() : void
- Loads display if not already an array
- preprocessLinks() : void
- Fills in info about each link in the search display.
- processResult() : void
- queryArray() : mixed
- reloadResults() : array<string|int, mixed>
- rewrite() : string
- Rewrite field value, subtituting tokens and evaluating smarty tags
- selectArray() : array<string|int, mixed>
- sortArray() : array<string|int, mixed>
- canAggregate() : bool
- Determines if a column belongs to an aggregate grouping
- evaluateFilters() : bool
- getEntityFields() : array<string|int, mixed>
- Used as a fallback for non-DAO entities which don't use the Query object
- getQuery() : Api4SelectQuery|null
- Returns a Query object for the search entity, or FALSE if it doesn't have a DAO
- outputCSV() : mixed
- Outputs headers and CSV directly to browser for download
- outputSpreadsheet() : mixed
- Create PhpSpreadsheet document and output directly to browser for download
- processData() : mixed
- renameIfAggregate() : string
- sortCompare() : mixed
- walkFilters() : bool
Properties
$_debugOutput
public
mixed
$_debugOutput
= []
$_actionName
protected
string
$_actionName
$_apiParams
protected
array{select: array, where: array, having: array, orderBy: array, limit: int, offset: int, checkPermissions: bool, debug: bool}
$_apiParams
$_entityName
protected
string
$_entityName
$afform
Name of Afform, if this display is embedded (used for permissioning)
protected
string
$afform
$appendDate
Whether to append the date to the file name.
protected
bool
$appendDate
= FALSE
$bcc
Send blind copy to email address (bcc)
protected
string
$bcc
$cc
Send copy to email address (cc)
protected
string
$cc
$chain
Additional api requests - will be called once per result.
protected
array<string|int, mixed>
$chain
= []
Keys can be any string - this will be the name given to the output.
You can reference other values in the api results in this call by prefixing them with $.
For example, you could create a contact and place them in a group by chaining the
GroupContact api to the Contact api:
Contact::create()
->setValue('first_name', 'Hello')
->addChain('add_a_group', GroupContact::create()
->setValue('contact_id', '$id')
->setValue('group_id', 123)
)
This will substitute the id of the newly created contact with $id.
$checkPermissions
Whether to enforce acl permissions based on the current user.
protected
bool
$checkPermissions
= TRUE
Setting to FALSE will disable permission checks and override ACLs. In REST/javascript this cannot be disabled.
$contactID
A single Contact ID or multiple Contact ID's separated by comma.
protected
string
$contactID
Tags
$debug
Add debugging info to the api result.
protected
bool
$debug
= FALSE
When enabled, $result->debug will be populated with information about the api call,
including sql queries executed.
Note: with checkPermissions enabled, debug info will only be returned if the user has "view debug output" permission.
$display
Either the name of the display or an array containing the display definition (for preview mode)
protected
string|array<string|int, mixed>|null
$display
Leave NULL to use the autogenerated default.
$fileName
The name of the file for the report output that is saved to the file system.
protected
string
$fileName
Tags
$filterLabels
Filters passed directly into this display via Afform markup will have their labels appended to the Afform title.
protected
array<string|int, mixed>
$filterLabels
= []
$filters
Search conditions that will be automatically added to the WHERE or HAVING clauses
protected
array<string|int, mixed>
$filters
= []
$folderName
If provided, the folder name will be used when saving the file.
protected
string
$folderName
$format
Requested file format.
protected
string
$format
= 'array'
'array' will return a normal api result, with table headers as the first row. 'csv', etc. will directly output a file to the browser.
Tags
$language
Preferred language (optional)
protected
string
$language
This option will notify major localization subsystems (ts(), multilingual, etc)
about which locale should be used for composing/formatting messaging.
This indicates the preferred language. The effective language is determined
by Civi\Core\Locale::negotiate($preferredLanguage).
Tags
$reportName
The name of the report for the document being created.
protected
string
$reportName
Tags
$savedSearch
Either the name of the savedSearch or an array containing the savedSearch definition (for preview mode)
protected
string|array<string|int, mixed>
$savedSearch
Tags
$seed
Integer used as a seed when ordering by RAND().
protected
int
$seed
This keeps the order stable enough to use a pager with random sorting.
$sort
Array of fields to use for ordering the results
protected
array<string|int, mixed>
$sort
= []
$subject
The subject of the email.
protected
string
$subject
Tags
$templateID
The ID of the message template to be used for the email.
protected
int
$templateID
Tags
$toggleColumns
Indices of columns to return
protected
array<string|int, mixed>
$toggleColumns
= []
$version
Api version number; cannot be changed.
protected
int
$version
= 4
$_joinMap
private
array<string|int, mixed>
$_joinMap
$_searchEntityFields
private
array<string|int, mixed>
$_searchEntityFields
$_selectClause
private
array<string|int, mixed>
$_selectClause
$_selectQuery
private
Api4SelectQuery
$_selectQuery
$formats
private
mixed
$formats
= ['array' => ['writer' => 'JSON', 'mime' => 'application/json'], 'csv' => ['writer' => 'CSV', 'mime' => 'text/csv'], 'xlsx' => ['writer' => 'Xlsx', 'mime' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'], 'ods' => ['writer' => 'Ods', 'mime' => 'application/vnd.oasis.opendocument.spreadsheet'], 'pdf' => ['writer' => 'Dompdf', 'mime' => 'application/pdf']]
Methods
__call()
Magic function to provide automatic getter/setter for params.
public
__call(mixed $name, mixed $arguments) : static|mixed
Parameters
- $name : mixed
- $arguments : mixed
Tags
Return values
static|mixed__construct()
Action constructor.
public
__construct(string $entityName, string $actionName) : mixed
Parameters
- $entityName : string
- $actionName : string
__set()
Strictly enforce api parameters
public
__set(mixed $name, mixed $value) : mixed
Parameters
- $name : mixed
- $value : mixed
Tags
_run()
public
_run(Result $result) : mixed
Parameters
- $result : Result
Tags
addChain()
public
addChain(string $name, AbstractAction $apiRequest[, string|int|array<string|int, mixed> $index = null ]) : $this
Parameters
- $name : string
-
Unique name for this chained request
- $apiRequest : AbstractAction
- $index : string|int|array<string|int, mixed> = null
-
See
civicrm_api4()for documentation of$indexparam
Return values
$thiscompareValues()
public
static compareValues(mixed $value, string $operator, mixed $expected) : bool
Parameters
- $value : mixed
- $operator : string
- $expected : mixed
Return values
boolentityFields()
Returns schema fields for this entity & action.
public
entityFields() : array<string|int, mixed>
Here we bypass the api wrapper and run the getFields action directly. This is because we DON'T want the wrapper to check permissions as this is an internal op.
Tags
Return values
array<string|int, mixed>evaluateCondition()
This function is used internally for evaluating field annotations.
public
static evaluateCondition(string $expr, array<string|int, mixed> $vars) : bool
It should never be passed raw user input.
Parameters
- $expr : string
-
Conditional in php format e.g. $foo > $bar
- $vars : array<string|int, mixed>
-
Variable name => value
Tags
Return values
boolexecute()
Override execute method to change the result object type
public
execute() : SearchDisplayRunResult
Return values
SearchDisplayRunResultfilterCompare()
public
static filterCompare(array<string|int, mixed> $row, array<string|int, mixed> $condition[, int|null $index = null ]) : bool
Parameters
- $row : array<string|int, mixed>
- $condition : array<string|int, mixed>
- $index : int|null = null
Tags
Return values
boolgetActionName()
public
getActionName() : string
Return values
stringgetAfform()
public
getAfform() : string
Return values
stringgetChain()
public
getChain() : array<string|int, mixed>
Return values
array<string|int, mixed>getCheckPermissions()
public
getCheckPermissions() : bool
Return values
boolgetDebug()
public
getDebug() : bool
Return values
boolgetDisplay()
public
getDisplay() : array<string|int, mixed>|string|null
Return values
array<string|int, mixed>|string|nullgetEntityName()
public
getEntityName() : string
Return values
stringgetFilters()
public
getFilters() : array<string|int, mixed>
Return values
array<string|int, mixed>getLanguage()
public
getLanguage() : string|null
Return values
string|nullgetParamInfo()
Get documentation for one or all params
public
getParamInfo([string $param = null ]) : array<string|int, mixed>
Parameters
- $param : string = null
Return values
array<string|int, mixed> —of arrays [description, type, default, (comment)]
getParams()
Serialize this object's params into an array
public
getParams() : array<string|int, mixed>
Return values
array<string|int, mixed>getPermissions()
public
getPermissions() : array<string|int, mixed>
Return values
array<string|int, mixed>getPseudoFields()
Extra calculated fields provided by SearchKit
public
static getPseudoFields() : array<string|int, array<string|int, mixed>>
Return values
array<string|int, array<string|int, mixed>>getQueryData()
Get data from the where/having clauses, useful for inferring values to create a new entity
public
getQueryData() : array<string|int, mixed>
If $this->applyFilters has already run, it will include data from filters
Tags
Return values
array<string|int, mixed>getSeed()
public
getSeed() : string
Return values
stringgetSelectClause()
Returns the select clause enhanced with metadata
public
getSelectClause() : array<string|int, SqlExpression, dataType: string}>
Return values
array<string|int, SqlExpression, dataType: string}>getSort()
public
getSort() : array<string|int, mixed>
Return values
array<string|int, mixed>getToggleColumns()
public
getToggleColumns() : array<string|int, mixed>
Return values
array<string|int, mixed>offsetExists()
public
offsetExists(mixed $offset) : bool
Parameters
- $offset : mixed
Tags
Return values
booloffsetGet()
public
& offsetGet(mixed $offset) : mixed
Parameters
- $offset : mixed
Tags
Attributes
- #[ReturnTypeWillChange]
offsetSet()
public
offsetSet(mixed $offset, mixed $value) : void
Parameters
- $offset : mixed
- $value : mixed
Tags
offsetUnset()
public
offsetUnset(mixed $offset) : void
Parameters
- $offset : mixed
Tags
paramExists()
public
paramExists(string $param) : bool
Parameters
- $param : string
Return values
boolreflect()
public
reflect() : ReflectionClass
Return values
ReflectionClasssetAfform()
public
setAfform(string $afform) : $this
Parameters
- $afform : string
Return values
$thissetChain()
public
setChain(array<string|int, mixed> $chain) : $this
Parameters
- $chain : array<string|int, mixed>
Return values
$thissetCheckPermissions()
public
setCheckPermissions(bool $checkPermissions) : $this
Parameters
- $checkPermissions : bool
Return values
$thissetDebug()
public
setDebug(bool $debug) : $this
Enable/disable debug output
Parameters
- $debug : bool
Return values
$thissetDisplay()
public
setDisplay(array<string|int, mixed>|string $display) : $this
Parameters
- $display : array<string|int, mixed>|string
Return values
$thissetFilters()
public
setFilters(array<string|int, mixed> $filters) : $this
Parameters
- $filters : array<string|int, mixed>
Return values
$thissetLanguage()
public
setLanguage(string|null $language) : $this
Parameters
- $language : string|null
Return values
$thissetSeed()
public
setSeed(string $seed) : $this
Parameters
- $seed : string
Return values
$thissetSort()
public
setSort(array<string|int, mixed> $sort) : $this
Parameters
- $sort : array<string|int, mixed>
Return values
$thissetToggleColumns()
public
setToggleColumns(array<string|int, mixed> $columnIndices) : $this
Parameters
- $columnIndices : array<string|int, mixed>
Return values
$thissetVersion()
public
setVersion(int $val) : $this
Parameters
- $val : int
Tags
Return values
$thisaddCallbackToDebugOutput()
When in debug mode, this logs the callback function being used by a Basic*Action class.
protected
addCallbackToDebugOutput(callable $callable) : mixed
Parameters
- $callable : callable
addSelectExpression()
protected
addSelectExpression(string $expr) : void
Parameters
- $expr : string
applyFilter()
protected
applyFilter(string|array<string|int, mixed> $fieldName, mixed $value[, array<string|int, mixed>|null $formFields = null ]) : mixed
Parameters
- $fieldName : string|array<string|int, mixed>
-
If multiple field names are given they will be combined in an OR clause
- $value : mixed
-
Filter value
- $formFields : array<string|int, mixed>|null = null
-
Afform filters
applyFilters()
Applies supplied filters to the where clause
protected
applyFilters() : mixed
augmentSelectClause()
Adds additional fields to the select clause required to render the display
protected
augmentSelectClause(array<string|int, mixed> &$apiParams) : void
Parameters
- $apiParams : array<string|int, mixed>
checkLinkCondition()
Evaluate a link condition.
protected
checkLinkCondition(array<string|int, mixed> $condition, array<string|int, mixed> $data) : bool
Parameters
- $condition : array<string|int, mixed>
- $data : array<string|int, mixed>
Return values
boolcheckLinkConditions()
Check if a link should be shown based on its conditions.
protected
checkLinkConditions(array<string|int, mixed> $link, array<string|int, mixed> $data) : bool
Given a link, check if it is set to be displayed conditionally. If so, evaluate the condition, else return TRUE.
Parameters
- $link : array<string|int, mixed>
- $data : array<string|int, mixed>
Return values
boolcheckPermissionToLoadSearch()
Only SearchKit admins can use unsecured "preview mode" and pass an array for savedSearch or display
protected
checkPermissionToLoadSearch() : mixed
Tags
checkRequiredFields()
Validates required fields for actions which create a new object.
protected
checkRequiredFields(mixed $values) : array<string|int, mixed>
Parameters
- $values : mixed
Tags
Return values
array<string|int, mixed>filterArray()
protected
filterArray(array<string|int, mixed> $values) : array<string|int, mixed>
Parameters
- $values : array<string|int, mixed>
Return values
array<string|int, mixed>filterPrintableColumns()
Checks columns for display and permissions.
protected
filterPrintableColumns(array<string|int, mixed> &$settings) : void
Parameters
- $settings : array<string|int, mixed>
-
The settings from search display.
formatColumnValue()
Returns final formatted column value
protected
formatColumnValue(array<string|int, mixed> $col, array<string|int, mixed> $value) : scalar|null
Parameters
- $col : array<string|int, mixed>
- $value : array<string|int, mixed>
Return values
scalar|nullformatEditableColumn()
protected
formatEditableColumn(array<string|int, mixed> $column, array<string|int, mixed> $data) : array{entity: string, action: string, input_type: string, data_type: string, options: bool, serialize: bool, nullable: bool, fk_entity: string, value_key: string, record: array, value_path: string}|null
Parameters
- $column : array<string|int, mixed>
- $data : array<string|int, mixed>
Return values
array{entity: string, action: string, input_type: string, data_type: string, options: bool, serialize: bool, nullable: bool, fk_entity: string, value_key: string, record: array, value_path: string}|nullformatLink()
Format a link to resolve tokens and form the url.
protected
formatLink(array<string|int, mixed> $link, array<string|int, mixed> $data[, bool $allowMultiple = false ][, string|null $text = null ][, int $index = 0 ]) : array<string|int, mixed>|null
There are 3 ways a link can be declared:
- entity+action
- entity+task
- path
Parameters
- $link : array<string|int, mixed>
- $data : array<string|int, mixed>
- $allowMultiple : bool = false
- $text : string|null = null
- $index : int = 0
Tags
Return values
array<string|int, mixed>|nullformatResult()
Transforms each row into an array of raw data and an array of formatted columns
protected
formatResult(iterable<string|int, mixed> $result) : array<string|int, array{data: array, columns: array, key: int, cssClass: string}>
Parameters
- $result : iterable<string|int, mixed>
Return values
array<string|int, array{data: array, columns: array, key: int, cssClass: string}>formatViewValue()
Format raw field value according to data type
protected
formatViewValue(string $key, mixed $rawValue, array<string|int, mixed> $data, string $dataType[, string|array<string|int, mixed>|null $format = null ]) : array<string|int, mixed>|string
Parameters
- $key : string
- $rawValue : mixed
- $data : array<string|int, mixed>
- $dataType : string
- $format : string|array<string|int, mixed>|null = null
Return values
array<string|int, mixed>|stringformatWriteValues()
Replaces pseudoconstants in input values
protected
formatWriteValues(array<string|int, mixed> &$record) : mixed
Parameters
- $record : array<string|int, mixed>
Tags
getColumnIcons()
Add icons to a column
protected
getColumnIcons(array<string|int, mixed> $column, array<string|int, mixed> $data, array<string|int, mixed> $out) : array<string|int, mixed>
Note: Only one icon is allowed per side (left/right). If more than one per side is given, latter icons are treated as fallbacks and only shown if prior ones are missing.
Parameters
- $column : array<string|int, mixed>
- $data : array<string|int, mixed>
- $out : array<string|int, mixed>
Return values
array<string|int, mixed>getColumnLabel()
protected
getColumnLabel(SqlExpression $expr) : string
Parameters
- $expr : SqlExpression
Return values
stringgetCssRulesSelect()
Return fields needed for the select clause by a set of css rules
protected
getCssRulesSelect(array<string|int, mixed> $cssRules) : array<string|int, mixed>
Parameters
- $cssRules : array<string|int, mixed>
Return values
array<string|int, mixed>getCssStyles()
Evaluates conditional style rules
protected
getCssStyles(array<string|int, array<string|int, mixed>> $styleRules, array<string|int, mixed> $data[, int|null $index = null ]) : array<string|int, mixed>
Rules are in the format ['css class', 'field_name', 'OPERATOR', 'value']
Parameters
- $styleRules : array<string|int, array<string|int, mixed>>
- $data : array<string|int, mixed>
- $index : int|null = null
Return values
array<string|int, mixed>getCurrencyField()
Return the corresponding currency field if a select expression is monetary
protected
getCurrencyField(string $select) : string|null
Parameters
- $select : string
Return values
string|nullgetEditableInfo()
protected
getEditableInfo(array<string|int, mixed> $column[, null|string $key = null ]) : array{entity: string, input_type: string, data_type: string, options: bool, serialize: bool, nullable: bool, fk_entity: string, value_key: string, value_path: string, id_key: string, id_path: string, explicit_join: string, grouping_fields: array}|null
Parameters
- $column : array<string|int, mixed>
-
Column definition
- $key : null|string = null
-
Internal use only
Return values
array{entity: string, input_type: string, data_type: string, options: bool, serialize: bool, nullable: bool, fk_entity: string, value_key: string, value_path: string, id_key: string, id_path: string, explicit_join: string, grouping_fields: array}|nullgetField()
Returns field definition for a given field or NULL if not found
protected
getField(mixed $fieldName) : array<string|int, mixed>|null
Parameters
- $fieldName : mixed
Return values
array<string|int, mixed>|nullgetIconsSelect()
Return fields needed for calculating a column's icons
protected
getIconsSelect(array<string|int, mixed> $icons) : array<string|int, mixed>
Parameters
- $icons : array<string|int, mixed>
Return values
array<string|int, mixed>getIdKeyName()
Given an entity name, returns the data fieldName used to identify it.
protected
getIdKeyName(string|null $entityName) : string
Parameters
- $entityName : string|null
Return values
stringgetJoin()
protected
getJoin(string $joinAlias) : array{entity: string, alias: string, table: string, bridge: string|null}|null
Parameters
- $joinAlias : string
-
Alias of the join, with or without the trailing dot
Return values
array{entity: string, alias: string, table: string, bridge: string|null}|nullgetJoinFromAlias()
Given an alias like Contact_Email_01_location_type_id this will return Contact_Email_01.location_type_id
protected
getJoinFromAlias(string $alias) : string
Parameters
- $alias : string
Return values
stringgetJoinLabel()
protected
getJoinLabel(string $joinAlias) : string
Parameters
- $joinAlias : string
Return values
stringgetJoins()
protected
getJoins() : array<string|int, array{entity: string, alias: string, table: string, on: array, bridge: string|null}>
Return values
array<string|int, array{entity: string, alias: string, table: string, on: array, bridge: string|null}>getLanguageOptions()
Get available preferred languages.
protected
getLanguageOptions() : array<string|int, mixed>
Return values
array<string|int, mixed>getMagicProperties()
Get a list of class properties for which magic methods are supported.
protected
static getMagicProperties() : array<string|int, mixed>
Return values
array<string|int, mixed> —List of supported properties, keyed by property name. Array(string $propertyName => bool $true).
getOrderByFromSort()
Transforms the SORT param (which is expected to be an array of arrays) to the ORDER BY clause (which is an associative array of [field => DIR]
protected
getOrderByFromSort() : array<string|int, mixed>
Return values
array<string|int, mixed>getParamDefaults()
protected
getParamDefaults() : array<string|int, mixed>
Return values
array<string|int, mixed>getRowKeyName()
protected
getRowKeyName() : string
Return values
stringgetRuleCondition()
Returns the condition of a cssRules
protected
getRuleCondition(array<string|int, mixed> $clause[, bool $isMulti = false ]) : array<string|int, mixed>
Parameters
- $clause : array<string|int, mixed>
- $isMulti : bool = false
Return values
array<string|int, mixed>getSelectAliases()
Returns an array of field names or aliases + allowed suffixes from the SELECT clause
protected
getSelectAliases() : array<string|int, string>
Return values
array<string|int, string>getSelectExpression()
protected
getSelectExpression(string $key) : SqlExpression, dataType: string}|null
Parameters
- $key : string
Return values
SqlExpression, dataType: string}|nullgetTokens()
Search a string for all square bracket tokens and return their contents (without the brackets)
protected
getTokens(string $str) : array<string|int, mixed>
Parameters
- $str : string
Return values
array<string|int, mixed>hasValue()
Checks if a filter contains a non-empty value
protected
hasValue(mixed $value) : bool
"Empty" search values are [], '', and NULL. Also recursively checks arrays to ensure they contain at least one non-empty value.
Parameters
- $value : mixed
Return values
boolisColumnEnabled()
protected
isColumnEnabled(int $columnIndex) : bool
Parameters
- $columnIndex : int
Return values
boollimitArray()
protected
limitArray(mixed $values) : array<string|int, mixed>
Parameters
- $values : mixed
Return values
array<string|int, mixed>loadSavedSearch()
If SavedSearch is supplied as a string, this will load it as an array
protected
loadSavedSearch([int|null $id = null ]) : mixed
Parameters
- $id : int|null = null
Tags
loadSearchDisplay()
Loads display if not already an array
protected
loadSearchDisplay() : void
preprocessLinks()
Fills in info about each link in the search display.
protected
preprocessLinks() : void
processResult()
protected
processResult(SearchDisplayRunResult $result) : void
Parameters
- $result : SearchDisplayRunResult
queryArray()
protected
queryArray(array<string|int, mixed> $values, Result $result) : mixed
Parameters
- $values : array<string|int, mixed>
-
List of all rows to be filtered
- $result : Result
-
Object to store result
reloadResults()
protected
reloadResults(array<string|int, mixed> $savedRecords[, array<string|int, mixed>|bool $select = true ]) : array<string|int, mixed>
Parameters
- $savedRecords : array<string|int, mixed>
- $select : array<string|int, mixed>|bool = true
Tags
Return values
array<string|int, mixed>rewrite()
Rewrite field value, subtituting tokens and evaluating smarty tags
protected
rewrite(string $rewrite, array<string|int, mixed> $data[, string $format = 'view' ]) : string
Parameters
- $rewrite : string
- $data : array<string|int, mixed>
- $format : string = 'view'
-
view|raw|url
Return values
stringselectArray()
protected
selectArray(mixed $values) : array<string|int, mixed>
Parameters
- $values : mixed
Return values
array<string|int, mixed>sortArray()
protected
sortArray(mixed $values) : array<string|int, mixed>
Parameters
- $values : mixed
Return values
array<string|int, mixed>canAggregate()
Determines if a column belongs to an aggregate grouping
private
canAggregate(string $fieldPath) : bool
Parameters
- $fieldPath : string
Return values
boolevaluateFilters()
private
evaluateFilters(array<string|int, mixed> $row) : bool
Parameters
- $row : array<string|int, mixed>
Return values
boolgetEntityFields()
Used as a fallback for non-DAO entities which don't use the Query object
private
getEntityFields() : array<string|int, mixed>
Return values
array<string|int, mixed>getQuery()
Returns a Query object for the search entity, or FALSE if it doesn't have a DAO
private
getQuery() : Api4SelectQuery|null
Return values
Api4SelectQuery|nulloutputCSV()
Outputs headers and CSV directly to browser for download
private
outputCSV(array<string|int, mixed> $rows, array<string|int, mixed> $columns, string $fileName) : mixed
Parameters
- $rows : array<string|int, mixed>
- $columns : array<string|int, mixed>
- $fileName : string
outputSpreadsheet()
Create PhpSpreadsheet document and output directly to browser for download
private
outputSpreadsheet(array<string|int, mixed> $rows, array<string|int, mixed> $columns) : mixed
Parameters
- $rows : array<string|int, mixed>
- $columns : array<string|int, mixed>
processData()
private
processData(mixed $label, mixed $columns, mixed $rows, mixed &$fileName) : mixed
Parameters
- $label : mixed
- $columns : mixed
- $rows : mixed
- $fileName : mixed
renameIfAggregate()
private
renameIfAggregate(string $fieldPath[, bool $asSelect = false ]) : string
Parameters
- $fieldPath : string
- $asSelect : bool = false
Return values
stringsortCompare()
private
sortCompare(mixed $a, mixed $b) : mixed
Parameters
- $a : mixed
- $b : mixed
walkFilters()
private
walkFilters(array<string|int, mixed> $row, array<string|int, mixed> $filters) : bool
Parameters
- $row : array<string|int, mixed>
- $filters : array<string|int, mixed>