Fix for bug 2705:
Decoupling from the beast that is /mod/forum/lib.php, it was a pity to include 100+ KB of code so that we could reuse 7-8 lines. This block also wasn't including that library itself, so after Martin removed that dependency from courses it was broken as well.
This commit is contained in:
@@ -3,24 +3,31 @@
|
||||
class block_search_forums extends block_base {
|
||||
function init() {
|
||||
$this->title = get_string('search', 'forum');
|
||||
$this->version = 2004041000;
|
||||
$this->version = 2005030900;
|
||||
}
|
||||
|
||||
function get_content() {
|
||||
global $CFG;
|
||||
|
||||
if($this->content !== NULL) {
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
$this->content = new stdClass;
|
||||
$this->content->footer = '';
|
||||
|
||||
if (empty($this->instance)) {
|
||||
$this->content = '';
|
||||
$this->content->text = '';
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
$course = get_record('course', 'id', $this->instance->pageid);
|
||||
|
||||
$this->content = new stdClass;
|
||||
$this->content->text = forum_print_search_form($course, '', true, 'block');
|
||||
$this->content->footer = '';
|
||||
$this->content->text = '<div class="searchform">';
|
||||
$this->content->text .= '<form name="search" action="'.$CFG->wwwroot.'/mod/forum/search.php" style="display:inline">';
|
||||
$this->content->text .= '<input name="search" type="text" size="18" value="" alt="search" /> ';
|
||||
$this->content->text .= '<input value="'.get_string('searchforums', 'forum').'" type="submit" />';
|
||||
$this->content->text .= helpbutton('search', get_string('search'), 'moodle', true, false, '', true);
|
||||
$this->content->text .= '<input name="id" type="hidden" value="'.$this->instance->pageid.'" />';
|
||||
$this->content->text .= '</form></div>';
|
||||
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user