Jump to content
Fórum Script Brasil
  • 0

Mesagem visualizada chat php


Rede Otaku
 Share

Question

Desenvolvi um chat utilizando php e gostaria de saber como posso colocar um aviso igual o do facebook de "mensagem visualizada"?

Esse é o código do meu chat

 

<?php
$hidden_class = '';

if (!isset($sk['chat']['recipient']['id'])) {
    $hidden_class = ' hidden';
}
?>
<div id="chat_<?php echo $sk['chat']['recipient']['id'] ?>" class="chat-wrapper<?php echo $hidden_class; ?>">
    <div class="chat-header" onclick="javascript:$('.chat-content-toggler').toggle();">
        <div class="float-left">
            <?php
            $active_class = '';
            if ($sk['chat']['recipient']['online'] == true) {
                $active_class = ' active';
            }
            ?>
            <i class="icon-circle online-icon<?php echo $active_class; ?>"></i>
            <span class="chat-recipient-name">
                <?php echo substr($sk['chat']['recipient']['name'], 0, 15); ?>
            </span>
        </div>
        <div class="float-right">
            <i class="icon-remove close-icon" onclick="SK_closeChat();" title="Close chat"></i>
        </div>
        <div class="float-clear"></div>
    </div>
    <div class="chat-content-toggler">
        <div class="chat-messages">
            <?php
            if (isset($sk['chat']['recipient']['id'])) {
                $array_data = array('recipient_id' => $sk['chat']['recipient']['id']);
                $messages = SK_getMessages($array_data);
                
                if (is_array($messages)) {
                    
                    foreach ($messages as $sk['message']) {
                        
                        if ($sk['message']['account']['id'] == $sk['user']['id']) {
                            echo SK_getPage('chat/outgoing-text');
                        } else {
                            echo SK_getPage('chat/incoming-text');
                        }
                    }
                }
            }
            ?>
        </div>
        <?php
        $chat_textarea = false;
        
        if ($sk['chat']['recipient']['message_privacy'] == "following" && SK_isFollowing($sk['user']['id'], $sk['chat']['recipient']['id'])) {
            $chat_textarea = true;
        } elseif ($sk['chat']['recipient']['message_privacy'] == "everyone") {
            $chat_textarea = true;
        }
        
        if ($chat_textarea == true) {
        ?>
        <div class="chat-textarea">
            <textarea class="auto-grow-input" onfocus="SK_focusChat();" onkeyup="SK_sendChatMessage(this.value,<?php echo $sk['chat']['recipient']['id']; ?>,event);"></textarea>
            <div class="advanced-options">
                <i class="icon-smile cursor-hand" onclick="javascript:$('.chat-emoticons-wrapper').toggle();"></i>
                <div class="chat-emoticons-wrapper">
                    <?php
                    $emoticons = SK_getEmoticons();
                    
                    if (is_array($emoticons)) {
                        
                        foreach ($emoticons as $emo_code => $emo_icon) {
                            echo '<img src="' . $emo_icon . '" width="16px" onclick="addEmoToChat(\'' . $emo_code . '\');">';
                        }
                    }
                    ?>
                </div>
            </div>
        </div>
        <?php
        }
        ?>
    </div>
</div>

Edited by Rede Otaku
Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Forum Statistics

    • Total Topics
      149.8k
    • Total Posts
      646.6k
×
×
  • Create New...