getGetLastChatMessagePending() 공개 정적인 메소드

Get last message for browser notification
public static getGetLastChatMessagePending ( $chat_id )
    }
    $onlineOperators = erLhcoreClassModelUserDep::getOnlineOperators($currentUser, $canListOnlineUsersAll, $filter, is_numeric($Params['user_parameters_unordered']['limito']) ? (int) $Params['user_parameters_unordered']['limito'] : 10, $onlineTimeout);
    erLhcoreClassChat::prefillGetAttributes($onlineOperators, array('lastactivity_ago', 'user_id', 'id', 'name_support', 'active_chats', 'departments_names'), array(), array('remove_all' => true));
    $ReturnMessages['online_op'] = array('list' => array_values($onlineOperators));
}
if ($unreadTabEnabled == true) {
    $filter = array('ignore_fields' => erLhcoreClassChat::$chatListIgnoreField);
    $limitList = is_numeric($Params['user_parameters_unordered']['limitu']) ? (int) $Params['user_parameters_unordered']['limitu'] : 10;
    if (is_array($Params['user_parameters_unordered']['unreadd']) && !empty($Params['user_parameters_unordered']['unreadd'])) {
        erLhcoreClassChat::validateFilterIn($Params['user_parameters_unordered']['unreadd']);
        $filter['filterin']['dep_id'] = $Params['user_parameters_unordered']['unreadd'];
    }
    // Unread chats
    $unreadChats = erLhcoreClassChat::getUnreadMessagesChats($limitList, 0, $filter);
    $lastPendingChatID = 0;
    $lastChatNick = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'Visitor');
    $lastMessage = erTranslationClassLhTranslation::getInstance()->getTranslation('pagelayout/pagelayout', 'New unread message');
    if (!empty($unreadChats)) {
        $lastPendingChatID = max(array_keys($unreadChats));
        $chatRecent = reset($unreadChats);
        $lastChatNick = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'Unread message') . ' | ' . $chatRecent->nick . ' | ' . $chatRecent->department;
        $lastMessage = erLhcoreClassChat::getGetLastChatMessagePending($chatRecent->id);
    }
    erLhcoreClassChat::prefillGetAttributes($unreadChats, array('time_created_front', 'department_name', 'unread_time', 'plain_user_name'), array('department', 'time', 'status', 'user_id', 'user'));
    $ReturnMessages['unread_chats'] = array('msg' => $lastMessage, 'nick' => $lastChatNick, 'last_id' => $lastPendingChatID, 'last_id_identifier' => 'unread_chat', 'list' => array_values($unreadChats));
}
// Update last visit
$currentUser->updateLastVisit();
erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.syncadmininterface', array('lists' => &$ReturnMessages));
echo json_encode(array('error' => 'false', 'result' => $ReturnMessages));
exit;