|
@@ -429,7 +429,8 @@ class SocialManager extends UserManager {
|
|
|
* @param bool show profile or not (show or hide the user image/information)
|
|
|
*
|
|
|
*/
|
|
|
- public static function show_social_menu($show = '', $group_id = 0, $user_id = 0, $show_full_profile = false, $show_delete_account_button = false) {
|
|
|
+ public static function show_social_menu($show = '', $group_id = 0, $user_id = 0, $show_full_profile = false, $show_delete_account_button = false)
|
|
|
+ {
|
|
|
if (empty($user_id)) {
|
|
|
$user_id = api_get_user_id();
|
|
|
}
|
|
@@ -445,65 +446,70 @@ class SocialManager extends UserManager {
|
|
|
$user_friend_relation = SocialManager::get_relation_between_contacts($current_user_id, $user_id);
|
|
|
}
|
|
|
|
|
|
- $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');
|
|
|
|
|
|
// get count unread message and total invitations
|
|
|
$count_unread_message = MessageManager::get_number_of_messages(true);
|
|
|
$count_unread_message = (!empty($count_unread_message)? Display::badge($count_unread_message) :'');
|
|
|
|
|
|
$number_of_new_messages_of_friend = SocialManager::get_message_number_invitation_by_user_id(api_get_user_id());
|
|
|
- $group_pending_invitations = $usergroup->get_groups_by_user(api_get_user_id(), GROUP_USER_PERMISSION_PENDING_INVITATION,false);
|
|
|
+ $group_pending_invitations = $usergroup->get_groups_by_user(api_get_user_id(), GROUP_USER_PERMISSION_PENDING_INVITATION, false);
|
|
|
$group_pending_invitations = count($group_pending_invitations);
|
|
|
$total_invitations = $number_of_new_messages_of_friend + $group_pending_invitations;
|
|
|
$total_invitations = (!empty($total_invitations) ? Display::badge($total_invitations) :'');
|
|
|
|
|
|
$html = '<div class="social-menu">';
|
|
|
- if (in_array($show, $show_groups) && !empty($group_id)) {
|
|
|
+ if (in_array($show, $show_groups) && !empty($group_id)) {
|
|
|
//--- Group image
|
|
|
$group_info = $usergroup->get($group_id);
|
|
|
$big = $usergroup->get_picture_group($group_id, $group_info['picture'],160,GROUP_IMAGE_SIZE_BIG);
|
|
|
|
|
|
$html .= '<div class="social-content-image">';
|
|
|
- $html .= '<div class="well social-background-content">';
|
|
|
- $html .= Display::url('<img src='.$big['file'].' class="social-groups-image" /> </a><br /><br />', api_get_path(WEB_PATH).'main/social/groups.php?id='.$group_id);
|
|
|
- if ($usergroup->is_group_admin($group_id, api_get_user_id())) {
|
|
|
- $html .= '<div id="edit_image" class="hidden_message" style="display:none"><a href="'.api_get_path(WEB_PATH).'main/social/group_edit.php?id='.$group_id.'">'.get_lang('EditGroup').'</a></div>';
|
|
|
- }
|
|
|
- $html .= '</div>';
|
|
|
- $html .= '</div>';
|
|
|
-
|
|
|
- } else {
|
|
|
+ $html .= '<div class="well social-background-content">';
|
|
|
+ $html .= Display::url('<img src='.$big['file'].' class="social-groups-image" /> </a><br /><br />', api_get_path(WEB_PATH).'main/social/groups.php?id='.$group_id);
|
|
|
+ if ($usergroup->is_group_admin($group_id, api_get_user_id())) {
|
|
|
+ $html .= '<div id="edit_image" class="hidden_message" style="display:none"><a href="'.api_get_path(WEB_PATH).'main/social/group_edit.php?id='.$group_id.'">'.get_lang('EditGroup').'</a></div>';
|
|
|
+ }
|
|
|
+ $html .= '</div>';
|
|
|
+ $html .= '</div>';
|
|
|
+ } else {
|
|
|
$img_array = UserManager::get_user_picture_path_by_id($user_id,'web',true,true);
|
|
|
$big_image = UserManager::get_picture_user($user_id, $img_array['file'],'', USER_IMAGE_SIZE_BIG);
|
|
|
$big_image = $big_image['file'];
|
|
|
$normal_image = $img_array['dir'].$img_array['file'];
|
|
|
|
|
|
- //--- User image
|
|
|
+ //--- User image
|
|
|
|
|
|
$html .= '<div class="well social-background-content">';
|
|
|
- if ($img_array['file'] != 'unknown.jpg') {
|
|
|
- $html .= '<a class="thumbnail ajax" href="'.$big_image.'"><img src='.$normal_image.' /> </a>';
|
|
|
- } else {
|
|
|
- $html .= '<img src='.$normal_image.' width="110px" />';
|
|
|
- }
|
|
|
- if (api_get_user_id() == $user_id) {
|
|
|
- $html .= '<div id="edit_image" class="hidden_message" style="display:none">';
|
|
|
- $html .= '<a href="'.api_get_path(WEB_PATH).'main/auth/profile.php">'.get_lang('EditProfile').'</a></div>';
|
|
|
- }
|
|
|
+ if ($img_array['file'] != 'unknown.jpg') {
|
|
|
+ $html .= '<a class="thumbnail ajax" href="'.$big_image.'"><img src='.$normal_image.' /> </a>';
|
|
|
+ } else {
|
|
|
+ $html .= '<img src='.$normal_image.' width="110px" />';
|
|
|
+ }
|
|
|
+ if (api_get_user_id() == $user_id) {
|
|
|
+ $html .= '<div id="edit_image" class="hidden_message" style="display:none">';
|
|
|
+ $html .= '<a href="'.api_get_path(WEB_PATH).'main/auth/profile.php">'.get_lang('EditProfile').'</a></div>';
|
|
|
+ }
|
|
|
$html .= '</div>';
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
if (!in_array($show, array('shared_profile', 'groups', 'group_edit', 'member_list','waiting_list','invite_friends'))) {
|
|
|
|
|
|
$html .= '<div class="well sidebar-nav"><ul class="nav nav-list">';
|
|
|
+
|
|
|
$active = $show=='home' ? 'active' : null;
|
|
|
$html .= '<li class="'.$active.'"><a href="'.api_get_path(WEB_PATH).'main/social/home.php">'.Display::return_icon('home.png',get_lang('Home'),array()).get_lang('Home').'</a></li>';
|
|
|
- $active = $show=='messages' ? 'active' : null;
|
|
|
- $html .= '<li class="'.$active.'"><a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php?f=social">'.Display::return_icon('instant_message.png',get_lang('Messages'),array()).get_lang('Messages').$count_unread_message.'</a></li>';
|
|
|
|
|
|
- //Invitations
|
|
|
- $active = $show=='invitations' ? 'active' : null;
|
|
|
- $html .= '<li class="'.$active.'"><a href="'.api_get_path(WEB_PATH).'main/social/invitations.php">'.Display::return_icon('invitation.png',get_lang('Invitations'),array()).get_lang('Invitations').$total_invitations.'</a></li>';
|
|
|
+ if (api_get_setting('allow_message_tool') == 'true') {
|
|
|
+ $active = $show=='messages' ? 'active' : null;
|
|
|
+ $html .= '<li class="'.$active.'"><a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php?f=social">'.Display::return_icon('instant_message.png',get_lang('Messages'),array()).get_lang('Messages').$count_unread_message.'</a></li>';
|
|
|
+ }
|
|
|
+
|
|
|
+ // Invitations
|
|
|
+ if (api_get_setting('allow_message_tool') == 'true') {
|
|
|
+ $active = $show=='invitations' ? 'active' : null;
|
|
|
+ $html .= '<li class="'.$active.'"><a href="'.api_get_path(WEB_PATH).'main/social/invitations.php">'.Display::return_icon('invitation.png',get_lang('Invitations'),array()).get_lang('Invitations').$total_invitations.'</a></li>';
|
|
|
+ }
|
|
|
|
|
|
//Shared profile and groups
|
|
|
$active = $show=='shared_profile' ? 'active' : null;
|
|
@@ -535,10 +541,13 @@ class SocialManager extends UserManager {
|
|
|
|
|
|
// My own profile
|
|
|
if ($show_full_profile && $user_id == intval(api_get_user_id())) {
|
|
|
- $html .= '<li><a href="'.api_get_path(WEB_PATH).'main/social/home.php">'.Display::return_icon('home.png',get_lang('Home'),array()).get_lang('Home').'</a></li>
|
|
|
- <li><a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php?f=social">'.Display::return_icon('instant_message.png', get_lang('Messages'),array()).get_lang('Messages').$count_unread_message.'</a></li>';
|
|
|
- $active = $show=='invitations' ? 'active' : null;
|
|
|
- $html .= '<li class="'.$active.'"><a href="'.api_get_path(WEB_PATH).'main/social/invitations.php">'.Display::return_icon('invitation.png',get_lang('Invitations'),array()).get_lang('Invitations').$total_invitations.'</a></li>';
|
|
|
+ $html .= '<li><a href="'.api_get_path(WEB_PATH).'main/social/home.php">'.Display::return_icon('home.png',get_lang('Home'),array()).get_lang('Home').'</a></li>';
|
|
|
+
|
|
|
+ if (api_get_setting('allow_message_tool') == 'true') {
|
|
|
+ $html .= '<li><a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php?f=social">'.Display::return_icon('instant_message.png', get_lang('Messages'),array()).get_lang('Messages').$count_unread_message.'</a></li>';
|
|
|
+ $active = $show=='invitations' ? 'active' : null;
|
|
|
+ $html .= '<li class="'.$active.'"><a href="'.api_get_path(WEB_PATH).'main/social/invitations.php">'.Display::return_icon('invitation.png',get_lang('Invitations'),array()).get_lang('Invitations').$total_invitations.'</a></li>';
|
|
|
+ }
|
|
|
|
|
|
$html .= '<li class="active"><a href="'.api_get_path(WEB_PATH).'main/social/profile.php">'.Display::return_icon('my_shared_profile.png', get_lang('ViewMySharedProfile'), array('style'=>'float:left')).''.get_lang('ViewMySharedProfile').'</a></li>
|
|
|
<li><a href="'.api_get_path(WEB_PATH).'main/social/friends.php">'.Display::return_icon('friend.png',get_lang('Friends'),array()).get_lang('Friends').'</a></li>
|
|
@@ -551,19 +560,22 @@ class SocialManager extends UserManager {
|
|
|
|
|
|
// My friend profile
|
|
|
|
|
|
- if ($user_id != api_get_user_id()) {
|
|
|
- $html .= '<li><a href="javascript:void(0);" onclick="javascript:send_message_to_user(\''.$user_id.'\');" title="'.get_lang('SendMessage').'">';
|
|
|
- $html .= Display::return_icon('compose_message.png',get_lang('SendMessage')).' '.get_lang('SendMessage').'</a></li>';
|
|
|
- }
|
|
|
+ if (api_get_setting('allow_message_tool') == 'true') {
|
|
|
+
|
|
|
+ if ($user_id != api_get_user_id()) {
|
|
|
+ $html .= '<li><a href="javascript:void(0);" onclick="javascript:send_message_to_user(\''.$user_id.'\');" title="'.get_lang('SendMessage').'">';
|
|
|
+ $html .= Display::return_icon('compose_message.png',get_lang('SendMessage')).' '.get_lang('SendMessage').'</a></li>';
|
|
|
+ }
|
|
|
|
|
|
- //check if I already sent an invitation message
|
|
|
- $invitation_sent_list = SocialManager::get_list_invitation_sent_by_user_id(api_get_user_id());
|
|
|
+ //check if I already sent an invitation message
|
|
|
+ $invitation_sent_list = SocialManager::get_list_invitation_sent_by_user_id(api_get_user_id());
|
|
|
|
|
|
- if (isset($invitation_sent_list[$user_id]) && is_array($invitation_sent_list[$user_id]) && count($invitation_sent_list[$user_id]) > 0 ) {
|
|
|
- $html .= '<li><a href="'.api_get_path(WEB_PATH).'main/social/invitations.php">'.Display::return_icon('invitation.png',get_lang('YouAlreadySentAnInvitation')).' '.get_lang('YouAlreadySentAnInvitation').'</a></li>';
|
|
|
- } else {
|
|
|
- if (!$show_full_profile) {
|
|
|
- $html .= '<li><a href="javascript:void(0);" onclick="javascript:send_invitation_to_user(\''.$user_id.'\');" title="'.get_lang('SendInvitation').'">'.Display :: return_icon('invitation.png', get_lang('SocialInvitationToFriends')).' '.get_lang('SendInvitation').'</a></li>';
|
|
|
+ if (isset($invitation_sent_list[$user_id]) && is_array($invitation_sent_list[$user_id]) && count($invitation_sent_list[$user_id]) > 0 ) {
|
|
|
+ $html .= '<li><a href="'.api_get_path(WEB_PATH).'main/social/invitations.php">'.Display::return_icon('invitation.png',get_lang('YouAlreadySentAnInvitation')).' '.get_lang('YouAlreadySentAnInvitation').'</a></li>';
|
|
|
+ } else {
|
|
|
+ if (!$show_full_profile) {
|
|
|
+ $html .= '<li><a href="javascript:void(0);" onclick="javascript:send_invitation_to_user(\''.$user_id.'\');" title="'.get_lang('SendInvitation').'">'.Display :: return_icon('invitation.png', get_lang('SocialInvitationToFriends')).' '.get_lang('SendInvitation').'</a></li>';
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|