|
|
|
|
@ -692,18 +692,30 @@ class SocialManager extends UserManager |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//Chat |
|
|
|
|
//@todo check if user is online and if it's a friend to show the chat link |
|
|
|
|
if (api_is_global_chat_enabled() && $user_friend_relation == USER_RELATION_TYPE_FRIEND) { |
|
|
|
|
if (api_is_global_chat_enabled()) { |
|
|
|
|
$user_name = $user_info['complete_name']; |
|
|
|
|
|
|
|
|
|
if ($user_friend_relation == USER_RELATION_TYPE_FRIEND) { |
|
|
|
|
if ($user_id != api_get_user_id()) { |
|
|
|
|
//Only show chat if I'm available to talk |
|
|
|
|
if ($current_user_info['user_is_online_in_chat'] == 1) { |
|
|
|
|
$user_name = $user_info['complete_name']; |
|
|
|
|
|
|
|
|
|
$options = array('onclick' => "javascript:chatWith('".$user_id."', '".Security::remove_XSS($user_name)."', '".$user_info['user_is_online_in_chat']."')"); |
|
|
|
|
$chat_icon = $user_info['user_is_online_in_chat'] ? Display::return_icon('online.png', get_lang('Online')) : Display::return_icon('offline.png', get_lang('Offline')); |
|
|
|
|
$html .= Display::tag('li', Display::url($chat_icon.' '.get_lang('Chat'), 'javascript:void(0);', $options)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
if ($user_id != api_get_user_id()) { |
|
|
|
|
if ($current_user_info['user_is_online_in_chat'] == 1) { |
|
|
|
|
$message = Security::remove_XSS(sprintf(get_lang("YouHaveToAddXAsAFriendFirst", $user_name))); |
|
|
|
|
$options = array('onclick' => "javascript:chatNotYetWith('".$message."')"); |
|
|
|
|
$chat_icon = $user_info['user_is_online_in_chat'] ? Display::return_icon('online.png', get_lang('Online')) : Display::return_icon('offline.png', get_lang('Offline')); |
|
|
|
|
$html .= Display::tag('li', Display::url($chat_icon.' '.get_lang('Chat'), 'javascript:void(0);', $options)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
$html .= '</ul></div>'; |
|
|
|
|
|
|
|
|
|
|