Amiro.CMS API Reference
Amiro.Ru / Manual
Loading search...

Event List

Event name Module id Description
Parameters
typevariabledescription
Callers
after_list_columns $modId Allows to modify async list columns.
array &columns Reference to array of columns
AMI_ModListView_JSON::get()
dispatch_mod_action $modId Fires to dispatch module controller action.
string action Action
AMI_Response oResponse Response object
AMI_Request oRequest Request object
string tableModelId Table model resource id
AMI_Mod|null oController Module controller object
string modId Module id
AMI_Mod::dispatch()
dispatch_mod_action_form_edit $modId Processing controller actions of the AMI_Mod module.
AMI_Response oResponse Response object
AMI_Request oRequest Request object
string tableModelId Table model resource id
AMI_Mod|null oController Module controller object
string modId Module id ---
dispatch_mod_action_list_view $modId List view module controller action.
string action Action
AMI_Response oResponse Response object
AMI_Request oRequest Request object
string tableModelId Table model resource id
AMI_Mod|null oController Module controller object
string modId Module id
AMI_ModListActions::refreshView()
dispatch_mod_action_{type} $modId Processing controller actions of the AMI_Mod module.
AMI_Response oResponse Response object
AMI_Request oRequest Request object
string tableModelId Table model resource id
AMI_Mod|null oController Module controller object
string modId Module id
dispatch_request $modId Request processing controller module.
on_add_status_message AMI_Event::MOD_ANY Called when status message added.
array aParams Status message scope
string type Status message type, AMI_Response constants: STATUS_MESSAGE | STATUS_MESSAGE_WARNING | STATUS_MESSAGE_ERROR
string key Status message key from locales
string modId Module id
AMI_Response::addStatusMessage()
on_after_delete_model_item $modId Called after model item deletion.
array aData Table item raw data
AMI_ModTableItem oItem Table item model
AMI_ModTable oTable Table model
AMI_ModTableItemModifier::delete()
on_after_init_componets
since 5.14.8
$modId Called before module controller components initialization.
&array aOptions Array with components options structure
&array aComponents Array with components structure
AMI_Mod oController Module controller object
string componentId Current component id
AMI_Mod::initComponents()
on_after_save_model_item $modId Allows perform actions after creating / updating item
bool success TRUE on success
array aData Table item raw data
AMI_ModTableItem oItem Table item model
AMI_ModTable oTable Table model
bool onCreate TRUE on new item creation, FALSE on existing item saving
AMI_ModTableItemModifier::save()
on_after_user_create
since 5.12.0
AMI_Event::MOD_ANY Fires after user create.
AmiUsers_Users_TableItem oUser User table item model
on_after_user_login
since 5.12.0
AMI_Event::MOD_ANY Fires after user login.
bool isPasswordHashed Password hashed flag (optional)
string password Password (optional)
AmiUsers_Users_TableItem oUser User table item model
on_before_add_{$ruleName}_rule $modId Fires before adding a module rule
CMS_ModuleRules oRuleMod Module rules object
AMI_Module oMod Module object
mixed defaultValue Default rule value
mixed aOptions Rule options
string type Rule type
string name Rule name
AMI_Module::addRule()
on_before_delete_model_item
since 6.0.6
$modId Called before model item deletion.

Set $aEvent['_discard'] to TRUE to discard action.

bool _discard Set to TRUE to discard action
mixed id Table item Id to delete
AMI_ModTableItem oItem Table item model
AMI_ModTableItem::delete()
on_before_form_field_{fieldName} $modId Allows change field at displaying form.
AMI_iFormModTableItem oItem Table item object
AMI_Template oTpl Template object
array aScope Scope
array aField Form field structure
AMI_ModFormView::getFieldScope()
on_before_init_componets
since 5.14.8
$modId Called before module controller components initialization.
&array aOptions Array with components options structure
&array aComponents Array with components structure
AMI_Mod oController Module controller object
string componentId Current component id
AMI_Mod::initComponents()
on_before_save_model_item $modId Allows change data model before create / update item.
bool _discard Allows to discard saving using AMI_ModTableItemModifier::rollback() (since 7.0.0)
array aData Table item raw data
AMI_ModTableItem oItem Table item model
AMI_ModTable oTable Table model
bool onCreate TRUE on new item creation, FALSE on existing item saving
AMI_ModTableItemModifier::save()
on_before_set_values_model_item $modId Fires before setting new table item values.
AMI_ModTableItem oItem Table item model
array aData New values
AMI_ModTableItem::setValues()
on_before_user_create
since 5.12.0
AMI_Event::MOD_ANY Fires before user create.

