viewpost.inc.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * @package chamilo.forum
  5. * @deprecated
  6. */
  7. $course = api_get_course_info();
  8. $userid = (int)$_GET['user_id'];
  9. $userInfo = api_get_user_info($userid);
  10. $current_thread = get_thread_information($_GET['thread']);
  11. $threadid = $current_thread['thread_id'];
  12. $rows = get_thread_user_post(
  13. $course['code'],
  14. $current_thread['thread_id'],
  15. $_GET['user']
  16. );
  17. $post_en = '';
  18. if (isset($rows)) {
  19. $counter = 1;
  20. foreach ($rows as $row) {
  21. if ($row['status']=='0') {
  22. $style = <<<HTML
  23. id="post$post_en" class="hide-me"
  24. style="
  25. border:1px solid red; display:none; background-color: #F7F7F7; width:95%; margin: 0px 0px 4px 40px;
  26. "
  27. HTML;
  28. $url_post = '';
  29. } else {
  30. $style = "";
  31. $post_en = $row['post_parent_id'];
  32. }
  33. if ($row['user_id'] == '0') {
  34. $name = prepare4display($row['poster_name']);
  35. } else {
  36. $name = api_get_person_name($row['firstname'], $row['lastname']);
  37. }
  38. if ($counter == 1) {
  39. echo Display::page_subheader($name);
  40. }
  41. echo "<div " . $style . "><table class=\"table table-stripped table-hover table-bordered\">";
  42. if ($row['visible']=='0') {
  43. $titleclass = 'forum_message_post_title_2_be_approved';
  44. $messageclass = 'forum_message_post_text_2_be_approved';
  45. $leftclass = 'forum_message_left_2_be_approved';
  46. } else {
  47. $titleclass = 'forum_message_post_title';
  48. $messageclass = 'forum_message_post_text';
  49. $leftclass = 'forum_message_left';
  50. }
  51. echo "<tr>";
  52. echo "<td rowspan=\"3\" class=\"$leftclass\">";
  53. echo '<br /><b>' . api_convert_and_format_date($row['post_date'], DATE_TIME_FORMAT_LONG) . '</b><br />';
  54. echo "</td>";
  55. // The post title
  56. echo "<td class=\"$titleclass\">" . prepare4display($row['post_title']) . "</td>";
  57. echo "</tr>";
  58. // The post message
  59. echo "<tr >";
  60. echo "<td class=\"$messageclass\">" . prepare4display($row['post_text']) . "</td>";
  61. echo "</tr>";
  62. // The check if there is an attachment
  63. $attachment_list = getAllAttachment($row['post_id']);
  64. if (!empty($attachment_list)) {
  65. foreach ($attachment_list as $attachment) {
  66. echo '<tr ><td height="50%">';
  67. $realname = $attachment['path'];
  68. $user_filename = $attachment['filename'];
  69. echo Display::return_icon('attachment.gif', get_lang('Attachment'));
  70. echo '<a href="download.php?file=';
  71. echo $realname;
  72. echo ' "> ' . $user_filename . ' </a>';
  73. echo '<span class="forum_attach_comment" >' . $attachment['comment'] . '</span><br />';
  74. echo '</td></tr>';
  75. }
  76. }
  77. // The post has been displayed => it can be removed from the what's new array
  78. if (isset($whatsnew_post_info)) {
  79. unset($whatsnew_post_info[$currentForum['forum_id']][$current_thread['thread_id']][$row['post_id']]);
  80. unset($whatsnew_post_info[$currentForum['forum_id']][$current_thread['thread_id']]);
  81. }
  82. if (isset($_SESSION['whatsnew_post_info'])) {
  83. unset($_SESSION['whatsnew_post_info'][$currentForum['forum_id']][$current_thread['thread_id']][$row['post_id']]);
  84. unset($_SESSION['whatsnew_post_info'][$currentForum['forum_id']][$current_thread['thread_id']]);
  85. }
  86. echo "</table></div>";
  87. $counter++;
  88. }
  89. }
  90. //return Max qualify thread
  91. $max_qualify = showQualify('2', $userid, $threadid);
  92. $current_qualify_thread = showQualify('1', $userid, $threadid);
  93. if (isset($_POST['idtextqualify'])) {
  94. saveThreadScore(
  95. $current_thread,
  96. $userid,
  97. $threadid,
  98. $_POST['idtextqualify'],
  99. api_get_user_id(),
  100. date('Y-m-d H:i:s'),
  101. ''
  102. );
  103. }
  104. $result = get_statistical_information(
  105. $current_thread['thread_id'],
  106. $_GET['user_id'],
  107. api_get_course_int_id()
  108. );
  109. /*
  110. if ($userInfo['status']!='1') {
  111. echo '<div class="forum-qualification-input-box">';
  112. require_once 'forumbody.inc.php';
  113. echo '</div>';
  114. }
  115. */