viewpost.inc.php 3.9 KB

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