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


PHP CIMNotify::add方法代码示例

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


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

示例1: checkMailDomain

 public static function checkMailDomain($service_id, $user_id, $cnt = 1)
 {
     $service_id = intval($service_id);
     $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', 'TIME_ZONE_OFFSET')))->fetch();
     if (empty($arAdmin)) {
         return '';
     }
     $service = \Bitrix\Mail\MailServicesTable::getList(array('filter' => array('=ID' => $service_id)))->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']);
         $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 (!in_array($stage, array('none', 'owner-check', 'mx-check', 'added'))) {
         return false;
     } else {
         if (in_array($stage, array('none', 'added'))) {
             if ($stage == 'added') {
                 if (CModule::includeModule('im')) {
                     includeModuleLangFile(__FILE__);
                     $siteUrl = sprintf('http%s://%s%s', CMain::isHTTPS() ? 's' : '', $_SERVER['SERVER_NAME'], in_array($_SERVER['SERVER_PORT'], array(80, 443)) ? '' : ':' . $_SERVER['SERVER_PORT']);
                     CIMNotify::add(array('TO_USER_ID' => $user_id, 'FROM_USER_ID' => 0, 'NOTIFY_TYPE' => IM_NOTIFY_SYSTEM, 'NOTIFY_MODULE' => 'intranet', 'NOTIFY_MESSAGE' => str_replace(array('#DOMAIN#', '#SERVER#'), array(htmlspecialcharsbx($service['SERVER']), $siteUrl), getMessage('INTR_MAIL_DOMAINREADY_NOTICE'))));
                 }
                 $timeout = new DateTime(intval($arAdmin['TIME_ZONE_OFFSET']) . ' seconds +7 days');
                 if ($timeout->format('N') > 5) {
                     $timeout->modify('next monday');
                 }
                 CAgent::addAgent('CIntranetUtils::notifyMailDomain("nomailbox", ' . $service_id . ', ' . $user_id . ');', 'intranet', 'N', $timeout->getTimestamp() - intval($arAdmin['TIME_ZONE_OFFSET']) - time());
             }
             return '';
         } else {
             if ($cnt > 100) {
                 return '';
             }
             global $pPERIOD;
             $pPERIOD = $pPERIOD * $cnt;
             if ($pPERIOD > 3600 * 4) {
                 $pPERIOD = 3600 * 4;
             }
             return 'CIntranetUtils::checkMailDomain(' . $service_id . ', ' . $user_id . ', ' . ++$cnt . ');';
         }
     }
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:53,代码来源:utils.php

示例2: sendNotify

 /**
  * Send notify by module "IM".
  *
  * @param int $toUserId Target user id.
  * @param array $dataNotify Specific data.
  * @return bool
  * @throws \Bitrix\Main\LoaderException
  */
 public function sendNotify($toUserId, array $dataNotify)
 {
     if (!(ModuleManager::isModuleInstalled('im') && Loader::includeModule('im'))) {
         return false;
     }
     $dataNotify['NOTIFY_MODULE'] = self::INTERNAL_MODULE_ID;
     $dataNotify['TO_USER_ID'] = $toUserId;
     switch ($dataNotify['NOTIFY_TYPE']) {
         case 'IM_NOTIFY_FROM':
             $dataNotify['NOTIFY_TYPE'] = IM_NOTIFY_FROM;
             break;
         case 'IM_NOTIFY_CONFIRM':
             $dataNotify['NOTIFY_TYPE'] = IM_NOTIFY_CONFIRM;
             break;
         default:
             $dataNotify['NOTIFY_TYPE'] = IM_NOTIFY_FROM;
     }
     return (bool) \CIMNotify::add($dataNotify);
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:27,代码来源:driver.php


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