viewpost.inc.php 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <?php
  2. /*
  3. ==============================================================================
  4. Dokeos - elearning and course management software
  5. Copyright (c) 2008 Dokeos Latinoamerica SAC
  6. For a full list of contributors, see "credits.txt".
  7. The full license can be read in "license.txt".
  8. This program is free software; you can redistribute it and/or
  9. modify it under the terms of the GNU General Public License
  10. as published by the Free Software Foundation; either version 2
  11. of the License, or (at your option) any later version.
  12. See the GNU General Public License for more details.
  13. Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium
  14. Mail: info@dokeos.com
  15. ==============================================================================
  16. */
  17. /**
  18. * @package dokeos.forum
  19. */
  20. $course = api_get_course_info();
  21. $rows = get_thread_user_post($course['dbName'], $current_thread['thread_id'], $_GET['user']);
  22. $sw = true;
  23. if(isset($rows)){
  24. foreach ($rows as $row) {
  25. if ($row['status']=='0') {
  26. $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; \" ";
  27. $url_post ='';
  28. } else {
  29. $style = "";
  30. $post_en = $row['post_parent_id'];
  31. $url_post = '<a href="javascript:;" onclick="javascript:hidecontent(\'#post'.$row['post_parent_id'].'\')"> '.get_lang('ViewComentPost').'</a> ';
  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($sw === true) {
  39. echo "<div style=\"border: 1px solid #000000; padding: 4px 0px 0px 4px; margin-top:5px;\" > <h3> $name </h3> </div>";
  40. $sw = false;
  41. }
  42. echo "<div ".$style."><table width=\"100%\" class=\"post\" cellspacing=\"5\" border=\"0\" >\n";
  43. // the style depends on the status of the message: approved or not
  44. //echo 'dd'.$row['status'];
  45. if ($row['visible']=='0') {
  46. $titleclass='forum_message_post_title_2_be_approved';
  47. $messageclass='forum_message_post_text_2_be_approved';
  48. $leftclass='forum_message_left_2_be_approved';
  49. } else {
  50. $titleclass='forum_message_post_title';
  51. $messageclass='forum_message_post_text';
  52. $leftclass='forum_message_left';
  53. }
  54. echo "\t<tr>\n";
  55. echo "\t\t<td rowspan=\"3\" class=\"$leftclass\">";
  56. echo '<br /><b>'.$row['post_date'].'</b><br />';
  57. if (api_is_allowed_to_edit(null,true)) {
  58. echo $url_post;
  59. }
  60. echo "</td>\n";
  61. // The post title
  62. echo "\t\t<td class=\"$titleclass\">".prepare4display($row['post_title'])."</td>\n";
  63. echo "\t</tr>\n";
  64. // The post message
  65. echo "\t<tr >\n";
  66. echo "\t\t<td class=\"$messageclass\">".prepare4display($row['post_text'])."</td>\n";
  67. echo "\t</tr>\n";
  68. // The check if there is an attachment
  69. $attachment_list=get_attachment($row['post_id']);
  70. if (!empty($attachment_list)) {
  71. echo '<tr ><td height="50%">';
  72. $realname=$attachment_list['path'];
  73. $user_filename=$attachment_list['filename'];
  74. echo Display::return_icon('attachment.gif',get_lang('Attachment'));
  75. echo '<a href="download.php?file=';
  76. echo $realname;
  77. echo ' "> '.$user_filename.' </a>';
  78. echo '<span class="forum_attach_comment" >'.$attachment_list['comment'].'</span><br />';
  79. echo '</td></tr>';
  80. }
  81. // The post has been displayed => it can be removed from the what's new array
  82. unset($whatsnew_post_info[$current_forum['forum_id']][$current_thread['thread_id']][$row['post_id']]);
  83. unset($whatsnew_post_info[$current_forum['forum_id']][$current_thread['thread_id']]);
  84. unset($_SESSION['whatsnew_post_info'][$current_forum['forum_id']][$current_thread['thread_id']][$row['post_id']]);
  85. unset($_SESSION['whatsnew_post_info'][$current_forum['forum_id']][$current_thread['thread_id']]);
  86. echo "</table></div>";
  87. }
  88. }
  89. $userid = (int)$_GET['user_id'];
  90. $userinf=api_get_user_info($userid);
  91. $current_thread = get_thread_information($_GET['thread']);
  92. $threadid = $current_thread['thread_id'];
  93. $qualify = (int)$_POST['idtextqualify'];
  94. //return Max qualify thread
  95. $max_qualify=show_qualify('2',$_GET['cidReq'],$_GET['forum'],$userid,$threadid);
  96. $current_qualify_thread=show_qualify('1',$_GET['cidReq'],$_GET['forum'],$userid,$threadid);
  97. if(isset($_POST['idtextqualify']))
  98. {
  99. store_theme_qualify($userid,$threadid,$qualify,$_SESSION['_user']['user_id'],date('Y-m-d H:i:s'),'');
  100. }
  101. $result = get_statistical_information($current_thread['thread_id'], $_GET['user_id'], $_GET['cidReq']);
  102. if($userinf['status']!='1') {
  103. echo '<div class="forum-qualification-input-box">';
  104. require_once 'forumbody.inc.php';
  105. //echo '<a href="forumqualify.php?'.api_get_cidreq().'&forum='.Security::remove_XSS($_GET['forum']).'&thread='.Security::remove_XSS($_GET['thread']).'&origin='.$origin.'&user_id='.$userid.'">'.get_lang('ViewHistoryChange').'</a>';
  106. echo '</div>';
  107. }