* @author Isaac Flores Paz * @package dokeos.social */ $language_file = array('registration','messages','userInfo','admin','forum','blog'); $cidReset = true; require '../inc/global.inc.php'; require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php'; require_once api_get_path(LIBRARY_PATH).'social.lib.php'; require_once api_get_path(LIBRARY_PATH).'array.lib.php'; require_once api_get_path(LIBRARY_PATH).'group_portal_manager.lib.php'; $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']); // 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==false) { // user does no exist !! api_not_allowed(); } 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(SOCIALPARENT, SOCIALFRIEND, SOCIALGOODFRIEND))) { $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(SOCIALPARENT, SOCIALFRIEND, SOCIALGOODFRIEND))) { $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.'course.lib.php'; require_once $libpath.'formvalidator/FormValidator.class.php'; require_once $libpath.'magpierss/rss_fetch.inc'; api_block_anonymous_users(); $htmlHeadXtra[] = ''; //jQuery $htmlHeadXtra[] = ''; //jQuery corner $htmlHeadXtra[] = ''; $htmlHeadXtra[] = ''; $htmlHeadXtra[] = ' '; $htmlHeadXtra[] = ''; 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' =>'profile.php','name' => get_lang('Social') ); //$interbreadcrumb[]= array ('url' => '../social/profile.php?'.$link_shared.'#remote-tab-1','name' => get_lang('ViewMySharedProfile')); if (isset($_GET['u']) && is_numeric($_GET['u'])) { $info_user=api_get_user_info($_GET['u']); $interbreadcrumb[]= array ('url' => '#','name' => api_get_person_name($info_user['firstName'], $info_user['lastName'])); } 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(null); // @todo here we must show the user information as read only //User picture size is calculated from SYSTEM path $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'],'','big_'); $big_image = $big_image['file'].$big_image['dir']; //print_r($user_info); // Added by Ivan Tcholakov, 03-APR-2009. if (USE_JQUERY_CORNERS_SCRIPT) { echo $s=""; } //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; //print_r($personal_course_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['c'],'dbName'=>$my_course['db'], 'title'=>$my_course['i']); cause double $course_list_code[] = array('code'=>$my_course['c'],'dbName'=>$my_course['db']); } else { break; } $i++; } //to avoid repeted courses $course_list_code = array_unique_dimensional($course_list_code); } //show the action menu SocialManager::show_social_menu(); echo '
'; if ($user_id == api_get_user_id()) echo get_lang('ViewMySharedProfile'); else echo get_lang('ViewSharedProfile').' - '.api_get_person_name($user_info['firstname'], $user_info['lastname']); echo '
'; echo '
'; // RIGHT COLUMN echo '
'; //---- FRIENDS if ($show_full_profile) { $list_path_friends= $list_path_normal_friends = $list_path_parents = array(); //SOCIALGOODFRIEND , SOCIALFRIEND, SOCIALPARENT $friends = SocialManager::get_friends($user_id, SOCIALFRIEND); $friend_html = ''; $number_of_images = 3; $number_friends = 0; $list_friends_id = array(); $number_friends = count($friends); $number_of_images = $number_friends; if ($number_friends != 0) { $number_loop = ($number_friends/$number_of_images); $loop_friends = ceil($number_loop); $j=0; $friend_html .= '
'.get_lang('SocialFriend').'
'; $friend_html .= ''; // end of content section echo '
'; //------------------------------------- // LEFT COLUMN echo '
'; //--- User image echo ''; echo '
'; $html_actions = ''; if ($user_id != api_get_user_id()) { $html_actions = ' '; $html_actions .= Display::return_icon('message_new.png').'  '.get_lang('SendMessage').'
'; } //check if I already sent an invitation message $invitation_sent_list = SocialManager::get_list_invitation_sent_by_user_id(api_get_user_id()); if (is_array($invitation_sent_list) && is_array($invitation_sent_list[$user_id]) && count($invitation_sent_list[$user_id]) >0 ) { $html_actions .= ''.get_lang('YouAlreadySentAnInvitation').''; } else { if (!$show_full_profile) { $html_actions .= ' '.Display :: return_icon('add_multiple_users.gif', get_lang('SocialInvitationToFriends')).' '.get_lang('SendInvitation').''; } } if (!empty($html_actions )) { echo '
'; echo $html_actions; 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 = '
'; $extra_information .= get_lang('ExtraInformation'); $extra_information .= '

'; $extra_information .=''; $extra_information .= '

'; } // if there are information to show if (!empty($extra_information_value)) echo $extra_information; $results = GroupPortalManager::get_groups_by_user($user_id , 0, true); $groups = array(); foreach ($results as $result) { $id = $result['id']; $url_open = ''; $url_close = ''; if ($result['relation_type'] == GROUP_USER_PERMISSION_ADMIN) { $result['name'].= Display::return_icon('admin_star.png', get_lang('Admin')); } $groups[]= array($url_open.$result['picture_uri'].$url_close, $url_open.$result['name'].$url_close); } if (count($groups)> 0) { echo '

'.get_lang('MyGroups').'

'; Display::display_sortable_grid('profile', array(), $groups, array('hide_navigation'=>true, 'per_page' => 100), $query_vars, false, array(true, true, true,false)); } // ---- My Agenda Items $my_agenda_items = show_simple_personal_agenda($user_id); if (!empty($my_agenda_items)) { echo '
'; echo get_lang('MyAgenda'); echo '
'; $tbl_personal_agenda = Database :: get_user_personal_table(TABLE_PERSONAL_AGENDA); echo ''; } //-----Announcements $announcement_content = ''; $my_announcement_by_user_id=isset($_GET['u']) ? Security::remove_XSS($_GET['u']) : api_get_user_id(); foreach ($course_list_code as $course) { $content = get_all_annoucement_by_user_course($course['dbName'],$my_announcement_by_user_id); $course_info=api_get_course_info($course['code']); if (!empty($content)) { $announcement_content.= ''; $announcement_content.= '
'; } } if(!empty($announcement_content)) { echo '
'; echo get_lang('Announcements'); echo '

'; echo ''; } //Load left plugin //echo SocialManager::get_plugins(SOCIAL_LEFT_PLUGIN); } echo '
'; // CENTER COLUMN echo '
'; //--- Basic Information echo '
'; echo get_lang('Information'); //class="social-profile-info" echo '
'; echo ''; // COURSES LIST if ($show_full_profile) { //print_r($personal_course_list); //echo '
';
				if ( is_array($list) ) {
					echo '
'; echo api_ucfirst(get_lang('MyCourses')); echo '
'; echo ''; } } //Load plugin center //echo SocialManager::get_plugins(SOCIAL_CENTER_PLUGIN); //-------------------------- echo '
'; echo '
'; echo '
'; echo '
'; //from the main echo '
 
'; Display :: display_footer();