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


PHP CEvent::send方法代码示例

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


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

示例1: onShipmentTrackingNumberChange

 /**
  * @param Main\Event $event
  *
  * @return Main\EventResult
  * @throws Main\ObjectNotFoundException
  */
 public static function onShipmentTrackingNumberChange(Main\Event $event)
 {
     $parameters = $event->getParameters();
     /** @var Sale\Shipment $basketItem */
     $shipment = $parameters['ENTITY'];
     $oldValues = $parameters['VALUES'];
     if (!$shipment instanceof Sale\Shipment) {
         return new Main\EventResult(Main\EventResult::ERROR, new Sale\ResultError(Main\Localization\Loc::getMessage('SALE_EVENT_COMPATIBILITY_SHIPMENT_TRACKING_NUMBER_CHANGE_WRONG_BASKET'), 'SALE_EVENT_COMPATIBILITY_SHIPMENT_TRACKING_NUMBER_CHANGE_WRONG_BASKET'), 'sale');
     }
     /** @var Sale\ShipmentCollection $shipmentCollection */
     if (!($shipmentCollection = $shipment->getCollection())) {
         throw new Main\ObjectNotFoundException('Entity "ShipmentCollection" not found');
     }
     /** @var Sale\Order $order */
     if (!($order = $shipmentCollection->getOrder())) {
         throw new Main\ObjectNotFoundException('Entity "Order" not found');
     }
     foreach (GetModuleEvents("sale", static::EVENT_COMPATIBILITY_ON_TRACKING_NUMBER_CHANGE, true) as $oldEvent) {
         ExecuteModuleEventEx($oldEvent, array($order->getId(), $shipment->getField('TRACKING_NUMBER')));
     }
     if (array_key_exists('TRACKING_NUMBER', $oldValues) && strval($shipment->getField('TRACKING_NUMBER')) != '' && $oldValues["TRACKING_NUMBER"] != $shipment->getField('TRACKING_NUMBER')) {
         $accountNumber = $order->getField("ACCOUNT_NUMBER");
         $userId = $order->getField("USER_ID");
         $payerName = "";
         $payerEMail = '';
         $userRes = \CUser::getByID($userId);
         if ($userData = $userRes->fetch()) {
             if (strval($payerName) == '') {
                 $payerName = $userData["NAME"] . (strval($userData["NAME"]) == '' || strval($userData["LAST_NAME"]) == '' ? "" : " ") . $userData["LAST_NAME"];
             }
             if (strval($payerEMail) == '') {
                 $payerEMail = $userData["EMAIL"];
             }
         }
         $emailFields = array("ORDER_ID" => $accountNumber, "ORDER_DATE" => $order->getDateInsert()->toString(), "ORDER_USER" => $payerName, "ORDER_TRACKING_NUMBER" => $shipment->getField('TRACKING_NUMBER'), "BCC" => Main\Config\Option::get("sale", "order_email", "order@" . $_SERVER['SERVER_NAME']), "EMAIL" => $payerEMail, "SALE_EMAIL" => Main\Config\Option::get("sale", "order_email", "order@" . $_SERVER['SERVER_NAME']));
         $event = new \CEvent();
         $event->send("SALE_ORDER_TRACKING_NUMBER", $order->getField("LID"), $emailFields, "N");
     }
     return new Main\EventResult(Main\EventResult::SUCCESS, null, 'sale');
 }
开发者ID:Satariall,项目名称:izurit,代码行数:46,代码来源:eventcompatibility.php

