예제 #1
0
        $operatorAccepted = true;
        $chatDataChanged = true;
    }
    if ($chat->support_informed == 0 || $chat->has_unread_messages == 1 || $chat->unread_messages_informed == 1) {
        $chatDataChanged = true;
    }
    $chat->support_informed = 1;
    $chat->has_unread_messages = 0;
    $chat->unread_messages_informed = 0;
    erLhcoreClassChat::getSession()->update($chat);
    $ownerString = 'No data';
    $user = $chat->getChatOwner();
    if ($user !== false) {
        $ownerString = $user->name . ' ' . $user->surname;
    }
    $cannedmsg = erLhcoreClassModelCannedMsg::getCannedMessages($chat->dep_id, $currentUser->getUserID());
    echo json_encode(array('error' => false, 'canned_messages' => $cannedmsg, 'chat' => $chat, 'ownerstring' => $ownerString));
    flush();
    session_write_close();
    if ($chatDataChanged == true) {
        erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.data_changed', array('chat' => &$chat, 'user' => $currentUser));
    }
    if ($operatorAccepted == true) {
        erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.accept', array('chat' => &$chat, 'user' => $currentUser));
        erLhcoreClassChat::updateActiveChats($chat->user_id);
        erLhcoreClassChatWorkflow::presendCannedMsg($chat);
        $options = $chat->department->inform_options_array;
        erLhcoreClassChatWorkflow::chatAcceptedWorkflow(array('department' => $chat->department, 'options' => $options), $chat);
    }
} else {
    echo json_encode(array('error' => true, 'error_string' => 'You do not have permission to read this chat!'));
예제 #2
0
 />&nbsp;<?php 
echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/sendnotice', 'Requires phone');
?>
</label></div>
	</div>
	
	<select class="form-control" id="id_CannedMessage-<?php 
echo $chat->id;
?>
" onchange="$('#sendMessageContent').val(($(this).val() > 0) ? $(this).find(':selected').text() : '');">
		        <option value=""><?php 
echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/adminchat', 'Select a canned message');
?>
</option>
		        <?php 
foreach (erLhcoreClassModelCannedMsg::getCannedMessages($chat->dep_id, erLhcoreClassUser::instance()->getUserID()) as $item) {
    ?>
		            <option value="<?php 
    echo $item->id;
    ?>
"><?php 
    echo htmlspecialchars(str_replace('{nick}', isset($chat) ? $chat->nick : '', $item->msg));
    ?>
</option>
		       <?php 
}
?>
	</select>
		      
	<input type="hidden" name="SendMessage" value="1" />
	<hr>      
예제 #3
0
<?php

$currentUser = erLhcoreClassUser::instance();
if (!$currentUser->isLogged() && !$currentUser->authenticate($_POST['username'], $_POST['password'])) {
    exit;
}
$chat = erLhcoreClassChat::getSession()->load('erLhcoreClassModelChat', $Params['user_parameters']['chat_id']);
if (erLhcoreClassChat::hasAccessToRead($chat)) {
    // If status is pending change status to active
    if ($chat->status == 0) {
        $chat->status = 1;
    }
    if ($chat->user_id == 0) {
        $currentUser = erLhcoreClassUser::instance();
        $chat->user_id = $currentUser->getUserID();
    }
    erLhcoreClassChat::getSession()->update($chat);
    $ownerString = 'No data';
    $user = $chat->getChatOwner();
    if ($user !== false) {
        $ownerString = $user->name . ' ' . $user->surname;
    }
    $cannedmsg = erLhcoreClassModelCannedMsg::getCannedMessages($chat->dep_id, erLhcoreClassUser::instance()->getUserID());
    echo json_encode(array('error' => false, 'canned_messages' => $cannedmsg, 'chat' => $chat, 'ownerstring' => $ownerString));
} else {
    echo json_encode(array('error' => true, 'error_string' => 'You do not have permission to read this chat!'));
}
exit;