dokeos-forum
[ class tree: dokeos-forum ] [ index: dokeos-forum ] [ all elements ]

Source for file iframe_thread.php

Documentation is available at iframe_thread.php

  1. <?php
  2. /*
  3. ==============================================================================
  4.     Dokeos - elearning and course management software
  5.  
  6.     Copyright (c) 2006 Dokeos S.A.
  7.     Copyright (c) 2006 Ghent University (UGent)
  8.  
  9.     For a full list of contributors, see "credits.txt".
  10.     The full license can be read in "license.txt".
  11.  
  12.     This program is free software; you can redistribute it and/or
  13.     modify it under the terms of the GNU General Public License
  14.     as published by the Free Software Foundation; either version 2
  15.     of the License, or (at your option) any later version.
  16.  
  17.     See the GNU General Public License for more details.
  18.  
  19.     Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
  20.     Mail: info@dokeos.com
  21. ==============================================================================
  22. */
  23.  
  24. /**
  25. *    These files are a complete rework of the forum. The database structure is
  26. *    based on phpBB but all the code is rewritten. A lot of new functionalities
  27. *    are added:
  28. *     - forum categories and forums can be sorted up or down, locked or made invisible
  29. *    - consistent and integrated forum administration
  30. *     - forum options:     are students allowed to edit their post?
  31. *                         moderation of posts (approval)
  32. *                         reply only forums (students cannot create new threads)
  33. *                         multiple forums per group
  34. *    - sticky messages
  35. *     - new view option: nested view
  36. *     - quoting a message
  37. *
  38. *    @Author Patrick Cool <patrick.cool@UGent.be>, Ghent University
  39. *    @Copyright Ghent University
  40. *    @Copyright Patrick Cool
  41. *
  42. *     @package dokeos.forum
  43. */
  44.  
  45. /**
  46.  *************************************************************************
  47.  *                        IMPORTANT NOTICE
  48.  * Please do not change anything is this code yet because there are still
  49.  * some significant code that need to happen and I do not have the time to
  50.  * merge files and test it all over again. So for the moment, please do not
  51.  * touch the code
  52.  *                             -- Patrick Cool <patrick.cool@UGent.be>
  53.  *************************************************************************
  54.  */
  55.  
  56. /*
  57. ==============================================================================
  58.         INIT SECTION
  59. ==============================================================================
  60. */
  61.     include('../inc/global.inc.php');
  62.     $this_section=SECTION_COURSES;
  63.     /* ------------    ACCESS RIGHTS ------------ */
  64.     // notice for unauthorized people.
  65. /*
  66. -----------------------------------------------------------
  67.     Language Initialisation
  68. -----------------------------------------------------------
  69. */
  70. // name of the language file that needs to be included
  71. $language_file 'forum';
  72. require ('../inc/global.inc.php');
  73. require_once (api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php');
  74. include_once (api_get_path(LIBRARY_PATH).'groupmanager.lib.php');
  75.  
  76. $fck_attribute['Width''100%';
  77. $fck_attribute['Height''400';
  78. $fck_attribute['ToolbarSet''Middle';
  79. $fck_attribute['Config']['IMUploadPath''upload/forum/';
  80. $fck_attribute['Config']['FlashUploadPath''upload/forum/';
  81. if(!api_is_allowed_to_edit()) $fck_attribute['Config']['UserStatus''student';
  82.  
  83.  
  84. $nameTools=get_lang('Forum');
  85. ?>
  86. <!DOCTYPE html
  87.      PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  88.      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  89. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  90. <head>
  91.     <title></title>
  92. <style type="text/css" media="screen, projection">
  93. /*<![CDATA[*/
  94. @import "<?php echo api_get_path(WEB_CODE_PATH)?>css/<?php echo api_get_setting('stylesheets');?>/default.css";
  95. /*]]>*/
  96. </style>
  97. </head>
  98. <body>
  99. <?php
  100.  
  101. /*
  102. -----------------------------------------------------------
  103.     Including necessary files
  104. -----------------------------------------------------------
  105. */
  106. include('forumconfig.inc.php');
  107. include('forumfunction.inc.php');
  108.  
  109.  
  110. /*
  111. ==============================================================================
  112.         MAIN DISPLAY SECTION
  113. ==============================================================================
  114. */
  115. /*
  116. -----------------------------------------------------------
  117.     Retrieving forum and forum categorie information
  118. -----------------------------------------------------------
  119. */
  120. // we are getting all the information about the current forum and forum category.
  121. // note pcool: I tried to use only one sql statement (and function) for this
  122. // but the problem is that the visibility of the forum AND forum cateogory are stored in the item_property table
  123. $current_thread=get_thread_information($_GET['thread'])// note: this has to be validated that it is an existing thread
  124. $current_forum=get_forum_information($current_thread['forum_id'])// note: this has to be validated that it is an existing forum.
  125. $current_forum_category=get_forumcategory_information($current_forum['forum_category']);
  126.  
  127. /*
  128. -----------------------------------------------------------
  129.     Is the user allowed here?
  130. -----------------------------------------------------------
  131. */
  132. // if the user is not a course administrator and the forum is hidden
  133. // then the user is not allowed here.
  134. if (!api_is_allowed_to_edit(AND ($current_forum['visibility']==OR $current_thread['visibility']==0))
  135. {
  136. }
  137.  
  138. /*
  139. -----------------------------------------------------------
  140.     Display Forum Category and the Forum information
  141. -----------------------------------------------------------
  142. */
  143. // we are getting all the information about the current forum and forum category.
  144. // note pcool: I tried to use only one sql statement (and function) for this
  145. // but the problem is that the visibility of the forum AND forum cateogory are stored in the item_property table
  146. /*
  147. echo "<table width='100%'>\n";
  148.  
  149. // the forum category
  150. echo "\t<tr class=\"forum_category\">\n\t\t<td colspan=\"6\">";
  151. echo '<a href="index.php" '.class_visible_invisible($current_forum_category['visibility']).'>'.$current_forum_category['cat_title'].'</a><br />';
  152. echo '<span>'.$current_forum_category['cat_comment'].'</span>';
  153. echo "</td>\n";
  154. echo "\t</tr>\n";
  155.  
  156. // the forum
  157. echo "\t<tr class=\"forum_header\">\n";
  158. echo "\t\t<td colspan=\"6\"><a href=\"viewforum.php?forum=".$current_forum['forum_id']."\" ".class_visible_invisible($current_forum['visibility']).">".$current_forum['forum_title']."</a><br />";
  159. echo '<span>'.$current_forum['forum_comment'].'</span>';
  160. echo "</td>\n";
  161. echo "\t</tr>\n";
  162. echo "</table>";
  163. */
  164.  
  165. $sql="SELECT * FROM $table_posts posts, $table_users users
  166.         WHERE posts.thread_id='".$current_thread['thread_id']."'
  167.         AND posts.poster_id=users.user_id
  168.         ORDER BY posts.post_id ASC";
  169. $result=api_sql_query($sql__FILE____LINE__);
  170.  
  171. echo "<table width=\"100%\" cellspacing=\"5\" border=\"0\">\n";
  172. while ($row=mysql_fetch_array($result))
  173. {
  174.     echo "\t<tr>\n";
  175.     echo "\t\t<td rowspan=\"2\" class=\"forum_message_left\">";
  176.     if ($row['user_id']=='0')
  177.     {
  178.         $name=$row['poster_name'];
  179.     }
  180.     else
  181.     {
  182.         $name=$row['firstname'].' '.$row['lastname'];
  183.     }
  184.     echo display_user_link($row['user_id']$name).'<br />';
  185.     echo $row['post_date'].'<br /><br />';
  186.  
  187.     echo "</td>\n";
  188.     echo "\t\t<td class=\"forum_message_post_title\">".$row['post_title']."</td>\n";
  189.     echo "\t</tr>\n";
  190.  
  191.     echo "\t<tr>\n";
  192.     echo "\t\t<td class=\"forum_message_post_text\">".$row['post_text']."</td>\n";
  193.     echo "\t</tr>\n";
  194. }
  195. echo "</table>";
  196.  
  197. ?>
  198. </body>
  199. </html>

Documentation generated on Thu, 12 Jun 2008 13:45:51 -0500 by phpDocumentor 1.4.1