data_personal.inc.php 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <?php
  2. /*
  3. ==============================================================================
  4. Dokeos - elearning and course management software
  5. Copyright (c) 2009 Dokeos SPRL
  6. Copyright (c) Julio Montoya Armas
  7. For a full list of contributors, see "credits.txt".
  8. The full license can be read in "license.txt".
  9. This program is free software; you can redistribute it and/or
  10. modify it under the terms of the GNU General Public License
  11. as published by the Free Software Foundation; either version 2
  12. of the License, or (at your option) any later version.
  13. See the GNU General Public License for more details.
  14. Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium
  15. Mail: info@dokeos.com
  16. ==============================================================================
  17. */
  18. $language_file = array('registration','messages','userInfo','admin','forum','blog');
  19. require_once ('../inc/global.inc.php');
  20. require_once (api_get_path(LIBRARY_PATH).'usermanager.lib.php');
  21. // @todo here we must show the user information as read only
  22. //User picture size is calculated from SYSTEM path
  23. $user_info= UserManager::get_user_info_by_id(api_get_user_id());
  24. $img_array= UserManager::get_user_picture_path_by_id(api_get_user_id(),'web',true,true);
  25. if (isset($_POST['load_ajax'])) {
  26. require_once (api_get_path(LIBRARY_PATH).'blog.lib.php');
  27. require_once (api_get_path(SYS_CODE_PATH).'forum/forumfunction.inc.php');
  28. $user_id = $_SESSION['social_user_id'];
  29. if ($_POST['action']) {$action = $_POST['action'];}
  30. switch($action) {
  31. case 'load_course' :
  32. $course_db = $_POST['course_code'];
  33. // @todo goto the course link
  34. //echo '<a href="'.api_get_path(WEB_COURSE_PATH).$course_directory.'/?id_session='.$my_course['id_session'].'">'.get_lang('GotoCourse').'</a>';
  35. $my_course_info_db=explode('_',$course_db);
  36. $course_id=$my_course_info_db[1];
  37. if (api_is_user_of_course($course_id,api_get_user_id())) {
  38. $table_forums = Database :: get_course_table(TABLE_FORUM,$course_db);
  39. $table_threads = Database :: get_course_table(TABLE_FORUM_THREAD,$course_db);
  40. $table_posts = Database :: get_course_table(TABLE_FORUM_POST,$course_db);
  41. $table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY,$course_db);
  42. $table_users = Database :: get_main_table(TABLE_MAIN_USER);
  43. //------Forum messages
  44. $forum_result = get_all_post_from_user($user_id, $course_db);
  45. $all_result_data = 0;
  46. if ($forum_result !='') {
  47. api_display_tool_title(get_lang('Forum'));
  48. echo '<div class="rounded social-profile-post" style="background:#FAF9F6; padding:0px;" >';
  49. echo $forum_result;
  50. echo '</div>';
  51. echo '<br />';
  52. $all_result_data++;
  53. }
  54. //------Blog posts
  55. $result = get_blog_post_from_user($course_db, $user_id);
  56. if (!empty($result)) {
  57. echo '<div class="clear"></div><br />';
  58. api_display_tool_title(get_lang('BlogPosts'));
  59. echo '<div class="rounded social-profile-post" style="background:#FAF9F6; padding:0px;">';
  60. echo $result;
  61. echo '</div>';
  62. echo '<br />';
  63. $all_result_data++;
  64. }
  65. //------Blog comments
  66. $result = get_blog_comment_from_user($course_db, $user_id);
  67. if (!empty($result)) {
  68. api_display_tool_title(get_lang('BlogComments'));
  69. echo '<div class="rounded social-profile-post" style="background:#FAF9F6; padding:0px;">';
  70. echo $result;
  71. echo '</div>';
  72. echo '<br />';
  73. $all_result_data++;
  74. }
  75. if ($all_result_data == 0) {
  76. echo get_lang('NoDataAvailable');
  77. }
  78. } else {
  79. echo '<div class="clear"></div><br />';
  80. api_display_tool_title(get_lang('Details'));
  81. echo '<div class="rounded social-profile-post" style="background:#FAF9F6; padding:0px;">';
  82. echo get_lang('UserNonRegisteredAtTheCourse');
  83. echo '<div class="clear"></div><br />';
  84. echo '</div>';
  85. echo '<div class="clear"></div><br />';
  86. }
  87. break;
  88. case 'unload_course' :
  89. //echo 'load2';
  90. break;
  91. default:
  92. }
  93. } else {
  94. // normal behavior
  95. $request=api_is_xml_http_request();
  96. $language_variable=($request===true) ? mb_convert_encoding(get_lang('PersonalData'),'UTF-8',$charset) : get_lang('PersonalData');
  97. //api_display_tool_title($language_variable);
  98. echo '<div class="actions">';
  99. echo '<a href="../auth/profile.php?show=1"">'.Display::return_icon('edit.gif',mb_convert_encoding(get_lang('EditInformation'),'UTF-8',$charset)).'&nbsp;'.mb_convert_encoding(get_lang('EditInformation'),'UTF-8',$charset).'</a>&nbsp;&nbsp;';
  100. if (api_get_setting('allow_social_tool')=='true' && api_get_setting('allow_message_tool')=='true' && api_get_user_id()<>2 && api_get_user_id()<>0) {
  101. echo '<a href="../social/profile.php?shared=true">'.Display::return_icon('shared_profile.png',mb_convert_encoding(get_lang('ViewSharedProfile'),'UTF-8',$charset)).'&nbsp;'.mb_convert_encoding(get_lang('ViewSharedProfile'),'UTF-8',$charset).'</a>';
  102. }
  103. echo '</div>';
  104. echo '<div id="profile_container" style="width:550px;display:block;">';
  105. echo '<div id="picture" style="width:200px;float:right;position:relative;">';
  106. echo '<img src='.$img_array['dir'].$img_array['file'].' />';
  107. echo '</div>';
  108. echo '<div class="social-profile-info">';
  109. echo '<dt>'.mb_convert_encoding(get_lang('UserName'),'UTF-8',$charset).'</dt>
  110. <dd>'. mb_convert_encoding($user_info['username'],'UTF-8',$charset).' </dd>';
  111. echo '<dt>'.mb_convert_encoding(get_lang('FirstName'),'UTF-8',$charset).'</dt>
  112. <dd>'. mb_convert_encoding($user_info['firstname'],'UTF-8',$charset).'</dd>';
  113. echo '<dt>'.mb_convert_encoding(get_lang('LastName'),'UTF-8',$charset).'</dt>
  114. <dd>'. mb_convert_encoding($user_info['lastname'],'UTF-8',$charset).'</dd>';
  115. echo '<dt>'.mb_convert_encoding(get_lang('OfficialCode'),'UTF-8',$charset).'</dt>
  116. <dd>'. mb_convert_encoding($user_info['official_code'],'UTF-8',$charset).'</dd>';
  117. echo '<dt>'.mb_convert_encoding(get_lang('Email'),'UTF-8',$charset).'</dt>
  118. <dd>'. mb_convert_encoding($user_info['email'],'UTF-8',$charset).'</dd>';
  119. echo '<dt>'.mb_convert_encoding(get_lang('Phone'),'UTF-8',$charset).'</dt>
  120. <dd>'. mb_convert_encoding($user_info['phone'],'UTF-8',$charset).'</dd>';
  121. echo '</div>';
  122. echo '</div>';
  123. }
  124. ?>