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


PHP erLhcoreClassChat::updateActiveChats方法代码示例

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


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

示例1: removeThis

 public function removeThis()
 {
     $q = ezcDbInstance::get()->createDeleteQuery();
     // Messages
     $q->deleteFrom('lh_msg')->where($q->expr->eq('chat_id', $this->id));
     $stmt = $q->prepare();
     $stmt->execute();
     // Transfered chats
     $q->deleteFrom('lh_transfer')->where($q->expr->eq('chat_id', $this->id));
     $stmt = $q->prepare();
     $stmt->execute();
     // Delete user footprint
     $q->deleteFrom('lh_chat_online_user_footprint')->where($q->expr->eq('chat_id', $this->id));
     $stmt = $q->prepare();
     $stmt->execute();
     // Delete screen sharing
     $q->deleteFrom('lh_cobrowse')->where($q->expr->eq('chat_id', $this->id));
     $stmt = $q->prepare();
     $stmt->execute();
     // Delete speech settings
     $q->deleteFrom('lh_speech_chat_language')->where($q->expr->eq('chat_id', $this->id));
     $stmt = $q->prepare();
     $stmt->execute();
     erLhcoreClassModelChatFile::deleteByChatId($this->id);
     erLhcoreClassChat::getSession()->delete($this);
     erLhcoreClassChat::updateActiveChats($this->user_id);
 }
开发者ID:nagyistoce,项目名称:livehelperchat,代码行数:27,代码来源:erlhcoreclassmodelchat.php

示例2: die

<?php

// Set new chat owner
$currentUser = erLhcoreClassUser::instance();
$currentUser->getUserID();
$chat = erLhcoreClassChat::getSession()->load('erLhcoreClassModelChat', $Params['user_parameters']['chat_id']);
// Chat can be closed only by owner
if ($chat->user_id == $currentUser->getUserID() || $currentUser->hasAccessTo('lhchat', 'allowcloseremote')) {
    if (!$currentUser->validateCSFRToken($Params['user_parameters_unordered']['csfr'])) {
        die('Invalid CSRF Token');
        exit;
    }
    if ($chat->status != erLhcoreClassModelChat::STATUS_CLOSED_CHAT) {
        $chat->status = erLhcoreClassModelChat::STATUS_CLOSED_CHAT;
        $chat->chat_duration = erLhcoreClassChat::getChatDurationToUpdateChatID($chat->id);
        $userData = $currentUser->getUserData(true);
        $msg = new erLhcoreClassModelmsg();
        $msg->msg = (string) $userData . ' ' . erTranslationClassLhTranslation::getInstance()->getTranslation('chat/closechatadmin', 'has closed the chat!');
        $msg->chat_id = $chat->id;
        $msg->user_id = -1;
        $chat->last_user_msg_time = $msg->time = time();
        erLhcoreClassChat::getSession()->save($msg);
        $chat->updateThis();
        erLhcoreClassChat::updateActiveChats($chat->user_id);
        // Execute callback for close chat
        erLhcoreClassChat::closeChatCallback($chat, $userData);
    }
}
CSCacheAPC::getMem()->removeFromArray('lhc_open_chats', (int) $Params['user_parameters']['chat_id']);
header('Location: ' . $_SERVER['HTTP_REFERER']);
exit;
开发者ID:sudogitguy,项目名称:livehelperchat,代码行数:31,代码来源:closechat.php

