当前位置: 首页>>代码示例>>PHP>>正文


PHP Event::getParameters方法代码示例

本文整理汇总了PHP中Bitrix\Main\Event::getParameters方法的典型用法代码示例。如果您正苦于以下问题:PHP Event::getParameters方法的具体用法?PHP Event::getParameters怎么用?PHP Event::getParameters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Bitrix\Main\Event的用法示例。


在下文中一共展示了Event::getParameters方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: onExecuteStartWriting

 function onExecuteStartWriting(\Bitrix\Main\Event $event)
 {
     $parameters = $event->getParameters();
     $userId = $parameters[0];
     $dialogId = $parameters[1] . $parameters[2];
     if ($userId > 0) {
         if (!\Bitrix\Main\Loader::includeModule('pull')) {
             return;
         }
         \CPushManager::DeleteFromQueueBySubTag($userId, 'IM_MESS');
         if (intval($dialogId) > 0) {
             \CPullStack::AddByUser($dialogId, array('module_id' => 'im', 'command' => 'startWriting', 'expiry' => 60, 'params' => array('senderId' => $userId, 'dialogId' => $dialogId)));
         } elseif (substr($dialogId, 0, 4) == 'chat') {
             $chatId = substr($dialogId, 4);
             $arRelation = \CIMChat::GetRelationById($chatId);
             unset($arRelation[$userId]);
             $pullMessage = array('module_id' => 'im', 'command' => 'startWriting', 'expiry' => 60, 'params' => array('senderId' => $userId, 'dialogId' => $dialogId));
             \CPullStack::AddByUsers(array_keys($arRelation), $pullMessage);
             $orm = \Bitrix\Im\ChatTable::getById($chatId);
             $chat = $orm->fetch();
             if ($chat['TYPE'] == IM_MESSAGE_OPEN) {
                 \CPullWatch::AddToStack('IM_PUBLIC_' . $chatId, $pullMessage);
             }
         }
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:26,代码来源:startwritinghandler.php

示例2: handleEvent

 /**
  * @param \Bitrix\Main\Event $event
  * @return mixed
  */
 public static function handleEvent(Event $event)
 {
     $eventData = $event->getParameters();
     $eventData = $eventData[0];
     $eventName = $eventData['EVENT_NAME'];
     $fields = is_array($eventData['C_FIELDS']) ? $eventData['C_FIELDS'] : array();
     if (static::isPreventable($eventName, $fields)) {
         // error
         $result = new EventResult(EventResult::ERROR);
     } else {
         // success
         $result = new EventResult(EventResult::SUCCESS);
     }
     return $result;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:19,代码来源:maileventhandler.php

示例3: onStartUserReplication

 public function onStartUserReplication(\Bitrix\Main\Event $event)
 {
     $parameters = $event->getParameters();
     $userId = $parameters[0];
     $domain = $parameters[2];
     $domainId = getNameByDomain($domain);
     if (!$domainId) {
         return;
     }
     $mapper = \Bitrix\Replica\Mapper::getInstance();
     $map = $mapper->getByPrimaryValue("b_user.ID", false, $userId);
     if (!$map) {
         return;
     }
     $guid = key($map);
     $event = array("operation" => "im_status_bind", "guid" => $guid);
     \Bitrix\Replica\Log\Client::getInstance()->write(array($domainId), $event);
     \Bitrix\Replica\Mapper::getInstance()->add("b_im_status.USER_ID", $userId, $domainId, $event["guid"]);
 }
开发者ID:Satariall,项目名称:izurit,代码行数:19,代码来源:statushandler.php

示例4: onExecuteStartWriting

 function onExecuteStartWriting(\Bitrix\Main\Event $event)
 {
     $parameters = $event->getParameters();
     $userId = $parameters[0];
     $dialogId = $parameters[1] . $parameters[2];
     if ($userId > 0) {
         if (!\Bitrix\Main\Loader::includeModule('pull')) {
             return;
         }
         \CPushManager::DeleteFromQueueBySubTag($userId, 'IM_MESS');
         if (intval($dialogId) > 0) {
             \CPullStack::AddByUser($dialogId, array('module_id' => 'im', 'command' => 'startWriting', 'expiry' => 60, 'params' => array('senderId' => $userId, 'dialogId' => $dialogId)));
         } elseif (substr($dialogId, 0, 4) == 'chat') {
             $arRelation = \CIMChat::GetRelationById(substr($dialogId, 4));
             foreach ($arRelation as $rel) {
                 if ($rel['USER_ID'] == $userId) {
                     continue;
                 }
                 \CPullStack::AddByUser($rel['USER_ID'], array('module_id' => 'im', 'command' => 'startWriting', 'expiry' => 60, 'params' => array('senderId' => $userId, 'dialogId' => $dialogId)));
             }
         }
     }
 }
开发者ID:Satariall,项目名称:izurit,代码行数:23,代码来源:startwritinghandler.php

示例5: onBasketItemChange

 /**
  * @param Main\Event $event
  *
  * @return Main\EventResult
  */
 public static function onBasketItemChange(Main\Event $event)
 {
     $parameters = $event->getParameters();
     /** @var Sale\BasketItem $basketItem */
     $basketItem = $parameters[0];
     if (!$basketItem instanceof Sale\BasketItem) {
         return new Main\EventResult(Main\EventResult::ERROR, new Sale\ResultError(Main\Localization\Loc::getMessage('SALE_EVENT_COMPATIBILITY_BASKET_ITEM_CHANGE_WRONG_BASKET'), 'SALE_EVENT_COMPATIBILITY_BASKET_ITEM_CHANGE_WRONG_BASKET'), 'sale');
     }
     $currentBasketFields = $basketFields = BasketCompatibility::convertBasketItemToArray($basketItem);
     if ($basketItem->getId() == 0) {
         foreach (GetModuleEvents("sale", static::EVENT_COMPATIBILITY_ON_BEFORE_BASKET_ITEM_ADD, true) as $oldEvent) {
             if (ExecuteModuleEventEx($oldEvent, array(&$basketFields)) === false) {
                 continue;
             }
         }
     } else {
         foreach (GetModuleEvents("sale", static::EVENT_COMPATIBILITY_ON_BEFORE_BASKET_ITEM_UPDATE, true) as $oldEvent) {
             if (ExecuteModuleEventEx($oldEvent, array($basketItem->getId(), &$basketFields)) === false) {
                 continue;
             }
         }
     }
     foreach ($currentBasketFields as $key => $value) {
         if (isset($basketFields[$key]) && $basketFields[$key] != $value) {
             $basketItem->setFieldNoDemand($key, $basketFields[$key]);
         }
     }
     return new Main\EventResult(Main\EventResult::SUCCESS, null, 'sale');
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:34,代码来源:eventcompatibility.php

示例6: sendToEventHandler

 private function sendToEventHandler(array $handler, Event $event)
 {
     try {
         $result = true;
         $event->addDebugInfo($handler);
         if (isset($handler["TO_MODULE_ID"]) && !empty($handler["TO_MODULE_ID"]) && $handler["TO_MODULE_ID"] != 'main') {
             $result = Loader::includeModule($handler["TO_MODULE_ID"]);
         } elseif (isset($handler["TO_PATH"]) && !empty($handler["TO_PATH"])) {
             $path = ltrim($handler["TO_PATH"], "/");
             if (($path = Loader::getLocal($path)) !== false) {
                 $result = (include_once $path);
             }
         } elseif (isset($handler["FULL_PATH"]) && !empty($handler["FULL_PATH"]) && IO\File::isFileExists($handler["FULL_PATH"])) {
             $result = (include_once $handler["FULL_PATH"]);
         }
         $event->addDebugInfo($result);
         if (isset($handler["TO_METHOD_ARG"]) && is_array($handler["TO_METHOD_ARG"]) && !empty($handler["TO_METHOD_ARG"])) {
             $args = $handler["TO_METHOD_ARG"];
         } else {
             $args = array();
         }
         if ($handler["VERSION"] > 1) {
             $args[] = $event;
         } else {
             $args = array_merge($args, array_values($event->getParameters()));
         }
         $callback = null;
         if (isset($handler["CALLBACK"])) {
             $callback = $handler["CALLBACK"];
         } elseif (!empty($handler["TO_CLASS"]) && !empty($handler["TO_METHOD"]) && class_exists($handler["TO_CLASS"])) {
             $callback = array($handler["TO_CLASS"], $handler["TO_METHOD"]);
         }
         if ($callback != null) {
             $result = call_user_func_array($callback, $args);
         }
         if ($result != null && !$result instanceof EventResult) {
             $result = new EventResult(EventResult::UNDEFINED, $result, $handler["TO_MODULE_ID"]);
         }
         $event->addDebugInfo($result);
         if ($result != null) {
             $event->addResult($result);
         }
     } catch (\Exception $ex) {
         if ($event->isDebugOn()) {
             $event->addException($ex);
         } else {
             throw $ex;
         }
     }
 }
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:50,代码来源:eventmanager.php

示例7: onSaleBeforeStatusOrderChange

 /**
  * @param Main\Event $event
  *
  * @return Main\EventResult
  * @throws Main\ObjectNotFoundException
  */
 public static function onSaleBeforeStatusOrderChange(Main\Event $event)
 {
     $parameters = $event->getParameters();
     /** @var Sale\Order $basketItem */
     $order = $parameters['ENTITY'];
     $value = $parameters['VALUE'];
     $oldValue = $parameters['OLD_VALUE'];
     if (!$order instanceof Sale\Order) {
         return new Main\EventResult(Main\EventResult::ERROR, new Sale\ResultError(Main\Localization\Loc::getMessage('SALE_EVENT_COMPATIBILITY_BEFORE_ORDER_STATUS_CHANGE_WRONG_ORDER'), 'SALE_EVENT_COMPATIBILITY_BEFORE_ORDER_STATUS_CHANGE_WRONG_ORDER'), 'sale');
     }
     foreach (GetModuleEvents("sale", static::EVENT_COMPATIBILITY_ON_BEFORE_ORDER_STATUS_CHANGE, true) as $oldEvent) {
         ExecuteModuleEventEx($oldEvent, array($order->getId(), $value));
     }
     return new Main\EventResult(Main\EventResult::SUCCESS, null, 'sale');
 }
开发者ID:Satariall,项目名称:izurit,代码行数:21,代码来源:eventcompatibility.php


注:本文中的Bitrix\Main\Event::getParameters方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。