示例2: notifyMailDomain

 public static function notifyMailDomain($type, $sid, $user_id, $cnt = 0)
 {
     $user_id = intval($user_id);
     $cnt = intval($cnt);
     if (!CModule::includeModule('mail')) {
         return '';
     }
     $arAdmin = CUser::getList($by, $order, array('ID' => $user_id, 'GROUPS_ID' => 1, 'ACTIVE' => 'Y'), array('FIELDS' => array('ID', 'EMAIL')))->fetch();
     if (empty($arAdmin)) {
         return '';
     }
     if ($cnt == 0) {
         return 'CIntranetUtils::notifyMailDomain("' . $type . '", "' . $sid . '", ' . $user_id . ', ' . ++$cnt . ');';
     }
     includeModuleLangFile(__FILE__);
     if (isModuleInstalled('bitrix24')) {
         $learnmoreLink = getMessage('INTR_MAIL_DOMAIN_LEARNMOREB24_LINK');
         $supportLink = getMessage('INTR_MAIL_DOMAIN_SUPPORTB24_LINK');
     } else {
         $learnmoreLink = getMessage('INTR_MAIL_DOMAIN_LEARNMORE_LINK');
         $supportLink = getMessage('INTR_MAIL_DOMAIN_SUPPORT_LINK');
     }
     if (in_array($type, array('nocomplete', 'nomailbox'))) {
         $sid = intval($sid);
         $service = \Bitrix\Mail\MailServicesTable::getList(array('filter' => array('=ID' => $sid)))->fetch();
         if (empty($service) || $service['ACTIVE'] != 'Y' || !in_array($service['SERVICE_TYPE'], array('domain', 'crdomain'))) {
             return '';
         }
         if ($service['SERVICE_TYPE'] == 'domain') {
             $result = CMailDomain2::getDomainStatus($service['TOKEN'], $service['SERVER'], $error);
             $stage = empty($result['stage']) ? null : $result['stage'];
         } else {
             $crResponse = CControllerClient::executeEvent('OnMailControllerCheckMemberDomain', array('DOMAIN' => $service['SERVER']));
             $stage = empty($crResponse['result']['stage']) ? null : $crResponse['result']['stage'];
         }
         if ($type == 'nocomplete') {
             if (in_array($stage, array('owner-check', 'mx-check'))) {
                 CEvent::send('INTRANET_MAILDOMAIN_NOCOMPLETE', array($service['SITE_ID']), array('EMAIL_TO' => $arAdmin['EMAIL'], 'LEARNMORE_LINK' => $learnmoreLink, 'SUPPORT_LINK' => $supportLink));
                 if ($cnt == 1) {
                     global $pPERIOD;
                     $pPERIOD = 3600 * 24 * 4;
                     return 'CIntranetUtils::notifyMailDomain("nocomplete", ' . $sid . ', ' . $user_id . ', ' . ++$cnt . ');';
                 }
             }
         } else {
             if ($stage == 'added') {
                 $dbMailboxes = CMailbox::getList(array(), array('ACTIVE' => 'Y', '!USER_ID' => 0, 'SERVICE_ID' => $sid));
                 $adminMailbox = false;
                 $userMailboxes = false;
                 while ($arMailbox = $dbMailboxes->fetch()) {
                     if ($arMailbox['USER_ID'] == $user_id) {
                         $adminMailbox = true;
                     } else {
                         $userMailboxes = true;
                         break;
                     }
                 }
                 if (!$userMailboxes) {
                     $eventType = $adminMailbox ? 'INTRANET_MAILDOMAIN_NOMAILBOX2' : 'INTRANET_MAILDOMAIN_NOMAILBOX';
                     CEvent::send($eventType, array($service['SITE_ID']), array('EMAIL_TO' => $arAdmin['EMAIL'], 'LEARNMORE_LINK' => $learnmoreLink, 'SUPPORT_LINK' => $supportLink));
                     if ($cnt == 1) {
                         global $pPERIOD;
                         $pPERIOD = 3600 * 24 * 21;
                         return 'CIntranetUtils::notifyMailDomain("nomailbox", ' . $sid . ', ' . $user_id . ', ' . ++$cnt . ');';
                     }
                 }
             }
         }
     } else {
         if ($type == 'noreg') {
             $dbServices = \Bitrix\Mail\MailServicesTable::getList(array('filter' => array('ACTIVE' => 'Y', 'SERVICE_TYPE' => 'crdomain')));
             while ($service = $dbServices->fetch()) {
                 if ($service['FLAGS'] & CMail::F_DOMAIN_REG) {
                     return '';
                 }
             }
             $r = CEvent::send('INTRANET_MAILDOMAIN_NOREG', array($sid), array('EMAIL_TO' => $arAdmin['EMAIL'], 'LEARNMORE_LINK' => $learnmoreLink, 'SUPPORT_LINK' => $supportLink));
         }
     }
     return '';
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:81,代码来源:utils.php

示例3: sendDefault

 /**
  * Creates a post event which will subsequently be sent as email message.
  *
  * @param string $event
  * @param mixed  $template
  * @param array  $data
  * @param array  $attachFiles
  *
  * @return mixed
  */
 protected function sendDefault($event, $template, $data, $attachFiles)
 {
     return $this->event->send($event, SITE_ID, $data, 'Y', $template, $attachFiles);
 }
开发者ID:ASDAFF,项目名称:citfact.form,代码行数:14,代码来源:Mailer.php


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