$show_message = Display::return_message(get_lang('UserIsSubscribedToThisGroup'), 'success'); } elseif (in_array($user_role, array(GROUP_USER_PERMISSION_READER, GROUP_USER_PERMISSION_ADMIN, GROUP_USER_PERMISSION_MODERATOR))) { $show_message = Display::return_message(get_lang('UserIsAlreadySubscribedToThisGroup'), 'warning'); } else { $show_message = Display::return_message(get_lang('UserIsNotSubscribedToThisGroup'), 'warning'); } break 2; case 'deny': // delete invitation $usergroup->delete_user_rel_group(api_get_user_id(), $value); $show_message = Display::return_message(get_lang('GroupInvitationWasDeny')); break 2; } } } $social_left_content = SocialManager::show_social_menu('invitations'); $social_right_content = '<div id="id_response" align="center"></div>'; $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) { $social_right_content .= '<div class="span8"><a class="btn" href="search.php">' . get_lang('TryAndFindSomeFriends') . '</a></div>'; } if ($number_loop != 0) { $social_right_content .= '<div class="span8">' . Display::page_subheader(get_lang('InvitationReceived')) . '</div>'; foreach ($list_get_invitation as $invitation) { $sender_user_id = $invitation['user_sender_id']; $userInfo = api_get_user_info($sender_user_id);
if (api_get_setting('social.allow_social_tool') == 'true' && api_get_setting('message.allow_message_tool') == 'true') { $social_right_content .= '<a href="' . api_get_path(WEB_PATH) . 'main/social/profile.php">' . Display::return_icon('shared_profile.png', get_lang('ViewSharedProfile')) . '</a>'; } if (api_get_setting('message.allow_message_tool') == 'true') { $social_right_content .= '<a href="' . api_get_path(WEB_PATH) . 'main/messages/new_message.php">' . Display::return_icon('message_new.png', get_lang('ComposeMessage')) . '</a>'; $social_right_content .= '<a href="' . api_get_path(WEB_PATH) . 'main/messages/inbox.php">' . Display::return_icon('inbox.png', get_lang('Inbox')) . '</a>'; $social_right_content .= '<a href="' . api_get_path(WEB_PATH) . 'main/messages/outbox.php">' . Display::return_icon('outbox.png', get_lang('Outbox')) . '</a>'; } $social_right_content .= '</div>'; } } // LEFT COLUMN $social_left_content = null; if (api_get_setting('social.allow_social_tool') == 'true') { //Block Social Menu $social_menu_block = SocialManager::show_social_menu('messages'); $social_right_content .= '<div class="row">'; $social_right_content .= '<div class="col-md-12">'; $social_right_content .= '<div class="actions">'; $social_right_content .= '<a href="' . api_get_path(WEB_PATH) . 'main/messages/inbox.php?f=social">' . Display::return_icon('back.png', get_lang('Back'), array(), 32) . '</a>'; $social_right_content .= '</div>'; $social_right_content .= '</div>'; $social_right_content .= '<div class="col-md-12">'; } // MAIN CONTENT if (!isset($_POST['compose'])) { if (isset($_GET['re_id'])) { $social_right_content .= show_compose_reply_to_message($_GET['re_id'], api_get_user_id()); } elseif (isset($_GET['send_to_user'])) { $social_right_content .= show_compose_to_user($_GET['send_to_user']); } else {
if (isset($_GET['action']) && $_GET['action']=='set_moderator') { // we add a user only if is a open group $user_moderator= intval($_GET['u']); //if i'm the admin if (GroupPortalManager::is_group_admin($group_id)) { GroupPortalManager::update_user_role($user_moderator, $group_id, GROUP_USER_PERMISSION_MODERATOR); $show_message = get_lang('UserChangeToModerator'); } } $users = GroupPortalManager::get_users_by_group($group_id, true, array(GROUP_USER_PERMISSION_PENDING_INVITATION_SENT_BY_USER), 0, 1000); $new_member_list = array(); $social_avatar_block = SocialManager::show_social_avatar_block('waiting_list', $group_id); $social_menu_block = SocialManager::show_social_menu('waiting_list', $group_id); if (!empty($show_message)){ $social_right_content .= Display :: return_message($show_message); } // Display form foreach($users as $user) { switch ($user['relation_type']) { case GROUP_USER_PERMISSION_PENDING_INVITATION_SENT_BY_USER: $user['link'] = '<a href="group_waiting_list.php?id='.$group_id.'&u='.$user['user_id'].'&action=accept">'.Display::return_icon('invitation_friend.png', get_lang('AddNormalUser')).'</a>'; $user['link'] .= '<a href="group_waiting_list.php?id='.$group_id.'&u='.$user['user_id'].'&action=set_moderator">'.Display::return_icon('social_moderator_add.png', get_lang('AddModerator')).'</a>'; $user['link'] .= '<a href="group_waiting_list.php?id='.$group_id.'&u='.$user['user_id'].'&action=deny">'.Display::return_icon('user_delete.png', get_lang('DenyEntry')).'</a>'; break; } $new_member_list[] = $user; }
url, {}, function(responseText, textStatus, XMLHttpRequest) { dialog.dialog({ modal : true, width : 520, height : 400, }); }); //prevent the browser to follow the link return false; }); }); </script>'; $this_section = SECTION_SOCIAL; $interbreadcrumb[] = array('url' => 'groups.php', 'name' => get_lang('Groups')); $interbreadcrumb[] = array('url' => 'groups.php?id=' . $group_id, 'name' => Security::remove_XSS($group_info['name'])); //$interbreadcrumb[] = array('url' => 'groups.php?id='.$group_id.'#tabs_2', 'name' => get_lang('Discussions')); $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Discussions')); $social_left_content = SocialManager::show_social_menu('member_list', $group_id); $show_message = null; if (!empty($show_message)) { $social_right_content .= Display::return_message($show_message, 'confirmation'); } $social_right_content .= MessageManager::display_message_for_group($group_id, $topic_id, $is_member, $message_id); $social_right_content = '<div class="span9">' . $social_right_content . '</div>'; $app['title'] = get_lang('Social'); $tpl = $app['template']; $tpl->setHelp('Groups'); $tpl->assign('message', $show_message); $tpl->assign('content', $social_right_content);
if (!$usergroup->is_group_admin($group_id)) { api_not_allowed(); } // Create the form $form = new FormValidator('group_edit', 'post', '', ''); $form->addElement('hidden', 'id', $group_id); $usergroup->setGroupType($usergroup::SOCIAL_CLASS); $usergroup->setForm($form, 'edit', $group_data); // Set default values $form->setDefaults($group_data); // Validate form if ($form->validate()) { $group = $form->exportValues(); $group['id'] = $group_id; $group['type'] = $usergroup::SOCIAL_CLASS; $usergroup->update($group); $tok = Security::get_token(); header('Location: groups.php?id=' . $group_id . '&action=show_message&message=' . urlencode(get_lang('GroupUpdated')) . '&sec_token=' . $tok); exit; } $social_left_content = SocialManager::show_social_menu('group_edit', $group_id); $social_right_content = '<div class="span9">'; $social_right_content .= $form->return_form(); $social_right_content .= '</div>'; $app['title'] = $tool_name; $tpl = $app['template']; $tpl->setHelp('Groups'); $tpl->assign('social_left_content', $social_left_content); $tpl->assign('social_right_content', $social_right_content); $social_layout = $tpl->get_template('layout/social_layout.tpl'); $tpl->display($social_layout);
} else { $social_right_content .= '<div class=actions>'; if (api_get_setting('allow_social_tool') == 'true' && api_get_setting('allow_message_tool') == 'true') { $social_right_content .= '<a href="' . api_get_path(WEB_PATH) . 'main/social/profile.php">' . Display::return_icon('shared_profile.png', get_lang('ViewSharedProfile')) . '</a>'; } if (api_get_setting('allow_message_tool') == 'true') { $social_right_content .= '<a href="' . api_get_path(WEB_PATH) . 'main/messages/new_message.php">' . Display::return_icon('message_new.png', get_lang('ComposeMessage')) . '</a>'; $social_right_content .= '<a href="' . api_get_path(WEB_PATH) . 'main/messages/inbox.php">' . Display::return_icon('inbox.png', get_lang('Inbox')) . '</a>'; $social_right_content .= '<a href="' . api_get_path(WEB_PATH) . 'main/messages/outbox.php">' . Display::return_icon('outbox.png', get_lang('Outbox')) . '</a>'; } $social_right_content .= '</div>'; } } //LEFT COLUMN if (api_get_setting('allow_social_tool') == 'true') { $social_left_content = SocialManager::show_social_menu('messages'); $social_right_content = '<div class="span9">'; $social_right_content .= '<div class="actions">'; $social_right_content .= '<a href="' . api_get_path(WEB_PATH) . 'main/messages/inbox.php?f=social">' . Display::return_icon('back.png', get_lang('Back'), array(), 32) . '</a>'; $social_right_content .= '</div>'; $social_right_content .= '</div>'; $social_right_content .= '<div class="span9">'; } //MAIN CONTENT if (!isset($_POST['compose'])) { if (isset($_GET['re_id'])) { $social_right_content .= show_compose_reply_to_message($_GET['re_id'], api_get_user_id()); } elseif (isset($_GET['send_to_user'])) { $social_right_content .= show_compose_to_user($_GET['send_to_user']); } else { $social_right_content .= show_compose_to_any($_user['user_id']);
} break 2; case 'deny': // delete invitation GroupPortalManager::delete_user_rel_group( api_get_user_id(), $value ); $show_message = get_lang('GroupInvitationWasDeny'); break 2; } } } $social_avatar_block = SocialManager::show_social_avatar_block('myfiles'); $social_menu_block = SocialManager::show_social_menu('myfiles'); $actions = null; if (isset($_GET['cidReq'])) { $actions = '<a href="' . api_get_path( WEB_CODE_PATH ) . 'document/document.php?cidReq=' . Security::remove_XSS( $_GET['cidReq'] ) . '&id_session=' . Security::remove_XSS( $_GET['id_session'] ) . '&gidReq=' . Security::remove_XSS( $_GET['gidReq'] ) . '&id=' . Security::remove_XSS( $_GET['parent_id'] ) . '">' . Display::return_icon( 'back.png',
ident="#img_"+id_elem[1]; $(ident).attr("src","../img/blank.gif"); $(ident).attr("alt",""); $(ident).attr("title",""); } function clear_form () { $("input[@type=radio]").attr("checked", false); $("div#div_qualify_image").html(""); $("div#div_info_user").html(""); } </script>'; $interbreadcrumb[] = array('url' => 'profile.php', 'name' => get_lang('SocialNetwork')); $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Friends')); $social_left_content = SocialManager::show_social_menu('friends'); $user_id = api_get_user_id(); $user_id = api_get_user_id(); $name_search = isset($_POST['search_name_q']) ? $_POST['search_name_q'] : null; $number_friends = 0; if (isset($name_search) && $name_search != 'undefined') { $friends = SocialManager::get_friends($user_id, null, $name_search); } else { $friends = SocialManager::get_friends($user_id); } $social_right_content = '<div class="span8">'; if (count($friends) == 0) { $social_right_content .= get_lang('NoFriendsInYourContactList') . '<br /><br />'; $social_right_content .= '<a class="btn" href="search.php">' . get_lang('TryAndFindSomeFriends') . '</a>'; } else { $social_right_content .= get_lang('Search') . ' : ';
api_not_allowed(); } if (api_get_setting('allow_students_to_create_groups_in_social') == 'false' && !api_is_allowed_to_edit()) { api_not_allowed(); } $table_message = Database::get_main_table(TABLE_MESSAGE); $usergroup = new UserGroup(); $form = new FormValidator('add_group'); $usergroup->setGroupType($usergroup::SOCIAL_CLASS); $usergroup->setForm($form, 'add', array()); if ($form->validate()) { $values = $form->exportValues(); $groupId = $usergroup->save($values); header('Location: groups.php?id=' . $groupId . '&action=show_message&message=' . urlencode(get_lang('GroupAdded'))); exit; } $nameTools = get_lang('AddGroup'); $this_section = SECTION_SOCIAL; $interbreadcrumb[] = array('url' => 'home.php', 'name' => get_lang('Social')); $interbreadcrumb[] = array('url' => 'groups.php', 'name' => get_lang('Groups')); $interbreadcrumb[] = array('url' => '#', 'name' => $nameTools); $social_left_content = SocialManager::show_social_menu('group_add'); $social_right_content = '<div class="span9">'; $social_right_content .= $form->return_form(); $social_right_content .= '</div>'; $tpl = $app['template']; $tpl->setHelp('Groups'); $tpl->assign('social_left_content', $social_left_content); $tpl->assign('social_right_content', $social_right_content); $social_layout = $tpl->get_template('layout/social_layout.tpl'); $tpl->display($social_layout);
//deleting anonymous users $user_anonymous = api_get_anonymous_id(); foreach ($nosessionUsersList as $key_user_list => $value_user_list) { if ($nosessionUsersList[$key_user_list]['user_id'] == $user_anonymous) { unset($nosessionUsersList[$key_user_list]); } } } if ($add_type == 'multiple') { $link_add_type_unique = '<a href="' . api_get_self() . '?id=' . $group_id . '&add_type=unique">' . Display::return_icon('single.gif') . get_lang('SessionAddTypeUnique') . '</a>'; $link_add_type_multiple = Display::return_icon('multiple.gif') . get_lang('SessionAddTypeMultiple'); } else { $link_add_type_unique = Display::return_icon('single.gif') . get_lang('SessionAddTypeUnique'); $link_add_type_multiple = '<a href="' . api_get_self() . '?id=' . $group_id . '&add_type=multiple">' . Display::return_icon('multiple.gif') . get_lang('SessionAddTypeMultiple') . '</a>'; } $social_left_content = SocialManager::show_social_menu('invite_friends', $group_id); $social_right_content = '<h2>' . Security::remove_XSS($group_info['name'], STUDENT, true) . '</h2>'; if (count($nosessionUsersList) == 0) { $friends = SocialManager::get_friends(api_get_user_id()); if ($friends == 0) { $social_right_content .= get_lang('YouNeedToHaveFriendsInYourSocialNetwork'); } else { $social_right_content .= get_lang('YouAlreadyInviteAllYourContacts'); } $social_right_content .= '<div>'; $social_right_content .= '<a href="search.php">' . get_lang('TryAndFindSomeFriends') . '</a>'; $social_right_content .= '</div>'; } $add_true = null; $ajax = null; if (!empty($_GET['add'])) {
$(ident).attr("src","../img/blank.gif"); $(ident).attr("alt",""); $(ident).attr("title",""); } function clear_form () { $("input[@type=radio]").attr("checked", false); $("div#div_qualify_image").html(""); $("div#div_info_user").html(""); } </script>'; $interbreadcrumb[] = array('url' => 'profile.php', 'name' => get_lang('SocialNetwork')); $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Friends')); //Block Social Menu $social_menu_block = SocialManager::show_social_menu('friends'); $user_id = api_get_user_id(); $name_search = isset($_POST['search_name_q']) ? $_POST['search_name_q'] : null; $number_friends = 0; if (isset($name_search) && $name_search != 'undefined') { $friends = SocialManager::get_friends($user_id, null, $name_search); } else { $friends = SocialManager::get_friends($user_id); } $social_right_content = '<div class="col-md-12">'; if (count($friends) == 0) { $social_right_content .= Display::return_message(Display::tag('p', get_lang('NoFriendsInYourContactList')), 'warning', false); $social_right_content .= Display::toolbarButton(get_lang('TryAndFindSomeFriends'), 'search.php', 'search', 'success'); } else { $filterForm = new FormValidator('filter'); $filterForm->addText('id_search_image', get_lang('Search'), false, ['onkeyup' => 'search_image_social()', 'id' => 'id_search_image']);
$course_list_code = array(); $i = 1; if (is_array($personal_course_list)) { foreach ($personal_course_list as $my_course) { if ($i <= 10) { $list[$my_course['code']] = SocialManager::get_logged_user_course_html($my_course, $i); $course_list_code[] = array('code' => $my_course['code']); } else { break; } $i++; } //to avoid repeted courses $course_list_code = ArrayClass::array_unique_dimensional($course_list_code); } $social_left_content = SocialManager::show_social_menu('shared_profile', null, $user_id, $show_full_profile); $personal_info = null; if (!empty($user_info['firstname']) || !empty($user_info['lastname'])) { $personal_info .= '<div><h3>' . api_get_person_name($user_info['firstname'], $user_info['lastname']) . '</h3></div>'; } else { //--- Basic Information $personal_info .= '<div><h3>' . get_lang('Profile') . '</h3></div>'; } if ($show_full_profile) { $personal_info .= '<dl class="dl-horizontal">'; $personal_info .= '<dt>' . get_lang('UserName') . '</dt><dd>' . $user_info['username'] . ' </dd>'; if (!empty($user_info['firstname']) || !empty($user_info['lastname'])) { $personal_info .= '<dt>' . get_lang('Name') . '</dt><dd>' . api_get_person_name($user_info['firstname'], $user_info['lastname']) . '</dd>'; } if (!empty($user_info['official_code'])) { $personal_info .= '<dt>' . get_lang('OfficialCode') . '</dt><dd>' . $user_info['official_code'] . '</dd>';
$usergroup->delete_user_rel_group($user_join, $group_id); $show_message = get_lang('UserDeleted'); } } if (isset($_GET['action']) && $_GET['action'] == 'set_moderator') { // we add a user only if is a open group $user_moderator = intval($_GET['u']); //if i'm the admin if ($usergroup->is_group_admin($group_id)) { $usergroup->update_user_role($user_moderator, $group_id, GROUP_USER_PERMISSION_MODERATOR); $show_message = get_lang('UserChangeToModerator'); } } $users = $usergroup->get_users_by_group($group_id, true, array(GROUP_USER_PERMISSION_PENDING_INVITATION_SENT_BY_USER), 0, 1000); $new_member_list = array(); $social_left_content = SocialManager::show_social_menu('waiting_list', $group_id); if (!empty($show_message)) { $social_right_content .= Display::return_message($show_message); } // Display form foreach ($users as $user) { switch ($user['relation_type']) { case GROUP_USER_PERMISSION_PENDING_INVITATION_SENT_BY_USER: $user['link'] = '<a href="group_waiting_list.php?id=' . $group_id . '&u=' . $user['user_id'] . '&action=accept">' . Display::return_icon('invitation_friend.png', get_lang('AddNormalUser')) . '</a>'; $user['link'] .= '<a href="group_waiting_list.php?id=' . $group_id . '&u=' . $user['user_id'] . '&action=set_moderator">' . Display::return_icon('social_moderator_add.png', get_lang('AddModerator')) . '</a>'; $user['link'] .= '<a href="group_waiting_list.php?id=' . $group_id . '&u=' . $user['user_id'] . '&action=deny">' . Display::return_icon('user_delete.png', get_lang('DenyEntry')) . '</a>'; break; } $new_member_list[] = $user; } $social_right_content = '<div class="span9">';
type: "POST", url: "' . api_get_path(WEB_AJAX_PATH) . 'social.ajax.php?a=add_friend", data: "friend_id="+user_friend_id+"&is_my_friend="+"friend", success: function(data) { $("div#"+name_div_id).hide("slow"); $("#id_response").html(data); } }); } } </script>'; $show_message = null; $content = null; // Block Menu Social $social_menu_block = SocialManager::show_social_menu('invitations'); // Block Invitations $socialInvitationsBlock = '<div id="id_response" align="center"></div>'; $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 .= '<div class="row"> <div class="col-md-12"> <a class="btn btn-success" href="search.php"><em class="fa fa-search"></em> ' . get_lang('TryAndFindSomeFriends') . ' </a> </div> </div>';
$form->addRule('picture', get_lang('OnlyImagesAllowed') . ' (' . implode(',', $allowed_picture_types) . ')', 'filetype', $allowed_picture_types); $form->addButtonSave(get_lang('SaveSettings'), 'apply_change'); if ($form->validate()) { $user_data = $form->getSubmitValues(); // upload picture if a new one is provided if ($_FILES['picture']['size']) { if ($new_picture = UserManager::update_user_picture(api_get_user_id(), $_FILES['picture']['name'], $_FILES['picture']['tmp_name'])) { $table_user = Database::get_main_table(TABLE_MAIN_USER); $sql = "UPDATE {$table_user}\n SET picture_uri = '{$new_picture}' WHERE user_id = " . api_get_user_id(); $result = Database::query($sql); } } } } //Block Menu $social_menu_block = SocialManager::show_social_menu('home'); $social_search_block = Display::panel(UserManager::get_search_form(''), get_lang("SearchUsers")); $results = $userGroup->get_groups_by_age(1, false); $groups_newest = array(); if (!empty($results)) { foreach ($results as $result) { $id = $result['id']; $result['description'] = Security::remove_XSS($result['description'], STUDENT, true); $result['name'] = Security::remove_XSS($result['name'], STUDENT, true); if ($result['count'] == 1) { $result['count'] = '1 ' . get_lang('Member'); } else { $result['count'] = $result['count'] . ' ' . get_lang('Members'); } $group_url = "group_view.php?id={$id}"; $result['name'] = '<div class="group-name">' . Display::url(api_ucwords(cut($result['name'], 40, true)), $group_url) . '</div><div class="count-username">' . Display::return_icon('user.png', '', '', ICON_SIZE_TINY) . $result['count'] . '</div>';
$tool_name = get_lang('Search'); $interbreadcrumb[] = array('url' => 'profile.php', 'name' => get_lang('SocialNetwork')); $query = isset($_GET['q']) ? Security::remove_XSS($_GET['q']) : null; $query_search_type = isset($_GET['search_type']) && in_array($_GET['search_type'], array('0', '1', '2')) ? $_GET['search_type'] : null; $extra_fields = UserManager::get_extra_filtrable_fields(); $query_vars = array('q' => $query, 'search_type' => $query_search_type); if (!empty($extra_fields)) { foreach ($extra_fields as $extra_field) { $field_name = 'field_' . $extra_field['variable']; if (isset($_GET[$field_name]) && $_GET[$field_name] != '0') { $query_vars[$field_name] = $_GET[$field_name]; } } } //Block Social Menu $social_menu_block = SocialManager::show_social_menu('search'); $social_right_content = ''; $searchForm = UserManager::get_search_form($query); $groups = array(); $totalGroups = array(); $users = array(); $totalUsers = array(); $usergroup = new UserGroup(); // I'm searching something if ($query != '' || $query_vars['search_type'] == '1' && count($query_vars) > 2) { $itemPerPage = 9; if ($_GET['search_type'] == '0' || $_GET['search_type'] == '1') { $page = isset($_GET['users_page_nr']) ? intval($_GET['users_page_nr']) : 1; $totalUsers = UserManager::get_all_user_tags($_GET['q'], 0, 0, $itemPerPage, true); $from = intval(($page - 1) * $itemPerPage); // Get users from tags
if ($group_id != 0) { $social_avatar_block = SocialManager::show_social_avatar_block( 'groups', $group_id ); $social_menu_block = SocialManager::show_social_menu('groups', $group_id); } else { $show_menu = 'browse_groups'; if (isset($_GET['view']) && $_GET['view'] == 'mygroups') { $show_menu = $_GET['view']; } $social_avatar_block = SocialManager::show_social_avatar_block( $show_menu, $group_id ); $social_menu_block = SocialManager::show_social_menu($show_menu, $group_id); } $social_right_content = null; if ($group_id != 0) { $group_info = GroupPortalManager::get_group_data($group_id); //Loading group information if (isset($_GET['status']) && $_GET['status'] == 'sent') { $social_right_content .= Display::return_message( get_lang('MessageHasBeenSent'), 'confirmation', false );
$member_content .= Display::div('<img class="social-groups-image" src="' . $userPicture . '"/> ' . $member_name); $member_content .= '</div>'; } } } if (!empty($create_thread_link)) { $create_thread_link = Display::div($create_thread_link, array('class' => 'pull-right')); } $headers = array(get_lang('Discussions'), get_lang('Members')); $social_right_content .= Display::tabs($headers, array($content, $member_content), 'tabs'); } else { // if I already sent an invitation message if (!in_array($role, array(GROUP_USER_PERMISSION_PENDING_INVITATION_SENT_BY_USER, GROUP_USER_PERMISSION_PENDING_INVITATION))) { $social_right_content .= '<a class="btn" href="group_view.php?id=' . $group_id . '&action=join&u=' . api_get_user_id() . '">' . get_lang('JoinGroup') . '</a>'; } elseif ($role == GROUP_USER_PERMISSION_PENDING_INVITATION) { $social_right_content .= '<a class="btn" href="group_view.php?id=' . $group_id . '&action=join&u=' . api_get_user_id() . '">' . get_lang('YouHaveBeenInvitedJoinNow') . '</a>'; } } $tpl = new Template(null); // Block Social Avatar SocialManager::setSocialUserBlock($tpl, $user_id, 'groups', $group_id); //Block Social Menu $social_menu_block = SocialManager::show_social_menu('groups', $group_id); $tpl->setHelp('Groups'); $tpl->assign('create_link', $create_thread_link); $tpl->assign('is_group_member', $is_group_member); $tpl->assign('group_info', $group_info); $tpl->assign('social_menu_block', $social_menu_block); $tpl->assign('social_right_content', $social_right_content); $social_layout = $tpl->get_template('social/group_view.tpl'); $tpl->display($social_layout);
* Initialization */ // name of the language file that needs to be included $language_file = array('registration', 'admin', 'userInfo'); $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; $tool_name = get_lang('Search'); $interbreadcrumb[] = array('url' => 'profile.php', 'name' => get_lang('SocialNetwork')); $query_vars = array(); $query = isset($_GET['q']) ? $_GET['q'] : null; $social_left_content = SocialManager::show_social_menu('search'); $social_right_content = '<div class="span9">' . UserManager::get_search_form($query) . '</div>'; $usergroup = new UserGroup(); //I'm searching something if ($query != '') { //get users from tags $users = UserManager::get_all_user_tags($_GET['q'], 0, 0, 5); $groups = $usergroup->get_all_group_tags($_GET['q']); if (empty($users) && empty($groups)) { $social_right_content .= get_lang('SorryNoResults'); } $results = '<div id="online_grid_container"><div class="col-md-12">'; if (is_array($users) && count($users) > 0) { $results .= Display::page_subheader(get_lang('Users')); $results .= '<ul class="thumbnails">'; foreach ($users as $user) {
$social_right_content .= '</div>'; } } if (empty($_GET['id'])) { $id_message = $_GET['id_send']; $source = 'outbox'; $show_menu = 'messages_outbox'; } else { $id_message = $_GET['id']; $source = 'inbox'; $show_menu = 'messages_inbox'; } $message = ''; //LEFT COLUMN if (api_get_setting('allow_social_tool') == 'true') { $social_left_content = SocialManager::show_social_menu($show_menu); $message .= '<div class="span9">'; } //MAIN CONTENT $message .= MessageManager::show_message_box($id_message, $source); if (api_get_setting('allow_social_tool') == 'true') { $message .= '</div>'; } if (!empty($message)) { $social_right_content .= $message; } else { api_not_allowed(); } $app['title'] = get_lang('View'); $tpl = $app['template']; if (api_get_setting('allow_social_tool') == 'true') {
if (count($grid_newest_groups) > 0) { $newest_content = Display::return_sortable_grid('mygroups', array(), $grid_newest_groups, array('hide_navigation' => true, 'per_page' => 100), $query_vars, false, array(true, true, true, false)); } if (count($grid_pop_groups) > 0) { $popular_content = Display::return_sortable_grid('mygroups', array(), $grid_pop_groups, array('hide_navigation' => true, 'per_page' => 100), $query_vars, false, array(true, true, true, true, true)); } } if (!empty($create_group_item)) { $social_right_content .= Display::page_subheader($create_group_item); } $headers = array(get_lang('Newest'), get_lang('Popular'), get_lang('MyGroups')); $social_right_content .= Display::tabs($headers, array($newest_content, $popular_content, $my_group_content), 'tab_browse'); $show_message = null; if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'show_message' && isset($_REQUEST['msg']) && $_REQUEST['msg'] == 'topic_deleted') { $show_message = Display::return_message(get_lang('Deleted'), 'success'); } $tpl = new Template(null); // Block Social Avatar SocialManager::setSocialUserBlock($tpl, $user_id, $show_menu); $show_menu = 'browse_groups'; if (isset($_GET['view']) && $_GET['view'] == 'mygroups') { $show_menu = $_GET['view']; } $social_menu_block = SocialManager::show_social_menu($show_menu); $templateName = 'social/groups.tpl'; $tpl->setHelp('Groups'); $tpl->assign('message', $show_message); $tpl->assign('social_menu_block', $social_menu_block); $tpl->assign('social_right_content', $social_right_content); $social_layout = $tpl->get_template($templateName); $tpl->display($social_layout);
$form->addRule('picture', get_lang('OnlyImagesAllowed') . ' (' . implode(',', $allowed_picture_types) . ')', 'filetype', $allowed_picture_types); $form->addElement('style_submit_button', 'apply_change', get_lang('SaveSettings'), 'class="save"'); if ($form->validate()) { $user_data = $form->getSubmitValues(); // upload picture if a new one is provided if ($_FILES['picture']['size']) { if ($new_picture = UserManager::update_user_picture(api_get_user_id(), $_FILES['picture']['name'], $_FILES['picture']['tmp_name'])) { $table_user = Database::get_main_table(TABLE_MAIN_USER); $sql = "UPDATE {$table_user} SET picture_uri = '{$new_picture}' WHERE user_id = " . api_get_user_id(); $result = Database::query($sql); } } } } $user_info = UserManager::get_user_info_by_id(api_get_user_id()); $social_left_content = SocialManager::show_social_menu('home'); $usergroup = new UserGroup(); $social_right_content = '<div class="span5">'; $social_right_content .= '<div class="well_border">'; $social_right_content .= '<h3>' . get_lang('ContactInformation') . '</h3>'; $list = array(array('title' => get_lang('Name'), 'content' => api_get_person_name($user_info['firstname'], $user_info['lastname'])), array('title' => get_lang('Email'), 'content' => $user_info['email'])); // Current user information $social_right_content .= '<div>' . Display::description($list) . '</div>'; $social_right_content .= ' <div class="form-actions"> <a class="btn" href="' . api_get_path(WEB_PATH) . 'main/auth/profile.php"> ' . get_lang('EditProfile') . ' </a> </div> </div>'; if (api_get_setting('allow_skills_tool') == 'true') {
exit; } } $social_right_content = null; // This if statement prevents users accessing the who's online feature when it has been disabled. if (api_get_setting('showonline', 'world') == 'true' && !$_user['user_id'] || (api_get_setting('showonline', 'users') == 'true' || api_get_setting('showonline', 'course') == 'true') && $_user['user_id']) { if (isset($_GET['cidReq']) && strlen($_GET['cidReq']) > 0) { $user_list = Online::who_is_online_in_this_course(0, 9, api_get_user_id(), api_get_setting('time_limit_whosonline'), $_GET['cidReq']); } else { $user_list = Online::who_is_online(0, 9); } if (!isset($_GET['id'])) { if (api_get_setting('allow_social_tool') == 'true') { if (!api_is_anonymous()) { //this include the social menu div $social_left_content = SocialManager::show_social_menu('whoisonline'); } } } if ($user_list) { if (!isset($_GET['id'])) { if (api_get_setting('allow_social_tool') == 'true') { if (!api_is_anonymous()) { $query = isset($_GET['q']) ? $_GET['q'] : null; $social_right_content .= '<div class="span9">' . UserManager::get_search_form($query) . '</div>'; } } $social_right_content .= SocialManager::display_user_list($user_list); } } if (isset($_GET['id'])) {
} $show = isset($_GET['show']) ? '&show=' . Security::remove_XSS($_GET['show']) : ''; if (isset($_GET['type']) && $_GET['type'] == 'extended') { $actions .= '<a href="profile.php?type=reduced' . $show . '">' . Display::return_icon('edit.png', get_lang('EditNormalProfile'), '', 16) . '</a>'; } else { $actions .= '<a href="profile.php?type=extended' . $show . '">' . Display::return_icon('edit.png', get_lang('EditExtendProfile'), '', 16) . '</a>'; } $actions .= '</div>'; } } $show_delete_account_button = api_get_setting('platform_unsubscribe_allowed') == 'true' ? true : false; $tpl = new Template(get_lang('ModifyProfile')); $tpl->assign('actions', $actions); SocialManager::setSocialUserBlock($tpl, $user_id, 'messages'); if (api_get_setting('social.allow_social_tool') == 'true') { SocialManager::setSocialUserBlock($tpl, api_get_user_id(), 'home'); $menu = SocialManager::show_social_menu('home', null, api_get_user_id(), false, $show_delete_account_button); $tpl->assign('social_menu_block', $menu); $tpl->assign('social_right_content', $form->returnForm()); $social_layout = $tpl->get_template('social/edit_profile.tpl'); $tpl->display($social_layout); } else { $bigImage = UserManager::getUserPicture(api_get_user_id(), USER_IMAGE_SIZE_BIG); $normalImage = UserManager::getUserPicture(api_get_user_id(), USER_IMAGE_SIZE_ORIGINAL); $imageToShow = '<div id="image-message-container">'; $imageToShow .= '<a class="expand-image" href="' . $bigImage . '" /><img src="' . $normalImage . '"></a>'; $imageToShow .= '</div>'; $content = $imageToShow . $form->returnForm(); $tpl->assign('content', $content); $tpl->display_one_col_template(); }
<a href="groups.php?id=' . $group_id . '">' . Security::remove_XSS( $group_info['name'], STUDENT, true ) . '</a> <span class="divider">/</span> <a href="groups.php?id=' . $group_id . '#tabs_2">' . get_lang( 'Discussions' ) . '</a> </div> '; $social_avatar_block = SocialManager::show_social_avatar_block( 'member_list', $group_id ); $social_menu_block = SocialManager::show_social_menu('member_list', $group_id); if (!empty($show_message)) { $social_right_content .= Display::return_message( $show_message, 'confirmation' ); } $social_right_content .= MessageManager::display_message_for_group( $group_id, $topic_id, $is_member, $message_id );
api_not_allowed(); } $table_message = Database::get_main_table(TABLE_MESSAGE); $usergroup = new UserGroup(); $form = new FormValidator('add_group'); $usergroup->setGroupType($usergroup::SOCIAL_CLASS); $usergroup->setForm($form, 'add', array()); if ($form->validate()) { $values = $form->exportValues(); $values['group_type'] = UserGroup::SOCIAL_CLASS; $values['relation_type'] = GROUP_USER_PERMISSION_ADMIN; $groupId = $usergroup->save($values); Display::addFlash(DIsplay::return_message(get_lang('GroupAdded'))); header('Location: group_view.php?id=' . $groupId); exit; } $nameTools = get_lang('AddGroup'); $this_section = SECTION_SOCIAL; $interbreadcrumb[] = array('url' => 'home.php', 'name' => get_lang('Social')); $interbreadcrumb[] = array('url' => 'groups.php', 'name' => get_lang('Groups')); $interbreadcrumb[] = array('url' => '#', 'name' => $nameTools); $social_avatar_block = SocialManager::show_social_avatar_block('group_add'); $social_menu_block = SocialManager::show_social_menu('group_add'); $social_right_content = $form->returnForm(); $tpl = new Template(null); SocialManager::setSocialUserBlock($tpl, $user_id, null, null); $tpl->setHelp('Groups'); $tpl->assign('social_menu_block', $social_menu_block); $tpl->assign('social_right_content', $social_right_content); $social_layout = $tpl->get_template('social/add_groups.tpl'); $tpl->display($social_layout);
$list = []; if (is_array($personal_course_list)) { foreach ($personal_course_list as $my_course) { if ($i <= 10) { $list[] = SocialManager::get_logged_user_course_html($my_course, $i); $course_list_code[] = array('code' => $my_course['code']); } else { break; } $i++; } //to avoid repeted courses $course_list_code = array_unique_dimensional($course_list_code); } //Social Block Menu $social_menu_block = SocialManager::show_social_menu('shared_profile', null, $user_id, $show_full_profile); //Setting some session info $user_info = api_get_user_info($my_user_id); $sessionList = SessionManager::getSessionsFollowedByUser($my_user_id, $user_info['status']); // My friends $friend_html = SocialManager::listMyFriendsBlock($user_id, $link_shared, $show_full_profile); $wallSocialAddPost = SocialManager::getWallForm(); $social_wall_block = $wallSocialAddPost; // Social Post Wall $posts = SocialManager::getWallMessagesByUser($my_user_id, $friendId); $posts = empty($posts) ? '<p>' . get_lang("NoPosts") . '</p>' : $posts; $social_post_wall_block = Display::panel($posts, get_lang('Posts')); $socialAutoExtendLink = Display::url(get_lang('SeeMore'), $socialAjaxUrl . '?u=' . $my_user_id . '&a=listWallMessage&start=10&length=5', array('class' => 'nextPage next')); // Added a Jquery Function to return the Preview of OpenGraph URL Content $htmlHeadXtra[] = '<script language="JavaScript"> $(document).ready(function() {
} else { $link_add_type_unique = Display::return_icon('single.gif') . get_lang( 'SessionAddTypeUnique' ); $link_add_type_multiple = '<a href="' . api_get_self( ) . '?id=' . $group_id . '&add=' . $add . '&add_type=multiple">' . Display::return_icon( 'multiple.gif' ) . get_lang('SessionAddTypeMultiple') . '</a>'; } $social_avatar_block = SocialManager::show_social_avatar_block( 'invite_friends', $group_id ); $social_menu_block = SocialManager::show_social_menu( 'invite_friends', $group_id ); $social_right_content = '<h2>' . Security::remove_XSS( $group_info['name'], STUDENT, true ) . '</h2>'; if (count($nosessionUsersList) == 0) { $friends = SocialManager::get_friends(api_get_user_id()); if ($friends == 0) { $social_right_content .= get_lang( 'YouNeedToHaveFriendsInYourSocialNetwork' ); } else { $social_right_content .= get_lang('YouAlreadyInviteAllYourContacts');