/** * Delete post events * * @return bool */ public function unInstallEvents() { $this->eventManager->unRegisterEventHandler('main', 'OnProlog', $this->MODULE_ID, 'Citfact\\DebugBar\\DebugEvent', 'includeModule'); $this->eventManager->unRegisterEventHandler('main', 'OnEndBufferContent', $this->MODULE_ID, 'Citfact\\DebugBar\\DebugEvent', 'render'); $this->eventManager->unRegisterEventHandler('main', 'OnEpilog', $this->MODULE_ID, 'Citfact\\DebugBar\\DebugEvent', 'renderAssets'); return true; }
function UnInstallDB($arParams = Array()) { UnRegisterModule($this->MODULE_ID); $eventManager = \Bitrix\Main\EventManager::getInstance(); $eventManager->unRegisterEventHandler("fileman", "OnIncludeHTMLEditorScript", "als.typograf", "ALSTypograf", "addButton"); $eventManager->unRegisterEventHandler("main", "OnAdminContextMenuShow", "als.typograf", "ALSTypograf", "addButtonName"); return true; }
/** * Initializes replication process on im side. * * @return void */ public function start() { self::$statusHandler = new StatusHandler(); \Bitrix\Replica\Client\HandlersManager::register(self::$statusHandler); \Bitrix\Replica\Client\HandlersManager::register(new ChatHandler()); \Bitrix\Replica\Client\HandlersManager::register(new RelationHandler()); \Bitrix\Replica\Client\HandlersManager::register(new MessageHandler()); \Bitrix\Replica\Client\HandlersManager::register(new MessageParamHandler()); \Bitrix\Replica\Client\HandlersManager::register(new StartWritingHandler()); $eventManager = \Bitrix\Main\EventManager::getInstance(); $eventManager->addEventHandler("main", "OnUserSetLastActivityDate", array(self::$statusHandler, "OnUserSetLastActivityDate")); \Bitrix\Replica\Server\Event::registerOperation("im_status_update", array(self::$statusHandler, "handleStatusUpdateOperation")); $eventManager->addEventHandler("socialservices", "OnAfterRegisterUserByNetwork", array(self::$statusHandler, "OnStartUserReplication"), false, 200); \Bitrix\Replica\Server\Event::registerOperation("im_status_bind", array(self::$statusHandler, "handleStatusBindOperation")); }
/** @internal */ public static function getTypesInternal() { if (!($types =& static::$types)) { $event = static::$event; $checkModule = static::$checkModule; foreach (EventManager::getInstance()->findEventHandlers('conversion', $event) as $handler) { $result = ExecuteModuleEventEx($handler); if (!is_array($result)) { throw new SystemException('Not array returned from: ' . print_r($handler, true)); } foreach ($result as $name => $type) { if (!is_array($type)) { throw new SystemException('Not array in: ' . $event . '()[' . $name . '] => ' . print_r($handler, true)); } if ($checkModule) { if (!$type['MODULE']) { throw new SystemException('No [MODULE] in: ' . $event . '()[' . $name . '] => ' . print_r($handler, true)); } } if ($types[$name]) { throw new SystemException('Duplicate in: ' . $event . '()[' . $name . '] => ' . print_r($handler, true)); } $types[$name] = $type; } } } return $types; }
public function DoUninstall() { $this->UnInstallFiles(); ModuleManager::unRegisterModule($this->MODULE_ID); $eventManager = \Bitrix\Main\EventManager::getInstance(); $eventManager->unRegisterEventHandler("fileman", "OnBeforeHTMLEditorScriptRuns", $this->MODULE_ID, '\\Newkaliningrad\\Typografru\\Typograf', "onBeforeHTMLEditorScriptRuns"); }
protected function setEvents() { $eventManager = EventManager::getInstance(); $eventManager->addEventHandler(Driver::INTERNAL_MODULE_ID, 'FileOnAfterMove', array($this, 'onObjectOnAfterMove')); $eventManager->addEventHandler(Driver::INTERNAL_MODULE_ID, 'FolderOnAfterMove', array($this, 'onObjectOnAfterMove')); $eventManager->addEventHandler(Driver::INTERNAL_MODULE_ID, 'ObjectOnAfterMove', array($this, 'onObjectOnAfterMove')); }
public static function prevent($eventName, array $filter) { if (empty(static::$list[$eventName])) { EventManager::getInstance()->addEventHandler('main', 'OnBeforeMailEventAdd', array(__CLASS__, 'handleEvent'), false, 1); } static::$list[$eventName][] = $filter; }
function DoUninstall() { global $APPLICATION; $eventManager = \Bitrix\Main\EventManager::getInstance(); UnRegisterModule($this->MODULE_ID); $eventManager->unRegisterEventHandler('main', 'OnPageStart', $this->MODULE_ID, '\\DigitalWand\\AdminHelper\\EventHandlers', 'onPageStart'); $APPLICATION->IncludeAdminFile(Loc::getMessage('ADMIN_HELPER_INSTALL_TITLE'), __DIR__ . '/unstep.php'); }
protected function subscribeDelete($deleteStatus) { $deleteStatus = $deleteStatus ?: 'F'; $callback = function (Event $event) use($deleteStatus) { /** @var \Bitrix\Sale\Order $order */ $order = $event->getParameter('ENTITY'); if ($order->getField('STATUS_ID') == $deleteStatus) { $this->deleteProducts($order); } }; EventManager::getInstance()->addEventHandler('sale', 'OnSaleOrderSaved', $callback); EventManager::getInstance()->addEventHandler('sale', 'OnSaleStatusOrderChange', $callback); }
public function __construct() { $this->eventManager = \Bitrix\Main\EventManager::getInstance(); $arModuleVersion = array(); include __DIR__ . '/version.php'; if (is_array($arModuleVersion) && array_key_exists('VERSION', $arModuleVersion)) { $this->MODULE_VERSION = $arModuleVersion['VERSION']; $this->MODULE_VERSION_DATE = $arModuleVersion['VERSION_DATE']; } $this->MODULE_ID = 'shantilab.bxecho'; $this->MODULE_NAME = Loc::getMessage('SHANTILAB_BXECHO_MODULE_NAME'); $this->MODULE_DESCRIPTION = Loc::getMessage('SHANTILAB_BXECHO_MODULE_DESCRIPTION'); $this->MODULE_GROUP_RIGHTS = 'N'; $this->PARTNER_NAME = Loc::getMessage('SHANTILAB_BXECHO_MODULE_PARTNER_NAME'); $this->PARTNER_URI = 'http://shantilab.ru'; }
public static function generateInitialData(Date $from) { if (($to = Option::get('conversion', 'START_DATE_TIME', 'undefined')) != 'undefined' && DateTime::isCorrect($to, 'Y-m-d H:i:s') && ($to = new DateTime($to, 'Y-m-d H:i:s')) && $to->format('Y-m-d H:i:s') > $from->format('Y-m-d H:i:s') && Option::get('conversion', 'GENERATE_INITIAL_DATA', 'undefined') == 'undefined') { Option::set('conversion', 'GENERATE_INITIAL_DATA', 'generated'); $context = new self(); // generate data $data = array(); foreach (EventManager::getInstance()->findEventHandlers('conversion', 'OnGenerateInitialData') as $handler) { $result = ExecuteModuleEventEx($handler, array($from, $to)); // TODO validate foreach ($result as $row) { $context->id = null; $context->attributes = array(); $context->setAttributes($row['ATTRIBUTES']); $context->save(); if ($dayCounters =& $data[$context->id]) { self::appendDayCounters($dayCounters, $row['DAY_COUNTERS']); } else { $dayCounters = $row['DAY_COUNTERS']; } } } unset($dayCounters); // save data to database $numerators = CounterManager::getTypes(array('GROUP' => 'day')); unset($numerators['conversion_visit_day']); foreach ($data as $id => $dayCounters) { $context->id = $id; foreach ($dayCounters as $day => $counters) { $day = new Date($day, 'Y-m-d'); $visitSum = 0; $visitQuantity = 0; unset($counters['conversion_visit_day']); foreach ($counters as $name => $value) { $context->addCounter($day, $name, $value); if ($numerators[$name]) { $visitSum += $value; $visitQuantity += 1; } } $context->addCounter($day, 'conversion_visit_day', $visitQuantity ? round($visitSum / $visitQuantity * 100) + 1 : 1); } } } }
public static function convertHtmlToBbCode($html) { $html = strval($html); if ($html === '') { return ''; } $eventManager = \Bitrix\Main\EventManager::getInstance(); $eventKey = $eventManager->addEventHandlerCompatible("main", "TextParserBeforeTags", array("\\Bitrix\\Crm\\Format\\TextHelper", "onTextParserBeforeTags")); $textParser = new \CTextParser(); $textParser->allow = array("HTML" => "N", "ANCHOR" => "Y", "BIU" => "Y", "IMG" => "Y", "QUOTE" => "Y", "CODE" => "Y", "FONT" => "Y", "LIST" => "Y", "SMILES" => "Y", "NL2BR" => "Y", "VIDEO" => "Y", "TABLE" => "Y", "CUT_ANCHOR" => "Y", "ALIGN" => "Y"); $result = $textParser->convertText($html); $result = htmlspecialcharsback($result); $result = preg_replace("/\\<br\\s*\\/*\\>/is" . BX_UTF_PCRE_MODIFIER, "\n", $result); $result = preg_replace("/ /is" . BX_UTF_PCRE_MODIFIER, "", $result); $result = preg_replace("/\\<([^>]*?)>/is" . BX_UTF_PCRE_MODIFIER, "", $result); $result = htmlspecialcharsbx($result); $eventManager->removeEventHandler("main", "TextParserBeforeTags", $eventKey); return $result; }
function UnInstallDB($arParams = array()) { global $APPLICATION, $DB, $errors; $this->errors = false; if (!$arParams['savedata']) { $this->errors = $DB->RunSQLBatch($_SERVER['DOCUMENT_ROOT'] . "/bitrix/modules/seo/install/db/" . strtolower($DB->type) . "/uninstall.sql"); } if (!empty($this->errors)) { $APPLICATION->ThrowException(implode("", $this->errors)); return false; } require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/seo/install/tasks/uninstall.php"; $eventManager = \Bitrix\Main\EventManager::getInstance(); $eventManager->unRegisterEventHandler('main', 'OnPanelCreate', 'seo'); $eventManager->unRegisterEventHandler("fileman", "OnIncludeHTMLEditorScript", "seo"); $eventManager->unRegisterEventHandler("iblock", "OnAfterIBlockSectionAdd", "seo", "\\Bitrix\\Seo\\SitemapIblock", "addSection"); $eventManager->unRegisterEventHandler("iblock", "OnAfterIBlockElementAdd", "seo", "\\Bitrix\\Seo\\SitemapIblock", "addElement"); $eventManager->unRegisterEventHandler("iblock", "OnBeforeIBlockSectionDelete", "seo", "\\Bitrix\\Seo\\SitemapIblock", "beforeDeleteSection"); $eventManager->unRegisterEventHandler("iblock", "OnBeforeIBlockElementDelete", "seo", "\\Bitrix\\Seo\\SitemapIblock", "beforeDeleteElement"); $eventManager->unRegisterEventHandler("iblock", "OnAfterIBlockSectionDelete", "seo", "\\Bitrix\\Seo\\SitemapIblock", "deleteSection"); $eventManager->unRegisterEventHandler("iblock", "OnAfterIBlockElementDelete", "seo", "\\Bitrix\\Seo\\SitemapIblock", "deleteElement"); $eventManager->unRegisterEventHandler("iblock", "OnBeforeIBlockSectionUpdate", "seo", "\\Bitrix\\Seo\\SitemapIblock", "beforeUpdateSection"); $eventManager->unRegisterEventHandler("iblock", "OnBeforeIBlockElementUpdate", "seo", "\\Bitrix\\Seo\\SitemapIblock", "beforeUpdateElement"); $eventManager->unRegisterEventHandler("iblock", "OnAfterIBlockSectionUpdate", "seo", "\\Bitrix\\Seo\\SitemapIblock", "updateSection"); $eventManager->unRegisterEventHandler("iblock", "OnAfterIBlockElementUpdate", "seo", "\\Bitrix\\Seo\\SitemapIblock", "updateElement"); $eventManager->unRegisterEventHandler("forum", "onAfterTopicAdd", "seo", "\\Bitrix\\Seo\\SitemapForum", "addTopic"); $eventManager->unRegisterEventHandler("forum", "onAfterTopicUpdate", "seo", "\\Bitrix\\Seo\\SitemapForum", "updateTopic"); $eventManager->unRegisterEventHandler("forum", "onAfterTopicDelete", "seo", "\\Bitrix\\Seo\\SitemapForum", "deleteTopic"); UnRegisterModule("seo"); return true; }
<?php /** * For the full copyright and license information, please view the LICENSE.md * file that was distributed with this source code. */ if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true) { return false; } $manager = \Bitrix\Main\EventManager::getInstance(); $manager->addEventHandler('main', 'OnBeforeChangeFile', ['\\Bex\\Niceaccess\\AccessFileHandler', 'onBeforeChangeFile']);
<? use Bitrix\Main; use Bitrix\Main\Entity; $eventManager = Main\EventManager::getInstance(); $eventManager->addEventHandler('', 'UserDiscountsOnAfterUpdate', '__OnAddUpdateHL'); $eventManager->addEventHandler('', 'UserDiscountsOnAfterAdd', '__OnAddUpdateHL'); AddEventHandler('iblock','OnAfterIblockElementAdd','__OnElementDiscount'); AddEventHandler('iblock','OnAfterIblockElementUpdate','__OnElementDiscount'); AddEventHandler("sale", "OnCondSaleControlBuildList", "__RegisterBuildList", 10001); function __RegisterBuildList() { CModule::IncludeModule('sale'); include_once "user_cond.php"; return CSaleCondCtrlUserFields::GetControlDescr(); } function __recalcSaleDiscount($user_id) { if(!$user_id) return; CModule::IncludeModule('sale'); CModule::IncludeModule('highloadblock'); $UserPrc = false;
/** * Add event handlers. */ protected static function addEventHandlers() { $eventManager = EventManager::getInstance(); foreach (static::$handlers as $module => $handlers) { foreach ($handlers as $event => $handler) { $eventManager->addEventHandler($module, $event, [__CLASS__, $handler], false, 5000); } } $eventManager->addEventHandler('main', 'OnAfterEpilog', function () { $notifier = new Notifier(); $notifier->deleteNotificationFromPreviousMigration(); return new EventResult(); }); }
/** * @return bool */ protected function isBound() { $handlers = EventManager::getInstance()->findEventHandlers('main', 'OnPageStart', array('security')); foreach ($handlers as $handler) { if ($handler['TO_CLASS'] === get_class($this)) { return true; } } return false; }
function UnInstallDB($arParams = array()) { global $APPLICATION, $DB, $errors; if (!defined('BX_CATALOG_UNINSTALLED')) { define('BX_CATALOG_UNINSTALLED', true); } if (!isset($arParams["savedata"]) || $arParams["savedata"] != "Y") { $errors = $DB->RunSQLBatch($_SERVER['DOCUMENT_ROOT'] . "/bitrix/modules/catalog/install/db/" . strtolower($DB->type) . "/uninstall.sql"); if (!empty($errors)) { $APPLICATION->ThrowException(implode("", $errors)); return false; } $this->UnInstallTasks(); COption::RemoveOption("catalog"); } UnRegisterModuleDependences("iblock", "OnIBlockDelete", "catalog", "CCatalog", "OnIBlockDelete"); UnRegisterModuleDependences("iblock", "OnIBlockElementDelete", "catalog", "CProduct", "OnIBlockElementDelete"); UnRegisterModuleDependences("iblock", "OnIBlockElementDelete", "catalog", "CPrice", "OnIBlockElementDelete"); UnRegisterModuleDependences("iblock", "OnIBlockElementDelete", "catalog", "CCatalogStoreProduct", "OnIBlockElementDelete"); UnRegisterModuleDependences("iblock", "OnIBlockElementDelete", "catalog", "CCatalogDocs", "OnIBlockElementDelete"); UnRegisterModuleDependences("iblock", "OnBeforeIBlockElementDelete", "catalog", "CCatalogDocs", "OnBeforeIBlockElementDelete"); UnRegisterModuleDependences("currency", "OnCurrencyDelete", "catalog", "CPrice", "OnCurrencyDelete"); UnRegisterModuleDependences("iblock", "OnAfterIBlockElementUpdate", "catalog", "CCatalogProduct", "OnAfterIBlockElementUpdate"); UnRegisterModuleDependences("currency", "OnModuleUnInstall", "catalog", "", "CurrencyModuleUnInstallCatalog"); UnRegisterModuleDependences("iblock", "OnBeforeIBlockDelete", "catalog", "CCatalog", "OnBeforeCatalogDelete"); UnRegisterModuleDependences("iblock", "OnBeforeIBlockElementDelete", "catalog", "CCatalog", "OnBeforeIBlockElementDelete"); UnRegisterModuleDependences("main", "OnEventLogGetAuditTypes", "catalog", "CCatalogEvent", "GetAuditTypes"); UnRegisterModuleDependences('main', 'OnBuildGlobalMenu', 'catalog', 'CCatalogAdmin', 'OnBuildGlobalMenu'); UnRegisterModuleDependences('main', 'OnAdminListDisplay', 'catalog', 'CCatalogAdmin', 'OnAdminListDisplay'); UnRegisterModuleDependences('main', 'OnBuildGlobalMenu', 'catalog', 'CCatalogAdmin', 'OnBuildSaleMenu'); UnRegisterModuleDependences("catalog", "OnCondCatControlBuildList", "catalog", "CCatalogCondCtrlGroup", "GetControlDescr"); UnRegisterModuleDependences("catalog", "OnCondCatControlBuildList", "catalog", "CCatalogCondCtrlIBlockFields", "GetControlDescr"); UnRegisterModuleDependences("catalog", "OnCondCatControlBuildList", "catalog", "CCatalogCondCtrlIBlockProps", "GetControlDescr"); UnRegisterModuleDependences("catalog", "OnDocumentBarcodeDelete", "catalog", "CCatalogStoreDocsElement", "OnDocumentBarcodeDelete"); UnRegisterModuleDependences("catalog", "OnBeforeDocumentDelete", "catalog", "CCatalogStoreDocsBarcode", "OnBeforeDocumentDelete"); UnRegisterModuleDependences("catalog", "OnCatalogStoreDelete", "catalog", "CCatalogDocs", "OnCatalogStoreDelete"); UnRegisterModuleDependences("iblock", "OnBeforeIBlockPropertyDelete", "catalog", "CCatalog", "OnBeforeIBlockPropertyDelete"); UnRegisterModuleDependences("sale", "OnCondSaleControlBuildList", "catalog", "CCatalogCondCtrlBasketProductFields", "GetControlDescr"); UnRegisterModuleDependences("sale", "OnCondSaleControlBuildList", "catalog", "CCatalogCondCtrlBasketProductProps", "GetControlDescr"); UnRegisterModuleDependences("sale", "OnCondSaleActionsControlBuildList", "catalog", "CCatalogActionCtrlBasketProductFields", "GetControlDescr"); UnRegisterModuleDependences("sale", "OnCondSaleActionsControlBuildList", "catalog", "CCatalogActionCtrlBasketProductProps", "GetControlDescr"); UnRegisterModuleDependences("sale", "OnExtendBasketItems", "catalog", "CCatalogDiscount", "ExtendBasketItems"); UnRegisterModuleDependences('iblock', 'OnModuleUnInstall', 'catalog', 'CCatalog', 'OnIBlockModuleUnInstall'); $eventManager = \Bitrix\Main\EventManager::getInstance(); $eventManager->unRegisterEventHandler('sale', 'onBuildCouponProviders', 'catalog', '\\Bitrix\\Catalog\\DiscountCouponTable', 'couponManager'); CAgent::RemoveModuleAgents('catalog'); ModuleManager::unRegisterModule('catalog'); return true; }
private static function GetMessageRatingVote($arParams, $bForMail = false) { $like = $arParams['VALUE'] >= 0 ? '_LIKE' : '_DISLIKE'; foreach (\Bitrix\Main\EventManager::getInstance()->findEventHandlers("im", "OnGetMessageRatingVote") as $event) { ExecuteModuleEventEx($event, array(&$arParams, &$bForMail)); } if (isset($arParams['MESSAGE'])) { return $arParams['MESSAGE']; } if ($arParams['ENTITY_TYPE_ID'] == 'FORUM_POST' || $arParams['ENTITY_TYPE_ID'] == 'BLOG_COMMENT') { $dot = strlen($arParams["ENTITY_MESSAGE"]) >= 200 ? '...' : ''; $arParams["ENTITY_MESSAGE"] = substr($arParams["ENTITY_MESSAGE"], 0, 199) . $dot; } else { $dot = strlen($arParams["ENTITY_TITLE"]) >= 200 ? '...' : ''; $arParams["ENTITY_TITLE"] = substr($arParams["ENTITY_TITLE"], 0, 199) . $dot; } if ($bForMail) { if ($arParams['ENTITY_TYPE_ID'] == 'BLOG_POST') { $message = str_replace('#LINK#', $arParams["ENTITY_TITLE"], GetMessage('IM_EVENT_RATING_BLOG_POST' . ($arParams['MENTION'] ? '_MENTION' : '') . $like) . ' (' . $arParams['ENTITY_LINK'] . ')'); } elseif ($arParams['ENTITY_TYPE_ID'] == 'BLOG_COMMENT') { $message = str_replace(array('#TITLE#', '#A_START#', '#A_END#'), array($arParams["ENTITY_MESSAGE"], '', ''), GetMessage('IM_EVENT_RATING_COMMENT' . ($arParams['MENTION'] ? '_MENTION' : '') . $like) . ' (' . $arParams['ENTITY_LINK'] . ')'); } elseif ($arParams['ENTITY_TYPE_ID'] == 'FORUM_TOPIC') { $message = str_replace('#LINK#', $arParams["ENTITY_TITLE"], GetMessage('IM_EVENT_RATING_FORUM_TOPIC' . $like) . ' (' . $arParams['ENTITY_LINK'] . ')'); } elseif ($arParams['ENTITY_TYPE_ID'] == 'FORUM_POST') { $message = str_replace(array('#TITLE#', '#A_START#', '#A_END#'), array($arParams["ENTITY_MESSAGE"], '', ''), GetMessage('IM_EVENT_RATING_COMMENT' . ($arParams['MENTION'] ? '_MENTION' : '') . $like) . ' (' . $arParams['ENTITY_LINK'] . ')'); } elseif ($arParams['ENTITY_TYPE_ID'] == 'IBLOCK_ELEMENT' && $arParams['ENTITY_PARAM'] == 'library') { $message = str_replace(array('#TITLE#', '#A_START#', '#A_END#'), array($arParams["ENTITY_TITLE"], '', ''), GetMessage('IM_EVENT_RATING_FILE' . $like) . ' (' . $arParams['ENTITY_LINK'] . ')'); } elseif ($arParams['ENTITY_TYPE_ID'] == 'IBLOCK_ELEMENT' && $arParams['ENTITY_PARAM'] == 'photos') { if (is_numeric($arParams["ENTITY_TITLE"])) { $message = str_replace(array('#A_START#', '#A_END#'), array('', ''), GetMessage('IM_EVENT_RATING_PHOTO1' . $like) . ' (' . $arParams['ENTITY_LINK'] . ')'); } else { $message = str_replace(array('#TITLE#', '#A_START#', '#A_END#'), array($arParams["ENTITY_TITLE"], '', ''), GetMessage('IM_EVENT_RATING_PHOTO' . $like) . ' (' . $arParams['ENTITY_LINK'] . ')'); } } elseif ($arParams['ENTITY_TYPE_ID'] == 'LOG_COMMENT') { $message = str_replace(array('#TITLE#', '#A_START#', '#A_END#'), array($arParams["ENTITY_TITLE"], '', ''), GetMessage('IM_EVENT_RATING_COMMENT' . ($arParams['MENTION'] ? '_MENTION' : '') . $like) . ' (' . $arParams['ENTITY_LINK'] . ')'); } elseif ($arParams['ENTITY_TYPE_ID'] == 'LISTS_NEW_ELEMENT') { $message = str_replace(array('#TITLE#', '#A_START#', '#A_END#'), array($arParams["ENTITY_TITLE"], '', ''), GetMessage('IM_EVENT_RATING_LISTS_NEW_ELEMENT_LIKE' . $like)); } else { $message = str_replace('#LINK#', $arParams["ENTITY_TITLE"], GetMessage('IM_EVENT_RATING_ELSE' . $like) . strlen($arParams['ENTITY_LINK']) > 0 ? ' (' . $arParams['ENTITY_LINK'] . ')' : ''); } } else { if ($arParams['ENTITY_TYPE_ID'] == 'BLOG_POST') { $message = str_replace('#LINK#', '<a href="' . $arParams['ENTITY_LINK'] . '" class="bx-notifier-item-action">' . $arParams["ENTITY_TITLE"] . '</a>', GetMessage('IM_EVENT_RATING_BLOG_POST' . ($arParams['MENTION'] ? '_MENTION' : '') . $like)); } elseif ($arParams['ENTITY_TYPE_ID'] == 'BLOG_COMMENT') { $message = str_replace(array('#TITLE#', '#A_START#', '#A_END#'), array($arParams["ENTITY_MESSAGE"], '<a href="' . $arParams['ENTITY_LINK'] . '" class="bx-notifier-item-action">', '</a>'), GetMessage('IM_EVENT_RATING_COMMENT' . ($arParams['MENTION'] ? '_MENTION' : '') . $like)); } elseif ($arParams['ENTITY_TYPE_ID'] == 'FORUM_TOPIC') { $message = str_replace('#LINK#', '<a href="' . $arParams['ENTITY_LINK'] . '" class="bx-notifier-item-action">' . $arParams["ENTITY_TITLE"] . '</a>', GetMessage('IM_EVENT_RATING_FORUM_TOPIC' . $like)); } elseif ($arParams['ENTITY_TYPE_ID'] == 'FORUM_POST') { $message = str_replace(array('#TITLE#', '#A_START#', '#A_END#'), array($arParams["ENTITY_MESSAGE"], '<a href="' . $arParams['ENTITY_LINK'] . '" class="bx-notifier-item-action">', '</a>'), GetMessage('IM_EVENT_RATING_COMMENT' . ($arParams['MENTION'] ? '_MENTION' : '') . $like)); } elseif ($arParams['ENTITY_TYPE_ID'] == 'IBLOCK_ELEMENT' && $arParams['ENTITY_PARAM'] == 'library') { $message = str_replace(array('#TITLE#', '#A_START#', '#A_END#'), array($arParams["ENTITY_TITLE"], '<a href="' . $arParams['ENTITY_LINK'] . '" class="bx-notifier-item-action">', '</a>'), GetMessage('IM_EVENT_RATING_FILE' . $like)); } elseif ($arParams['ENTITY_TYPE_ID'] == 'IBLOCK_ELEMENT' && $arParams['ENTITY_PARAM'] == 'photos') { if (is_numeric($arParams["ENTITY_TITLE"])) { $message = str_replace(array('#A_START#', '#A_END#'), array('<a href="' . $arParams['ENTITY_LINK'] . '" class="bx-notifier-item-action">', '</a>'), GetMessage('IM_EVENT_RATING_PHOTO1' . $like)); } else { $message = str_replace(array('#TITLE#', '#A_START#', '#A_END#'), array($arParams["ENTITY_TITLE"], '<a href="' . $arParams['ENTITY_LINK'] . '" class="bx-notifier-item-action">', '</a>'), GetMessage('IM_EVENT_RATING_PHOTO' . $like)); } } elseif ($arParams['ENTITY_TYPE_ID'] == 'LOG_COMMENT') { $message = str_replace(array('#TITLE#', '#A_START#', '#A_END#'), array($arParams["ENTITY_TITLE"], '<a href="' . $arParams['ENTITY_LINK'] . '" class="bx-notifier-item-action">', '</a>'), GetMessage('IM_EVENT_RATING_COMMENT' . ($arParams['MENTION'] ? '_MENTION' : '') . $like)); } elseif ($arParams['ENTITY_TYPE_ID'] == 'LISTS_NEW_ELEMENT') { $message = str_replace(array('#TITLE#', '#A_START#', '#A_END#'), array($arParams["ENTITY_TITLE"], '<a href="' . $arParams['ENTITY_LINK'] . '" class="bx-notifier-item-action">', '</a>'), GetMessage('IM_EVENT_RATING_LISTS_NEW_ELEMENT' . $like)); } else { $message = str_replace('#LINK#', strlen($arParams['ENTITY_LINK']) > 0 ? '<a href="' . $arParams['ENTITY_LINK'] . '" class="bx-notifier-item-action">' . $arParams["ENTITY_TITLE"] . '</a>' : '<i>' . $arParams["ENTITY_TITLE"] . '</i>', GetMessage('IM_EVENT_RATING_ELSE' . $like)); } } return $message; }
/** * Удаление события * @param string $eventName имя события * @param integer $eventHandlerKey ключ обработчика * @param string $moduleName имя модуля * @return boolean результат операции */ public static function off($eventName, $eventHandlerKey = 0, $moduleName = 'main') { return EventManager::getInstance()->removeEventHandler($moduleName, $eventName, $eventHandlerKey); }
function AddEventHandler($FROM_MODULE_ID, $MESSAGE_ID, $CALLBACK, $SORT = 100, $FULL_PATH = false) { global $MAIN_MODULE_EVENTS; $arEvent = array("FROM_MODULE_ID" => $FROM_MODULE_ID, "MESSAGE_ID" => $MESSAGE_ID, "CALLBACK" => $CALLBACK, "SORT" => $SORT, "FULL_PATH" => $FULL_PATH, "VERSION" => 1); $arEvent['TO_NAME'] = CModule::_GetName($arEvent); $FROM_MODULE_ID = strtoupper($FROM_MODULE_ID); $MESSAGE_ID = strtoupper($MESSAGE_ID); if (!isset($MAIN_MODULE_EVENTS[$FROM_MODULE_ID]) || !is_array($MAIN_MODULE_EVENTS[$FROM_MODULE_ID])) { $MAIN_MODULE_EVENTS[$FROM_MODULE_ID] = array(); } $arEvents =& $MAIN_MODULE_EVENTS[$FROM_MODULE_ID]; if (!isset($arEvents[$MESSAGE_ID]) || !is_array($arEvents[$MESSAGE_ID])) { $arEvents[$MESSAGE_ID] = array(); } $iEventHandlerKey = count($arEvents[$MESSAGE_ID]); $arEvents[$MESSAGE_ID][$iEventHandlerKey] = $arEvent; uasort($arEvents[$MESSAGE_ID], create_function('$a, $b', 'if($a["SORT"] == $b["SORT"]) return 0; return ($a["SORT"] < $b["SORT"])? -1 : 1;')); if (class_exists("\\Bitrix\\Main\\EventManager")) { $eventManager = \Bitrix\Main\EventManager::getInstance(); $eventManager->addEventHandlerOld($FROM_MODULE_ID, $MESSAGE_ID, $CALLBACK, $FULL_PATH, $SORT); } return $iEventHandlerKey; }
private static function addEventData($eventName, array &$data, callable $eachRow = null) { foreach (EventManager::getInstance()->findEventHandlers('sale', $eventName) as $handler) { $rows = ExecuteModuleEventEx($handler); if (!is_array($rows)) { throw new SystemException('Not array returned from: ' . print_r($handler, true)); } foreach ($rows as $name => $row) { if (!is_array($row)) { throw new SystemException('Not array in: ' . $eventName . '()[' . $name . '] => ' . print_r($handler, true)); } if (isset($data[$name])) { throw new SystemException('Duplicate in: ' . $eventName . '()[' . $name . '] => ' . print_r($handler, true)); } if ($eachRow) { $eachRow($row); } $data[$name] = $row; } } self::sortArray($data); }
protected function initialize() { static::$initialized = true; foreach (EventManager::getInstance()->findEventHandlers('sale', 'registerInputTypes') as $handler) { ExecuteModuleEventEx($handler); } }
function InitParamArrays($arOrder, $orderID = 0, $psParams = "", $relatedData = array(), $payment = array()) { if (!is_array($relatedData)) { $relatedData = array(); } $GLOBALS["SALE_INPUT_PARAMS"] = array(); $GLOBALS["SALE_CORRESPONDENCE"] = array(); if (!is_array($arOrder) || count($arOrder) <= 0 || !array_key_exists("ID", $arOrder)) { $arOrder = array(); $orderID = IntVal($orderID); if ($orderID > 0) { $arOrderTmp = CSaleOrder::GetByID($orderID); } if (!empty($arOrderTmp)) { foreach ($arOrderTmp as $k => $v) { $arOrder["~" . $k] = $v; $arOrder[$k] = htmlspecialcharsbx($v); } } } else { if ($orderID == 0 && $arOrder['ID'] > 0) { $orderID = $arOrder['ID']; } } if (empty($payment) && $orderID > 0) { $payment = \Bitrix\Sale\Internals\PaymentTable::getRow(array('select' => array('*'), 'filter' => array('ORDER_ID' => $orderID, '!PAY_SYSTEM_ID' => \Bitrix\Sale\PaySystem\Manager::getInnerPaySystemId()))); } if (count($arOrder) > 0) { $GLOBALS["SALE_INPUT_PARAMS"]["ORDER"] = $arOrder; } if (!empty($payment)) { $GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["PAYMENT_ID"] = $payment['ID']; $GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["~PAYMENT_ID"] = $payment['ID']; $GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["SHOULD_PAY"] = $payment['SUM']; $GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["~SHOULD_PAY"] = $payment['SUM']; $GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["PAYED"] = $payment['PAID']; $GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["~PAYED"] = $payment['PAID']; $GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["PAY_SYSTEM_ID"] = $payment['PAY_SYSTEM_ID']; $GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["~PAY_SYSTEM_ID"] = $payment['PAY_SYSTEM_ID']; $GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["ORDER_PAYMENT_ID"] = $payment['ID']; $GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["~ORDER_PAYMENT_ID"] = $payment['ID']; $GLOBALS["SALE_INPUT_PARAMS"]["PAYMENT"] = $payment; } else { $GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["SHOULD_PAY"] = DoubleVal($GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["PRICE"]) - DoubleVal($GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["SUM_PAID"]); } $arDateInsert = explode(" ", $GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["DATE_INSERT"]); if (is_array($arDateInsert) && count($arDateInsert) > 0) { $GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["DATE_INSERT_DATE"] = $arDateInsert[0]; } else { $GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["DATE_INSERT_DATE"] = $GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["DATE_INSERT"]; } if (!empty($payment)) { $GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["DATE_BILL_DATE"] = ConvertTimeStamp(MakeTimeStamp($payment["DATE_BILL"]), 'SHORT'); } $userID = IntVal($GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["USER_ID"]); if ($userID > 0) { $dbUser = CUser::GetByID($userID); if ($arUser = $dbUser->GetNext()) { $GLOBALS["SALE_INPUT_PARAMS"]["USER"] = $arUser; } } $arCurOrderProps = array(); if (isset($relatedData["PROPERTIES"]) && is_array($relatedData["PROPERTIES"])) { $properties = $relatedData["PROPERTIES"]; foreach ($properties as $key => $value) { $arCurOrderProps["~" . $key] = $value; $arCurOrderProps[$key] = htmlspecialcharsEx($value); } } else { $dbOrderPropVals = CSaleOrderPropsValue::GetList(array(), array("ORDER_ID" => $GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["ID"]), false, false, array("ID", "CODE", "VALUE", "ORDER_PROPS_ID", "PROP_TYPE")); while ($arOrderPropVals = $dbOrderPropVals->Fetch()) { $arCurOrderPropsTmp = CSaleOrderProps::GetRealValue($arOrderPropVals["ORDER_PROPS_ID"], $arOrderPropVals["CODE"], $arOrderPropVals["PROP_TYPE"], $arOrderPropVals["VALUE"], LANGUAGE_ID); foreach ($arCurOrderPropsTmp as $key => $value) { $arCurOrderProps["~" . $key] = $value; $arCurOrderProps[$key] = htmlspecialcharsEx($value); } } } if (count($arCurOrderProps) > 0) { $GLOBALS["SALE_INPUT_PARAMS"]["PROPERTY"] = $arCurOrderProps; } $shipment = \Bitrix\Sale\Internals\ShipmentTable::getRow(array('select' => array('DELIVERY_ID'), 'filter' => array('ORDER_ID' => $orderID, 'SYSTEM' => 'N'))); if ($shipment) { $GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["DELIVERY_ID"] = $shipment['DELIVERY_ID']; $GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["~DELIVERY_ID"] = $shipment['DELIVERY_ID']; } $paySystemId = ''; if ($payment && $payment['PAY_SYSTEM_ID'] > 0) { $paySystemId = $payment['PAY_SYSTEM_ID']; } elseif (isset($arOrder['PAY_SYSTEM_ID']) && $arOrder['PAY_SYSTEM_ID'] > 0) { $paySystemId = $arOrder['PAY_SYSTEM_ID']; } else { $psParams = unserialize($psParams); if (isset($psParams['BX_PAY_SYSTEM_ID'])) { $paySystemId = $psParams['BX_PAY_SYSTEM_ID']['VALUE']; } } if ($paySystemId !== '') { if (!isset($arOrder['PERSON_TYPE_ID']) || $arOrder['PERSON_TYPE_ID'] <= 0) { // for crm quote compatibility $personTypes = CSalePaySystem::getPaySystemPersonTypeIds($paySystemId); $personTypeId = array_shift($personTypes); } else { $personTypeId = $arOrder['PERSON_TYPE_ID']; } $params = CSalePaySystemAction::getParamsByConsumer('PAYSYSTEM_' . $paySystemId, $personTypeId); foreach ($params as $key => $value) { $params[$key]['~VALUE'] = htmlspecialcharsbx($value['VALUE']); } $GLOBALS["SALE_CORRESPONDENCE"] = $params; } if ($payment['COMPANY_ID'] > 0) { if (!array_key_exists('COMPANY', $GLOBALS["SALE_INPUT_PARAMS"])) { $GLOBALS["SALE_INPUT_PARAMS"]["COMPANY"] = array(); } global $USER_FIELD_MANAGER; $userFieldsList = $USER_FIELD_MANAGER->GetUserFields(\Bitrix\Sale\Internals\CompanyTable::getUfId(), null, LANGUAGE_ID); foreach ($userFieldsList as $key => $userField) { $value = $USER_FIELD_MANAGER->GetUserFieldValue(\Bitrix\Sale\Internals\CompanyTable::getUfId(), $key, $payment['COMPANY_ID']); $GLOBALS["SALE_INPUT_PARAMS"]["COMPANY"][$key] = $value; $GLOBALS["SALE_INPUT_PARAMS"]["COMPANY"]["~" . $key] = $value; } $companyFieldList = \Bitrix\Sale\Internals\CompanyTable::getRowById($payment['COMPANY_ID']); foreach ($companyFieldList as $key => $value) { $GLOBALS["SALE_INPUT_PARAMS"]["COMPANY"][$key] = $value; $GLOBALS["SALE_INPUT_PARAMS"]["COMPANY"]["~" . $key] = $value; } } // fields with no interface $GLOBALS["SALE_CORRESPONDENCE"]['PAYER_STREET']["TYPE"] = 'PROPERTY'; $GLOBALS["SALE_CORRESPONDENCE"]['PAYER_STREET']["VALUE"] = 'LOCATION_STREET'; $GLOBALS["SALE_CORRESPONDENCE"]['PAYER_STREET']["~VALUE"] = 'LOCATION_STREET'; $GLOBALS["SALE_CORRESPONDENCE"]['PAYER_VILLAGE']["TYPE"] = 'PROPERTY'; $GLOBALS["SALE_CORRESPONDENCE"]['PAYER_VILLAGE']["VALUE"] = 'LOCATION_VILLAGE'; $GLOBALS["SALE_CORRESPONDENCE"]['PAYER_VILLAGE']["~VALUE"] = 'LOCATION_VILLAGE'; $GLOBALS["SALE_CORRESPONDENCE"]['ORDER_PAYMENT_ID']["TYPE"] = 'ORDER'; $GLOBALS["SALE_CORRESPONDENCE"]['ORDER_PAYMENT_ID']["VALUE"] = 'PAYMENT_ID'; $GLOBALS["SALE_CORRESPONDENCE"]['ORDER_PAYMENT_ID']["~VALUE"] = 'PAYMENT_ID'; $GLOBALS["SALE_CORRESPONDENCE"]['PAYED']["TYPE"] = 'ORDER'; $GLOBALS["SALE_CORRESPONDENCE"]['PAYED']["VALUE"] = 'PAYED'; $GLOBALS["SALE_CORRESPONDENCE"]['PAYED']["~VALUE"] = 'PAYED'; if (isset($relatedData["BASKET_ITEMS"]) && is_array($relatedData["BASKET_ITEMS"])) { $GLOBALS["SALE_INPUT_PARAMS"]["BASKET_ITEMS"] = $relatedData["BASKET_ITEMS"]; } if (isset($relatedData["TAX_LIST"]) && is_array($relatedData["TAX_LIST"])) { $GLOBALS["SALE_INPUT_PARAMS"]["TAX_LIST"] = $relatedData["TAX_LIST"]; } if (isset($relatedData["REQUISITE"]) && is_array($relatedData["REQUISITE"])) { $GLOBALS["SALE_INPUT_PARAMS"]["REQUISITE"] = $relatedData["REQUISITE"]; self::$relatedData['REQUISITE'] = array('GET_INSTANCE_VALUE' => function ($providerInstance, $providerValue, $personTypeId) { return $GLOBALS['SALE_INPUT_PARAMS']['REQUISITE'][$providerValue]; }); } if (isset($relatedData["BANK_DETAIL"]) && is_array($relatedData["BANK_DETAIL"])) { $GLOBALS["SALE_INPUT_PARAMS"]["BANK_DETAIL"] = $relatedData["BANK_DETAIL"]; self::$relatedData['BANK_DETAIL'] = array('GET_INSTANCE_VALUE' => function ($providerInstance, $providerValue, $personTypeId) { return $GLOBALS['SALE_INPUT_PARAMS']['BANK_DETAIL'][$providerValue]; }); } if (isset($relatedData["CRM_COMPANY"]) && is_array($relatedData["CRM_COMPANY"])) { $GLOBALS["SALE_INPUT_PARAMS"]["CRM_COMPANY"] = $relatedData["CRM_COMPANY"]; self::$relatedData['CRM_COMPANY'] = array('GET_INSTANCE_VALUE' => function ($providerInstance, $providerValue, $personTypeId) { return $GLOBALS['SALE_INPUT_PARAMS']['CRM_COMPANY'][$providerValue]; }); } if (isset($relatedData["CRM_CONTACT"]) && is_array($relatedData["CRM_CONTACT"])) { $GLOBALS["SALE_INPUT_PARAMS"]["CRM_CONTACT"] = $relatedData["CRM_CONTACT"]; self::$relatedData['CRM_CONTACT'] = array('GET_INSTANCE_VALUE' => function ($providerInstance, $providerValue, $personTypeId) { return $GLOBALS['SALE_INPUT_PARAMS']['CRM_CONTACT'][$providerValue]; }); } if (isset($relatedData["MC_REQUISITE"]) && is_array($relatedData["MC_REQUISITE"])) { $GLOBALS["SALE_INPUT_PARAMS"]["MC_REQUISITE"] = $relatedData["MC_REQUISITE"]; self::$relatedData['MC_REQUISITE'] = array('GET_INSTANCE_VALUE' => function ($providerInstance, $providerValue, $personTypeId) { return $GLOBALS['SALE_INPUT_PARAMS']['MC_REQUISITE'][$providerValue]; }); } if (isset($relatedData["MC_BANK_DETAIL"]) && is_array($relatedData["MC_BANK_DETAIL"])) { $GLOBALS["SALE_INPUT_PARAMS"]["MC_BANK_DETAIL"] = $relatedData["MC_BANK_DETAIL"]; self::$relatedData['MC_BANK_DETAIL'] = array('GET_INSTANCE_VALUE' => function ($providerInstance, $providerValue, $personTypeId) { return $GLOBALS['SALE_INPUT_PARAMS']['MC_BANK_DETAIL'][$providerValue]; }); } if (isset($relatedData["CRM_MYCOMPANY"]) && is_array($relatedData["CRM_MYCOMPANY"])) { $GLOBALS["SALE_INPUT_PARAMS"]["CRM_MYCOMPANY"] = $relatedData["CRM_MYCOMPANY"]; self::$relatedData['CRM_MYCOMPANY'] = array('GET_INSTANCE_VALUE' => function ($providerInstance, $providerValue, $personTypeId) { return $GLOBALS['SALE_INPUT_PARAMS']['CRM_MYCOMPANY'][$providerValue]; }); } if ($relatedData) { $eventManager = \Bitrix\Main\EventManager::getInstance(); $eventManager->addEventHandler('sale', 'OnGetBusinessValueProviders', array('\\CSalePaySystemAction', 'getProviders')); } }
<?php defined('B_PROLOG_INCLUDED') and B_PROLOG_INCLUDED === true or die; use Bitrix\Main\Loader; use Bitrix\Main\EventManager; Loader::registerAutoLoadClasses('maycat.d7dull', array('Maycat\\D7dull\\ExampleTable' => 'lib/ExampleTable.php')); EventManager::getInstance()->addEventHandler('main', 'OnAfterUserAdd', function () { // do something when new user added });
protected function unSetCatalogSectionsTabEvent() { $eventManager = EventManager::getInstance(); $eventManager->unRegisterEventHandler("main", "OnAdminIBlockSectionEdit", "sale", "\\Bitrix\\Sale\\TradingPlatform\\CatalogSectionTab", "OnInit"); }
/** * */ public static function unRegisterEvents() { $eventManager = Main\EventManager::getInstance(); $eventManager->unRegisterEventHandler('sale', 'OnSaleOrderPaid', 'sale', '\\Bitrix\\Sale\\Compatible\\EventCompatibility', 'onSalePayOrder'); $eventManager->unRegisterEventHandler('sale', 'OnSaleBeforeOrderDelete', 'sale', '\\Bitrix\\Sale\\Compatible\\EventCompatibility', 'onBeforeOrderDelete'); $eventManager->unRegisterEventHandler('sale', 'OnSaleOrderDeleted', 'sale', '\\Bitrix\\Sale\\Compatible\\EventCompatibility', 'onOrderDelete'); $eventManager->unRegisterEventHandler('sale', 'OnSaleShipmentDelivery', 'sale', '\\Bitrix\\Sale\\Compatible\\EventCompatibility', 'onSaleDeliveryOrder'); $eventManager->unRegisterEventHandler('sale', 'OnSaleBeforeOrderCanceled', 'sale', '\\Bitrix\\Sale\\Compatible\\EventCompatibility', 'onSaleBeforeCancelOrder'); $eventManager->unRegisterEventHandler('sale', 'OnSaleOrderCanceled', 'sale', '\\Bitrix\\Sale\\Compatible\\EventCompatibility', 'onSaleCancelOrder'); $eventManager->unRegisterEventHandler('sale', 'OnSaleOrderPaidSendMail', 'sale', '\\Bitrix\\Sale\\Compatible\\EventCompatibility', 'onSaleOrderPaidSendMail'); $eventManager->unRegisterEventHandler('sale', 'OnSaleOrderCancelSendEmail', 'sale', '\\Bitrix\\Sale\\Compatible\\EventCompatibility', 'onSaleOrderCancelSendEmail'); $eventManager->unRegisterEventHandler('sale', 'OnSaleOrderSaved', 'sale', '\\Bitrix\\Sale\\Compatible\\EventCompatibility', 'onOrderSave'); $eventManager->unRegisterEventHandler('sale', 'OnSaleOrderSaved', 'sale', '\\Bitrix\\Sale\\Compatible\\EventCompatibility', 'onOrderAdd'); $eventManager->unRegisterEventHandler('sale', 'OnSaleBasketItemBeforeSaved', 'sale', '\\Bitrix\\Sale\\Compatible\\EventCompatibility', 'onBasketItemChange'); }
/** * Register handlers of the Bitrix events. */ protected function registerHandlers() { foreach ($this->getHandlers() as $handler) { $this->eventManager->addEventHandler($handler[0], $handler[1], [$handler[2], $handler[3]]); } }
function UnInstallDB($arParams = array()) { global $DB, $DBType, $APPLICATION; $this->errors = false; if (array_key_exists("savedata", $arParams) && $arParams["savedata"] != "Y") { $this->errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/sale/install/db/" . $DBType . "/uninstall.sql"); if ($this->errors !== false) { $APPLICATION->ThrowException(implode("", $this->errors)); return false; } } UnRegisterModuleDependences("catalog", "OnSaleOrderSumm", "sale", "CSaleOrder", "__SaleOrderCount"); UnRegisterModuleDependences("main", "OnBeforeProlog", "main", "", "", "/modules/sale/affiliate.php"); UnRegisterModuleDependences("main", "OnUserLogin", "sale", "CSaleUser", "OnUserLogin"); UnRegisterModuleDependences("main", "OnBeforeLangDelete", "sale", "CSalePersonType", "OnBeforeLangDelete"); UnRegisterModuleDependences("main", "OnLanguageDelete", "sale", "CSaleLocation", "OnLangDelete"); UnRegisterModuleDependences("main", "OnLanguageDelete", "sale", "CSaleLocationGroup", "OnLangDelete"); UnRegisterModuleDependences("main", "OnUserDelete", "sale", "CSaleOrderUserProps", "OnUserDelete"); UnRegisterModuleDependences("main", "OnUserDelete", "sale", "CSaleUserAccount", "OnUserDelete"); UnRegisterModuleDependences("main", "OnUserDelete", "sale", "CSaleAuxiliary", "OnUserDelete"); UnRegisterModuleDependences("main", "OnUserDelete", "sale", "CSaleUser", "OnUserDelete"); UnRegisterModuleDependences("main", "OnUserDelete", "sale", "CSaleRecurring", "OnUserDelete"); UnRegisterModuleDependences("main", "OnUserDelete", "sale", "CSaleUserCards", "OnUserDelete"); UnRegisterModuleDependences("main", "OnBeforeUserDelete", "sale", "CSaleOrder", "OnBeforeUserDelete"); UnRegisterModuleDependences("main", "OnBeforeUserDelete", "sale", "CSaleAffiliate", "OnBeforeUserDelete"); UnRegisterModuleDependences("main", "OnBeforeUserDelete", "sale", "CSaleUserAccount", "OnBeforeUserDelete"); UnRegisterModuleDependences("currency", "OnBeforeCurrencyDelete", "sale", "CSaleOrder", "OnBeforeCurrencyDelete"); UnRegisterModuleDependences("currency", "OnBeforeCurrencyDelete", "sale", "CSaleLang", "OnBeforeCurrencyDelete"); UnRegisterModuleDependences("currency", "OnModuleUnInstall", "sale", "", "CurrencyModuleUnInstallSale"); UnRegisterModuleDependences("mobileapp", "OnBeforeAdminMobileMenuBuild", "sale", "CSaleMobileOrderUtils", "buildSaleAdminMobileMenu"); UnRegisterModuleDependences("sender", "OnConnectorList", "sale", "\\Bitrix\\Sale\\SenderEventHandler", "onConnectorListBuyer"); UnRegisterModuleDependences("sale", "OnCondSaleControlBuildList", "sale", "CSaleCondCtrlGroup", "GetControlDescr"); UnRegisterModuleDependences("sale", "OnCondSaleControlBuildList", "sale", "CSaleCondCtrlBasketGroup", "GetControlDescr"); UnRegisterModuleDependences("sale", "OnCondSaleControlBuildList", "sale", "CSaleCondCtrlBasketFields", "GetControlDescr"); UnRegisterModuleDependences("sale", "OnCondSaleControlBuildList", "sale", "CSaleCondCtrlBasketProps", "GetControlDescr"); UnRegisterModuleDependences("sale", "OnCondSaleControlBuildList", "sale", "CSaleCondCtrlOrderFields", "GetControlDescr"); UnRegisterModuleDependences("sale", "OnCondSaleControlBuildList", "sale", "CSaleCondCtrlCommon", "GetControlDescr"); UnRegisterModuleDependences("sale", "OnCondSaleActionsControlBuildList", "sale", "CSaleActionCtrlGroup", "GetControlDescr"); UnRegisterModuleDependences("sale", "OnCondSaleActionsControlBuildList", "sale", "CSaleActionCtrlDelivery", "GetControlDescr"); UnRegisterModuleDependences("sale", "OnCondSaleActionsControlBuildList", "sale", "CSaleActionCtrlBasketGroup", "GetControlDescr"); UnRegisterModuleDependences("sale", "OnCondSaleActionsControlBuildList", "sale", "CSaleActionCtrlSubGroup", "GetControlDescr"); UnRegisterModuleDependences("sale", "OnCondSaleActionsControlBuildList", "sale", "CSaleActionCondCtrlBasketFields", "GetControlDescr"); UnRegisterModuleDependences("sale", "OnOrderDelete", "sale", "CSaleMobileOrderPull", "onOrderDelete"); UnRegisterModuleDependences("sale", "OnOrderAdd", "sale", "CSaleMobileOrderPull", "onOrderAdd"); UnRegisterModuleDependences("sale", "OnOrderUpdate", "sale", "CSaleMobileOrderPull", "onOrderUpdate"); UnRegisterModuleDependences("sale", "OnSaleStatusOrder", "sale", "\\Bitrix\\Sale\\Product2ProductTable", "onSaleStatusOrderHandler"); UnRegisterModuleDependences("sale", "OnSaleDeliveryOrder", "sale", "\\Bitrix\\Sale\\Product2ProductTable", "onSaleDeliveryOrderHandler"); UnRegisterModuleDependences("sale", "OnSaleDeductOrder", "sale", "\\Bitrix\\Sale\\Product2ProductTable", "onSaleDeductOrderHandler"); UnRegisterModuleDependences("sale", "OnSaleCancelOrder", "sale", "\\Bitrix\\Sale\\Product2ProductTable", "onSaleCancelOrderHandler"); UnRegisterModuleDependences("sale", "OnSalePayOrder", "sale", "\\Bitrix\\Sale\\Product2ProductTable", "onSalePayOrderHandler"); UnRegisterModuleDependences("main", "OnEventLogGetAuditTypes", "sale", "CSaleYMHandler", 'OnEventLogGetAuditTypes'); UnRegisterModuleDependences("main", "OnEventLogGetAuditTypes", "sale", "CSalePaySystemAction", 'OnEventLogGetAuditTypes'); $eventManager = \Bitrix\Main\EventManager::getInstance(); $eventManager->unRegisterEventHandler('main', 'OnUserLogout', 'sale', '\\Bitrix\\Sale\\DiscountCouponsManager', 'logout'); CAgent::RemoveModuleAgents("sale"); ModuleManager::unRegisterModule('sale'); return true; }
function RegisterModuleDependences($FROM_MODULE_ID, $MESSAGE_ID, $TO_MODULE_ID, $TO_CLASS = "", $TO_METHOD = "", $SORT = 100, $TO_PATH = "", $TO_METHOD_ARG = array()) { $eventManager = \Bitrix\Main\EventManager::getInstance(); $eventManager->registerEventHandlerCompatible($FROM_MODULE_ID, $MESSAGE_ID, $TO_MODULE_ID, $TO_CLASS, $TO_METHOD, $SORT, $TO_PATH, $TO_METHOD_ARG); }