Exemplo n.º 1
0
/**
 * User data
 * @note: Don't change anything if you don't know what you are doing;
 *
 * @return {Object}
 */ 
<?php 
$owner = elgg_get_logged_in_user_entity();
$online = OhYesChat::countOnline($owner);
$total_notifications = OhYesChat::countNew();
$new_all = OhYesChat::getNewAll(array('sender'));
$active_chat = $_SESSION['ohyes_chat'];
foreach ($active_chat as $friend) {
    $message = OhYesChat::getNew($friend);
    $icon = elgg_view("icon/default", array('entity' => get_user($friend), 'size' => 'small'));
    if (OhYesChat::userStatus($friend) == 'online') {
        $status = 'OhYesChat-Icon-Onine';
    } else {
        $status = 'OhYesChat-Icon-Offline';
    }
    $construct_active[$friend] = array('status' => $status);
    foreach ($message as $text) {
        if ($message->view == 0) {
            $new_messages[] = array('fid' => $friend, 'message' => elgg_view('ohyes/chat/message-item', array('icon' => $icon, 'message' => $text->message)), 'total' => count($message));
        }
    }
    if (!empty($message)) {
        $sound = "'<script>OhYesChat.playSound();</script>";
        $login = elgg_get_logged_in_user_entity()->guid;
        update_data("UPDATE {$CONFIG->dbprefix}ohyes_chat SET view='1' WHERE(sender='{$friend}' AND reciever='{$login}')");
    } else {
Exemplo n.º 2
0
 /**
 * Return status icon
 *
 * @access system
 * @return return;
 */
 public static function getStatusClass($friend)
 {
     if (OhYesChat::userStatus($friend) == 'online') {
         return 'OhYesChat-Icon-Onine';
     } else {
         return 'OhYesChat-Icon-Offline';
     }
 }