data_personal.inc.php 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <?php
  2. /* For licensing terms, see /dokeos_license.txt */
  3. $language_file = array('registration','messages','userInfo','admin','forum','blog');
  4. require_once '../inc/global.inc.php';
  5. require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
  6. require_once api_get_path(LIBRARY_PATH).'social.lib.php';
  7. require_once api_get_path(LIBRARY_PATH).'course.lib.php';
  8. // @todo here we must show the user information as read only
  9. //User picture size is calculated from SYSTEM path
  10. $user_info= UserManager::get_user_info_by_id(api_get_user_id());
  11. $img_array= UserManager::get_user_picture_path_by_id(api_get_user_id(),'web',true,true);
  12. if (isset($_POST['load_ajax'])) {
  13. require_once api_get_path(LIBRARY_PATH).'blog.lib.php';
  14. require_once api_get_path(SYS_CODE_PATH).'forum/forumfunction.inc.php';
  15. $user_id = intval($_SESSION['social_user_id']);
  16. if ($_POST['action']) {$action = $_POST['action'];}
  17. switch($action) {
  18. case 'load_course' :
  19. $course_db = $_POST['course_code'];
  20. // @todo goto the course link
  21. //echo '<a href="'.api_get_path(WEB_COURSE_PATH).$course_directory.'/?id_session='.$my_course['id_session'].'">'.get_lang('GotoCourse').'</a>';
  22. $course_id=CourseManager::get_course_id_by_database_name($course_db);
  23. if (api_is_user_of_course($course_id,api_get_user_id())) {
  24. $table_forums = Database :: get_course_table(TABLE_FORUM,$course_db);
  25. $table_threads = Database :: get_course_table(TABLE_FORUM_THREAD,$course_db);
  26. $table_posts = Database :: get_course_table(TABLE_FORUM_POST,$course_db);
  27. $table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY,$course_db);
  28. $table_users = Database :: get_main_table(TABLE_MAIN_USER);
  29. //------Forum messages
  30. $forum_result = get_all_post_from_user($user_id, $course_db);
  31. $all_result_data = 0;
  32. if ($forum_result !='') {
  33. api_display_tool_title(get_lang('Forum'));
  34. echo '<div class="social-background-content" style="background:#FAF9F6; padding:0px;" >';
  35. echo api_xml_http_response_encode($forum_result);
  36. echo '</div>';
  37. echo '<br />';
  38. $all_result_data++;
  39. }
  40. //------Blog posts
  41. $result = get_blog_post_from_user($course_db, $user_id);
  42. if (!empty($result)) {
  43. echo '<div class="clear"></div><br />';
  44. api_display_tool_title(api_xml_http_response_encode(get_lang('BlogPosts')));
  45. echo '<div class="social-background-content" style="background:#FAF9F6; padding:0px;">';
  46. echo api_xml_http_response_encode($result);
  47. echo '</div>';
  48. echo '<br />';
  49. $all_result_data++;
  50. }
  51. //------Blog comments
  52. $result = get_blog_comment_from_user($course_db, $user_id);
  53. if (!empty($result)) {
  54. api_display_tool_title(api_xml_http_response_encode(get_lang('BlogComments')));
  55. echo '<div class="social-background-content" style="background:#FAF9F6; padding:0px;">';
  56. echo api_xml_http_response_encode($result);
  57. echo '</div>';
  58. echo '<br />';
  59. $all_result_data++;
  60. }
  61. if ($all_result_data == 0) {
  62. echo api_xml_http_response_encode(get_lang('NoDataAvailable'));
  63. }
  64. } else {
  65. echo '<div class="clear"></div><br />';
  66. api_display_tool_title(api_xml_http_response_encode(get_lang('Details')));
  67. echo '<div class="social-background-content" style="background:#FAF9F6; padding:0px;">';
  68. echo api_xml_http_response_encode(get_lang('UserNonRegisteredAtTheCourse'));
  69. echo '<div class="clear"></div><br />';
  70. echo '</div>';
  71. echo '<div class="clear"></div><br />';
  72. }
  73. break;
  74. case 'unload_course' :
  75. //echo 'load2';
  76. break;
  77. default:
  78. }
  79. } else {
  80. // normal behavior
  81. $request=api_is_xml_http_request();
  82. $language_variable=api_xml_http_response_encode(get_lang('PersonalData'));
  83. //api_display_tool_title($language_variable);
  84. echo '<div class="actions">';
  85. echo '<a href="../auth/profile.php?show=1"">'.Display::return_icon('edit.gif',api_xml_http_response_encode(get_lang('EditInformation'))).'&nbsp;'.api_xml_http_response_encode(get_lang('EditInformation')).'</a>&nbsp;&nbsp;';
  86. 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) {
  87. echo '<a href="../social/profile.php?shared=true">'.Display::return_icon('shared_profile.png',api_xml_http_response_encode(get_lang('ViewSharedProfile'))).'&nbsp;'.api_xml_http_response_encode(get_lang('ViewSharedProfile')).'</a>';
  88. }
  89. echo '</div>';
  90. echo '<div id="profile_container">';
  91. echo '<div class="social-profile-info" style="float:left;position:relative">';
  92. echo '<dl><dt>'.api_xml_http_response_encode(get_lang('UserName')).'</dt>
  93. <dd>'. api_xml_http_response_encode($user_info['username']).' </dd></dl>';
  94. if (api_is_western_name_order()) {
  95. echo '<dl><dt>'.api_xml_http_response_encode(get_lang('FirstName')).'</dt>
  96. <dd>'. api_xml_http_response_encode($user_info['firstname']).'</dd></dl>';
  97. echo '<dl><dt>'.api_xml_http_response_encode(get_lang('LastName')).'</dt>
  98. <dd>'. api_xml_http_response_encode($user_info['lastname']).'</dd></dl>';
  99. } else {
  100. echo '<dl><dt>'.api_xml_http_response_encode(get_lang('LastName')).'</dt><dd>'. api_xml_http_response_encode($user_info['lastname']).'</dd></dl>';
  101. echo '<dl><dt>'.api_xml_http_response_encode(get_lang('FirstName')).'</dt><dd>'. api_xml_http_response_encode($user_info['firstname']).'</dd></dl>';
  102. }
  103. echo '<dl><dt>'.api_xml_http_response_encode(get_lang('OfficialCode')).'</dt>
  104. <dd>'. api_xml_http_response_encode($user_info['official_code']).'</dd></dl>';
  105. echo '<dl><dt>'.api_xml_http_response_encode(get_lang('Email')).'</dt>
  106. <dd>'. api_xml_http_response_encode($user_info['email']).'</dd></dl>';
  107. echo '<dl><dt>'.api_xml_http_response_encode(get_lang('Phone')).'</dt>
  108. <dd>'. api_xml_http_response_encode($user_info['phone']).'</dd></dl>';
  109. echo '</div>';
  110. echo '<div style="float:left;position:relative">';
  111. echo '<div id="picture" style="width:200px;float:left;position:relative;margin-top:10px;">';
  112. echo '<img src='.$img_array['dir'].$img_array['file'].' />';
  113. echo '</div>';
  114. /*if (api_get_setting('allow_message_tool')=='true') {
  115. require_once api_get_path(LIBRARY_PATH).'message.lib.php';
  116. $number_of_new_messages = MessageManager::get_new_messages();
  117. $number_of_outbox_message=MessageManager::get_number_of_messages_sent();
  118. $cant_out_box=' ('.$number_of_outbox_message.')';
  119. $cant_msg = ' ('.$number_of_new_messages.')';
  120. $number_of_new_messages_of_friend=UserFriend::get_message_number_invitation_by_user_id(api_get_user_id());
  121. //echo '<div class="message-view" style="display:none;">'.get_lang('ViewMessages').'</div>';
  122. echo '<div class="message-content" style="float:right" >
  123. <h2 class="message-title" style="margin-top:0">'.get_lang('Messages').'</h2>
  124. <p>
  125. <a href="../social/index.php#remote-tab-2" class="message-body">'.get_lang('Inbox').$cant_msg.' </a><br />
  126. <a href="../social/index.php#remote-tab-3" class="message-body">'.get_lang('Outbox').$cant_out_box.'</a><br />
  127. </p>';
  128. echo '<img src="../img/delete.gif" alt="'.get_lang('Close').'" title="'.get_lang('Close').'" class="message-delete" onclick="delete_message_js()" />';
  129. if ($number_of_new_messages_of_friend>0) {
  130. echo '<br/>';
  131. }
  132. echo '</div>';
  133. }*/
  134. echo '</div>';
  135. }
  136. ?>