* @author Isaac Flores Paz * @package chamilo.social */ $language_file = array('userInfo'); $cidReset = true; require_once '../inc/global.inc.php'; require_once api_get_path(LIBRARY_PATH).'group_portal_manager.lib.php'; if (api_get_setting('allow_social_tool') !='true') { api_not_allowed(); } $user_id = api_get_user_id(); $show_full_profile = true; //social tab $this_section = SECTION_SOCIAL; //I'm your friend? I can see your profile? if (isset($_GET['u'])) { $user_id = (int) Database::escape_string($_GET['u']); if (api_is_anonymous($user_id, true)) { api_not_allowed(true); } // It's me! if (api_get_user_id() != $user_id) { $user_info = UserManager::get_user_info_by_id($user_id); $show_full_profile = false; if (!$user_info) { // user does no exist !! api_not_allowed(true); } else { //checking the relationship between me and my friend $my_status= SocialManager::get_relation_between_contacts(api_get_user_id(), $user_id); if (in_array($my_status, array(USER_RELATION_TYPE_PARENT, USER_RELATION_TYPE_FRIEND, USER_RELATION_TYPE_GOODFRIEND))) { $show_full_profile = true; } //checking the relationship between my friend and me $my_friend_status = SocialManager::get_relation_between_contacts($user_id, api_get_user_id()); if (in_array($my_friend_status, array(USER_RELATION_TYPE_PARENT, USER_RELATION_TYPE_FRIEND, USER_RELATION_TYPE_GOODFRIEND))) { $show_full_profile = true; } else { // im probably not a good friend $show_full_profile = false; } } } else { $user_info = UserManager::get_user_info_by_id($user_id); } } else { $user_info = UserManager::get_user_info_by_id($user_id); } $libpath = api_get_path(LIBRARY_PATH); require_once api_get_path(SYS_CODE_PATH).'calendar/myagenda.inc.php'; require_once api_get_path(SYS_CODE_PATH).'announcements/announcements.inc.php'; require_once $libpath.'magpierss/rss_fetch.inc'; api_block_anonymous_users(); $htmlHeadXtra[] = ' '; $htmlHeadXtra[] = ''; $nametool = get_lang('ViewMySharedProfile'); if (isset($_GET['shared'])) { $my_link='../social/profile.php'; $link_shared='shared='.Security::remove_XSS($_GET['shared']); } else { $my_link='../social/profile.php'; $link_shared=''; } $interbreadcrumb[]= array ('url' =>'home.php','name' => get_lang('Social') ); if (isset($_GET['u']) && is_numeric($_GET['u']) && $_GET['u'] != api_get_user_id()) { $info_user = api_get_user_info($_GET['u']); $interbreadcrumb[]= array ('url' => '#','name' => api_get_person_name($info_user['firstName'], $info_user['lastName'])); $nametool = ''; } if (isset($_GET['u'])) { $param_user='u='.Security::remove_XSS($_GET['u']); }else { $info_user = api_get_user_info(api_get_user_id()); $param_user = ''; } $_SESSION['social_user_id'] = intval($user_id); /** * Display */ Display :: display_header($nametool); //Setting some course info $my_user_id=isset($_GET['u']) ? Security::remove_XSS($_GET['u']) : api_get_user_id(); $personal_course_list = UserManager::get_personal_session_course_list($my_user_id); $course_list_code = array(); $i=1; 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['k']); } else { break; } $i++; } //to avoid repeted courses $course_list_code = array_unique_dimensional($course_list_code); } $user_online_list = who_is_online(api_get_setting('time_limit_whosonline'), true); $user_online_count = count($user_online_list); echo '
'; echo '
'; //this include the social menu div SocialManager::show_social_menu('shared_profile', null, $user_id, $show_full_profile); echo '
'; echo '
'; echo '
'; if (!empty($user_info['firstname']) || !empty($user_info['lastname'])) { echo '

'.api_get_person_name($user_info['firstname'], $user_info['lastname']).'

'; } else { //--- Basic Information echo '

'.get_lang('Profile').'

'; } if ($show_full_profile) { echo ''; } else { echo ''; } echo '
'; // Extra information if ($show_full_profile) { //-- Extra Data $t_uf = Database :: get_main_table(TABLE_MAIN_USER_FIELD); $t_ufo = Database :: get_main_table(TABLE_MAIN_USER_FIELD_OPTIONS); $extra_user_data = UserManager::get_extra_user_data($user_id); $extra_information = ''; if (is_array($extra_user_data) && count($extra_user_data)>0 ) { $extra_information .= '