示例3: changeStatus

 public static function changeStatus($params)
 {
     $changeStatus = $params['status'];
     $chat = $params['chat'];
     $userData = $params['user'];
     $allowCloseRemote = $params['allow_close_remote'];
     if ($changeStatus == erLhcoreClassModelChat::STATUS_ACTIVE_CHAT) {
         if ($chat->status != erLhcoreClassModelChat::STATUS_ACTIVE_CHAT) {
             $chat->status = erLhcoreClassModelChat::STATUS_ACTIVE_CHAT;
             $chat->wait_time = time() - $chat->time;
         }
         if ($chat->user_id == 0) {
             $chat->user_id = $userData->id;
         }
         $chat->updateThis();
     } elseif ($changeStatus == erLhcoreClassModelChat::STATUS_PENDING_CHAT) {
         $chat->status = erLhcoreClassModelChat::STATUS_PENDING_CHAT;
         $chat->support_informed = 0;
         $chat->has_unread_messages = 1;
         $chat->updateThis();
     } elseif ($changeStatus == erLhcoreClassModelChat::STATUS_CLOSED_CHAT && $chat->user_id == $userData->id || $allowCloseRemote == true) {
         if ($chat->status != erLhcoreClassModelChat::STATUS_CLOSED_CHAT) {
             $chat->status = erLhcoreClassModelChat::STATUS_CLOSED_CHAT;
             $chat->chat_duration = erLhcoreClassChat::getChatDurationToUpdateChatID($chat->id);
             $msg = new erLhcoreClassModelmsg();
             $msg->msg = (string) $userData . ' ' . erTranslationClassLhTranslation::getInstance()->getTranslation('chat/closechatadmin', 'has closed the chat!');
             $msg->chat_id = $chat->id;
             $msg->user_id = -1;
             $chat->last_user_msg_time = $msg->time = time();
             erLhcoreClassChat::getSession()->save($msg);
             $chat->updateThis();
             CSCacheAPC::getMem()->removeFromArray('lhc_open_chats', $chat->id);
             // Execute callback for close chat
             erLhcoreClassChat::closeChatCallback($chat, $userData);
         }
     } elseif ($changeStatus == erLhcoreClassModelChat::STATUS_CHATBOX_CHAT) {
         $chat->status = erLhcoreClassModelChat::STATUS_CHATBOX_CHAT;
         erLhcoreClassChat::getSession()->update($chat);
     } elseif ($changeStatus == erLhcoreClassModelChat::STATUS_OPERATORS_CHAT) {
         $chat->status = erLhcoreClassModelChat::STATUS_OPERATORS_CHAT;
         erLhcoreClassChat::getSession()->update($chat);
     }
     erLhcoreClassChat::updateActiveChats($chat->user_id);
     if ($chat->department !== false) {
         erLhcoreClassChat::updateDepartmentStats($chat->department);
     }
 }
开发者ID:Adeelgill,项目名称:livehelperchat,代码行数:47,代码来源:lhchathelper.php

示例4: autoAssign

 public static function autoAssign(&$chat, $department)
 {
     if ($department->active_balancing == 1 && ($chat->user_id == 0 || $department->max_timeout_seconds > 0 && $chat->tslasign < time() - $department->max_timeout_seconds)) {
         $isOnlineUser = (int) erLhcoreClassModelChatConfig::fetch('sync_sound_settings')->data['online_timeout'];
         $appendSQL = '';
         if ($department->max_active_chats > 0) {
             $appendSQL = ' AND active_chats < :max_active_chats';
         }
         $sql = "SELECT user_id FROM lh_userdep WHERE hide_online = 0 AND dep_id = :dep_id AND last_activity > :last_activity AND user_id != :user_id {$appendSQL} ORDER BY last_accepted ASC LIMIT 1";
         $db = ezcDbInstance::get();
         $stmt = $db->prepare($sql);
         $stmt->bindValue(':dep_id', $department->id, PDO::PARAM_INT);
         $stmt->bindValue(':last_activity', time() - $isOnlineUser, PDO::PARAM_INT);
         $stmt->bindValue(':user_id', $chat->user_id, PDO::PARAM_INT);
         if ($department->max_active_chats > 0) {
             $stmt->bindValue(':max_active_chats', $department->max_active_chats, PDO::PARAM_INT);
         }
         $stmt->execute();
         $user_id = $stmt->fetchColumn();
         if ($user_id > 0) {
             erLhcoreClassChat::updateActiveChats($chat->user_id);
             $chat->tslasign = time();
             $chat->user_id = $user_id;
             $chat->updateThis();
             erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.data_changed_auto_assign', array('chat' => &$chat));
             $stmt = $db->prepare('UPDATE lh_userdep SET last_accepted = :last_accepted WHERE user_id = :user_id');
             $stmt->bindValue(':last_accepted', time(), PDO::PARAM_INT);
             $stmt->bindValue(':user_id', $user_id, PDO::PARAM_INT);
             $stmt->execute();
         }
     }
 }
开发者ID:Joeboyc2,项目名称:livehelperchat,代码行数:32,代码来源:lhchatworkflow.php

