viewpost.inc.php 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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['dbName'], $current_thread['thread_id'], $_GET['user']);
  8. $sw = true;
  9. if (isset($rows)){
  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. //$url_post = '<a href="javascript:;" onclick="javascript:hidecontent(\'#post'.$row['post_parent_id'].'\')"> '.get_lang('ViewComentPost').'</a> ';
  18. }
  19. if ($row['user_id']=='0') {
  20. $name=prepare4display($row['poster_name']);
  21. } else {
  22. $name=api_get_person_name($row['firstname'], $row['lastname']);
  23. }
  24. if ($sw === true) {
  25. echo "<div style=\"border: 1px solid #000000; padding: 4px 0px 0px 4px; margin-top:5px;\" > <h3> $name </h3> </div>";
  26. $sw = false;
  27. }
  28. echo "<div ".$style."><table width=\"100%\" class=\"post\" cellspacing=\"5\" border=\"0\" >";
  29. // the style depends on the status of the message: approved or not
  30. //echo 'dd'.$row['status'];
  31. if ($row['visible']=='0') {
  32. $titleclass='forum_message_post_title_2_be_approved';
  33. $messageclass='forum_message_post_text_2_be_approved';
  34. $leftclass='forum_message_left_2_be_approved';
  35. } else {
  36. $titleclass='forum_message_post_title';
  37. $messageclass='forum_message_post_text';
  38. $leftclass='forum_message_left';
  39. }
  40. echo "<tr>";
  41. echo "<td rowspan=\"3\" class=\"$leftclass\">";
  42. echo '<br /><b>'.$row['post_date'].'</b><br />';
  43. if (api_is_allowed_to_edit(null,true)) {
  44. echo $url_post;
  45. }
  46. echo "</td>";
  47. // The post title
  48. echo "<td class=\"$titleclass\">".prepare4display($row['post_title'])."</td>";
  49. echo "</tr>";
  50. // The post message
  51. echo "<tr >";
  52. echo "<td class=\"$messageclass\">".prepare4display($row['post_text'])."</td>";
  53. echo "</tr>";
  54. // The check if there is an attachment
  55. $attachment_list=get_attachment($row['post_id']);
  56. if (!empty($attachment_list)) {
  57. echo '<tr ><td height="50%">';
  58. $realname=$attachment_list['path'];
  59. $user_filename=$attachment_list['filename'];
  60. echo Display::return_icon('attachment.gif',get_lang('Attachment'));
  61. echo '<a href="download.php?file=';
  62. echo $realname;
  63. echo ' "> '.$user_filename.' </a>';
  64. echo '<span class="forum_attach_comment" >'.$attachment_list['comment'].'</span><br />';
  65. echo '</td></tr>';
  66. }
  67. // The post has been displayed => it can be removed from the what's new array
  68. unset($whatsnew_post_info[$current_forum['forum_id']][$current_thread['thread_id']][$row['post_id']]);
  69. unset($whatsnew_post_info[$current_forum['forum_id']][$current_thread['thread_id']]);
  70. unset($_SESSION['whatsnew_post_info'][$current_forum['forum_id']][$current_thread['thread_id']][$row['post_id']]);
  71. unset($_SESSION['whatsnew_post_info'][$current_forum['forum_id']][$current_thread['thread_id']]);
  72. echo "</table></div>";
  73. }
  74. }
  75. $userid = (int)$_GET['user_id'];
  76. $userinf=api_get_user_info($userid);
  77. $current_thread = get_thread_information($_GET['thread']);
  78. $threadid = $current_thread['thread_id'];
  79. $qualify = (int)$_POST['idtextqualify'];
  80. //return Max qualify thread
  81. $max_qualify=show_qualify('2',$_GET['cidReq'],$_GET['forum'],$userid,$threadid);
  82. $current_qualify_thread=show_qualify('1',$_GET['cidReq'],$_GET['forum'],$userid,$threadid);
  83. if (isset($_POST['idtextqualify'])) {
  84. store_theme_qualify($userid,$threadid,$qualify,$_SESSION['_user']['user_id'],date('Y-m-d H:i:s'),'');
  85. }
  86. $result = get_statistical_information($current_thread['thread_id'], $_GET['user_id'], $_GET['cidReq']);
  87. if($userinf['status']!='1') {
  88. echo '<div class="forum-qualification-input-box">';
  89. require_once 'forumbody.inc.php';
  90. //echo '<a href="forumqualify.php?'.api_get_cidreq().'&amp;forum='.Security::remove_XSS($_GET['forum']).'&amp;thread='.Security::remove_XSS($_GET['thread']).'&amp;origin='.$origin.'&amp;user_id='.$userid.'">'.get_lang('ViewHistoryChange').'</a>';
  91. echo '</div>';
  92. }