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