Adding online/offline icons

skala
Julio Montoya 13 years ago
parent 391193d58c
commit f0a06c4e59
  1. 17
      main/css/base.css
  2. BIN
      main/css/offline.png
  3. BIN
      main/css/online.png
  4. 4
      main/inc/lib/javascript/chat/js/chat.js
  5. 11
      main/inc/lib/online.inc.php
  6. 21
      main/inc/lib/social.lib.php
  7. 23
      main/social/profile.php
  8. 8
      main/social/search.php
  9. 1
      whoisonline.php

@ -4180,3 +4180,20 @@ a:active{
.skills-skills ul.holder { .skills-skills ul.holder {
margin-bottom: 8px; margin-bottom: 8px;
} }
.offline_user {
display: block;
height: 20px;
width: 20px;
position:absolute;
background: url("offline.png") no-repeat scroll right center transparent;
}
.online_user {
display: block;
height: 20px;
width: 20px;
position:absolute;
background: url("online.png") no-repeat scroll right center transparent;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 840 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

@ -261,8 +261,8 @@ function restructureChatBoxes() {
* @param string user's firstname + lastname * @param string user's firstname + lastname
* *
**/ **/
function chatWith(user_id, user_name) { function chatWith(user_id, user_name, status) {
createChatBox(user_id, user_name, 0, 0); createChatBox(user_id, user_name, 0, status);
$("#chatbox_"+user_id+" .chatboxtextarea").focus(); $("#chatbox_"+user_id+" .chatboxtextarea").focus();
} }

@ -117,17 +117,18 @@ function LoginDelete($user_id) {
function user_is_online($user_id) { function user_is_online($user_id) {
$track_online_table = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ONLINE); $track_online_table = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ONLINE);
$friend_user_table = Database::get_main_table(TABLE_MAIN_USER_REL_USER);
$table_user = Database::get_main_table(TABLE_MAIN_USER); $table_user = Database::get_main_table(TABLE_MAIN_USER);
$current_date = date('Y-m-d H:i:s',time()); $current_date = date('Y-m-d H:i:s',time());
$access_url_id = api_get_current_access_url_id(); $access_url_id = api_get_current_access_url_id();
$time_limit = api_get_setting('time_limit_whosonline'); $time_limit = api_get_setting('time_limit_whosonline');
$time_limit = 1; //$time_limit = 1;
$query = "SELECT login_user_id,login_date FROM ".$track_online_table ." track INNER JOIN ".$table_user ." u ON (u.user_id=track.login_user_id) $query = " SELECT login_user_id,login_date FROM ".$track_online_table ." track INNER JOIN ".$table_user ." u ON (u.user_id=track.login_user_id)
WHERE track.access_url_id = $access_url_id AND DATE_ADD(login_date,INTERVAL $time_limit MINUTE) >= '".$current_date."' AND u.user_id = $user_id LIMIT 1 "; WHERE track.access_url_id = $access_url_id AND
DATE_ADD(login_date,INTERVAL $time_limit MINUTE) >= '".$current_date."' AND
u.user_id = $user_id
LIMIT 1 ";
$result = Database::query($query); $result = Database::query($query);
if (Database::num_rows($result)) { if (Database::num_rows($result)) {

@ -558,10 +558,10 @@ class SocialManager extends UserManager {
* *
*/ */
public static function show_social_menu($show = '', $group_id = 0, $user_id = 0, $show_full_profile = false) { public static function show_social_menu($show = '', $group_id = 0, $user_id = 0, $show_full_profile = false) {
if (empty($user_id)) {
if (empty($user_id)) {
$user_id = api_get_user_id(); $user_id = api_get_user_id();
} }
$user_info = api_get_user_info($user_id, true);
$show_groups = array('groups', 'group_messages', 'messages_list', 'group_add', 'mygroups', 'group_edit', 'member_list', 'invite_friends', 'waiting_list', 'browse_groups'); $show_groups = array('groups', 'group_messages', 'messages_list', 'group_add', 'mygroups', 'group_edit', 'member_list', 'invite_friends', 'waiting_list', 'browse_groups');
$show_messages = array('messages', 'messages_inbox', 'messages_outbox', 'messages_compose'); $show_messages = array('messages', 'messages_inbox', 'messages_outbox', 'messages_compose');
@ -678,8 +678,6 @@ class SocialManager extends UserManager {
echo '<li><a href="'.api_get_path(WEB_PATH).'main/social/myfiles.php">'.Display::return_icon('briefcase.png',get_lang('MyFiles'),array('hspace'=>'6'),16).'<span class="'.($show=='myfiles'?'social-menu-text-active':'social-menu-text4').'" >'.get_lang('MyFiles').'</span></a></li>'; echo '<li><a href="'.api_get_path(WEB_PATH).'main/social/myfiles.php">'.Display::return_icon('briefcase.png',get_lang('MyFiles'),array('hspace'=>'6'),16).'<span class="'.($show=='myfiles'?'social-menu-text-active':'social-menu-text4').'" >'.get_lang('MyFiles').'</span></a></li>';
} }
$user_info = api_get_user_info($user_id);
// My friend profile // My friend profile
$html_actions = ''; $html_actions = '';
@ -703,7 +701,9 @@ class SocialManager extends UserManager {
if (api_get_setting('allow_global_chat') == 'true') { if (api_get_setting('allow_global_chat') == 'true') {
if ($user_id != api_get_user_id()) { if ($user_id != api_get_user_id()) {
$user_name = $user_info['complete_name']; $user_name = $user_info['complete_name'];
echo Display::tag('li', Display::url(Display::return_icon('chat.gif').get_lang('Chat'), 'javascript:void(0);', array('onclick' => "javascript:chatWith('".$user_id."', '".Security::remove_XSS($user_name)."')"))); $options = array('onclick' => "javascript:chatWith('".$user_id."', '".Security::remove_XSS($user_name)."', '".$user_info['user_is_online']."')");
$chat_icon = $user_info['user_is_online'] ? Display::return_icon('online.png', get_lang('Online')) : Display::return_icon('offline.png', get_lang('Offline'));
echo Display::tag('li', Display::url($chat_icon.'&nbsp;&nbsp;'.get_lang('Chat'), 'javascript:void(0);', $options));
} }
} }
echo '</ul></div>'; echo '</ul></div>';
@ -802,15 +802,17 @@ class SocialManager extends UserManager {
$image_array = UserManager::get_user_picture_path_by_id($uid, 'system', false, true); $image_array = UserManager::get_user_picture_path_by_id($uid, 'system', false, true);
// reduce image // reduce image
$name = api_get_person_name($user_info['firstName'], $user_info['lastName']); $name = $user_info['complete_name'];
if ($image_array['file'] == 'unknown.jpg' || !file_exists($image_array['dir'].$image_array['file'])) { if ($image_array['file'] == 'unknown.jpg' || !file_exists($image_array['dir'].$image_array['file'])) {
$friends_profile['file'] = api_get_path(WEB_CODE_PATH).'img/unknown_180_100.jpg'; $friends_profile['file'] = api_get_path(WEB_CODE_PATH).'img/unknown_180_100.jpg';
$table_row[] = '<a href="'.$url.'"><img title = "'.$name.'" class="social-home-anonymous-online" alt="'.$name.'" src="'.$friends_profile['file'].'"></a>'; $status_icon = Display::span('', array('class' => 'online_user'));
//$img = $status_icon.$img;
$table_row[] = '<a href="'.$url.'">'.$status_icon.'<img title = "'.$name.'" class="social-home-anonymous-online" alt="'.$name.'" src="'.$friends_profile['file'].'"></a>';
} else { } else {
$friends_profile = UserManager::get_picture_user($uid, $image_array['file'], 80, USER_IMAGE_SIZE_ORIGINAL); $friends_profile = UserManager::get_picture_user($uid, $image_array['file'], 80, USER_IMAGE_SIZE_ORIGINAL);
$img = '<img title = "'.$name.'" alt="'.$name.'" src="'.$friends_profile['file'].'">'; $img = '<img title = "'.$name.'" alt="'.$name.'" src="'.$friends_profile['file'].'">';
$clip = 'clip_vertical'; $clip = 'clip_vertical';
@ -822,6 +824,9 @@ class SocialManager extends UserManager {
if ($friends_profile['original_height'] < 50 || $friends_profile['original_height']< 50) { if ($friends_profile['original_height'] < 50 || $friends_profile['original_height']< 50) {
$clip = ''; $clip = '';
} }
//$status_icon = Display::span($status_icon, array('class' => 'online_user'));
//$img = $status_icon.$img;
$table_row[] = Display::url(Display::div(Display::div($img, array('class'=>$clip)), array('class'=>'clip-wrapper')) , $url); $table_row[] = Display::url(Display::div(Display::div($img, array('class'=>$clip)), array('class'=>'clip-wrapper')) , $url);
} }

@ -393,13 +393,27 @@ if ($show_full_profile) {
if (isset($friends[$k])) { if (isset($friends[$k])) {
$friend = $friends[$k]; $friend = $friends[$k];
$name_user = api_get_person_name($friend['firstName'], $friend['lastName']); $name_user = api_get_person_name($friend['firstName'], $friend['lastName']);
$friend_html.='<div id=div_'.$friend['friend_user_id'].' class="image_friend_network" ><span><center>'; $user_info = api_get_user_info($friend['friend_user_id'], true);
if ($user_info['user_is_online']) {
$status_icon = Display::div('', array('class' => 'online_user'));
} else {
$status_icon = Display::div('', array('class' => 'offline_user'));
}
$friend_html.= '<div id=div_'.$friend['friend_user_id'].' class="image_friend_network" >';
$friend_html.= $status_icon.'<span><center>';
// the height = 92 must be the sqme in the image_friend_network span style in default.css // the height = 92 must be the sqme in the image_friend_network span style in default.css
$friends_profile = SocialManager::get_picture_user($friend['friend_user_id'], $friend['image'], 92, USER_IMAGE_SIZE_MEDIUM , 'width="85" height="90" '); $friends_profile = SocialManager::get_picture_user($friend['friend_user_id'], $friend['image'], 92, USER_IMAGE_SIZE_MEDIUM , 'width="85" height="90" ');
$friend_html.='<a href="profile.php?u='.$friend['friend_user_id'].'&amp;'.$link_shared.'">';
$friend_html.='<img src="'.$friends_profile['file'].'" '.$friends_profile['style'].' id="imgfriend_'.$friend['friend_user_id'].'" title="'.$name_user.'" />'; $friend_html.= '<a href="profile.php?u='.$friend['friend_user_id'].'&amp;'.$link_shared.'">';
$friend_html.= '<img src="'.$friends_profile['file'].'" '.$friends_profile['style'].' id="imgfriend_'.$friend['friend_user_id'].'" title="'.$name_user.'" />';
$friend_html.= '</center></span>'; $friend_html.= '</center></span>';
$friend_html.= '<center class="friend">'.$name_user.'</a></center>'; $friend_html.= '<center class="friend">'.$name_user.'</a></center>';
$friend_html.= '</div>'; $friend_html.= '</div>';
@ -640,9 +654,6 @@ if ($show_full_profile) {
} }
echo '</div>'; // close social-box-main1 echo '</div>'; // close social-box-main1
} }
//echo '<form id="id_reload" name="id_reload" action="profile.php"></form>';
echo '</div>'; echo '</div>';
echo '</div>'; echo '</div>';
Display :: display_footer(); Display :: display_footer();

@ -22,7 +22,6 @@ $this_section = SECTION_SOCIAL;
$tool_name = get_lang('Search'); $tool_name = get_lang('Search');
$interbreadcrumb[]= array ('url' =>'profile.php','name' => get_lang('Social')); $interbreadcrumb[]= array ('url' =>'profile.php','name' => get_lang('Social'));
$query_vars = array(); $query_vars = array();
$query = isset($_GET['q']) ? $_GET['q'] : null; $query = isset($_GET['q']) ? $_GET['q'] : null;
@ -52,6 +51,7 @@ echo '<div id="social-content">';
if (is_array($users) && count($users)> 0) { if (is_array($users) && count($users)> 0) {
echo '<h2>'.get_lang('Users').'</h2>'; echo '<h2>'.get_lang('Users').'</h2>';
foreach($users as $user) { foreach($users as $user) {
$user_info = api_get_user_info($user['user_id'], true);
$url = api_get_path(WEB_PATH).'main/social/profile.php?u='.$user['user_id']; $url = api_get_path(WEB_PATH).'main/social/profile.php?u='.$user['user_id'];
if (empty($user['picture_uri'])) { if (empty($user['picture_uri'])) {
@ -67,6 +67,12 @@ echo '<div id="social-content">';
} }
$img = Display::url(Display::div(Display::div($img, array('class'=>$clip)), array('class'=>'clip-wrapper')) , $url); $img = Display::url(Display::div(Display::div($img, array('class'=>$clip)), array('class'=>'clip-wrapper')) , $url);
} }
if ($user_info['user_is_online']) {
$status_icon = Display::span('', array('class' => 'online_user'));
} else {
$status_icon = Display::span('', array('class' => 'offline_user'));
}
$img = $status_icon.$img;
$user['firstname'] = Display::url($user['firstname'], $url); $user['firstname'] = Display::url($user['firstname'], $url);
$user['lastname'] = Display::url($user['lastname'], $url); $user['lastname'] = Display::url($user['lastname'], $url);

@ -16,7 +16,6 @@ if (!isset($_GET['cidReq'])) {
require_once './main/inc/global.inc.php'; require_once './main/inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php'; require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php';
//social tab //social tab
$this_section = SECTION_SOCIAL; $this_section = SECTION_SOCIAL;
// table definitions // table definitions

Loading…
Cancel
Save