home.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614
  1. <?php //$id: $
  2. /* For licensing terms, see /dokeos_license.txt */
  3. /**
  4. * This is the home of a social network user, here we should show the latest info/status of our friends
  5. * @author Julio Montoya <gugli100@gmail.com>
  6. * @package dokeos.social
  7. */
  8. $language_file = array('registration','messages','userInfo','admin','forum','blog');
  9. $cidReset = true;
  10. require '../inc/global.inc.php';
  11. require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
  12. require_once api_get_path(LIBRARY_PATH).'social.lib.php';
  13. require_once api_get_path(LIBRARY_PATH).'array.lib.php';
  14. $user_id = api_get_user_id();
  15. $show_full_profile = true;
  16. //social tab
  17. $this_section = SECTION_SOCIAL;
  18. //I'm your friend? I can see your profile?
  19. if (isset($_GET['u'])) {
  20. $user_id = (int) Database::escape_string($_GET['u']);
  21. // It's me!
  22. if (api_get_user_id() != $user_id) {
  23. $user_info = UserManager::get_user_info_by_id($user_id);
  24. $show_full_profile = false;
  25. if ($user_info==false) {
  26. // user does no exist !!
  27. api_not_allowed();
  28. } else {
  29. //checking the relationship between me and my friend
  30. $my_status= SocialManager::get_relation_between_contacts(api_get_user_id(), $user_id);
  31. if (in_array($my_status, array(SOCIALPARENT, SOCIALFRIEND, SOCIALGOODFRIEND))) {
  32. $show_full_profile = true;
  33. }
  34. //checking the relationship between my friend and me
  35. $my_friend_status = SocialManager::get_relation_between_contacts($user_id, api_get_user_id());
  36. if (in_array($my_friend_status, array(SOCIALPARENT, SOCIALFRIEND, SOCIALGOODFRIEND))) {
  37. $show_full_profile = true;
  38. } else {
  39. // im probably not a good friend
  40. $show_full_profile = false;
  41. }
  42. }
  43. } else {
  44. $user_info = UserManager::get_user_info_by_id($user_id);
  45. }
  46. } else {
  47. $user_info = UserManager::get_user_info_by_id($user_id);
  48. }
  49. $libpath = api_get_path(LIBRARY_PATH);
  50. require_once api_get_path(SYS_CODE_PATH).'calendar/myagenda.inc.php';
  51. require_once api_get_path(SYS_CODE_PATH).'announcements/announcements.inc.php';
  52. require_once $libpath.'course.lib.php';
  53. require_once $libpath.'formvalidator/FormValidator.class.php';
  54. require_once $libpath.'magpierss/rss_fetch.inc';
  55. api_block_anonymous_users();
  56. $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.js" type="text/javascript" language="javascript"></script>'; //jQuery
  57. $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.corners.min.js" type="text/javascript" language="javascript"></script>'; //jQuery corner
  58. $htmlHeadXtra[] = '<script type="text/javascript" src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/thickbox.js"></script>';
  59. $htmlHeadXtra[] = '<link rel="stylesheet" href="'.api_get_path(WEB_LIBRARY_PATH).'javascript/thickbox.css" type="text/css" media="projection, screen">';
  60. $htmlHeadXtra[] = '
  61. <script type="text/javascript">
  62. function toogle_function (element_html, course_code){
  63. elem_id=$(element_html).attr("id");
  64. id_elem=elem_id.split("_");
  65. ident="div#div_group_"+id_elem[1];
  66. id_button="#btn_"+id_elem[1];
  67. elem_src=$(id_button).attr("src");
  68. image_show=elem_src.split("/");
  69. my_image=image_show[2];
  70. var content = \'social_content\' + id_elem[1];
  71. if (my_image=="nolines_plus.gif") {
  72. $(id_button).attr("src","../img/nolines_minus.gif"); var action = "load_course";
  73. $("div#"+content).show("slow");
  74. } else {
  75. $("div#"+content).hide("slow");
  76. $(id_button).attr("src","../img/nolines_plus.gif"); var action = "unload";
  77. return false;
  78. }
  79. $.ajax({
  80. contentType: "application/x-www-form-urlencoded",
  81. beforeSend: function(objeto) {
  82. $("div#"+content).html("<img src=\'../inc/lib/javascript/indicator.gif\' />"); },
  83. type: "POST",
  84. url: "../social/data_personal.inc.php",
  85. data: "load_ajax="+id_elem+"&action="+action+"&course_code="+course_code,
  86. success: function(datos) {
  87. //$("div#"+name_div_id).hide("slow");
  88. $("div#"+content).html(datos);
  89. }
  90. });
  91. }
  92. </script>';
  93. $htmlHeadXtra[] = '<script type="text/javascript">
  94. $(document).ready(function (){
  95. $("input#id_btn_send_invitation").bind("click", function(){
  96. if (confirm("'.get_lang('SendMessageInvitation', '').'")) {
  97. $("#form_register_friend").submit();
  98. }
  99. });
  100. });
  101. function change_panel (mypanel_id,myuser_id) {
  102. $.ajax({
  103. contentType: "application/x-www-form-urlencoded",
  104. beforeSend: function(objeto) {
  105. $("#id_content_panel").html("<img src=\'../inc/lib/javascript/indicator.gif\' />"); },
  106. type: "POST",
  107. url: "../messages/send_message.php",
  108. data: "panel_id="+mypanel_id+"&user_id="+myuser_id,
  109. success: function(datos) {
  110. $("div#id_content_panel_init").html(datos);
  111. $("div#display_response_id").html("");
  112. }
  113. });
  114. }
  115. function action_database_panel (option_id,myuser_id) {
  116. if (option_id==5) {
  117. my_txt_subject=$("#txt_subject_id").val();
  118. } else {
  119. my_txt_subject="clear";
  120. }
  121. my_txt_content=$("#txt_area_invite").val();
  122. if (my_txt_content.length==0 || my_txt_subject.length==0) {
  123. $("#display_response_id").html("&nbsp;&nbsp;&nbsp;'.get_lang('MessageInvitationNotSent', '').'");
  124. setTimeout("message_information_display()",3000);
  125. return false;
  126. }
  127. $.ajax({
  128. contentType: "application/x-www-form-urlencoded",
  129. beforeSend: function(objeto) {
  130. $("#display_response_id").html("<img src=\'../inc/lib/javascript/indicator.gif\' />"); },
  131. type: "POST",
  132. url: "../messages/send_message.php",
  133. data: "panel_id="+option_id+"&user_id="+myuser_id+"&txt_subject="+my_txt_subject+"&txt_content="+my_txt_content,
  134. success: function(datos) {
  135. $("#display_response_id").html(datos);
  136. }
  137. });
  138. }
  139. function display_hide () {
  140. setTimeout("hide_display_message()",3000);
  141. }
  142. function message_information_display() {
  143. $("#display_response_id").html("");
  144. }
  145. function hide_display_message () {
  146. $("div#display_response_id").html("");
  147. try {
  148. $("#txt_subject_id").val("");
  149. $("#txt_area_invite").val("");
  150. }catch(e) {
  151. $("#txt_area_invite").val("");
  152. }
  153. }
  154. function register_friend(element_input) {
  155. if(confirm("'.get_lang('AddToFriends').'")) {
  156. name_button=$(element_input).attr("id");
  157. name_div_id="id_"+name_button.substring(13);
  158. user_id=name_div_id.split("_");
  159. user_friend_id=user_id[1];
  160. $.ajax({
  161. contentType: "application/x-www-form-urlencoded",
  162. beforeSend: function(objeto) {
  163. $("div#dpending_"+user_friend_id).html("<img src=\'../inc/lib/javascript/indicator.gif\' />"); },
  164. type: "POST",
  165. url: "../social/register_friend.php",
  166. data: "friend_id="+user_friend_id+"&is_my_friend="+"friend",
  167. success: function(datos) {
  168. $("form").submit()
  169. }
  170. });
  171. }
  172. }
  173. </script>';
  174. if (isset($_GET['shared'])) {
  175. $my_link='../social/index.php';
  176. $link_shared='shared='.Security::remove_XSS($_GET['shared']);
  177. } else {
  178. $my_link='../auth/profile.php';
  179. $link_shared='';
  180. }
  181. $interbreadcrumb[]= array ('url' =>$my_link,'name' => get_lang('ModifyProfile') );
  182. $interbreadcrumb[]= array (
  183. 'url' => '../social/profile.php?'.$link_shared.'#remote-tab-1',
  184. 'name' => get_lang('ViewMySharedProfile')
  185. );
  186. if (isset($_GET['u']) && is_numeric($_GET['u'])) {
  187. $info_user=api_get_user_info($_GET['u']);
  188. $interbreadcrumb[]= array (
  189. 'url' => 'javascript: void(0);',
  190. 'name' => api_get_person_name($info_user['firstName'], $info_user['lastName'])
  191. );
  192. }
  193. if (isset($_GET['u'])) {
  194. $param_user='u='.Security::remove_XSS($_GET['u']);
  195. }else {
  196. $info_user=api_get_user_info(api_get_user_id());
  197. $param_user='';
  198. }
  199. $_SESSION['social_user_id'] = $user_id;
  200. /**
  201. * Display
  202. */
  203. Display :: display_header(null);
  204. // @todo here we must show the user information as read only
  205. //User picture size is calculated from SYSTEM path
  206. $img_array= UserManager::get_user_picture_path_by_id($user_id,'web',true,true);
  207. //print_r($user_info);
  208. // Added by Ivan Tcholakov, 03-APR-2009.
  209. if (USE_JQUERY_CORNERS_SCRIPT) {
  210. echo $s="<script>$(document).ready( function(){
  211. $('.rounded').corners();
  212. });</script>";
  213. }
  214. //echo '<div id="actions">';
  215. //echo '<a href="../auth/profile.php?show=1"">'.Display::return_icon('edit.gif').'&nbsp;'.api_convert_encoding(get_lang('EditInformation'),'UTF-8',$charset).'</a>';
  216. //echo '</div>';
  217. //Setting some course info
  218. $my_user_id=isset($_GET['u']) ? Security::remove_XSS($_GET['u']) : api_get_user_id();
  219. $personal_course_list = UserManager::get_personal_session_course_list($my_user_id);
  220. $course_list_code = array();
  221. $i=1;
  222. //print_r($personal_course_list);
  223. if (is_array($personal_course_list)) {
  224. foreach ($personal_course_list as $my_course) {
  225. if ($i<=10) {
  226. $list[] = SocialManager::get_logged_user_course_html($my_course,$i);
  227. //$course_list_code[] = array('code'=>$my_course['c'],'dbName'=>$my_course['db'], 'title'=>$my_course['i']); cause double
  228. $course_list_code[] = array('code'=>$my_course['c'],'dbName'=>$my_course['db']);
  229. } else {
  230. break;
  231. }
  232. $i++;
  233. }
  234. //to avoid repeted courses
  235. $course_list_code = array_unique_dimensional($course_list_code);
  236. }
  237. echo '<div class="actions">';
  238. echo '<a href="profile.php">'.Display::return_icon('shared_profile.png').' '.get_lang('ViewMySharedProfile').'</a>';
  239. echo '<a href="friends.php">'.Display::return_icon('lp_users.png').' '.get_lang('Friends').'</a>';
  240. echo '<a href="../messages/inbox.php">'.Display::return_icon('inbox.png').' '.get_lang('Inbox').'</a>';
  241. echo '<a href="group.php">'.Display::return_icon('group.gif').' '.get_lang('MyGroups').'</a>';
  242. echo '<a href="'.api_get_path(WEB_PATH).'main/social/search.php">'.Display::return_icon('search.gif').' '.get_lang('Search').'</a>';
  243. echo '<a href="'.api_get_path(WEB_PATH).'main/auth/profile.php?show=1">'.Display::return_icon('edit.gif').' '.get_lang('Configuration').'</a>';
  244. /*
  245. echo '<span style="float:right; padding-top:7px;">'.
  246. '<a href="/main/auth/profile.php?show=1">'.Display::return_icon('edit.gif').' '.get_lang('Configuration').'</a>';
  247. '</span>';
  248. */
  249. echo '</div>';
  250. echo '<div class="actions-title">';
  251. if ($user_id == api_get_user_id())
  252. echo get_lang('ViewMySharedProfile');
  253. else
  254. echo get_lang('ViewSharedProfile').' - '.api_get_person_name($user_info['firstname'], $user_info['lastname']);
  255. echo '</div>';
  256. echo '<div id="social-profile-wrapper">';
  257. // RIGHT COLUMN
  258. echo '<div id="social-profile-right">';
  259. //---- FRIENDS
  260. if ($show_full_profile) {
  261. $list_path_friends= $list_path_normal_friends = $list_path_parents = array();
  262. $list_path_good_friends = SocialManager::get_list_path_web_by_user_id($user_id, SOCIALGOODFRIEND);
  263. $list_path_normal_friends = SocialManager::get_list_path_web_by_user_id($user_id, SOCIALFRIEND);
  264. $list_path_parents = SocialManager::get_list_path_web_by_user_id($user_id, SOCIALPARENT);
  265. $list_path_friends = array_merge_recursive($list_path_good_friends, $list_path_normal_friends, $list_path_parents);
  266. $friend_html='';
  267. $number_of_images=3;
  268. $number_friends=0;
  269. $list_friends_id=array();
  270. $list_friends_dir=array();
  271. $list_friends_file=array();
  272. if (count($list_path_friends)!=0) {
  273. $friends_count = count($list_path_friends['id_friend']);
  274. for ($z=0;$z< $friends_count ;$z++) {
  275. $list_friends_id[] = $list_path_friends['id_friend'][$z]['friend_user_id'];
  276. $list_friends_dir[] = $list_path_friends['path_friend'][$z]['dir'];
  277. $list_friends_file[]= $list_path_friends['path_friend'][$z]['file'];
  278. }
  279. $number_friends= count($list_friends_dir);
  280. $number_loop = ($number_friends/$number_of_images);
  281. $loop_friends = ceil($number_loop);
  282. $j=0;
  283. $friend_html .= '<div class="sectiontitle">'.get_lang('SocialFriend').'</div>';
  284. $friend_html.= '<div id="friend-container" class="social-friend-container">';
  285. $friend_html.= '<div id="friend-header">';
  286. //$friend_html.= $friends_count.' '.get_lang('Friends');
  287. if ($friends_count == 1)
  288. $friend_html.= '<div style="float:left;">'.$friends_count.' '.get_lang('Friend').'</div>';
  289. else
  290. $friend_html.= '<div style="float:left;">'.$friends_count.' '.get_lang('Friends').'</div>';
  291. if (api_get_user_id() == $user_id)
  292. $friend_html.= '<div style="float:right;"><a href="index.php?#remote-tab-6">'.get_lang('SeeAll').'</a></div>';
  293. $friend_html.= '</div>'; // close div friend-header
  294. for ($k=0;$k<$loop_friends;$k++) {
  295. if ($j==$number_of_images) {
  296. $number_of_images=$number_of_images*2;
  297. }
  298. while ($j<$number_of_images) {
  299. if ($list_friends_file[$j]<>"") {
  300. $my_user_info=api_get_user_info($list_friends_id[$j]);
  301. $name_user=api_get_person_name($my_user_info['firstName'], $my_user_info['lastName']);
  302. $friend_html.='<div id=div_'.$list_friends_id[$j].' class="image_friend_network" ><span><center>';
  303. // the height = 92 must be the sqme in the image_friend_network span style in default.css
  304. $friends_profile = SocialManager::get_picture_user($list_friends_id[$j], $list_friends_file[$j], 92, 'medium_', 'width="85" height="90" ');
  305. $friend_html.='<a href="profile.php?u='.$list_friends_id[$j].'&amp;'.$link_shared.'">';
  306. $friend_html.='<img src="'.$friends_profile['file'].'" '.$friends_profile['style'].' id="imgfriend_'.$list_friends_id[$j].'" title="'.$name_user.'" />';
  307. $friend_html.= '</center></span>';
  308. $friend_html.= '<center class="friend">'.api_get_person_name($my_user_info['firstName'], $my_user_info['lastName']).'</a></center>';
  309. $friend_html.= '</div>';
  310. }
  311. $j++;
  312. }
  313. }
  314. } else {
  315. // No friends!! :(
  316. $friend_html .= '<div class="sectiontitle">'.get_lang('Friends').'</div>';
  317. $friend_html.= '<div id="friend-container" class="social-friend-container">';
  318. $friend_html.= '<div id="friend-header">';
  319. $friend_html.= '<div style="float:left; padding:0px 8px 0px 8px;">'.get_lang('NoFriendsInYourContactList').'<br /><a href="'.api_get_path(WEB_PATH).'whoisonline.php">'.get_lang('TryAndFindSomeFriends').'</a></div>';
  320. $friend_html.= '</div>'; // close div friend-header
  321. }
  322. $friend_html.= '</div>';
  323. echo $friend_html;
  324. //Pending invitations
  325. if (!isset($_GET['u']) || (isset($_GET['u']) && $_GET['u']==api_get_user_id())) {
  326. $pending_invitations = SocialManager::get_list_invitation_of_friends_by_user_id(api_get_user_id());
  327. $list_get_path_web=SocialManager::get_list_web_path_user_invitation_by_user_id(api_get_user_id());
  328. $count_pending_invitations = count($pending_invitations);
  329. //echo '<div class="clear"></div><br />';
  330. //javascript:register_friend(this)
  331. //var_dump($pending_invitations);
  332. echo '<div class="clear"></div><br />';
  333. echo '<div id="social-profile-invitations" >';
  334. if ($count_pending_invitations > 0) {
  335. echo '<div class="sectiontitle">';
  336. echo api_convert_encoding(get_lang('PendingInvitations'),$charset,'UTF-8');
  337. echo '</div><br />';
  338. for ($i=0;$i<$count_pending_invitations;$i++) {
  339. //var_dump($invitations);
  340. echo '<div id="dpending_'.$pending_invitations[$i]['user_sender_id'].'" class="friend_invitations">';
  341. echo '<div style="float:left;width:60px;" >';
  342. echo '<img style="margin-bottom:5px;" src="'.$list_get_path_web[$i]['dir'].'/'.$list_get_path_web[$i]['file'].'" width="60px">';
  343. echo '</div>';
  344. echo '<div style="padding-left:70px;">';
  345. echo ' '.api_convert_encoding(substr($pending_invitations[$i]['content'],0,50),$charset,'UTF-8');
  346. echo '<br />';
  347. echo '<a id="btn_accepted_'.$pending_invitations[$i]['user_sender_id'].'" onclick="register_friend(this)" href="javascript:void(0)">'.get_lang('SocialAddToFriends').'</a>';
  348. echo '<div id="id_response">&nbsp;</div>';
  349. echo '</div>';
  350. echo '</div>';
  351. echo '<div class="clear"></div>';
  352. }
  353. }
  354. echo '</div>';
  355. }
  356. //--Productions
  357. $production_list = UserManager::build_production_list($user_id);
  358. if (!empty($production_list )) {
  359. echo '<div class="clear"></div><br />';
  360. echo '<div class="sectiontitle">';
  361. echo get_lang('MyProductions');
  362. echo '</div>';
  363. echo '<div class="rounded1">';
  364. echo $production_list;
  365. echo '</div>';
  366. }
  367. // Images uploaded by course
  368. $file_list = '';
  369. if (is_array($course_list_code) && count($course_list_code)>0) {
  370. foreach ($course_list_code as $course) {
  371. $file_list.= UserManager::get_user_upload_files_by_course($user_id,$course['code']);
  372. }
  373. }
  374. if (!empty($file_list)) {
  375. echo '<div class="clear"></div><br />';
  376. echo '<div class="sectiontitle">';
  377. echo get_lang('ImagesUploaded');
  378. echo '</div><br />';
  379. echo '</br><div class="social-content-information">';
  380. echo $file_list;
  381. echo '</div>';
  382. }
  383. //loading this information
  384. //-- Competences
  385. if (!empty($user_info['competences']) || !empty($user_info['diplomas']) || !empty($user_info['openarea']) || !empty($user_info['teach']) ) {
  386. echo '<div class="clear"></div>';
  387. echo '<div class="sectiontitle">';
  388. echo get_lang('MoreInformation');
  389. echo '</div>';
  390. }
  391. echo '<div class="social-content-competences">';
  392. $cut_size = 220;
  393. if (!empty($user_info['competences'])) {
  394. echo '<br />';
  395. echo '<div class="social-background-content" style="width:100%;">';
  396. echo '<div class="social-actions-message">'.get_lang('MyCompetences').'</div>';
  397. echo cut($user_info['competences'],$cut_size);
  398. echo '</div>';
  399. echo '<br />';
  400. }
  401. if (!empty($user_info['diplomas'])) {
  402. echo '<div class="social-background-content" style="width:100%;" >';
  403. echo '<div class="social-actions-message">'.get_lang('MyDiplomas').'</div>';
  404. echo cut($user_info['diplomas'],$cut_size);
  405. echo '</div>';
  406. echo '<br />';
  407. }
  408. if (!empty($user_info['openarea'])) {
  409. echo '<div class="social-background-content" style="width:100%;" >';
  410. echo '<div class="social-actions-message">'.get_lang('MyPersonalOpenArea').'</div>';
  411. echo cut($user_info['openarea'],$cut_size);
  412. echo '</div>';
  413. echo '<br />';
  414. }
  415. if (!empty($user_info['teach'])) {
  416. echo '<div class="social-background-content" style="width:100%;" >';
  417. echo '<div class="social-actions-message">'.get_lang('MyTeach').'</div>';
  418. echo cut($user_info['teach'],$cut_size);
  419. echo '</div>';
  420. echo '<br />';
  421. }
  422. echo '</div>';
  423. } else {
  424. echo '<div class="clear"></div><br />';
  425. }
  426. echo '</div>'; // end of content section
  427. echo '<div id="social-profile-container">';
  428. // LEFT COLUMN
  429. echo '<div id="social-profile-left">';
  430. //--- User image
  431. echo '<div class="social-content-image">';
  432. echo '<div class="social-background-content" style="width:95%;" align="center">';
  433. echo '<br/>';
  434. echo '<a href="../auth/profile.php?show=1"><img src='.$img_array['dir'].$img_array['file'].' /></a><br /><br />';
  435. echo '</div>';
  436. echo '</div>';
  437. // Send message or Add to friend links
  438. /*if (!$show_full_profile) {
  439. echo '&nbsp;&nbsp;<a href="../messages/send_message_to_userfriend.inc.php?height=365&width=610&user_friend='.$user_id.'&view=profile" class="thickbox" title="'.get_lang('SendMessage').'">'.Display::return_icon('message_new.png').'&nbsp;&nbsp;'.get_lang('SendMessage').'</a><br />';
  440. }*/
  441. // Extra information
  442. if ($show_full_profile) {
  443. //-- Extra Data
  444. $t_uf = Database :: get_main_table(TABLE_MAIN_USER_FIELD);
  445. $t_ufo = Database :: get_main_table(TABLE_MAIN_USER_FIELD_OPTIONS);
  446. $extra_user_data = UserManager::get_extra_user_data($user_id);
  447. $extra_information = '';
  448. if (is_array($extra_user_data) && count($extra_user_data)>0 ) {
  449. $extra_information = '<div class="sectiontitle">';
  450. $extra_information .= get_lang('ExtraInformation');
  451. $extra_information .= '</div><br />';
  452. $extra_information .='<div class="social-content-information">';
  453. $extra_information_value = '';
  454. foreach($extra_user_data as $key=>$data) {
  455. // get display text, visibility and type from user_field table
  456. $field_variable = str_replace('extra_','',$key);
  457. $sql = "SELECT field_display_text,field_visible,field_type,id FROM $t_uf WHERE field_variable ='$field_variable'";
  458. $res_field = Database::query($sql,__FILE__,__LINE__);
  459. $row_field = Database::fetch_row($res_field);
  460. $field_display_text = $row_field[0];
  461. $field_visible = $row_field[1];
  462. $field_type = $row_field[2];
  463. $field_id = $row_field[3];
  464. if ($field_visible == 1) {
  465. if (is_array($data)) {
  466. $extra_information_value .= '<strong>'.ucfirst($field_display_text).':</strong> '.implode(',',$data).'<br />';
  467. } else {
  468. if ($field_type == USER_FIELD_TYPE_DOUBLE_SELECT) {
  469. $id_options = explode(';',$data);
  470. $value_options = array();
  471. // get option display text from user_field_options table
  472. foreach ($id_options as $id_option) {
  473. $sql = "SELECT option_display_text FROM $t_ufo WHERE id = '$id_option'";
  474. $res_options = Database::query($sql,__FILE__,__LINE__);
  475. $row_options = Database::fetch_row($res_options);
  476. $value_options[] = $row_options[0];
  477. }
  478. $extra_information_value .= '<strong>'.ucfirst($field_display_text).':</strong> '.implode(' ',$value_options).'<br />';
  479. } elseif($field_type == USER_FIELD_TYPE_TAG ) {
  480. $user_tags = UserManager::get_user_tags($user_id, $field_id);
  481. $tag_tmp = array();
  482. foreach ($user_tags as $tags) {
  483. //$tag_tmp[] = $tags['tag'];
  484. $tag_tmp[] = '<a href="../tag/?q='.$tags['tag'].'">'.$tags['tag'].'</a>';
  485. }
  486. if (is_array($user_tags) && count($user_tags)>0) {
  487. $extra_information_value .= '<strong>'.ucfirst($field_display_text).':</strong> '.implode(', ',$tag_tmp).'<br />';
  488. }
  489. } else {
  490. $extra_information_value .= '<strong>'.ucfirst($field_display_text).':</strong> '.$data.'<br />';
  491. }
  492. }
  493. }
  494. }
  495. // if there are information to show
  496. if (!empty($extra_information_value)) {
  497. $extra_information .= $extra_information_value;
  498. }
  499. $extra_information .= '</div>';
  500. $extra_information .= '<br /><br />';
  501. }
  502. // if there are information to show
  503. if (!empty($extra_information_value))
  504. echo $extra_information;
  505. // ---- My Agenda Items
  506. $my_agenda_items = show_simple_personal_agenda($user_id);
  507. if (!empty($my_agenda_items)) {
  508. echo '<div class="sectiontitle">';
  509. echo get_lang('MyAgenda');
  510. echo '</div>';
  511. $tbl_personal_agenda = Database :: get_user_personal_table(TABLE_PERSONAL_AGENDA);
  512. echo '<div class="social-content-agenda">';
  513. echo '<div class="social-background-content">';
  514. echo $my_agenda_items;
  515. echo '</div>';
  516. echo '<br /><br />';
  517. echo '</div>';
  518. }
  519. //-----Announcements
  520. $announcement_content = '';
  521. $my_announcement_by_user_id=isset($_GET['u']) ? Security::remove_XSS($_GET['u']) : api_get_user_id();
  522. foreach ($course_list_code as $course) {
  523. $content = get_all_annoucement_by_user_course($course['dbName'],$my_announcement_by_user_id);
  524. $course_info=api_get_course_info($course['code']);
  525. if (!empty($content)) {
  526. $announcement_content.= '<div class="social-background-content" style="width:100%">';
  527. $announcement_content.= '<div class="actions">'.$course_info['name'].'</div>';
  528. $announcement_content.= $content;
  529. $announcement_content.= '</div>';
  530. $announcement_content.= '<br/>';
  531. }
  532. }
  533. if(!empty($announcement_content)) {
  534. echo '<div class="sectiontitle">';
  535. echo get_lang('Announcements');
  536. echo '</div><br/>';
  537. echo '<div class="social-content-announcements">';
  538. echo $announcement_content.'<br/>';
  539. echo '</div>';
  540. }
  541. }
  542. echo '</div>';
  543. // CENTER COLUMN
  544. echo '<div id="social-profile-content">';
  545. //--- Basic Information
  546. echo 'ssss';
  547. echo '</div>';
  548. echo '</div>';
  549. echo '</div>'; //from the main
  550. echo '<form id="id_reload" name="id_reload" action="profile.php">&nbsp;</form>';
  551. Display :: display_footer();