Simplified by removing two optional parameters from forum_print_search_form,
because everyone was using the same values for them! Also renamed the function to simply forum_search_form, because in the end noone was using it to PRINT html, it was just put into a variable.
This commit is contained in:
@@ -109,7 +109,7 @@
|
||||
|
||||
$navmiddle = "<a href=\"../forum/index.php?id=$course->id\">".get_string("forums", "forum")."</a> -> <a href=\"../forum/view.php?f=$forum->id\">$forum->name</a>";
|
||||
|
||||
$searchform = forum_print_search_form($course, "", true, "navbar");
|
||||
$searchform = forum_search_form($course);
|
||||
|
||||
if ($course->category) {
|
||||
print_header("$course->shortname: $discussion->name", "$course->fullname",
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@
|
||||
$strunreadposts = get_string("unreadposts", "forum");
|
||||
$strrss = get_string("rss");
|
||||
|
||||
$searchform = forum_print_search_form($course, "", true, "navbar");
|
||||
$searchform = forum_search_form($course);
|
||||
|
||||
|
||||
// Start of the table for General Forums
|
||||
|
||||
+10
-23
@@ -1981,32 +1981,19 @@ function forum_print_mode_form($discussion, $mode) {
|
||||
echo "</div>\n";
|
||||
}
|
||||
|
||||
function forum_print_search_form($course, $search='', $return=false, $type='navbar') {
|
||||
function forum_search_form($course, $search='') {
|
||||
global $CFG;
|
||||
|
||||
if ($type == 'block') {
|
||||
$output = '<div class="searchform">';
|
||||
$output .= '<form name="search" action="'.$CFG->wwwroot.'/mod/forum/search.php" style="display:inline">';
|
||||
$output .= '<input name="search" type="text" size="18" value="'.$search.'" alt="search" /> ';
|
||||
$output .= '<input value="'.get_string('searchforums', 'forum').'" type="submit" />';
|
||||
$output .= helpbutton('search', get_string('search'), 'moodle', true, false, '', true);
|
||||
$output .= '<input name="id" type="hidden" value="'.$course->id.'" />';
|
||||
$output .= '</form></div>';
|
||||
} else {
|
||||
$output = '<table border="0" cellpadding="0" cellspacing="0"><tr><td nowrap="nowrap">';
|
||||
$output .= helpbutton('search', get_string('search'), 'moodle', true, false, '', true);
|
||||
$output .= ' <form name="search" action="'.$CFG->wwwroot.'/mod/forum/search.php" style="display:inline">';
|
||||
$output .= '<input name="search" type="text" size="18" value="'.$search.'" alt="search" />';
|
||||
$output .= '<input value="'.get_string('searchforums', 'forum').'" type="submit" />';
|
||||
$output .= '<input name="id" type="hidden" value="'.$course->id.'" />';
|
||||
$output .= '</form>';
|
||||
$output .= '</td></tr></table>';
|
||||
}
|
||||
$output = '<table border="0" cellpadding="0" cellspacing="0"><tr><td nowrap="nowrap">';
|
||||
$output .= helpbutton('search', get_string('search'), 'moodle', true, false, '', true);
|
||||
$output .= ' <form name="search" action="'.$CFG->wwwroot.'/mod/forum/search.php" style="display:inline">';
|
||||
$output .= '<input name="search" type="text" size="18" value="'.$search.'" alt="search" />';
|
||||
$output .= '<input value="'.get_string('searchforums', 'forum').'" type="submit" />';
|
||||
$output .= '<input name="id" type="hidden" value="'.$course->id.'" />';
|
||||
$output .= '</form>';
|
||||
$output .= '</td></tr></table>';
|
||||
|
||||
if ($return) {
|
||||
return $output;
|
||||
}
|
||||
echo $output;
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@
|
||||
$searchterms = str_replace('forumid:', 'instance:', $search);
|
||||
$searchterms = explode(' ', $searchterms);
|
||||
|
||||
$searchform = forum_print_search_form($course, $search, true, "navbar");
|
||||
$searchform = forum_search_form($course, $search);
|
||||
|
||||
if ($group = user_group($course->id, $USER->id)) {
|
||||
$groupid = $group->id;
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@
|
||||
}
|
||||
|
||||
if (!$buttontext) {
|
||||
$buttontext = forum_print_search_form($course, $search, true, "navbar");
|
||||
$buttontext = forum_search_form($course, $search);
|
||||
}
|
||||
|
||||
require_course_login($course, true, $cm);
|
||||
|
||||
Reference in New Issue
Block a user