*/ $cidReset = true; require_once '../inc/global.inc.php'; api_block_anonymous_users(); if (api_get_setting('allow_social_tool') !='true') { api_not_allowed(); } $this_section = SECTION_SOCIAL; $interbreadcrumb[] = array ('url' =>'profile.php','name' => get_lang('SocialNetwork')); $interbreadcrumb[] = array ('url' =>'#','name' => get_lang('Invitations')); $userGroup = new UserGroup(); $htmlHeadXtra[] = ' '; $show_message = null; $content = null; // Block Menu Social $social_menu_block = SocialManager::show_social_menu('invitations'); // Block Invitations $socialInvitationsBlock = '
'; $user_id = api_get_user_id(); $list_get_invitation = SocialManager::get_list_invitation_of_friends_by_user_id($user_id); $list_get_invitation_sent = SocialManager::get_list_invitation_sent_by_user_id($user_id); $pending_invitations = $userGroup->get_groups_by_user( $user_id, GROUP_USER_PERMISSION_PENDING_INVITATION ); $number_loop = count($list_get_invitation); $total_invitations = $number_loop + count($list_get_invitation_sent) + count($pending_invitations); if ($total_invitations == 0 && count($_GET) <= 0) { $socialInvitationsBlock .= '
'. get_lang('TryAndFindSomeFriends').'
'; } if ($number_loop != 0) { $invitationHtml = ''; foreach ($list_get_invitation as $invitation) { $sender_user_id = $invitation['user_sender_id']; $user_info = api_get_user_info($sender_user_id); $userPicture = $user_info['avatar']; $invitationHtml .= '
'; $title = Security::remove_XSS($invitation['title'], STUDENT, true); $content = Security::remove_XSS($invitation['content'], STUDENT, true); $date = api_convert_and_format_date($invitation['send_date'], DATE_TIME_FORMAT_LONG); $invitationHtml .= '
'; $invitationHtml .= '
'; $invitationHtml .= ''; $invitationHtml .= '
'; $invitationHtml .= '
'; $invitationHtml .= '

'.$user_info['complete_name'].':

'; $invitationHtml .= '
'.$content.'
'; $invitationHtml .= '
'.get_lang('DateSend').' : '.$date.'
'; $invitationHtml .= '
'; $invitationHtml .= '
'; $invitationHtml .= '
'; $invitationHtml .= '
'; } $socialInvitationsBlock .= Display::panel($invitationHtml, get_lang('InvitationReceived')); } if (count($list_get_invitation_sent) > 0) { $invitationSentHtml = ''; foreach ($list_get_invitation_sent as $invitation) { $sender_user_id = $invitation['user_receiver_id']; $user_info = api_get_user_info($sender_user_id); $invitationSentHtml .= '
'; $title = Security::remove_XSS($invitation['title'], STUDENT, true); $content = Security::remove_XSS($invitation['content'], STUDENT, true); $date = api_convert_and_format_date($invitation['send_date'], DATE_TIME_FORMAT_LONG); $invitationSentHtml .= '
'; $invitationSentHtml .= '
'; $invitationSentHtml .= ''; $invitationSentHtml .= '
'; $invitationSentHtml .= '
'; $invitationSentHtml .= '

'.$user_info['complete_name'].'

'; $invitationSentHtml .= '
'.$title.' : '.$content.'
'; $invitationSentHtml .= '
'. get_lang('DateSend').' : '.$date.'
'; $invitationSentHtml .= '
'; $invitationSentHtml .= '
'; } $socialInvitationsBlock .= Display::panel($invitationSentHtml, get_lang('InvitationSent')); } if (count($pending_invitations) > 0) { $new_invitation = array(); $waitingInvitation = ''; foreach ($pending_invitations as $invitation) { $picture = $userGroup->get_picture_group( $invitation['id'], $invitation['picture'], 80 ); $img = ''; $invitation['picture_uri'] = ''.$img.''; $invitation['name'] = ''.cut($invitation['name'],120,true).''; $invitation['description'] = cut($invitation['description'],220,true); $new_invitation[]=$invitation; $waitingInvitation .= '
'; $waitingInvitation .= '
'.$invitation['picture_uri'].'
'; $waitingInvitation .= '
'; $waitingInvitation .= '

'.$invitation['name'].'

'; $waitingInvitation .= '
'.$invitation['description'].'
'; $waitingInvitation .= '
'; $waitingInvitation .= ' '.get_lang('AcceptInvitation').''; $waitingInvitation .= ' '.get_lang('DenyInvitation').''; $waitingInvitation .='
'; $waitingInvitation .= '
'; } $socialInvitationsBlock .= Display::panel($waitingInvitation, get_lang('GroupsWaitingApproval')); } $tpl = new Template(null); SocialManager::setSocialUserBlock($tpl, $user_id, 'invitations'); $tpl->assign('social_menu_block', $social_menu_block); $tpl->assign('social_invitations_block',$socialInvitationsBlock); $tpl->assign('message', $show_message); $tpl->assign('content', $content); $social_layout = $tpl->get_template('social/invitations.tpl'); $tpl->display($social_layout);