'.get_lang('ExtraInformation').'

'; $extra_information .=''; //social-profile-info } // if there are information to show if (!empty($extra_information_value)) echo $extra_information; } echo '
'; // close div tag rounded if ($show_full_profile) { echo '
'; $list_path_friends= $list_path_normal_friends = $list_path_parents = array(); //SOCIALGOODFRIEND , USER_RELATION_TYPE_FRIEND, USER_RELATION_TYPE_PARENT $friends = SocialManager::get_friends($user_id, USER_RELATION_TYPE_FRIEND); $friend_html = ''; $number_of_images = 6; $number_friends = 0; $list_friends_id = array(); $number_friends = count($friends); if ($number_friends != 0) { $friend_html.= '

'.get_lang('SocialFriend').'

'; $friend_html.= ''; // close div tag rounded } if ($show_full_profile) { // MY GROUPS $results = GroupPortalManager::get_groups_by_user($my_user_id, 0); $grid_my_groups = array(); $max_numbers_of_group = 4; if (is_array($results) && count($results) > 0) { $i = 1; foreach ($results as $result) { if ($i > $max_numbers_of_group) break; $id = $result['id']; $url_open = ''; $url_close = ''; $icon = ''; $name = cut($result['name'],CUT_GROUP_NAME,true); if ($result['relation_type'] == GROUP_USER_PERMISSION_ADMIN) { $icon = Display::return_icon('social_group_admin.png', get_lang('Admin'), array('style'=>'vertical-align:middle;width:16px;height:16px;')); } elseif ($result['relation_type'] == GROUP_USER_PERMISSION_MODERATOR) { $icon = Display::return_icon('social_group_moderator.png', get_lang('Moderator'), array('style'=>'vertical-align:middle;width:16px;height:16px;')); } $count_users_group = count(GroupPortalManager::get_all_users_by_group($id)); if ($count_users_group == 1 ) { $count_users_group = $count_users_group.' '.get_lang('Member'); } else { $count_users_group = $count_users_group.' '.get_lang('Members'); } $picture = GroupPortalManager::get_picture_group($result['id'], $result['picture_uri'],80); $item_name = $url_open.$name.$icon.$url_close; if ($result['description'] != '') { //$item_description = '
'; } else { //$item_description = '
'; } //$result['picture_uri'] = '
'; $item_actions = ''; if (api_get_user_id() == $user_id) { //$item_actions = ''; } $grid_my_groups[]= array($item_name,$url_open.$result['picture_uri'].$url_close, $item_actions); $i++; } } if (count($grid_my_groups) > 0) { echo '
'; $count_groups = 0; if (count($results) == 1 ) { $count_groups = count($results); } else { $count_groups = count($results); } echo '

'.get_lang('MyGroups').' ('.$count_groups.')

'; if ($i > $max_numbers_of_group) { if (api_get_user_id() == $user_id) { echo '
'; } else { echo ''; } } //Display::display_sortable_grid('shared_profile_mygroups', array(), $grid_my_groups, array('hide_navigation'=>true, 'per_page' => 2), $query_vars, false, array(true, true, true,false)); $total = count($grid_my_groups); $i = 1; foreach($grid_my_groups as $group) { echo $group[0]; if ($i < $total) { echo ', '; } $i++; } echo '

'; //close rounded } // COURSES LIST if ( is_array($list) ) { echo '
'; echo '

'.api_ucfirst(get_lang('MyCourses')).'

'; echo ''; //social-content-training echo '
'; //close rounded } // user feeds $user_feeds = SocialManager::get_user_feeds($user_id); if (!empty($user_feeds)) { echo '
'; echo '

'.get_lang('RSSFeeds').'

'; echo ''; echo '
'; } //--Productions $production_list = UserManager::build_production_list($user_id); // Images uploaded by course $file_list = ''; if (is_array($course_list_code) && count($course_list_code)>0) { foreach ($course_list_code as $course) { $file_list.= UserManager::get_user_upload_files_by_course($user_id, $course['code'], $resourcetype='images'); } } $count_pending_invitations = 0; if (!isset($_GET['u']) || (isset($_GET['u']) && $_GET['u']==api_get_user_id())) { $pending_invitations = SocialManager::get_list_invitation_of_friends_by_user_id(api_get_user_id()); $list_get_path_web = SocialManager::get_list_web_path_user_invitation_by_user_id(api_get_user_id()); $count_pending_invitations = count($pending_invitations); } echo ''; // close social-box-main1 } //echo '
'; echo '
'; echo '
'; Display :: display_footer();