Documentation

EventHandler
in package

Event Handler main class.

Tags
copyright

YetiForce Sp. z o.o

license

YetiForce Public License 3.0 (licenses/LicenseEN.txt or yetiforce.com)

author

Mariusz Krzaczkowski m.krzaczkowski@yetiforce.com

author

Radosław Skrzypczak r.skrzypczak@yetiforce.com

Table of Contents

EDIT_VIEW_CHANGE_VALUE  = 'EditViewChangeValue'
EDIT_VIEW_PRE_SAVE  = 'EditViewPreSave'
EDITABLE  = 1
HANDLER_TYPES  = ['EditViewPreSave' => ['label' => 'LBL_EDIT_VIEW_PRESAVE', 'icon' => 'fas fa-step-backward', 'columns' => ['eventName' => ['label' => 'LBL_EVENT_NAME'], 'eventDescription' => ['label' => 'LBL_EVENT_DESC'], 'modules' => ['label' => 'LBL_INCLUDE_MODULES'], 'modulesExcluded' => ['label' => 'LBL_EXCLUDE_MODULES'], 'active' => ['label' => 'LBL_EVENT_IS_ACTIVE']]], 'EntityChangeState' => ['label' => 'LBL_ENTITY_CHANGE_STATE', 'icon' => 'fas fa-compass', 'columns' => ['eventName' => ['label' => 'LBL_EVENT_NAME'], 'eventDescription' => ['label' => 'LBL_EVENT_DESC'], 'modules' => ['label' => 'LBL_INCLUDE_MODULES'], 'modulesExcluded' => ['label' => 'LBL_EXCLUDE_MODULES'], 'active' => ['label' => 'LBL_EVENT_IS_ACTIVE']]], 'EntityBeforeSave' => ['label' => 'LBL_ENTITY_BEFORE_SAVE', 'icon' => 'fas fa-save', 'columns' => ['eventName' => ['label' => 'LBL_EVENT_NAME'], 'eventDescription' => ['label' => 'LBL_EVENT_DESC'], 'modules' => ['label' => 'LBL_INCLUDE_MODULES'], 'modulesExcluded' => ['label' => 'LBL_EXCLUDE_MODULES'], 'active' => ['label' => 'LBL_EVENT_IS_ACTIVE']]], 'EntityAfterSave' => ['label' => 'LBL_ENTITY_AFTER_SAVE', 'icon' => 'far fa-save', 'columns' => ['eventName' => ['label' => 'LBL_EVENT_NAME'], 'eventDescription' => ['label' => 'LBL_EVENT_DESC'], 'modules' => ['label' => 'LBL_INCLUDE_MODULES'], 'modulesExcluded' => ['label' => 'LBL_EXCLUDE_MODULES'], 'active' => ['label' => 'LBL_EVENT_IS_ACTIVE']]]]
Handler types.
RECORD_CONVERTER_AFTER_SAVE  = 'RecordConverterAfterSave'
SYSTEM  = 0
$baseTable  : string
Table name.
$exceptions  : mixed
$handlers  : mixed
$mandatoryEventClass  : mixed
$moduleName  : mixed
$params  : mixed
$recordModel  : mixed
addParams()  : mixed
Add param.
checkActive()  : bool
Check if it is active function.
clearCache()  : mixed
Clear cache.
deleteHandler()  : mixed
Unregister a registered handler.
getAll()  : array<string|int, mixed>
Get all event handlers.
getByType()  : array<string|int, mixed>
Get active event handlers by type (event_name).
getHandlers()  : array<string|int, mixed>
getModuleName()  : string
Get module name.
getParams()  : array<string|int, mixed>
Get params.
getRecordModel()  : Vtiger_Record_Model
Get record model.
getVarsByType()  : string
Get vars event handlers by type (event_name).
registerHandler()  : bool
Register an event handler.
setActive()  : mixed
Set an event handler as active.
setExceptions()  : mixed
Set exceptions.
setInActive()  : mixed
Set an event handler as inactive.
setModuleName()  : $this
Set module name.
setParams()  : mixed
Set params.
setRecordModel()  : $this
Set record model.
trigger()  : mixed
Trigger an event.
triggerHandler()  : mixed
Trigger handler.
update()  : void
Update an event handler.

Constants

EDIT_VIEW_CHANGE_VALUE

public string EDIT_VIEW_CHANGE_VALUE = 'EditViewChangeValue'

EDIT_VIEW_PRE_SAVE

public string EDIT_VIEW_PRE_SAVE = 'EditViewPreSave'

HANDLER_TYPES

Handler types.

