* @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'; $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/index.php'; $link_shared='shared='.Security::remove_XSS($_GET['shared']); } else { $my_link='../auth/profile.php'; $link_shared=''; } $interbreadcrumb[]= array ('url' =>$my_link,'name' => get_lang('ModifyProfile') ); $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' => 'javascript: void(0);', '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'] = $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); //print_r($user_info); // Added by Ivan Tcholakov, 03-APR-2009. if (USE_JQUERY_CORNERS_SCRIPT) { echo $s=""; } //echo '
'; //echo ''.Display::return_icon('edit.gif').' '.api_convert_encoding(get_lang('EditInformation'),'UTF-8',$charset).''; //echo '
'; //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); } echo '
'; echo ''.Display::return_icon('shared_profile.png').' '.get_lang('ViewMySharedProfile').''; echo ''.Display::return_icon('lp_users.png').' '.get_lang('Friends').''; echo ''.Display::return_icon('inbox.png').' '.get_lang('Inbox').''; echo ''.Display::return_icon('group.gif').' '.get_lang('MyGroups').''; echo ''.Display::return_icon('search.gif').' '.get_lang('Search').''; echo ''.Display::return_icon('edit.gif').' '.get_lang('Configuration').''; /* echo ''. ''.Display::return_icon('edit.gif').' '.get_lang('Configuration').''; ''; */ echo '
'; 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(); $list_path_good_friends = SocialManager::get_list_path_web_by_user_id($user_id, SOCIALGOODFRIEND); $list_path_normal_friends = SocialManager::get_list_path_web_by_user_id($user_id, SOCIALFRIEND); $list_path_parents = SocialManager::get_list_path_web_by_user_id($user_id, SOCIALPARENT); $list_path_friends = array_merge_recursive($list_path_good_friends, $list_path_normal_friends, $list_path_parents); $friend_html=''; $number_of_images=3; $number_friends=0; $list_friends_id=array(); $list_friends_dir=array(); $list_friends_file=array(); if (count($list_path_friends)!=0) { $friends_count = count($list_path_friends['id_friend']); for ($z=0;$z< $friends_count ;$z++) { $list_friends_id[] = $list_path_friends['id_friend'][$z]['friend_user_id']; $list_friends_dir[] = $list_path_friends['path_friend'][$z]['dir']; $list_friends_file[]= $list_path_friends['path_friend'][$z]['file']; } $number_friends= count($list_friends_dir); $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 ''; // Send message or Add to friend links /*if (!$show_full_profile) { echo '  '.Display::return_icon('message_new.png').'  '.get_lang('SendMessage').'
'; }*/ // 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; // ---- 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 ''; } } echo '
'; // CENTER COLUMN echo '
'; //--- Basic Information echo 'ssss'; echo '
'; echo '
'; echo '
'; //from the main echo '
 
'; Display :: display_footer();