|
|
|
@ -566,43 +566,22 @@ class SocialManager extends UserManager |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Shows the right menu of the Social Network tool |
|
|
|
|
* Shows the avatar block in social pages |
|
|
|
|
* |
|
|
|
|
* @param string highlight link possible values: group_add, home, messages, messages_inbox, messages_compose ,messages_outbox ,invitations, shared_profile, friends, groups search |
|
|
|
|
* @param int group id |
|
|
|
|
* @param int user id |
|
|
|
|
* @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_avatar_block($show = '', $group_id = 0, $user_id = 0) |
|
|
|
|
{ |
|
|
|
|
if (empty($user_id)) { |
|
|
|
|
$user_id = api_get_user_id(); |
|
|
|
|
} |
|
|
|
|
$user_info = api_get_user_info($user_id, true); |
|
|
|
|
|
|
|
|
|
$current_user_id = api_get_user_id(); |
|
|
|
|
$current_user_info = api_get_user_info($current_user_id, true); |
|
|
|
|
|
|
|
|
|
if ($current_user_id == $user_id) { |
|
|
|
|
$user_friend_relation = null; |
|
|
|
|
} else { |
|
|
|
|
$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'); |
|
|
|
|
|
|
|
|
|
// 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) : null; |
|
|
|
|
|
|
|
|
|
$number_of_new_messages_of_friend = SocialManager::get_message_number_invitation_by_user_id(api_get_user_id()); |
|
|
|
|
$group_pending_invitations = GroupPortalManager::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">'; |
|
|
|
|
$html = ''; |
|
|
|
|
if (in_array($show, $show_groups) && !empty($group_id)) { |
|
|
|
|
//--- Group image |
|
|
|
|
$group_info = GroupPortalManager::get_group_data($group_id); |
|
|
|
@ -638,6 +617,47 @@ class SocialManager extends UserManager |
|
|
|
|
} |
|
|
|
|
$html .= '</div>'; |
|
|
|
|
} |
|
|
|
|
return $html; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Shows the right menu of the Social Network tool |
|
|
|
|
* |
|
|
|
|
* @param string highlight link possible values: group_add, home, messages, messages_inbox, messages_compose ,messages_outbox ,invitations, shared_profile, friends, groups search |
|
|
|
|
* @param int group id |
|
|
|
|
* @param int user id |
|
|
|
|
* @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) |
|
|
|
|
{ |
|
|
|
|
if (empty($user_id)) { |
|
|
|
|
$user_id = api_get_user_id(); |
|
|
|
|
} |
|
|
|
|
$user_info = api_get_user_info($user_id, true); |
|
|
|
|
|
|
|
|
|
$current_user_id = api_get_user_id(); |
|
|
|
|
$current_user_info = api_get_user_info($current_user_id, true); |
|
|
|
|
|
|
|
|
|
if ($current_user_id == $user_id) { |
|
|
|
|
$user_friend_relation = null; |
|
|
|
|
} else { |
|
|
|
|
$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'); |
|
|
|
|
|
|
|
|
|
// 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) : null; |
|
|
|
|
|
|
|
|
|
$number_of_new_messages_of_friend = SocialManager::get_message_number_invitation_by_user_id(api_get_user_id()); |
|
|
|
|
$group_pending_invitations = GroupPortalManager::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 = ''; |
|
|
|
|
|
|
|
|
|
if (!in_array($show, array('shared_profile', 'groups', 'group_edit', 'member_list', 'waiting_list', 'invite_friends'))) { |
|
|
|
|
|
|
|
|
@ -788,7 +808,7 @@ class SocialManager extends UserManager |
|
|
|
|
$html .= Display::url(Display::return_icon('delete.png', get_lang('Unsubscribe'), array(), ICON_SIZE_TINY).get_lang('Unsubscribe'), $url); |
|
|
|
|
$html .= '</li></ul></div>'; |
|
|
|
|
} |
|
|
|
|
$html .= '</div>'; |
|
|
|
|
$html .= ''; |
|
|
|
|
return $html; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|