Set $aEvent['aError']['code'] to non zero value to discard action.

array &aError array('code' => 0, 'message' => '')
AmiUsers_Users_TableItem oUser User table item model
on_before_user_login
since 5.12.0
AMI_Event::MOD_ANY Fires before user login.

Allows to modify login/password/password hased flag before login.
Set $aEvent['_discard'] to TRUE to discard action.

bool _discard Set to TRUE to discard action
bool &isPasswordHashed Password hashed flag (optional)
string &password Password (optional)
string &login Login
on_before_user_logout
since 5.12.0
AMI_Event::MOD_ANY Fires before user logout.
AmiUsers_Users_TableItem oUser User table item model
on_before_user_update
since 5.12.0
AMI_Event::MOD_ANY Fires before user create.

Set $aEvent['aError']['code'] to non zero value to discard action.

array &aError array('code' => 0, 'message' => '')
array &aData New user data (optionsl)
array aSourceData Source user data (optionsl)
AmiUsers_Users_TableItem oUser User table item model
on_data_exchange_export_item
since 5.14.8
AMI_Event::MOD_ANY Allows to modify item data on export, forbid to export item setting $aEvent['_break'], interrupt export setting $aEvent['_result'] as FALSE.
array &aItem Module item data
int itemId Module item id
string modId Module id
string driver Driver name
on_data_import_driver_before_save_item
since 6.0.2
----- Fires before saving item during working of data import driver.
AMI_ModTableItem oItem Table item model
on_dataexchange_export_sql
since 6.0.6
AMI_Event::MOD_ANY Allows to customize SQL query to export products.