public array<string|int, mixed> HANDLER_TYPES = ['EditViewPreSave' => ['label' => 'LBL_EDIT_VIEW_PRESAVE', 'icon' => 'fas fa-step-backward', 'columns' => ['eventName' => ['label' => 'LBL_EVENT_NAME'], 'eventDescription' => ['label' => 'LBL_EVENT_DESC'], 'modules' => ['label' => 'LBL_INCLUDE_MODULES'], 'modulesExcluded' => ['label' => 'LBL_EXCLUDE_MODULES'], 'active' => ['label' => 'LBL_EVENT_IS_ACTIVE']]], 'EntityChangeState' => ['label' => 'LBL_ENTITY_CHANGE_STATE', 'icon' => 'fas fa-compass', 'columns' => ['eventName' => ['label' => 'LBL_EVENT_NAME'], 'eventDescription' => ['label' => 'LBL_EVENT_DESC'], 'modules' => ['label' => 'LBL_INCLUDE_MODULES'], 'modulesExcluded' => ['label' => 'LBL_EXCLUDE_MODULES'], 'active' => ['label' => 'LBL_EVENT_IS_ACTIVE']]], 'EntityBeforeSave' => ['label' => 'LBL_ENTITY_BEFORE_SAVE', 'icon' => 'fas fa-save', 'columns' => ['eventName' => ['label' => 'LBL_EVENT_NAME'], 'eventDescription' => ['label' => 'LBL_EVENT_DESC'], 'modules' => ['label' => 'LBL_INCLUDE_MODULES'], 'modulesExcluded' => ['label' => 'LBL_EXCLUDE_MODULES'], 'active' => ['label' => 'LBL_EVENT_IS_ACTIVE']]], 'EntityAfterSave' => ['label' => 'LBL_ENTITY_AFTER_SAVE', 'icon' => 'far fa-save', 'columns' => ['eventName' => ['label' => 'LBL_EVENT_NAME'], 'eventDescription' => ['label' => 'LBL_EVENT_DESC'], 'modules' => ['label' => 'LBL_INCLUDE_MODULES'], 'modulesExcluded' => ['label' => 'LBL_EXCLUDE_MODULES'], 'active' => ['label' => 'LBL_EVENT_IS_ACTIVE']]]]

RECORD_CONVERTER_AFTER_SAVE

public string RECORD_CONVERTER_AFTER_SAVE = 'RecordConverterAfterSave'

Properties

$baseTable

Table name.

protected static string $baseTable = 'vtiger_eventhandlers'

$mandatoryEventClass

private static mixed $mandatoryEventClass = ['ModTracker_ModTrackerHandler_Handler']

Methods

addParams()

Add param.

public addParams(mixed $key, mixed $value) : mixed
Parameters
$key : mixed
$value : mixed
Return values
mixed

checkActive()

Check if it is active function.

public static checkActive(string $className[, string|null $eventName = null ]) : bool
Parameters
$className : string
$eventName : string|null = null
Return values
bool

clearCache()

Clear cache.

public static clearCache() : mixed
Return values
mixed

deleteHandler()

Unregister a registered handler.

public static deleteHandler(string $className[, bool|string $eventName = false ]) : mixed
Parameters
$className : string
$eventName : bool|string = false
Return values
mixed

getAll()

Get all event handlers.

public static getAll([bool $active = true ]) : array<string|int, mixed>
Parameters
$active : bool = true
Return values
array<string|int, mixed>

getByType()

Get active event handlers by type (event_name).

public static getByType(string $name[, string $moduleName = '' ][, bool $active = true ]) : array<string|int, mixed>
Parameters
$name : string
$moduleName : string = ''
$active : bool = true
Return values
array<string|int, mixed>

getHandlers()

public getHandlers(string $name) : array<string|int, mixed>
Parameters
$name : string

Event name

Return values
array<string|int, mixed>

Handlers list

getModuleName()

Get module name.

public getModuleName() : string
Return values
string

getParams()

Get params.

public getParams() : array<string|int, mixed>
Return values
array<string|int, mixed>

Additional parameters

getVarsByType()

Get vars event handlers by type (event_name).

public static getVarsByType(string $name, string $moduleName, array<string|int, mixed> $params[, bool $byKey = false ]) : string
Parameters
$name : string
$moduleName : string
$params : array<string|int, mixed>
$byKey : bool = false
Return values
string

registerHandler()

Register an event handler.

public static registerHandler(string $eventName, string $className[, string $includeModules = '' ][, string $excludeModules = '' ][, int $priority = 5 ][, bool $isActive = true ], int $ownerId[, int $mode = 1 ]) : bool
Parameters
$eventName : string

The name of the event to handle

$className : string
$includeModules : string = ''
$excludeModules : string = ''
$priority : int = 5
$isActive : bool = true
$ownerId : int
$mode : int = 1
Return values
bool

setActive()

Set an event handler as active.

public static setActive(string $className[, bool|string $eventName = false ]) : mixed
Parameters
$className : string
$eventName : bool|string = false
Return values
mixed

setExceptions()

Set exceptions.

public setExceptions(array<string|int, mixed> $exceptions) : mixed
Parameters
$exceptions : array<string|int, mixed>
Return values
mixed

setInActive()

Set an event handler as inactive.

public static setInActive(string $className[, bool|string $eventName = false ]) : mixed
Parameters
$className : string
$eventName : bool|string = false
Return values
mixed

setModuleName()

Set module name.

public setModuleName(string $moduleName) : $this
Parameters
$moduleName : string
Return values
$this

setParams()

Set params.

public setParams(array<string|int, mixed> $params) : mixed
Parameters
$params : array<string|int, mixed>
Return values
mixed

trigger()

Trigger an event.

public trigger(string $name) : mixed
Parameters
$name : string

Event name

Tags
throws
AppException
Return values
mixed

triggerHandler()

Trigger handler.

public triggerHandler(array<string|int, mixed> $handler) : mixed
Parameters
$handler : array<string|int, mixed>
Tags
throws
AppException
Return values
mixed

update()

Update an event handler.

public static update(array<string|int, mixed> $params, int $id) : void
Parameters
$params : array<string|int, mixed>
$id : int
Return values
void

Search results