• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP CIMNotify类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: notify

 public static function notify($arParams)
 {
     global $USER;
     $arParams = array_change_key_case($arParams, CASE_UPPER);
     $arMessageFields = array("TO_USER_ID" => $arParams['TO'], "FROM_USER_ID" => $USER->GetID(), "NOTIFY_TYPE" => IM_NOTIFY_FROM, "NOTIFY_MODULE" => "rest", "NOTIFY_EVENT" => "rest_notify", "NOTIFY_MESSAGE" => $arParams['MESSAGE']);
     return CIMNotify::Add($arMessageFields);
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:7,代码来源:im_rest.php


示例2: notify

 public static function notify($arParams, $n, $server)
 {
     global $USER;
     $arParams = array_change_key_case($arParams, CASE_UPPER);
     if (!isset($arParams['TYPE']) || !in_array($arParams['TYPE'], array('USER', 'SYSTEM'))) {
         $arParams['TYPE'] = 'USER';
     }
     if ($arParams['TYPE'] == 'SYSTEM') {
         $result = \CBitrix24App::getList(array(), array('APP_ID' => $server->getAppId()));
         $result = $result->fetch();
         $moduleName = isset($result['APP_NAME']) ? $result['APP_NAME'] : $result['CODE'];
         $fromUserId = 0;
         $notifyType = IM_NOTIFY_SYSTEM;
         $message = $moduleName . "#BR#" . $arParams['MESSAGE'];
     } else {
         $fromUserId = $USER->GetID();
         $notifyType = IM_NOTIFY_FROM;
         $message = $arParams['MESSAGE'];
     }
     $message = trim($message);
     if (strlen($message) <= 0) {
         return false;
     }
     $arMessageFields = array("TO_USER_ID" => $arParams['TO'], "FROM_USER_ID" => $fromUserId, "NOTIFY_TYPE" => $notifyType, "NOTIFY_MODULE" => "rest", "NOTIFY_EVENT" => "rest_notify", "NOTIFY_MESSAGE" => $message);
     return CIMNotify::Add($arMessageFields);
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:26,代码来源:im_rest.php


示例3: Notify

 public static function Notify($addresseeID, $internalMessage, $externalMessage, $schemeTypeID, $tag = '')
 {
     self::ClearErrors();
     if (!(IsModuleInstalled('im') && CModule::IncludeModule('im'))) {
         self::RegisterError('IM module is not installed.');
         return false;
     }
     if ($addresseeID <= 0) {
         self::RegisterError('Addressee is not assigned.');
         return false;
     }
     $arMessage = array('TO_USER_ID' => $addresseeID, 'FROM_USER_ID' => 0, 'NOTIFY_TYPE' => IM_NOTIFY_SYSTEM, 'NOTIFY_MODULE' => 'crm', 'NOTIFY_MESSAGE' => strval($internalMessage), 'NOTIFY_MESSAGE_OUT' => strval($externalMessage));
     $schemeTypeName = CCrmNotifierSchemeType::ResolveName($schemeTypeID);
     if ($schemeTypeName !== '') {
         $arMessage['NOTIFY_EVENT'] = $schemeTypeName;
     }
     $tag = strval($tag);
     if ($tag !== '') {
         $arMessage['NOTIFY_TAG'] = $tag;
     }
     $msgID = CIMNotify::Add($arMessage);
     if (!$msgID) {
         $e = $GLOBALS['APPLICATION']->GetException();
         $errorMessage = $e ? $e->GetString() : 'Unknown sending error. message not send.';
         self::RegisterError($errorMessage);
         return false;
     }
     return true;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:29,代码来源:crm_notifier.php


示例4: Add

 function Add($arFields)
 {
     global $DB;
     if (IsModuleInstalled("im") && CModule::IncludeModule("im")) {
         if ($arFields["MESSAGE_TYPE"] == SONET_MESSAGE_SYSTEM) {
             if (!(isset($arFields["EMAIL_TEMPLATE"]) && strlen($arFields["EMAIL_TEMPLATE"]) > 0)) {
                 $arFields["EMAIL_TEMPLATE"] = "SONET_NEW_MESSAGE";
             }
             $ID = CIMNotify::Add($arFields);
             return $ID;
         } else {
             CIMMessenger::SpeedFileDelete($arFields['TO_USER_ID'], IM_SPEED_MESSAGE);
         }
     }
     if (defined("INTASK_SKIP_SOCNET_MESSAGES1") && INTASK_SKIP_SOCNET_MESSAGES1) {
         $arFields["=DATE_VIEW"] = $DB->CurrentTimeFunction();
     }
     $arFields1 = array();
     foreach ($arFields as $key => $value) {
         if (substr($key, 0, 1) == "=") {
             $arFields1[substr($key, 1)] = $value;
             unset($arFields[$key]);
         }
     }
     if (!CSocNetMessages::CheckFields("ADD", $arFields)) {
         return false;
     }
     $db_events = GetModuleEvents("socialnetwork", "OnBeforeSocNetMessagesAdd");
     while ($arEvent = $db_events->Fetch()) {
         if (ExecuteModuleEventEx($arEvent, array(&$arFields)) === false) {
             return false;
         }
     }
     $arInsert = $DB->PrepareInsert("b_sonet_messages", $arFields);
     foreach ($arFields1 as $key => $value) {
         if (strlen($arInsert[0]) > 0) {
             $arInsert[0] .= ", ";
         }
         $arInsert[0] .= $key;
         if (strlen($arInsert[1]) > 0) {
             $arInsert[1] .= ", ";
         }
         $arInsert[1] .= $value;
     }
     $ID = false;
     if (strlen($arInsert[0]) > 0) {
         $strSql = "INSERT INTO b_sonet_messages(" . $arInsert[0] . ") " . "VALUES(" . $arInsert[1] . ")";
         $DB->Query($strSql, False, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         $ID = IntVal($DB->LastID());
         $events = GetModuleEvents("socialnetwork", "OnSocNetMessagesAdd");
         while ($arEvent = $events->Fetch()) {
             ExecuteModuleEventEx($arEvent, array($ID, $arFields));
         }
         //CSocNetMessages::SendEvent($ID, "SONET_NEW_MESSAGE");
         CSocNetMessages::__SpeedFileCreate($arFields["TO_USER_ID"]);
     }
     return $ID;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:58,代码来源:messages.php


示例5: afterInsertTrigger

 /**
  * Method will be invoked after new database record inserted.
  *
  * @param array $newRecord All fields of inserted record.
  *
  * @return void
  */
 public function afterInsertTrigger(array $newRecord)
 {
     $id = intval($newRecord['MESSAGE_ID']);
     if (!\Bitrix\Main\Loader::includeModule('pull')) {
         return;
     }
     $message = \CIMMessenger::GetById($id, array('WITH_FILES' => 'Y'));
     if (!$message) {
         return;
     }
     if ($newRecord['PARAM_NAME'] === 'LIKE' && $newRecord["PARAM_VALUE"]) {
         $like = $message['PARAMS']['LIKE'];
         $result = \Bitrix\IM\ChatTable::getList(array('filter' => array('=ID' => $message['CHAT_ID'])));
         $chat = $result->fetch();
         $relations = \CIMMessenger::GetRelationById($id);
         if (!isset($relations[$newRecord["PARAM_VALUE"]])) {
             return;
         }
         if ($message['AUTHOR_ID'] > 0 && $message['AUTHOR_ID'] != $newRecord["PARAM_VALUE"]) {
             $CCTP = new \CTextParser();
             $CCTP->MaxStringLen = 200;
             $CCTP->allow = array("HTML" => "N", "ANCHOR" => "N", "BIU" => "N", "IMG" => "N", "QUOTE" => "N", "CODE" => "N", "FONT" => "N", "LIST" => "N", "SMILES" => "N", "NL2BR" => "Y", "VIDEO" => "N", "TABLE" => "N", "CUT_ANCHOR" => "N", "ALIGN" => "N");
             $message['MESSAGE'] = str_replace('<br />', ' ', $CCTP->convertText($message['MESSAGE']));
             $message['MESSAGE'] = preg_replace("/\\[s\\].*?\\[\\/s\\]/i", "", $message['MESSAGE']);
             $message['MESSAGE'] = preg_replace("/\\[[bui]\\](.*?)\\[\\/[bui]\\]/i", "\$1", $message['MESSAGE']);
             $message['MESSAGE'] = preg_replace("/\\[USER=([0-9]{1,})\\](.*?)\\[\\/USER\\]/i", "\$2", $message['MESSAGE']);
             $message['MESSAGE'] = preg_replace("/------------------------------------------------------(.*)------------------------------------------------------/mi", " [" . GetMessage('IM_QUOTE') . "] ", str_replace(array("#BR#"), array(" "), $message['MESSAGE']));
             if (count($message['FILES']) > 0 && strlen($message['MESSAGE']) < 200) {
                 foreach ($message['FILES'] as $file) {
                     $file = " [" . GetMessage('IM_MESSAGE_FILE') . ": " . $file['name'] . "]";
                     if (strlen($message['MESSAGE'] . $file) > 200) {
                         break;
                     }
                     $message['MESSAGE'] .= $file;
                 }
                 $message['MESSAGE'] = trim($message['MESSAGE']);
             }
             $isChat = $chat && strlen($chat['TITLE']) > 0;
             $dot = strlen($message['MESSAGE']) >= 200 ? '...' : '';
             $message['MESSAGE'] = substr($message['MESSAGE'], 0, 199) . $dot;
             $message['MESSAGE'] = strlen($message['MESSAGE']) > 0 ? $message['MESSAGE'] : '-';
             $arMessageFields = array("MESSAGE_TYPE" => IM_MESSAGE_SYSTEM, "TO_USER_ID" => $message['AUTHOR_ID'], "FROM_USER_ID" => $newRecord["PARAM_VALUE"], "NOTIFY_TYPE" => IM_NOTIFY_FROM, "NOTIFY_MODULE" => "main", "NOTIFY_EVENT" => "rating_vote", "NOTIFY_TAG" => "RATING|IM|" . ($isChat ? 'G' : 'P') . "|" . ($isChat ? $chat['ID'] : $newRecord["PARAM_VALUE"]) . "|" . $id, "NOTIFY_MESSAGE" => GetMessage($isChat ? 'IM_MESSAGE_LIKE' : 'IM_MESSAGE_LIKE_PRIVATE', array('#MESSAGE#' => $message['MESSAGE'], '#TITLE#' => $chat['TITLE'])));
             \CIMNotify::Add($arMessageFields);
         }
         $arPullMessage = array('id' => $id, 'chatId' => $relations[$newRecord["PARAM_VALUE"]]['CHAT_ID'], 'senderId' => $newRecord["PARAM_VALUE"], 'users' => $like);
         foreach ($relations as $rel) {
             \CPullStack::AddByUser($rel['USER_ID'], array('module_id' => 'im', 'command' => 'messageLike', 'params' => $arPullMessage));
         }
     }
 }
开发者ID:Satariall,项目名称:izurit,代码行数:57,代码来源:messageparamhandler.php


示例6: notify

	public static function notify($arParams)
	{
		global $USER;

		$arMessageFields = array(
			"TO_USER_ID" => $arParams['to'],
			"FROM_USER_ID" => $USER->GetID(),
			"NOTIFY_TYPE" => IM_NOTIFY_FROM,
			"NOTIFY_MODULE" => "rest",
			"NOTIFY_EVENT" => "rest_notify",// - get it from the oauth module
			"NOTIFY_MESSAGE" => $arParams['message'],
		);

		return CIMNotify::Add($arMessageFields);
	}
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:15,代码来源:im_rest.php


示例7: SendMessage

 /**
  * Sends notifications to IM.
  *
  * @param $fromUserID
  * @param $arRecipientsIDs
  * @param $message
  * @param int $taskID
  * @param null $message_email
  * @param array $arEventData
  * @return bool|null
  */
 public static function SendMessage($fromUserID, $arRecipientsIDs, $message, $taskID = 0, $message_email = null, $arEventData = array(), $taskAssignedTo = null)
 {
     if (!(IsModuleInstalled("im") && CModule::IncludeModule("im"))) {
         return false;
     }
     $message_email = is_null($message_email) ? $message : $message_email;
     if (!($fromUserID && $arRecipientsIDs && $message)) {
         return false;
     }
     CTaskAssert::assert(is_array($arEventData));
     $arEventData['fromUserID'] =& $fromUserID;
     $arEventData['arRecipientsIDs'] =& $arRecipientsIDs;
     $arEventData['message'] =& $message;
     $arEventData['message_email'] =& $message_email;
     foreach (GetModuleEvents('tasks', 'OnBeforeTaskNotificationSend', true) as $arEvent) {
         if (ExecuteModuleEventEx($arEvent, array($arEventData)) === false) {
             return false;
         }
     }
     $arSites = array();
     if (CModule::IncludeModule("extranet")) {
         $dbSite = CSite::GetList($by = "sort", $order = "desc", array("ACTIVE" => "Y"));
         while ($arSite = $dbSite->Fetch()) {
             $type = $arSite["ID"] == CExtranet::GetExtranetSiteID() ? "EXTRANET" : "INTRANET";
             if ($type === 'INTRANET' && isset($arSites['INTRANET']) && $arSite['DEF'] !== 'Y') {
                 // Don't overwrite INTRANET site data by not default site
                 continue;
             }
             $arSites[$type] = array('SITE_ID' => $arSite['ID'], "DIR" => strlen(trim($arSite["DIR"])) > 0 ? $arSite["DIR"] : "/", "SERVER_NAME" => strlen(trim($arSite["SERVER_NAME"])) > 0 ? $arSite["SERVER_NAME"] : COption::GetOptionString("main", "server_name", $_SERVER["HTTP_HOST"]));
         }
     }
     if (is_array($arRecipientsIDs) && count($arRecipientsIDs)) {
         $arRecipientsIDs = array_unique($arRecipientsIDs);
         $rsUser = CUser::GetList($by = 'ID', $order = 'ASC', array('ID' => implode('|', $arRecipientsIDs)), array('FIELDS' => array('ID')));
         while ($arUser = $rsUser->Fetch()) {
             $notifyEvent = 'manage';
             if ($taskAssignedTo !== null) {
                 if ($arUser['ID'] == $taskAssignedTo) {
                     $notifyEvent = 'task_assigned';
                 }
             }
             $pathToTask = CTaskNotifications::GetNotificationPath($arUser, $taskID, true, $arSites);
             $arMessageFields = array("TO_USER_ID" => $arUser['ID'], "FROM_USER_ID" => $fromUserID, "NOTIFY_TYPE" => IM_NOTIFY_FROM, "NOTIFY_MODULE" => "tasks", "NOTIFY_EVENT" => $notifyEvent, "NOTIFY_MESSAGE" => str_replace("#PATH_TO_TASK#", $pathToTask, $message), "NOTIFY_MESSAGE_OUT" => strip_tags(str_replace("#PATH_TO_TASK#", $pathToTask, $message_email)));
             CIMNotify::Add($arMessageFields);
         }
     }
     return null;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:59,代码来源:tasknotifications.php


示例8: onAfterTimeManagerDayStart

 public static function onAfterTimeManagerDayStart($arData)
 {
     if (!(isset($arData['USER_ID'], $arData['MODIFIED_BY']) && $arData['USER_ID'] > 0 && $arData['MODIFIED_BY'] > 0 && $arData['MODIFIED_BY'] == $arData['USER_ID'] && IsModuleInstalled("im") && CModule::IncludeModule("im"))) {
         return;
     }
     $recipientId = (int) $arData['USER_ID'];
     try {
         $tasksCounter = CTaskListCtrl::getMainCounterForUser($recipientId);
         if ($tasksCounter <= 0) {
             return;
         }
         /** @noinspection PhpDeprecationInspection */
         CIMNotify::Add(array('FROM_USER_ID' => 0, 'TO_USER_ID' => $recipientId, 'NOTIFY_MODULE' => 'tasks', 'NOTIFY_EVENT' => 'notice', 'NOTIFY_TYPE' => IM_NOTIFY_SYSTEM, 'NOTIFY_TAG' => 'TASKS|COUNTERS_NOTICE|' . $recipientId, 'MESSAGE' => CTasksTools::getMessagePlural($tasksCounter, 'TASKS_COUNTERS_NOTICE_CONTENT_V2', array('#TASKS_COUNT#' => $tasksCounter, '#HREF#' => self::getTasksListLink($recipientId))), 'TITLE' => GetMessage('TASKS_COUNTERS_NOTICE_TITLE')));
     } catch (Exception $e) {
         CTaskAssert::logWarning('[0xb83d6845] unexpected exception in CTaskCountersNotifier::onAfterTimeManagerDayStart()' . ', file: ' . $e->getFile() . ', line: ' . $e->getLine() . ', code: ' . $e->getCode() . ', message: ' . $e->getMessage());
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:17,代码来源:countersnotifier.php


示例9: OnUserInitialize

 function OnUserInitialize($user_id, $arFields = array())
 {
     if (intval($user_id) <= 0) {
         return false;
     }
     if (CModule::IncludeModule("im")) {
         $bIM = true;
     }
     $dbRelation = CSocNetUserToGroup::GetList(array(), array("USER_ID" => $user_id, "ROLE" => SONET_ROLES_REQUEST, "INITIATED_BY_TYPE" => SONET_INITIATED_BY_GROUP), false, false, array("ID", "GROUP_ID"));
     while ($arRelation = $dbRelation->Fetch()) {
         if (CSocNetUserToGroup::UserConfirmRequestToBeMember($user_id, $arRelation["ID"], false) && defined("BX_COMP_MANAGED_CACHE")) {
             $GLOBALS["CACHE_MANAGER"]->ClearByTag("sonet_user2group_G" . $arRelation["GROUP_ID"]);
             $GLOBALS["CACHE_MANAGER"]->ClearByTag("sonet_user2group_U" . $user_id);
             if ($bIM) {
                 CIMNotify::DeleteByTag("SOCNET|INVITE_GROUP|" . $user_id . "|" . intval($arRelation["ID"]));
             }
         }
     }
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:19,代码来源:user.php


示例10: Execute

 public function Execute()
 {
     if (!CModule::IncludeModule("im")) {
         return CBPActivityExecutionStatus::Closed;
     }
     $rootActivity = $this->GetRootActivity();
     $documentId = $rootActivity->GetDocumentId();
     $arMessageUserFrom = CBPHelper::ExtractUsers($this->MessageUserFrom, $documentId, true);
     $arMessageUserTo = CBPHelper::ExtractUsers($this->MessageUserTo, $documentId, false);
     $arMessageFields = array("FROM_USER_ID" => $arMessageUserFrom, "NOTIFY_TYPE" => intval($this->MessageType), "NOTIFY_MESSAGE" => $this->MessageSite, "NOTIFY_MESSAGE_OUT" => $this->MessageOut, "NOTIFY_MODULE" => "bizproc", "NOTIFY_EVENT" => "activity");
     $ar = array();
     foreach ($arMessageUserTo as $userTo) {
         if (in_array($userTo, $ar)) {
             continue;
         }
         $ar[] = $userTo;
         $arMessageFields["TO_USER_ID"] = $userTo;
         CIMNotify::Add($arMessageFields);
     }
     return CBPActivityExecutionStatus::Closed;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:21,代码来源:imnotifyactivity.php


示例11: AddCommentToIM

 public static function AddCommentToIM($arFields)
 {
     if (CModule::IncludeModule("im") && intval($arFields["USER_ID"]) > 0) {
         $date_text = "";
         $dbReport = CTimeManReportFull::GetByID($arFields["REPORT_ID"]);
         if ($arReport = $dbReport->Fetch()) {
             $date_from = FormatDate("j F", MakeTimeStamp($arReport["DATE_FROM"], CSite::GetDateFormat("FULL", SITE_ID)));
             $date_to = FormatDate("j F", MakeTimeStamp($arReport["DATE_TO"], CSite::GetDateFormat("FULL", SITE_ID)));
             if ($date_from == $date_to) {
                 $date_text = $date_to;
             } else {
                 $date_text = $date_from . " - " . $date_to;
             }
             $arMessageFields = array("MESSAGE_TYPE" => IM_MESSAGE_SYSTEM, "FROM_USER_ID" => $arFields["USER_ID"], "NOTIFY_TYPE" => IM_NOTIFY_FROM, "NOTIFY_MODULE" => "timeman", "NOTIFY_EVENT" => "report_comment", "NOTIFY_TAG" => "TIMEMAN|REPORT|" . $arFields["REPORT_ID"]);
             $arUserIDToSend = array($arReport["USER_ID"]);
             $gender_suffix = "";
             $dbUser = CUser::GetByID($arFields["USER_ID"]);
             if ($arUser = $dbUser->Fetch()) {
                 switch ($arUser["PERSONAL_GENDER"]) {
                     case "M":
                         $gender_suffix = "_M";
                         break;
                     case "F":
                         $gender_suffix = "_F";
                         break;
                     default:
                         $gender_suffix = "";
                 }
             }
             $arManagers = CTimeMan::GetUserManagers($arReport["USER_ID"]);
             if (is_array($arManagers)) {
                 $arUserIDToSend = array_merge($arUserIDToSend, $arManagers);
             }
             $reports_page = COption::GetOptionString("timeman", "WORK_REPORT_PATH", "/company/work_report.php");
             $arUnFollowers = array();
             $rsUnFollower = CSocNetLogFollow::GetList(array("USER_ID" => $arUserIDToSend, "CODE" => "L" . $arFields["LOG_ID"], "TYPE" => "N"), array("USER_ID"));
             while ($arUnFollower = $rsUnFollower->Fetch()) {
                 $arUnFollowers[] = $arUnFollower["USER_ID"];
             }
             $arUserIDToSend = array_diff($arUserIDToSend, $arUnFollowers);
             foreach ($arUserIDToSend as $user_id) {
                 if ($arFields["USER_ID"] == $user_id) {
                     continue;
                 }
                 $arMessageFields["TO_USER_ID"] = $user_id;
                 $arTmp = CSocNetLogTools::ProcessPath(array("REPORTS_PAGE" => $reports_page), $user_id);
                 $sender_type = $arReport["USER_ID"] == $user_id ? "1" : ($arReport["USER_ID"] == $arFields["USER_ID"] ? "2" : "3");
                 $arMessageFields["NOTIFY_MESSAGE"] = GetMessage("REPORT_FULL_IM_COMMENT_" . $sender_type . $gender_suffix, array("#period#" => "<a href=\"" . $arTmp["URLS"]["REPORTS_PAGE"] . "#user_id=" . $arReport["USER_ID"] . "&report=" . $arReport["ID"] . "\" class=\"bx-notifier-item-action\">" . htmlspecialcharsbx($date_text) . "</a>"));
                 $arMessageFields["NOTIFY_MESSAGE_OUT"] = GetMessage("REPORT_FULL_IM_COMMENT_" . $sender_type . $gender_suffix, array("#period#" => htmlspecialcharsbx($date_text))) . " ( " . $arTmp["SERVER_NAME"] . $arTmp["URLS"]["REPORTS_PAGE"] . "#user_id=" . $arReport["USER_ID"] . "&report=" . $arReport["ID"] . " )#BR##BR#" . $arFields["MESSAGE"];
                 CIMNotify::Add($arMessageFields);
             }
         }
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:54,代码来源:timeman_report_full.php


示例12: GetUnreadNotify

	public function GetUnreadNotify($arParams = Array())
	{
		global $DB;

		$order = isset($arParams['ORDER']) && $arParams['ORDER'] == 'ASC'? 'ASC': 'DESC';
		$bSpeedCheck = isset($arParams['SPEED_CHECK']) && $arParams['SPEED_CHECK'] == 'N'? false: true;
		$bTimeZone = isset($arParams['USE_TIME_ZONE']) && $arParams['USE_TIME_ZONE'] == 'N'? false: true;
		$bGetOnlyFlash = isset($arParams['GET_ONLY_FLASH']) && $arParams['GET_ONLY_FLASH'] == 'Y'? true: false;

		$arNotify['result'] = false;
		$arNotify['notify'] = Array();
		$arNotify['unreadNotify'] = Array();
		$arNotify['loadNotify'] = false;
		$arNotify['countNotify'] = 0;
		$arNotify['maxNotify'] = 0;

		$bLoadNotify = $bSpeedCheck? !CIMMessenger::SpeedFileExists($this->user_id, IM_SPEED_NOTIFY): true;
		if ($bLoadNotify)
		{
			$strSql = "SELECT CHAT_ID, STATUS FROM b_im_relation WHERE USER_ID = ".$this->user_id." AND MESSAGE_TYPE = '".IM_MESSAGE_SYSTEM."'";
			$dbRes = $DB->Query($strSql, false, "File: ".__FILE__."<br>Line: ".__LINE__);
			if ($arRes = $dbRes->Fetch())
			{
				$chatId = intval($arRes['CHAT_ID']);
				$chatStatus = $arRes['STATUS'];
			}
			else
				return $arNotify;

			if (!$bTimeZone)
				CTimeZone::Disable();
			$strSql ="
				SELECT
					M.ID,
					M.CHAT_ID,
					M.MESSAGE,
					M.MESSAGE_OUT,
					".$DB->DatetimeToTimestampFunction('M.DATE_CREATE')." DATE_CREATE,
					M.NOTIFY_TYPE,
					M.NOTIFY_MODULE,
					M.NOTIFY_EVENT,
					M.NOTIFY_TITLE,
					M.NOTIFY_BUTTONS,
					M.NOTIFY_TAG,
					M.NOTIFY_SUB_TAG,
					$this->user_id TO_USER_ID,
					M.AUTHOR_ID FROM_USER_ID
				FROM b_im_message M
				WHERE M.CHAT_ID = ".$chatId." AND M.NOTIFY_READ = 'N'
			";
			if (!$bTimeZone)
				CTimeZone::Enable();
			$strSql = $DB->TopSql($strSql, 500);
			$dbRes = $DB->Query($strSql, false, "File: ".__FILE__."<br>Line: ".__LINE__);

			$arMark = Array();
			$arGetUsers = Array();
			while ($arRes = $dbRes->Fetch())
			{
				if ($this->bHideLink)
					$arRes['HIDE_LINK'] = 'Y';

				$arNotify['original_notify'][$arRes['ID']] = $arRes;
				$arNotify['notify'][$arRes['ID']] = $arRes;
				$arNotify['unreadNotify'][$arRes['ID']] = $arRes['ID'];

				if ($chatStatus == IM_STATUS_UNREAD && (!isset($arMark[$arRes["CHAT_ID"]]) || $arMark[$arRes["CHAT_ID"]] < $arRes["ID"]))
					$arMark[$arRes["CHAT_ID"]] = $arRes["ID"];

				if ($arNotify['maxNotify'] < $arRes['ID'])
					$arNotify['maxNotify'] = $arRes['ID'];

				$arGetUsers[] = $arRes['FROM_USER_ID'];
			}
			foreach ($arMark as $chatId => $lastSendId)
				CIMNotify::SetLastSendId($chatId, $lastSendId);

			$arNotify['countNotify'] = $this->GetNotifyCounter($arNotify);
			CIMMessenger::SpeedFileCreate($this->user_id, $arNotify['countNotify'], IM_SPEED_NOTIFY);

			$arUsers = CIMContactList::GetUserData(Array('ID' => $arGetUsers, 'DEPARTMENT' => 'N', 'USE_CACHE' => 'Y', 'CACHE_TTL' => 86400));
			$arGetUsers = $arUsers['users'];

			if ($bGetOnlyFlash)
			{
				foreach ($arNotify['notify'] as $key => $value)
				{
					if (isset($_SESSION['IM_FLASHED_NOTIFY'][$key]))
					{
						unset($arNotify['notify'][$key]);
						unset($arNotify['original_notify'][$key]);
						$arNotify['loadNotify'] = true;
					}
					else
					{
						$value['FROM_USER_DATA'] = $arGetUsers;
						$arNotify['notify'][$key] = self::GetFormatNotify($value);
					}
				}
			}
//.........这里部分代码省略.........
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:101,代码来源:im_notify.php


示例13: SetMeetingStatus

 public static function SetMeetingStatus($userId, $eventId, $status = 'Q', $comment = '')
 {
     global $DB;
     $eventId = intVal($eventId);
     $userId = intVal($userId);
     if (!in_array($status, array("Q", "Y", "N"))) {
         $status = "Q";
     }
     // Select meeting info about event
     CTimeZone::Disable();
     $res = CCalendarEvent::GetList(array('arFilter' => array("ID" => $eventId, "DELETED" => "N"), 'fetchMeetings' => true, 'parseRecursion' => false, 'setDefaultLimit' => false));
     $Event = $res[0];
     if ($Event && $Event['IS_MEETING']) {
         if ($Event['IS_MEETING']) {
             $arAffectedSections = array($Event['SECT_ID']);
             // Try to find this user into attendees for this event
             $strSql = "SELECT * FROM b_calendar_attendees WHERE USER_KEY={$userId} AND EVENT_ID={$eventId}";
             $dbAtt = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
             $curStatus = "Q";
             if ($att = $dbAtt->Fetch()) {
                 $curStatus = $att["STATUS"];
                 //Set status
                 if ($att["STATUS"] != $status) {
                     $strSql = "UPDATE b_calendar_attendees SET " . $DB->PrepareUpdate("b_calendar_attendees", array("STATUS" => $status, "DESCRIPTION" => $comment)) . " WHERE EVENT_ID=" . $eventId . " AND USER_KEY=" . $userId;
                     $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
                 }
             } else {
                 if ($Event['MEETING'] && $Event['MEETING']['OPEN'] && $status == "Y") {
                     //Set status
                     $strSql = "INSERT INTO b_calendar_attendees(EVENT_ID, USER_KEY, USER_ID, STATUS, DESCRIPTION, ACCESSIBILITY) " . "VALUES (" . $eventId . ", '" . $userId . "', " . $userId . ", '" . $status . "', '" . $DB->ForSql($comment) . "','')";
                     $res = $DB->Query($strSql, false, "FILE: " . __FILE__ . "<br> LINE: " . __LINE__);
                 }
             }
             if (($status == 'Y' || ($status = 'N')) && CModule::IncludeModule("im")) {
                 CIMNotify::DeleteByTag("CALENDAR|INVITE|" . $eventId . "|" . $userId);
             }
             if ($Event['MEETING']['NOTIFY'] && $status != 'Q' && $userId != $Event['CREATED_BY'] && $curStatus != $status) {
                 // Send message to the author
                 CCalendar::SendMessage(array('mode' => $status == "Y" ? 'accept' : 'decline', 'name' => $Event['NAME'], "from" => $Event["DT_FROM"], "to" => $Event["DT_TO"], "location" => CCalendar::GetTextLocation($Event["LOCATION"]), "comment" => $comment, "guestId" => $userId, "eventId" => $eventId, "userId" => $Event['CREATED_BY']));
             }
             $arAffectedSections[] = CCalendar::GetMeetingSection($userId);
             if (count($arAffectedSections) > 0) {
                 CCalendarSect::UpdateModificationLabel($arAffectedSections);
             }
         }
     }
     CTimeZone::Enable();
     CCalendar::ClearCache(array('attendees_list', 'event_list'));
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:49,代码来源:calendar_event.php


示例14: SendUnreadMessages

 public function SendUnreadMessages($receiverJId, $domain = "")
 {
     $receiverJId = trim($receiverJId);
     if (strlen($receiverJId) <= 0) {
         return false;
     }
     $receiver = CXMPPUtility::GetUserByJId($receiverJId, $domain);
     if (!$receiver) {
         return false;
     }
     $factory = CXMPPFactory::GetFactory();
     if (IsModuleInstalled("im") && CModule::IncludeModule("im")) {
         $CIMMessage = new CIMMessage($receiverJId, array('hide_link' => true));
         $arMessage = $CIMMessage->GetUnreadMessage(array('SPEED_CHECK' => 'N', 'ORDER' => 'ASC', 'USE_SMILES' => 'N', 'USER_LOAD' => 'N', 'LOAD_DEPARTMENT' => 'N'));
         if ($arMessage['result']) {
             foreach ($arMessage['message'] as $id => $arMessage) {
                 $factory->__SendMessage($arMessage["senderId"], $arMessage["recipientId"], $arMessage["id"], IM_MESSAGE_PRIVATE, htmlspecialcharsbx(CTextParser::convert4mail(str_replace(array("#BR#", "<br />", "<br>", "<br/>"), "\n", $arMessage["text"]))), $domain);
             }
         }
         // Notify
         $CIMNotify = new CIMNotify($receiverJId);
         $arNotify = $CIMNotify->GetUnreadNotify(array('SPEED_CHECK' => 'N', 'ORDER' => 'ASC'));
         if ($arNotify['result']) {
             foreach ($arNotify['original_notify'] as $id => $arNotify) {
                 if (isset($arNotify["NOTIFY_MODULE"]) && isset($arNotify["NOTIFY_EVENT"]) && !CIMSettings::GetNotifyAccess($arNotify["TO_USER_ID"], $arNotify["NOTIFY_MODULE"], $arNotify["NOTIFY_EVENT"], CIMSettings::CLIENT_XMPP)) {
                     continue;
                 }
                 if ($arNotify["MESSAGE_OUT"] == IM_MAIL_SKIP) {
                     $arNotify["MESSAGE_OUT"] = '';
                 }
                 $factory->__SendMessage($arNotify["FROM_USER_ID"], $arNotify["TO_USER_ID"], $arNotify["ID"], IM_MESSAGE_SYSTEM, htmlspecialcharsbx(CTextParser::convert4mail(str_replace(array("#BR#", "<br />", "<br>", "<br/>"), "\n", strlen($arNotify["MESSAGE_OUT"]) > 0 ? $arNotify["MESSAGE_OUT"] : $arNotify["MESSAGE"]))), $domain);
             }
         }
     } else {
         $parser = new CSocNetTextParser();
         $dbMessages = CSocNetMessages::GetList(array("DATE_CREATE" => "ASC"), array("TO_USER_ID" => $receiver["ID"], "DATE_VIEW" => "", "TO_DELETED" => "N", "IS_LOG_ALL" => "Y"), false, false, array("ID", "FROM_USER_ID", "TO_USER_ID", "MESSAGE", "DATE_VIEW", "MESSAGE_TYPE", "FROM_DELETED", "TO_DELETED", "IS_LOG"));
         while ($arMessage = $dbMessages->Fetch()) {
             $factory->__SendMessage($arMessage["IS_LOG"] == "Y" ? -5 : $arMessage["FROM_USER_ID"], $arMessage["TO_USER_ID"], $arMessage["ID"], $arMessage["MESSAGE_TYPE"], htmlspecialcharsbx($parser->convert4mail(str_replace(array("#BR#", "<br />", "<br>", "<br/>"), "\n", $arMessage["MESSAGE"]))), $domain);
         }
     }
     return true;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:42,代码来源:factory.php


示例15: 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


示例16: NotifyImToModerators

 function NotifyImToModerators($arNotifyParams)
 {
     if (!CModule::IncludeModule("im")) {
         return;
     }
     if (!is_array($arNotifyParams) || !array_key_exists("TYPE", $arNotifyParams) || !in_array($arNotifyParams["TYPE"], array("join", "unjoin", "exclude", "moderate", "unmoderate", "owner")) || !array_key_exists("USER_ID", $arNotifyParams) || intval($arNotifyParams["USER_ID"]) <= 0 || !array_key_exists("GROUP_ID", $arNotifyParams) || intval($arNotifyParams["GROUP_ID"]) <= 0 || !array_key_exists("RELATION_ID", $arNotifyParams) || intval($arNotifyParams["RELATION_ID"]) <= 0 || !array_key_exists("GROUP_NAME", $arNotifyParams) || strlen($arNotifyParams["GROUP_NAME"]) <= 0) {
         return;
     }
     switch ($arNotifyParams["TYPE"]) {
         case "join":
             $from_user_id = $arNotifyParams["USER_ID"];
             $message_code = "SONET_UG_IM_JOIN";
             $schema_code = "inout_group";
             $notify_tag = "INOUT_GROUP";
             break;
         case "unjoin":
             $from_user_id = $arNotifyParams["USER_ID"];
             $message_code = "SONET_UG_IM_UNJOIN";
             $schema_code = "inout_group";
             $notify_tag = "INOUT_GROUP";
             break;
         case "exclude":
             $from_user_id = $arNotifyParams["USER_ID"];
             $message_code = "SONET_UG_IM_EXCLUDE";
             $schema_code = "inout_group";
             $notify_tag = "INOUT_GROUP";
             break;
         case "moderate":
             $from_user_id = $arNotifyParams["USER_ID"];
             $message_code = "SONET_UG_IM_MODERATE";
             $schema_code = "moderators_group";
             $notify_tag = "MOD_GROUP";
             break;
         case "unmoderate":
             $from_user_id = $arNotifyParams["USER_ID"];
             $message_code = "SONET_UG_IM_UNMODERATE";
             $schema_code = "moderators_group";
             $notify_tag = "MOD_GROUP";
             break;
         case "owner":
             $from_user_id = $arNotifyParams["USER_ID"];
             $message_code = "SONET_UG_IM_OWNER";
             $schema_code = "owner_group";
             $notify_tag = "OWNER_GROUP";
             break;
         default:
     }
     $rsUser = CUser::GetByID($arNotifyParams["USER_ID"]);
     if ($arUser = $rsUser->Fetch()) {
         switch ($arUser["PERSONAL_GENDER"]) {
             case "M":
                 $gender_suffix = "_M";
                 break;
             case "F":
                 $gender_suffix = "_F";
                 break;
             default:
                 $gender_suffix = "";
         }
     }
     $arToUserID = array();
     $rsUserToGroup = CSocNetUserToGroup::GetList(array(), array("GROUP_ID" => $arNotifyParams["GROUP_ID"], "USER_ACTIVE" => "Y", "<=ROLE" => SONET_ROLES_MODERATOR), false, false, array("USER_ID"));
     while ($arUserToGroup = $rsUserToGroup->Fetch()) {
         $arToUserID[] = $arUserToGroup["USER_ID"];
     }
     $arMessageFields = array("MESSAGE_TYPE" => IM_MESSAGE_SYSTEM, "FROM_USER_ID" => $from_user_id, "NOTIFY_TYPE" => IM_NOTIFY_FROM, "NOTIFY_MODULE" => "socialnetwork", "NOTIFY_EVENT" => $schema_code, "LOG_ID" => $arEntry["LOG_ID"], "NOTIFY_TAG" => "SOCNET|" . $notify_tag . "|" . intval($arNotifyParams["USER_ID"]) . "|" . intval($arNotifyParams["GROUP_ID"]) . "|" . intval($arNotifyParams["RELATION_ID"]));
     $groups_path = COption::GetOptionString("socialnetwork", "workgroups_page", SITE_DIR . "workgroups/");
     $group_url_template = str_replace($groups_path, "#GROUPS_PATH#", COption::GetOptionString("socialnetwork", "group_path_template", SITE_DIR . "workgroups/group/#group_id#/"));
     $groupUrl = str_replace("#group_id#", $arNotifyParams["GROUP_ID"], $group_url_template);
     foreach ($arToUserID as $to_user_id) {
         if (is_array($arNotifyParams["EXCLUDE_USERS"]) && in_array($to_user_id, $arNotifyParams["EXCLUDE_USERS"]) || $to_user_id == $from_user_id) {
             continue;
         }
         $arMessageFields["TO_USER_ID"] = $to_user_id;
         $arTmp = CSocNetLogTools::ProcessPath(array("GROUP_PAGE" => $groupUrl), $to_user_id, SITE_ID);
         $arMessageFields["NOTIFY_MESSAGE"] = GetMessage($message_code . $gender_suffix, array("#group_name#" => "<a href=\"" . $arTmp["URLS"]["GROUP_PAGE"] . "\" class=\"bx-notifier-item-action\">" . $arNotifyParams["GROUP_NAME"] . "</a>"));
         $arMessageFields["NOTIFY_MESSAGE_OUT"] = GetMessage($message_code . $gender_suffix, array("#group_name#" => $arNotifyParams["GROUP_NAME"])) . " (" . $arTmp["SERVER_NAME"] . $arTmp["URLS"]["GROUP_PAGE"] . ")";
         CIMNotify::Add($arMessageFields);
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP CI_Base类代码示例发布时间:2022-05-23
下一篇:
PHP CIBlockType类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap