viewpost.inc.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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. // the style depends on the status of the message: approved or not
  28. //echo 'dd'.$row['status'];
  29. if ($row['visible']=='0') {
  30. $titleclass='forum_message_post_title_2_be_approved';
  31. $messageclass='forum_message_post_text_2_be_approved';
  32. $leftclass='forum_message_left_2_be_approved';
  33. } else {
  34. $titleclass='forum_message_post_title';
  35. $messageclass='forum_message_post_text';
  36. $leftclass='forum_message_left';
  37. }
  38. echo "<tr>";
  39. echo "<td rowspan=\"3\" class=\"$leftclass\">";
  40. echo '<br /><b>'. api_convert_and_format_date($row['post_date'], DATE_TIME_FORMAT_LONG).'</b><br />';
  41. if (api_is_allowed_to_edit(null,true)) {
  42. echo $url_post;
  43. }
  44. echo "</td>";
  45. // The post title
  46. echo "<td class=\"$titleclass\">".prepare4display($row['post_title'])."</td>";
  47. echo "</tr>";
  48. // The post message
  49. echo "<tr >";
  50. echo "<td class=\"$messageclass\">".prepare4display($row['post_text'])."</td>";
  51. echo "</tr>";
  52. // The check if there is an attachment
  53. $attachment_list=get_attachment($row['post_id']);
  54. if (!empty($attachment_list)) {
  55. echo '<tr ><td height="50%">';
  56. $realname=$attachment_list['path'];
  57. $user_filename=$attachment_list['filename'];
  58. echo Display::return_icon('attachment.gif',get_lang('Attachment'));
  59. echo '<a href="download.php?file=';
  60. echo $realname;
  61. echo ' "> '.$user_filename.' </a>';
  62. echo '<span class="forum_attach_comment" >'.$attachment_list['comment'].'</span><br />';
  63. echo '</td></tr>';
  64. }
  65. // The post has been displayed => it can be removed from the what's new array
  66. unset($whatsnew_post_info[$current_forum['forum_id']][$current_thread['thread_id']][$row['post_id']]);
  67. unset($whatsnew_post_info[$current_forum['forum_id']][$current_thread['thread_id']]);
  68. unset($_SESSION['whatsnew_post_info'][$current_forum['forum_id']][$current_thread['thread_id']][$row['post_id']]);
  69. unset($_SESSION['whatsnew_post_info'][$current_forum['forum_id']][$current_thread['thread_id']]);
  70. echo "</table></div>";
  71. $counter++;
  72. }
  73. }
  74. $userid = (int)$_GET['user_id'];
  75. $userinf=api_get_user_info($userid);
  76. $current_thread = get_thread_information($_GET['thread']);
  77. $threadid = $current_thread['thread_id'];
  78. $qualify = (int)$_POST['idtextqualify'];
  79. //return Max qualify thread
  80. $max_qualify=show_qualify('2', $userid,$threadid);
  81. $current_qualify_thread=show_qualify('1',$userid,$threadid);
  82. if (isset($_POST['idtextqualify'])) {
  83. store_theme_qualify($userid,$threadid,$qualify,$_SESSION['_user']['user_id'],date('Y-m-d H:i:s'),'');
  84. }
  85. $result = get_statistical_information($current_thread['thread_id'], $_GET['user_id'], $_GET['cidReq']);
  86. if ($userinf['status']!='1') {
  87. echo '<div class="forum-qualification-input-box">';
  88. require_once 'forumbody.inc.php';
  89. echo '</div>';
  90. }