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


PHP erLhcoreClassChat::closeChatCallback方法代码示例

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


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

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

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

 public static function automaticChatClosing()
 {
     $closedChatsNumber = 0;
     $timeout = (int) erLhcoreClassModelChatConfig::fetch('autoclose_timeout')->current_value;
     if ($timeout > 0) {
         // Close normal chats
         $delay = time() - $timeout * 60;
         foreach (erLhcoreClassChat::getList(array('limit' => 500, 'filtergt' => array('last_user_msg_time' => 0), 'filterlt' => array('last_user_msg_time' => $delay), 'filter' => array('status' => erLhcoreClassModelChat::STATUS_ACTIVE_CHAT))) as $chat) {
             $chat->status = erLhcoreClassModelChat::STATUS_CLOSED_CHAT;
             $msg = new erLhcoreClassModelmsg();
             $msg->msg = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/syncuser', 'Chat was automatically closed by cron');
             $msg->chat_id = $chat->id;
             $msg->user_id = -1;
             $chat->last_user_msg_time = $msg->time = time();
             erLhcoreClassChat::getSession()->save($msg);
             if ($chat->last_msg_id < $msg->id) {
                 $chat->last_msg_id = $msg->id;
             }
             $chat->chat_duration = erLhcoreClassChat::getChatDurationToUpdateChatID($chat->id);
             $chat->updateThis();
             erLhcoreClassChat::closeChatCallback($chat, $chat->user);
             erLhcoreClassChat::updateActiveChats($chat->user_id);
             $closedChatsNumber++;
         }
         // Close pending chats where the only message is user initial message
         foreach (erLhcoreClassChat::getList(array('limit' => 500, 'filterlt' => array('time' => $delay), 'filterin' => array('status' => array(erLhcoreClassModelChat::STATUS_PENDING_CHAT, erLhcoreClassModelChat::STATUS_ACTIVE_CHAT)), 'filter' => array('last_user_msg_time' => 0))) as $chat) {
             $chat->status = erLhcoreClassModelChat::STATUS_CLOSED_CHAT;
             $msg = new erLhcoreClassModelmsg();
             $msg->msg = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/syncuser', 'Chat was automatically closed by cron');
             $msg->chat_id = $chat->id;
             $msg->user_id = -1;
             $chat->last_user_msg_time = $msg->time = time();
             erLhcoreClassChat::getSession()->save($msg);
             if ($chat->last_msg_id < $msg->id) {
                 $chat->last_msg_id = $msg->id;
             }
             $chat->updateThis();
             erLhcoreClassChat::closeChatCallback($chat, $chat->user);
             erLhcoreClassChat::updateActiveChats($chat->user_id);
             $closedChatsNumber++;
         }
     }
     return $closedChatsNumber;
 }
开发者ID:remdex,项目名称:livehelperchat,代码行数:44,代码来源:lhchatworkflow.php


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