示例5: sendMessageToChat

 /**
  * Executed in erLhcoreClassExtensionXmppserviceHandler::handleMessageFromOperator send message to user from operator.
  * if provided message is a command to operator is send command response
  *
  * @param erLhcoreClassModelChat $chat            
  *
  * @param erLhcoreClassModelXMPPAccount $xmppUser            
  *
  * @param string $body            
  *
  * @throws Exception
  */
 public static function sendMessageToChat(erLhcoreClassModelChat $chat, erLhcoreClassModelXMPPAccount $xmppUser, $body)
 {
     $db = ezcDbInstance::get();
     $db->beginTransaction();
     try {
         $user = $xmppUser->user;
         $messageUserId = $user->id;
         $ignoreMessage = false;
         // Predefine
         $statusCommand = array('processed' => false, 'process_status' => '');
         if (strpos(trim($body), '!') === 0) {
             $statusCommand = erLhcoreClassChatCommand::processCommand(array('no_ui_update' => true, 'msg' => $body, 'chat' => &$chat));
             if ($statusCommand['processed'] === true) {
                 $messageUserId = -1;
                 // Message was processed set as internal message
                 $body = '[b]' . $userData->name_support . '[/b]: ' . $body . ' ' . ($statusCommand['process_status'] != '' ? '|| ' . $statusCommand['process_status'] : '');
             }
             if (isset($statusCommand['ignore']) && $statusCommand['ignore'] == true) {
                 $ignoreMessage = true;
             }
             if (isset($statusCommand['info'])) {
                 $xmppService = erLhcoreClassModule::getExtensionInstance('erLhcoreClassExtensionXmppservice');
                 $xmppService->sendMessageToOperatorAsUserByChat(array('xmpp_account_operator' => $xmppUser, 'chat' => $chat, 'msg' => '[[System Assistant]] ' . $statusCommand['info']));
             }
         }
         if ($ignoreMessage == false) {
             $msg = new erLhcoreClassModelmsg();
             $msg->msg = $body;
             $msg->chat_id = $chat->id;
             $msg->user_id = $messageUserId;
             $msg->time = time();
             $msg->name_support = $user->name_support;
             if ($messageUserId > 0 && $chat->chat_locale != '' && $chat->chat_locale_to != '') {
                 erLhcoreClassTranslate::translateChatMsgOperator($chat, $msg);
             }
             erLhcoreClassChat::getSession()->save($msg);
             // Set last message ID
             if ($chat->last_msg_id < $msg->id) {
                 $userChange = '';
                 // Assign operator if chat does not have one
                 if ($chat->user_id == 0) {
                     $userChange = ',user_id = :user_id';
                 }
                 $stmt = $db->prepare("UPDATE lh_chat SET status = :status, user_status = :user_status, last_msg_id = :last_msg_id{$userChange} WHERE id = :id");
                 $stmt->bindValue(':id', $chat->id, PDO::PARAM_INT);
                 $stmt->bindValue(':last_msg_id', $msg->id, PDO::PARAM_INT);
                 $changeStatus = false;
                 if ($user->invisible_mode == 0) {
                     if ($chat->status == erLhcoreClassModelChat::STATUS_PENDING_CHAT) {
                         $chat->status = erLhcoreClassModelChat::STATUS_ACTIVE_CHAT;
                         $changeStatus = true;
                     }
                 }
                 if ($chat->user_status == erLhcoreClassModelChat::USER_STATUS_CLOSED_CHAT) {
                     $chat->user_status = erLhcoreClassModelChat::USER_STATUS_PENDING_REOPEN;
                     if (($onlineuser = $chat->online_user) !== false) {
                         $onlineuser->reopen_chat = 1;
                         $onlineuser->saveThis();
                     }
                 }
                 $stmt->bindValue(':user_status', $chat->user_status, PDO::PARAM_INT);
                 $stmt->bindValue(':status', $chat->status, PDO::PARAM_INT);
                 if ($userChange != '') {
                     $stmt->bindValue(':user_id', $msg->user_id, PDO::PARAM_INT);
                 }
                 $stmt->execute();
             }
             // If chat status changes update statistic
             if ($changeStatus == true) {
                 if ($chat->department !== false) {
                     erLhcoreClassChat::updateDepartmentStats($chat->department);
                 }
                 erLhcoreClassChat::updateActiveChats($chat->user_id);
             }
         }
         $db->commit();
         // Inform operator about command status
         if ($statusCommand['processed'] == true && $statusCommand['process_status'] != '') {
             $xmppService = erLhcoreClassModule::getExtensionInstance('erLhcoreClassExtensionXmppservice');
             $xmppService->sendMessageToOperatorAsUserByChat(array('xmpp_account_operator' => $xmppUser, 'chat' => $chat, 'msg' => '[[System Assistant]] ' . $statusCommand['process_status']));
         }
         // For nodejs plugin
         erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.desktop_client_admin_msg', array('msg' => &$msg, 'chat' => &$chat));
         // For general listeners
         erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.web_add_msg_admin', array('msg' => &$msg, 'chat' => &$chat));
     } catch (Exception $e) {
         $db->rollback();
         throw $e;
//.........这里部分代码省略.........
开发者ID:noikiy,项目名称:xmpp-chat,代码行数:101,代码来源:erlhcoreclassxmppservicehandler.php


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