Added simple paging ... only top 100 are shown by default. If there
are more then "older discussions" link shows all of them. Someday proper 1,2,3,4 paging would be nice but this will do for now.
This commit is contained in:
+4
-4
@@ -29,7 +29,7 @@ define("FORUM_SHORT_POST", 300); // Less non-HTML characters than this is short
|
||||
|
||||
define("FORUM_LONG_POST", 600); // More non-HTML characters than this is long
|
||||
|
||||
define("FORUM_MANY_DISCUSSIONS", 3);
|
||||
define("FORUM_MANY_DISCUSSIONS", 100);
|
||||
|
||||
|
||||
/// STANDARD FUNCTIONS ///////////////////////////////////////////////////////////
|
||||
@@ -1478,8 +1478,8 @@ function forum_print_latest_discussions($forum_id=0, $forum_numdiscussions=5, $f
|
||||
return;
|
||||
}
|
||||
|
||||
if ((!$forum_numdiscussions) && ($forum_style == "plain") && (count($discussions) > FORUM_MANY_DISCUSSIONS) ) {
|
||||
$forum_style = "header"; // Abbreviate display if it's going to be long.
|
||||
if ((!$forum_numdiscussions) && ($forum_style == "plain")) {
|
||||
$forum_style = "header"; // Abbreviate display by default
|
||||
}
|
||||
|
||||
$replies = forum_count_discussion_replies($forum->id);
|
||||
@@ -1507,7 +1507,7 @@ function forum_print_latest_discussions($forum_id=0, $forum_numdiscussions=5, $f
|
||||
$discussioncount++;
|
||||
|
||||
if ($forum_numdiscussions && ($discussioncount > $forum_numdiscussions)) {
|
||||
echo "<P ALIGN=right><A HREF=\"$CFG->wwwroot/mod/forum/view.php?f=$forum->id\">";
|
||||
echo "<P ALIGN=right><A HREF=\"$CFG->wwwroot/mod/forum/view.php?f=$forum->id&showall=1\">";
|
||||
echo get_string("olderdiscussions", "forum")."</A> ...</P>";
|
||||
break;
|
||||
}
|
||||
|
||||
+14
-6
@@ -3,11 +3,11 @@
|
||||
require_once("../../config.php");
|
||||
require_once("lib.php");
|
||||
|
||||
optional_variable($id); // Course Module ID
|
||||
optional_variable($f); // Forum ID
|
||||
optional_variable($mode); // Display mode (for single forum)
|
||||
optional_variable($id); // Course Module ID
|
||||
optional_variable($f); // Forum ID
|
||||
optional_variable($mode); // Display mode (for single forum)
|
||||
optional_variable($search, ""); // search string
|
||||
|
||||
optional_variable($showall, ""); // show all discussions on one page
|
||||
|
||||
$strforums = get_string("modulenameplural", "forum");
|
||||
$strforum = get_string("modulename", "forum");
|
||||
@@ -127,13 +127,21 @@
|
||||
echo " ";
|
||||
}
|
||||
echo "</P>";
|
||||
forum_print_latest_discussions($forum->id, 0);
|
||||
if (!empty($showall)) {
|
||||
forum_print_latest_discussions($forum->id, 0, "header");
|
||||
} else {
|
||||
forum_print_latest_discussions($forum->id, FORUM_MANY_DISCUSSIONS, "header");
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
print_simple_box(text_to_html($forum->intro), "CENTER");
|
||||
echo "<P> </P>";
|
||||
forum_print_latest_discussions($forum->id, 0);
|
||||
if (!empty($showall)) {
|
||||
forum_print_latest_discussions($forum->id, 0, "header");
|
||||
} else {
|
||||
forum_print_latest_discussions($forum->id, FORUM_MANY_DISCUSSIONS, "header");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user