function cstHandleDataExchangeExportSQL($name, array $aEvent, $handlerModId, $srcModId){
    $pfx = $aEvent['aSQL]['default_prefix'];
    // select extra field `id_owner`
    $aEvent['aSQL]['select'] .= ', ' . $pfx . 'id_owner';
    // select products having `price` > 1000 only
    $aEvent['aSQL]['where'] .= ' AND ' . $pfx . 'price > 1000';
    // limit selection to 100 products
    $aEvent['aSQL]['limit'] = 'LIMIT 100';
    // JOIN query part
    // $aEvent['aSQL]['join']

    return $aEvent;
}

AMI_Event::addHandler('on_dataexchange_export_sql', 'cstHandleDataExchangeExportSQL', AMI_Event::MOD_ANY);

&array aSQL Array of SQL query parts
string modId Module id
on_dataexchange_get_tpl_set_name
since 6.0.6
AMI_Event::MOD_ANY Allows to change name of template set for next exchange drivers: Yandex.Market, Rambler, IRR.

function cstHandleDataExchangeGetTplSetName($name, array $aEvent, $handlerModId, $srcModId){
    if(
        in_array($aEvent['driverName'], array('YandexEshopDriver', 'RapidYandexEshopDriver') AND
        'export' === $aEvent['exchangeType'] AND
        'eshop_item' === $aEvent['modId'] AND
        'product' === $aEvent['type']
    ){
        $aEvent['setName'] = 'item_row_my_custom';
    }

    return $aEvent;
}

AMI_Event::addHandler('on_dataexchange_get_tpl_set_name', 'cstHandleDataExchangeGetTplSetName', AMI_Event::MOD_ANY);

&string setName Name of template set
string type Type of template set
string modId Module id
string exchangeType Exchange type
string driverName Driver name
on_file_download
since 6.0.4
AMI_Event::MOD_ANY Fires when file is downloading using "ftpgetfile.php" script.

Setting "errorCode" will return appropriate error and deny downloading.
Possible values / HTTP code: * wrong_request - "Wrong request" (400); * not_logged_in - "You are not registered" (401); * access_denied - "Access denied" (403); * no_attempts - "The quantity of loadings is exhausted" (403); * order_expired - "The time for loadings has expired" (403); * not_found - "File not found" (404); * unknown_file - "Unknown file" (404); * not_installed - "This functionality is inaccessible" (404).

string errorCode Error code, empty string by default
int itemId Module item id
string modId Module id
on_file_move $modId Called before file move.
string newName New filename
string targetPath Target dir path
AMI_iFile oFile File Object
AMI_ModTableItem oItem Item Object
on_filter_init $modId Called when the controller is initialized filter components that can handle the filter component.
AMI_Filter oFilter Filter object
AMI_ModFilter::init()
on_form_field_{fieldName} $modId Allows to modify form fields before displaying.
AMI_iFormModTableItem oItem Table item model
AMI_Template oTpl Tamplate object
array aScope Scope
array aField Form field structure
AMI_ModFormView::getFieldScope()
on_form_fields_{viewType} $modId Allows modify list of form fields.
AMI_iFormModTableItem oItem Table item model
AMI_ModFormView oFormView Form view object
array aScope Scope
AMI_ModFormView::get()
on_get_available_fields $modId Allows modify list of fields available from AMI_ModTable::getAvailableFields(true), AMI_ModTableList::getAvailableFields(true).
array aFields Array of fields
AMI_ModTable::getAvailableFields()
on_get_date_format AMI_Event::MOD_ANY Called before the return date / time format.
array date_format Array of date formats for all possible locales
string ret_locale Target locale
string locale Current locale
AMI::getDateFormat()
on_get_id_page $modId Call when receive page ID.
AMI_ModTableItem oItem Table item model
int/null pageId Page id
AMI_ModTableItem::getFrontLink()
on_get_nav_data $modId Called when received the data to generate a reference to the element.
AMI_ModTableItem oItem Table item model
array aNavData Internal navigation data
array aNavModNames Internal navigation structure
AMI_ModTableItem::getURL()
on_get_status_messages AMI_Event::MOD_ANY Called when received an array of status messages.
array aStatusMessages Array of status messages
AMI_Response::getJSONResponse()
on_item_details ----- Allows to modify item details data.
string block Template block name
AMI_ModTableItem oItem Table item model
array &aData Item data
array &aScope Scope
AMI_ModDetailsView::get()
on_item_sublink_generation $modId Called when generating a table item model sublink.
string link New link
array aData Data array
AMI_ModTable oTable Table model
bool onCreate TRUE on new item creation, FALSE on existing item saving
AMI_ModTableItemMeta::processSublink()
on_list_add_columns $modId Aloows to add columns to a list.
array aColumns Array of columns
AMI_ModTableList oList Table l;ist model
AMI_ModTable oTable Table model
AMI_ModListView_JSON::get()
on_list_body_row $modId Allows modify the data line of the list.
AMI_ModTableItem oItem Table item model
array aScope Scope
AMI_ModListView_JSON::get()
on_list_body_{item} $modId Allows modify the value of a cell in the list.
AMI_ModTableItem oItem Table item model
array aScope Scope
AMI_ModListView::get()
on_list_columns $modId Allows modify list of columns in list of elements.
array aLocale Array of locales
array aScope Scope
AMI_ModListView_JSON oView View Model
AMI_ModListView_JSON::get()
on_list_header $modId Allows modify list's header.
array aScope Scope
AMI_ModListView::get()
on_list_init $modId Called when list initialization.
DB_Query oQuery DBQuery object
AMI_ArrayIterator oTable Iterator
AMI_ArrayIteratorList oList List Iterator
string modId Module Id
AMI_ArrayIteratorList::__construct()
on_list_locate_pos $modId Calls before location of item position in list.
array aColumns Columns
string orderDirection Order direction
string orderColumn Order column name
string apliedId Applied item id
AMI_ModTable oTable Table item model
AMI_ModListView_JSON::get()
on_list_recordset $modId -----------------
ModManager_TableList oList Table list object
string modId Module id
on_list_recordset_loaded $modId Called after recordset initialization, if included counting the number of entries. Allows obtain a number of records..
AMI_ModTableList oList List object (since 5.14.8)
int numberOfFoundRows Number of found rows
string modId Module Id
AMI_ModTableList::load()
on_list_view $modId Allows modify the value of header, body and footer of list.
AMI_Response oResponse Response object
array aScope Contens keys header, body, footer
AMI_ModListView_JSON::get()
on_mod_post_init $modId Called after initialization module component.
AMI_Response oResponse Response object
AMI_Request oRequest Request object
string tableModelId Table model resource id
AMI_Mod|null oController Module controller object
string modId Module id
AMI_Mod::init()
on_mod_pre_init $modId Called before initialization module component.
AMI_Response oResponse Response object
AMI_Request oRequest Request object
string tableModelId Table model resource id
AMI_Mod|null oController Module controller object
string modId Module id
AMI_Mod::init()
on_module_{$type}_response_type $modId Allows to alternate specified response type data before module output.
bool skip Skip this response type (default: true)
string type Response type
array aData Module data
AMI_ModCommonViewFrn::outType()
on_order_after_status_change
since 6.0.4
AMI_Event::MOD_ANY Allows to do some action afetr E-shop order status changed.
array aParams Order parameters
AmiClean_EshopOrder_TableItem oItem Order table item model
string status New status of order
on_order_before_create
since 6.0.6
AMI_Event::MOD_ANY Allows to modify E-shop some order data before order creation.
float &total Total order cost
float &shipping Shipping cost
string &comments Order comments
string &company Buyer company name
string &lastname Buyer last name
string &firstname Buyer firs tname
string &header Order header
string &status New status of order
on_order_before_status_change
since 6.0.4
AMI_Event::MOD_ANY Allows to modify E-shop order status or discard action.

Set $aEvent['_discard'] to TRUE to discard action.

bool _discard Set to TRUE to discard action
array &aParams Order parameters
AmiClean_EshopOrder_TableItem oItem Order table item model
string &status New status of order
on_pkg_action AMI_Event::MOD_ANY Allows to modify or discard package manipulation action.

Set $aEvent['_discard'] to TRUE to discard action.

AMI_Tx oTx Transaction object
array aArgs Transaction arguments
string action Transaction action
AMI_Package_Manipulator::doActions()
on_post_process_fields $modId Called after front data processing.
array &aScope Scope
array &aItem Item data
string bodyType Body type
AMI_ModCommonViewFrn::processFields()
on_query_add_joined_columns $modId Event, called for add columns to the query result, a compound derived from the dependent model.
string alias Model alias
AMI_ModTableList oList Table list model
AMI_ModTable oTable Table model
DB_Query oQuery DB query object
string modId Module id
AMI_ModTable::getQueryBase()
on_query_add_table $modId Allow to modify DB query object.
string alias Model alias
AMI_ModTable oTable Table model
DB_Query oQuery DB query object
string modId Module id
AMI_ModTable::getQueryBase()
on_query_add_table AMI_Event::MOD_ANY Allow to modify DB query object.
string alias Model alias
AMI_ModTable oTable Table model
DB_Query oQuery DB query object
string modId Module id
AMI_ModTable::getQueryBase()
on_rate ext_rating Allows to collect information about ratings in Raeting extension.
string vid Site visitor id
int userId Authorized user id or 0 if not authorized
string rating Passed rating
int itemId Module item id
string modId Module id
on_response_send AMI_Event::MOD_ANY Allows receive information and modify headers buffered response, change response content.
array aHTTPHeaders Array of HTTP headers
string &content Content
bool isBuffered TRUE if response is buffered
string type Response type
AMI_Response::send()
on_response_start AMI_Event::MOD_ANY Allows receive information and modify headers of answer.
array aHTTPHeaders Array of HTTP headers
bool isBuffered Buffering
string type Type
AMI_Response::start()
on_rollback_save_model_item $modId Allows rollback saved model item.
bool success TRUE on success
array aData Table item raw data
AMI_ModTableItem oItem Table item model
AMI_ModTable oTable Table model
bool onCreate TRUE on new item creation, FALSE on existing item saving
AMI_ModTableItemModifier::rollback()
on_save_validate_{validator} $modId Allows add custom data validator.
AMI_ModTableItemModifier oTableItemModifier Table item modifier object
AMI_ModTable oTable Table object
AMI_ModTableItem oItem Table item object
mixed value Value of field
string field Field name
AMI_ModTableItemModifier::validate()
on_search_command
since 7.0.0
$modId Fires on building search query.
searchCmd oCommand Search command
on_search_index
since 7.0.0
$modId Fires on building item search index.

Example: // "_local/common_functions.php" // Allowing to search "/" symbol AMI_Event::addHandler('on_search_index', 'cstOnSearchIndex', 'eshop_item'); AMI_Event::addHandler('on_search_command', 'cstOnSearchCommand', 'eshop_item'); function cstOnSearchIndex($name, array $aEvent, $handlerModId, $srcModId){ $aSearch = array_keys($aEvent['aReplacement']); $aReplace = array_values($aEvent['aReplacement']); $index = array_search('/[^a-zа-ялёА-ЯЛЁ0-9\.,&-]/u', $aSearch); if(FALSE !== $index){ $aSearch[$index] = '/[^a-zа-ялёА-ЯЛЁ0-9\.,&-\/]/u'; $aEvent['aReplacement'] = array_combine($aSearch, $aReplace); } return $aEvent; } function cstOnSearchCommand($name, array $aEvent, $handlerModId, $srcModId){ $aEvent['oCommand']->Allowed = "_\*a-zA-ZёЁа-яА-Я0-9.\-\/"; return $aEvent; }

array &aReplacement Array of replacements for preg_rep[lace
string &content Prepared item content
string sourceContent Source item content6
on_sort_columns $modId Allows modify list of sortable columns in list.
AMI_ModTableList oList Table list model
array aColumns Array of columns
AMI_ModListView_JSON::get()
on_table_get_item $modId Called when receive array of validators, allow add own validators.
AMI_ModTable oTable Table model
string modId Module id
AMI_ModTable::getItem()
on_table_get_item_post $modId Called when receive array of validators, allow add own validators.
AMI_ModTableItem oItem Table item model
AMI_ModTable oTable Table model
string modId Module id
AMI_ModTable::getItem()
on_table_get_list $modId Allows to handle table list model creation.
AMI_ModTable oTable Table model
string modId Module id
AMI_ModTable::getList()
on_tx_command AMI_Event::MOD_ANY Allows to modify or discard transacton command.

Set $aEvent['_discard'] to TRUE to discard command.

AMI_Tx_Cmd_Args oArgs Transaction command arguments
AMI_Tx_Cmd oTx_Cmd Transaction command object
mixed caller Callback
AMI_Tx_Cmd::__construct()
on_webservice_start ----- Event to set any initial data.
AmiClean_Webservice_Service oWebservice Webservice service object
string action Action
on_webservice_{action}_action $modId Calls webservice action handler.
string errorMessage Error message
string errorCode Error code
set_global_filter_{FilterType} AMI_Event::MOD_ANY Called when a global filter type {FilterType}.
v5_on_action_verification
since 7.0.0
AMI_Event::MOD_ANY Fires before action will be processed in old environment.

Allows to modify action, array of item Ids for group action.
Set $aEvent['_discard'] to TRUE to discard action.

bool _discard Set to TRUE to discard action
&array aGrpIds Array of item Ids for group action
int id Item Id
&string action Action
string modId Module Id
v5_on_admin_list_view
since 7.0.0
AMI_Event::MOD_ANY Allows to modify old environment SQL filter for admin list.
Browser oBrowser Old environment browser object
CMS_ActModule oEngine Old environment module object
string modId Module Id
v5_on_apply_data
since 6.0.2
AMI_Event::MOD_ANY CustomApplyVars() function replacement ("_local/admin_functions.php", "_local/front_functions.php").
Set $aEvent['_discard'] to TRUE to "return FALSE" from function.
bool _discard Set to TRUE to discard action
int pageId Page Id (was $pageId argument)
mixed &aData Data (was $aVars argument)
mixed oObject Object (was $vObject argument)
string type Data type (was $cThread argument)
v5_on_apply_filters
since 7.0.0
$modId Allows to modify old environment SQL filter.
CMS_ActModule oEngine Old environment module object
string sqlPrefix Filter field prefix (i. e. 'i.' for items, 'c.' for categories etc.)
string &sqlPart Raw SQL filter part
v5_on_before_init
since 6.0.2
AMI_Event::MOD_ANY EventInitBefore() function replacement ("_local/admin_functions.php", "_local/front_functions.php").
CMS_Base oObject Core v5 CMS object (was $vObject argument)
v5_on_before_save_cached_page
since 6.0.2
AMI_Event::MOD_ANY CacheSavePageBefore() function replacement ("_local/common_functions.php").
Set $aEvent['_discard'] to TRUE to "return FALSE" from function.
bool _discard Set to TRUE to discard action
int &pageId Found page Id (was $foundPageId argument)
string &pageUIN Page UIN (was $Pageuin argument)
CMS_Cache oObject Cache object (was $vObject argument)
v5_on_dataexchange_download_image
since 7.0.0
AMI_Event::MOD_ANY Allows to discard to import/export product or modify product fields during data exchange.
string &targetName Target file name
string &sourceURL Source image URL
string modId Module Id
string driver Data exchange driver name
string type Data exchange type: 'import' / 'export'
v5_on_dataexchange_item
since 7.0.0
AMI_Event::MOD_ANY Allows to discard to import/export product or modify product fields during data exchange.
bool _discard Set to TRUE to discard action
array &aItem Product data
string modId Module Id
string driver Data exchange driver name
string type Data exchange type: 'import' / 'export'
v5_on_dataexchange_sql
since 7.0.0
AMI_Event::MOD_ANY Allows to customize SQL query to select products during data exchange.

function cstHandleDataExchangeSQL($name, array $aEvent, $handlerModId, $srcModId){
    $pfx = $aEvent['aSQL]['default_prefix'];
    // select extra field `id_owner`
    $aEvent['aSQL]['select'] .= ', ' . $pfx . 'id_owner';
    // select products having `price` > 1000 only
    $aEvent['aSQL]['where'] .= ' AND ' . $pfx . 'price > 1000';
    // limit selection to 100 products
    $aEvent['aSQL]['limit'] = 'LIMIT 100';
    // JOIN query part
    // $aEvent['aSQL]['join']

    return $aEvent;
}

AMI_Event::addHandler('v5_on_dataexchange_sql', 'cstHandleDataExchangeSQL', AMI_Event::MOD_ANY);

&array aSQL Array of SQL query parts
string modId Module id
string driver Data exchange driver name
string type Data exchange type: 'import' / 'export'
v5_on_dataexchange_start
since 7.0.0
AMI_Event::MOD_ANY Allows to discard data exchange.
bool _discard Set to TRUE to discard action
CMS_DataExchangeModule oEngine Old environment module object
string modId Module Id
v5_on_eshop_order_before_pay_button_params
since 7.0.0
AMI_Event::MOD_ANY Fires on creating e-shop order payment button.
Array aData Array of payment data
v5_on_ext_action
since 7.0.0
AMI_Event::MOD_ANY Fires after old environment extensions processed action.

Other event parameters depend on action.
Usage example.

CMS_ActModule oOldEnvModule Old environment module object
string action Action
string modId Module Id
v5_on_front_filter_init
since 7.0.0
$modId Fires before initializing of front filter.
bool discard_ext_init_front_filter Flag to discard initializing of extensions
v5_on_get_list_sql
since 7.0.0
AMI_Event::MOD_ANY Fires on building list query.

Arguments will be described later.

string order_sql -----
array grouping -----
array calc_options -----
array calculating -----
string group_by -----
string force_limit -----
string force_order -----
string order_col_pref -----
string order_col -----
array joined_tables -----
string default_prefix -----
array order_replace -----
int options -----
string order_addon -----
string order_field -----
string sql_from -----
array sql_from_tables -----
string sql_fields -----
v5_on_item_prepare
since 6.0.6
AMI_Event::MOD_ANY Fires on before prepare item data for saving.
array aData Array of item data
int itemId Item Id
string modId Module Id
v5_on_render_page_adm
since 7.0.0
AMI_Event::MOD_ANY Fires before admin page will be combined from several parts.

Other event parameters depend on module.
Allows to modify form or other part HTML code.
Usage example.

string modId Module Id
v5_on_set_page_size
since 6.0.6
AMI_Event::MOD_ANY Fires on before front list page size set.
int pageSize Number of items on page
string modId Module Id
v5_on_show_page_size
since 6.0.6
AMI_Event::MOD_ANY Fires on before front list page size control show.
array aPageSizes Array of page sizes
bool enabled Is page