本文整理汇总了PHP中CPullStack::AddByUser方法的典型用法代码示例。如果您正苦于以下问题:PHP CPullStack::AddByUser方法的具体用法?PHP CPullStack::AddByUser怎么用?PHP CPullStack::AddByUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPullStack
的用法示例。
在下文中一共展示了CPullStack::AddByUser方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
}
}
示例2: afterUpdateTrigger
/**
* Method will be invoked after an database record updated.
*
* @param array $oldRecord All fields before update.
* @param array $newRecord All fields after update.
*
* @return void
*/
public static function afterUpdateTrigger(array $oldRecord, array $newRecord)
{
if ($oldRecord['TITLE'] !== $newRecord['TITLE']) {
if (\CModule::IncludeModule("pull")) {
$ar = \CIMChat::GetRelationById($newRecord['CHAT_ID']);
foreach ($ar as $rel) {
\CIMContactList::CleanChatCache($rel['USER_ID']);
\CPullStack::AddByUser($rel['USER_ID'], array('module_id' => 'im', 'command' => 'chatRename', 'params' => array('chatId' => $newRecord['CHAT_ID'], 'chatTitle' => htmlspecialcharsbx($newRecord['TITLE']))));
}
}
}
if ($oldRecord['AVATAR'] !== $newRecord['AVATAR']) {
if (\CModule::IncludeModule('pull')) {
$avatarImage = \CIMChat::GetAvatarImage($newRecord['AVATAR']);
$ar = \CIMChat::GetRelationById($newRecord['CHAT_ID']);
foreach ($ar as $relation) {
\CIMContactList::CleanChatCache($relation['USER_ID']);
\CPullStack::AddByUser($relation['USER_ID'], array('module_id' => 'im', 'command' => 'chatAvatar', 'params' => array('chatId' => $newRecord['CHAT_ID'], 'chatAvatar' => $avatarImage)));
}
}
}
if ($oldRecord['COLOR'] !== $newRecord['COLOR']) {
if (\CModule::IncludeModule('pull')) {
$ar = \CIMChat::GetRelationById($newRecord['CHAT_ID']);
foreach ($ar as $relation) {
\CIMContactList::CleanChatCache($relation['USER_ID']);
\CPullStack::AddByUser($relation['USER_ID'], array('module_id' => 'im', 'command' => 'chatChangeColor', 'params' => array('chatId' => $newRecord['CHAT_ID'], 'chatColor' => \Bitrix\Im\Color::getColor($newRecord['COLOR']))));
}
}
}
}
示例3: 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));
}
}
}
示例4: afterUpdateTrigger
/**
* Method will be invoked after an database record updated.
*
* @param array $oldRecord All fields before update.
* @param array $newRecord All fields after update.
*
* @return void
*/
public function afterUpdateTrigger(array $oldRecord, array $newRecord)
{
if ($newRecord["MESSAGE_TYPE"] === "P" && intval($oldRecord["LAST_ID"]) < intval($newRecord["LAST_ID"])) {
$oldLastRead = $oldRecord["LAST_READ"] instanceof \Bitrix\Main\Type\DateTime ? $oldRecord["LAST_READ"]->getTimestamp() : 0;
$newLastRead = $newRecord["LAST_READ"] instanceof \Bitrix\Main\Type\DateTime ? $newRecord["LAST_READ"]->getTimestamp() : 0;
if ($oldLastRead < $newLastRead) {
if (\Bitrix\Main\Loader::includeModule('pull')) {
$relationList = \Bitrix\IM\RelationTable::getList(array("select" => array("ID", "USER_ID"), "filter" => array("=CHAT_ID" => $newRecord["CHAT_ID"], "!=USER_ID" => $newRecord["USER_ID"])));
if ($relation = $relationList->fetch()) {
\CPullStack::AddByUser($relation['USER_ID'], array('module_id' => 'im', 'command' => 'readMessageApponent', 'params' => array('chatId' => intval($newRecord['CHAT_ID']), 'userId' => intval($newRecord['USER_ID']), 'lastId' => $newRecord['LAST_ID'], 'date' => $newLastRead, 'count' => 1)));
}
}
}
}
}
示例5: SendPullEvent
public static function SendPullEvent($params)
{
// TODO check params
if (!CModule::IncludeModule('pull') || !CPullOptions::GetQueueServerStatus() || $params['USER_ID'] <= 0) {
return false;
}
$config = array();
if ($params['COMMAND'] == 'outgoing') {
$config = array("callId" => $params['CALL_ID'], "callIdTmp" => $params['CALL_ID_TMP'] ? $params['CALL_ID_TMP'] : '', "callDevice" => $params['CALL_DEVICE'] == 'PHONE' ? 'PHONE' : 'WEBRTC', "phoneNumber" => $params['PHONE_NUMBER'], "external" => $params['EXTERNAL'] ? true : false, "CRM" => $params['CRM'] ? $params['CRM'] : array());
} else {
if ($params['COMMAND'] == 'timeout') {
$config = array("callId" => $params['CALL_ID'], "failedCode" => intval($params['FAILED_CODE']));
}
}
CPullStack::AddByUser($params['USER_ID'], array('module_id' => 'voximplant', 'command' => $params['COMMAND'], 'params' => $config));
return true;
}
示例6: 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)));
}
}
}
}
示例7: SendPullEvent
public static function SendPullEvent($params)
{
if (!CModule::IncludeModule('pull') || !CPullOptions::GetQueueServerStatus() || $params['USER_ID'] <= 0) {
return false;
}
$config = array();
$push = array();
if ($params['COMMAND'] == 'start') {
$config = array("callId" => $params['CALL_ID'], "callDevice" => $params['CALL_DEVICE'] == 'PHONE' ? 'PHONE' : 'WEBRTC', "external" => $params['EXTERNAL'] ? true : false, "CRM" => $params['CRM'] ? $params['CRM'] : false);
} else {
if ($params['COMMAND'] == 'hold' || $params['COMMAND'] == 'unhold') {
$config = array("callId" => $params['CALL_ID']);
} else {
if ($params['COMMAND'] == 'timeout') {
$config = array("callId" => $params['CALL_ID']);
$push['send_immediately'] = 'Y';
$push['advanced_params'] = array("notificationsToCancel" => array('VI_CALL_' . $params['CALL_ID']));
}
}
}
if (isset($params['MARK'])) {
$config['mark'] = $params['MARK'];
}
CPullStack::AddByUser($params['USER_ID'], array('module_id' => 'voximplant', 'command' => $params['COMMAND'], 'params' => $config, 'push' => $push));
return true;
}
示例8: SendPullEvent
public static function SendPullEvent($params)
{
// TODO check $params
if (!CModule::IncludeModule('pull') || !CPullOptions::GetQueueServerStatus() || $params['USER_ID'] <= 0) {
return false;
}
$config = array();
$push = array();
if ($params['COMMAND'] == 'invite') {
$config = array("callId" => $params['CALL_ID'], "callerId" => $params['CALLER_ID'], "phoneNumber" => $params['PHONE_NAME'], "chatId" => 0, "chat" => array(), "typeConnect" => $params['TYPE_CONNECT'], "portalCall" => $params['PORTAL_CALL'] == 'Y' ? true : false, "portalCallUserId" => $params['PORTAL_CALL'] == 'Y' ? $params['PORTAL_CALL_USER_ID'] : 0, "portalCallData" => $params['PORTAL_CALL'] == 'Y' ? $params['PORTAL_CALL_DATA'] : array(), "config" => $params['CONFIG'] ? $params['CONFIG'] : array(), "CRM" => $params['CRM']);
$callName = $params['CALLER_ID'];
if (isset($params['CRM']['CONTACT']['NAME']) && strlen($params['CRM']['CONTACT']['NAME']) > 0) {
$callName = $params['CRM']['CONTACT']['NAME'];
}
if (isset($params['CRM']['COMPANY']) && strlen($params['CRM']['COMPANY']) > 0) {
$callName .= ' (' . $params['CRM']['COMPANY'] . ')';
} else {
if (isset($params['CRM']['CONTACT']['POST']) && strlen($params['CRM']['CONTACT']['POST']) > 0) {
$callName .= ' (' . $params['CRM']['CONTACT']['POST'] . ')';
}
}
$push['sub_tag'] = 'VI_CALL_' . $params['CALL_ID'];
$push['send_immediately'] = 'Y';
$push['sound'] = 'call.aif';
$push['advanced_params'] = array("notificationsToCancel" => array('VI_CALL_' . $params['CALL_ID']), "androidHighPriority" => true);
if ($params['PORTAL_CALL'] == 'Y') {
$push['message'] = GetMessage('INCOMING_CALL', array('#NAME#' => $params['PORTAL_CALL_DATA']['users'][$params['PORTAL_CALL_USER_ID']]['name']));
} else {
$push['message'] = GetMessage('INCOMING_CALL', array('#NAME#' => $callName));
$push['message'] = $push['message'] . ' ' . GetMessage('CALL_FOR_NUMBER', array('#NUMBER#' => $params['PHONE_NAME']));
}
$push['params'] = array('ACTION' => 'VI_CALL_' . $params['CALL_ID'], 'PARAMS' => $config);
} else {
if ($params['COMMAND'] == 'update_crm') {
$config = array("callId" => $params['CALL_ID'], "CRM" => $params['CRM']);
} else {
if ($params['COMMAND'] == 'timeout' || $params['COMMAND'] == 'answer_self') {
$config = array("callId" => $params['CALL_ID']);
$push['send_immediately'] = 'Y';
$push['advanced_params'] = array("notificationsToCancel" => array('VI_CALL_' . $params['CALL_ID']));
}
}
}
if (isset($params['MARK'])) {
$config['mark'] = $params['MARK'];
}
CPullStack::AddByUser($params['USER_ID'], array('module_id' => 'voximplant', 'command' => $params['COMMAND'], 'params' => $config, 'push' => $push));
return true;
}
示例9: SetReadMessage
public function SetReadMessage($chatId, $lastId = null)
{
global $DB;
$chatId = intval($chatId);
if ($chatId <= 0) {
return false;
}
$sqlLastId = '';
if (intval($lastId) > 0) {
$sqlLastId = "AND M.ID <= " . intval($lastId);
}
$strSql = "\n\t\t\tSELECT COUNT(M.ID) CNT, MAX(M.ID) ID, M.CHAT_ID\n\t\t\tFROM b_im_message M\n\t\t\tINNER JOIN b_im_relation R1 ON M.ID > R1.LAST_ID " . $sqlLastId . " AND M.CHAT_ID = R1.CHAT_ID\n\t\t\tWHERE R1.CHAT_ID = " . $chatId . " AND R1.USER_ID = " . $this->user_id . "\n\t\t\tGROUP BY M.CHAT_ID\n\t\t";
$dbRes = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
if ($arRes = $dbRes->Fetch()) {
$bReadMessage = CIMMessage::SetLastId($chatId, $this->user_id, $arRes['ID']);
if ($bReadMessage) {
//CUserCounter::Decrement($this->user_id, 'im_chat_v2', '**', false, $arRes['CNT']);
CIMMessenger::SpeedFileDelete($this->user_id, IM_SPEED_GROUP);
if (CModule::IncludeModule("pull")) {
CPushManager::DeleteFromQueueBySubTag($this->user_id, 'IM_MESS');
CPullStack::AddByUser($this->user_id, array('module_id' => 'im', 'command' => 'readMessageChat', 'params' => array('chatId' => $chatId, 'lastId' => $arRes['ID'], 'count' => $arRes['CNT'])));
CIMMessenger::SendBadges($this->user_id);
}
return true;
}
}
return false;
}
示例10: Edit
//.........这里部分代码省略.........
} else {
$eventId = $arFields['ID'];
$strUpdate = $DB->PrepareUpdate("b_calendar_event", $dbFields);
$strSql = "UPDATE b_calendar_event SET " . $strUpdate . " WHERE ID=" . IntVal($eventId);
$DB->QueryBind($strSql, array('DESCRIPTION' => $arFields['DESCRIPTION'], 'MEETING' => $arFields['MEETING'], 'RDATE' => $arFields['RDATE'], 'EXDATE' => $arFields['EXDATE']));
}
CTimeZone::Enable();
if ($bNew && !isset($dbFields['DAV_XML_ID'])) {
$strSql = "UPDATE b_calendar_event SET " . $DB->PrepareUpdate("b_calendar_event", array('DAV_XML_ID' => $eventId)) . " WHERE ID=" . IntVal($eventId);
$DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
}
// *** Check and update section links ***
$sectionId = is_array($arFields['SECTIONS']) && $arFields['SECTIONS'][0] ? intVal($arFields['SECTIONS'][0]) : false;
if ($sectionId && CCalendarSect::GetById($sectionId, false)) {
if (!$bNew) {
$arAffectedSections[] = $currentEvent['SECT_ID'];
}
self::ConnectEventToSection($eventId, $sectionId);
} else {
// It's new event we have to find section where to put it automatically
if ($bNew) {
if ($arFields['IS_MEETING'] && $arFields['PARENT_ID'] && $arFields['CAL_TYPE'] == 'user') {
$sectionId = CCalendar::GetMeetingSection($arFields['OWNER_ID']);
} else {
$sectionId = CCalendarSect::GetLastUsedSection($arFields['CAL_TYPE'], $arFields['OWNER_ID'], $userId);
}
if ($sectionId) {
$res = CCalendarSect::GetList(array('arFilter' => array('CAL_TYPE' => $arFields['CAL_TYPE'], 'OWNER_ID' => $arFields['OWNER_ID'], 'ID' => $sectionId)));
if (!$res || !$res[0]) {
$sectionId = false;
}
} else {
$sectionId = false;
}
if (!$sectionId) {
$sectRes = CCalendarSect::GetSectionForOwner($arFields['CAL_TYPE'], $arFields['OWNER_ID'], true);
$sectionId = $sectRes['sectionId'];
}
self::ConnectEventToSection($eventId, $sectionId);
} else {
// It's existing event, we take it's section to update modification lables (no db changes in b_calendar_event_sect)
$sectionId = $currentEvent['SECT_ID'];
}
}
$arAffectedSections[] = $sectionId;
if (count($arAffectedSections) > 0) {
CCalendarSect::UpdateModificationLabel($arAffectedSections);
}
$bPull = CModule::IncludeModule("pull");
if ($arFields['IS_MEETING'] || !$bNew && $currentEvent['IS_MEETING']) {
if (!$arFields['PARENT_ID']) {
$DB->Query("UPDATE b_calendar_event SET " . $DB->PrepareUpdate("b_calendar_event", array("PARENT_ID" => $eventId)) . " WHERE ID=" . intVal($eventId), false, "FILE: " . __FILE__ . "<br> LINE: " . __LINE__);
}
if (!$arFields['PARENT_ID'] || $arFields['PARENT_ID'] == $eventId) {
self::CreateChildEvents($eventId, $arFields, $Params, $userId);
}
if (!$arFields['PARENT_ID']) {
$arFields['PARENT_ID'] = intVal($eventId);
}
} else {
if ($bNew && !$arFields['PARENT_ID'] || !$bNew && !$currentEvent['PARENT_ID']) {
$DB->Query("UPDATE b_calendar_event SET " . $DB->PrepareUpdate("b_calendar_event", array("PARENT_ID" => $eventId)) . " WHERE ID=" . intVal($eventId), false, "FILE: " . __FILE__ . "<br> LINE: " . __LINE__);
if (!$arFields['PARENT_ID']) {
$arFields['PARENT_ID'] = intVal($eventId);
}
}
if ($bPull) {
$curUserId = $userId;
if ($arFields['PARENT_ID'] && $arFields['PARENT_ID'] !== $arFields['ID']) {
$curUserId = $arFields['OWNER_ID'];
}
CPullStack::AddByUser($curUserId, array('module_id' => 'calendar', 'command' => 'event_update', 'params' => array('EVENT' => CCalendarEvent::OnPullPrepareArFields($arFields), 'ATTENDEES' => array(), 'NEW' => $bNew ? 'Y' : 'N')));
}
}
// Clean old reminders and add new reminders
self::UpdateReminders(array('id' => $eventId, 'reminders' => $arReminders, 'arFields' => $arFields, 'userId' => $userId, 'path' => $path, 'bNew' => $bNew));
// Send invitations and notivications
if ($arFields['IS_MEETING']) {
if ($bSendInvitations) {
if ($arFields['PARENT_ID'] != $eventId) {
$CACHE_MANAGER->ClearByTag('calendar_user_' . $arFields['OWNER_ID']);
$fromTo = CCalendarEvent::GetEventFromToForUser($arFields, $arFields['OWNER_ID']);
CCalendar::SendMessage(array('mode' => 'invite', 'name' => $arFields['NAME'], "from" => $fromTo['DATE_FROM'], "to" => $fromTo['DATE_TO'], "location" => CCalendar::GetTextLocation($arFields["LOCATION"]), "meetingText" => $arFields["~MEETING"]["TEXT"], "guestId" => $arFields['OWNER_ID'], "eventId" => $arFields['PARENT_ID'], "userId" => $userId));
}
} else {
if ($arFields['PARENT_ID'] != $eventId && $arFields['MEETING_STATUS'] == "Y") {
$CACHE_MANAGER->ClearByTag('calendar_user_' . $arFields['OWNER_ID']);
$fromTo = CCalendarEvent::GetEventFromToForUser($arFields, $arFields['OWNER_ID']);
CCalendar::SendMessage(array('mode' => 'change_notify', 'name' => $arFields['NAME'], "from" => $fromTo['DATE_FROM'], "to" => $fromTo['DATE_TO'], "location" => CCalendar::GetTextLocation($arFields["LOCATION"]), "meetingText" => $arFields["~MEETING"]["TEXT"], "guestId" => $arFields['OWNER_ID'], "eventId" => $arFields['PARENT_ID'], "userId" => $userId));
}
}
}
if ($arFields['CAL_TYPE'] == 'user' && $arFields['IS_MEETING'] && !empty($attendeesCodes) && $arFields['PARENT_ID'] == $eventId) {
CCalendarLiveFeed::OnEditCalendarEventEntry($eventId, $arFields, $attendeesCodes);
}
CCalendar::ClearCache('event_list');
$result = $eventId;
}
return $result;
}
示例11: SetReadMessage
public function SetReadMessage($fromUserId, $lastId = null)
{
global $DB;
$fromUserId = intval($fromUserId);
if ($fromUserId <= 0)
return false;
$sqlLastId = '';
if (intval($lastId) > 0)
$sqlLastId = "AND M.ID <= ".intval($lastId);
$strSql = "
SELECT COUNT(M.ID) CNT, MAX(M.ID) ID, M.CHAT_ID
FROM b_im_relation RF
INNER JOIN b_im_relation RT on RF.CHAT_ID = RT.CHAT_ID
INNER JOIN b_im_message M ON M.ID > RT.LAST_ID ".$sqlLastId." AND M.CHAT_ID = RT.CHAT_ID
WHERE RT.USER_ID = ".$this->user_id."
and RF.USER_ID = ".$fromUserId."
and RT.MESSAGE_TYPE = '".IM_MESSAGE_PRIVATE."' and RT.STATUS < ".IM_STATUS_READ."
GROUP BY M.CHAT_ID";
$dbRes = $DB->Query($strSql, false, "File: ".__FILE__."<br>Line: ".__LINE__);
if ($arRes = $dbRes->Fetch())
{
$bReadMessage = self::SetLastId(intval($arRes['CHAT_ID']), $this->user_id, $arRes['ID']);
if ($bReadMessage)
{
//CUserCounter::Decrement($this->user_id, 'im_message_v2', '**', false, $arRes['CNT']);
CIMMessenger::SpeedFileDelete($this->user_id, IM_SPEED_MESSAGE);
if (CModule::IncludeModule("pull"))
{
CPushManager::DeleteFromQueueBySubTag($this->user_id, 'IM_MESS');
CPullStack::AddByUser($this->user_id, Array(
'module_id' => 'im',
'command' => 'readMessage',
'params' => Array(
'chatId' => intval($arRes['CHAT_ID']),
'senderId' => $this->user_id,
'id' => $fromUserId,
'userId' => $fromUserId,
'lastId' => $arRes['ID'],
'count' => $arRes['CNT']
),
));
CPullStack::AddByUser($fromUserId, Array(
'module_id' => 'im',
'command' => 'readMessageApponent',
'params' => Array(
'chatId' => intval($arRes['CHAT_ID']),
'userId' => $this->user_id,
'lastId' => $arRes['ID'],
'date' => time(),
'count' => $arRes['CNT']
),
));
CIMMessenger::SendBadges($this->user_id);
}
return true;
}
}
return false;
}
示例12: Command
public static function Command($chatId, $recipientId, $command, $params = Array())
{
if (!CModule::IncludeModule("pull"))
return false;
$chatId = intval($chatId);
$recipientId = intval($recipientId);
if ($recipientId <= 0 || $chatId <= 0 || empty($command) || !is_array($params))
return false;
global $USER;
$params['senderId'] = $USER->GetID();
$params['chatId'] = $chatId;
$params['command'] = $command;
CPullStack::AddByUser($recipientId, Array(
'module_id' => 'im',
'command' => 'call',
'params' => $params,
));
return true;
}
示例13: SetPhoneActive
public function SetPhoneActive($userId, $active = false)
{
$userId = intval($userId);
if (!$userId) {
return false;
}
CUserOptions::SetOption('voximplant', 'phone_device_active', $active ? true : false, false, $userId);
global $USER, $CACHE_MANAGER;
$USER->Update($userId, array('UF_VI_PHONE' => $active ? 'Y' : 'N'));
if ($active) {
$arUserInfo = $this->GetUserInfo($userId);
if (!$arUserInfo['phone_enable']) {
$USER->Update($userId, array('UF_VI_PHONE' => 'N'));
$CACHE_MANAGER->ClearByTag("USER_NAME_" . $userId);
CUserOptions::SetOption('voximplant', 'phone_device_active', false, false, $userId);
return false;
}
}
$CACHE_MANAGER->ClearByTag("USER_NAME_" . $userId);
if (CModule::IncludeModule('pull') && CPullOptions::GetQueueServerStatus()) {
CPullStack::AddByUser($userId, array('module_id' => 'voximplant', 'command' => 'phoneDeviceActive', 'params' => array('active' => $active ? 'Y' : 'N')));
}
return true;
}
示例14: SendPullEvent
public static function SendPullEvent($params)
{
if (!CModule::IncludeModule('pull') || !CPullOptions::GetQueueServerStatus() || $params['USER_ID'] <= 0) {
return false;
}
$config = array();
if ($params['COMMAND'] == 'start') {
$config = array("callId" => $params['CALL_ID'], "callDevice" => $params['CALL_DEVICE'] == 'PHONE' ? 'PHONE' : 'WEBRTC', "external" => $params['EXTERNAL'] ? true : false, "CRM" => $params['CRM'] ? $params['CRM'] : false);
} else {
if ($params['COMMAND'] == 'hold' || $params['COMMAND'] == 'unhold') {
$config = array("callId" => $params['CALL_ID']);
} else {
if ($params['COMMAND'] == 'timeout') {
$config = array("callId" => $params['CALL_ID']);
}
}
}
CPullStack::AddByUser($params['USER_ID'], array('module_id' => 'voximplant', 'command' => $params['COMMAND'], 'params' => $config));
return true;
}
示例15: StartWriting
public static function StartWriting($recipientId)
{
global $USER;
if ($USER->GetID() > 0 && intval($recipientId) > 0 && CModule::IncludeModule("pull")) {
CPullStack::AddByUser($recipientId, array('module_id' => 'im', 'command' => 'startWriting', 'params' => array('senderId' => $USER->GetID(), 'recipientId' => $recipientId)));
return true;
}
return false;
}