--- lib_standard.php 2010-11-26 20:12:52.000000000 -0500 +++ lib.php 2010-12-16 10:09:41.223468470 -0500 @@ -32,6 +32,7 @@ define('FORUM_MODE_FLATNEWEST', -1); define('FORUM_MODE_THREADED', 2); define('FORUM_MODE_NESTED', 3); +define('FORUM_MODE_ROUNDTABLE', 4); define('FORUM_CHOOSESUBSCRIBE', 0); define('FORUM_FORCESUBSCRIBE', 1); @@ -84,7 +85,7 @@ $discussion->mailnow = false; $discussion->groupid = -1; - $message = ''; + $message = ''; $discussion->id = forum_add_discussion($discussion, null, $message); @@ -5279,11 +5280,28 @@ $posters = array(); // preload all posts - TODO: improve... + /* begin original code if ($mode == FORUM_MODE_FLATNEWEST) { $sort = "p.created DESC"; - } else { - $sort = "p.created ASC"; + } + else { + $sort = "p.created ASC"; + } + //end orginal code + */ + + //determine sort order with new code + switch($mode) { + case FORUM_MODE_FLATNEWEST: + $sort = "p.created DESC"; + break; + case FORUM_MODE_ROUNDTABLE: + $sort = "u.firstname, u.lastname ASC"; + break; + default: + $sort = "p.created ASC"; } + //end new code $forumtracked = forum_tp_is_tracked($forum); $posts = forum_get_all_discussion_posts($discussion->id, $sort, $forumtracked); @@ -5351,6 +5369,12 @@ case FORUM_MODE_NESTED : forum_print_posts_nested($course, $cm, $forum, $discussion, $post, $reply, $forumtracked, $posts); break; + + case FORUM_MODE_ROUNDTABLE : + forum_print_posts_roundtable($course, $cm, $forum, $discussion, $post, 'FORUM_MODE_ROUNDTABLE', $reply, $forumtracked, $posts); + break; + + } } @@ -5395,6 +5419,25 @@ } } +function forum_print_posts_roundtable($course, &$cm, $forum, $discussion, $post, $mode, $reply, $forumtracked, $posts) { + global $USER, $CFG; + + $link = false; + + foreach ($posts as $post) { + if (!$post->parent) { + continue; + } + $post->subject = format_string($post->subject); + $ownpost = ($USER->id == $post->userid); + + $postread = !empty($post->postread); + + forum_print_post($post, $discussion, $forum, $cm, $course, $ownpost, $reply, $link, + '', '', $postread, true, $forumtracked); + } +} + /** * @todo Document this function * @@ -7346,11 +7389,13 @@ * Returns array of forum layout modes * * @return array + * ilusent: added FORUM_MODE_ROUNDTABLE line */ function forum_get_layout_modes() { return array (FORUM_MODE_FLATOLDEST => get_string('modeflatoldestfirst', 'forum'), FORUM_MODE_FLATNEWEST => get_string('modeflatnewestfirst', 'forum'), FORUM_MODE_THREADED => get_string('modethreaded', 'forum'), + FORUM_MODE_ROUNDTABLE => get_string('moderoundtable', 'forum'), FORUM_MODE_NESTED => get_string('modenested', 'forum')); }