3 require_once(dirname(dirname(dirname(__FILE__
))).'/config.php');
4 require_once($CFG->dirroot
.'/mod/forum/lib.php');
6 class block_search_forums
extends block_base
{
8 $this->title
= get_string('blocktitle', 'block_search_forums');
9 $this->version
= 2005030900;
12 function get_content() {
15 if($this->content
!== NULL) {
16 return $this->content
;
19 $this->content
= new stdClass
;
20 $this->content
->footer
= '';
22 if (empty($this->instance
)) {
23 $this->content
->text
= '';
24 return $this->content
;
27 $advancedsearch = get_string('advancedsearch', 'block_search_forums');
29 $search = get_string('search');
31 //Accessibility: replaced <input value=" />" type="submit"> with configurable text/'silent' character.
32 // Theme config, $CFG->block_search_button = get_arrow_right() .'<span class="accesshide">'.get_string('search').'</span>';
33 $button = (isset($CFG->block_search_button
)) ?
$CFG->block_search_button
: get_string('go');
35 $this->content
->text
= '<div class="searchform">';
36 $this->content
->text
.= '<form action="'.$CFG->wwwroot
.'/mod/forum/search.php" style="display:inline"><fieldset class="invisiblefieldset">';
37 $this->content
->text
.= '<input name="id" type="hidden" value="'.$this->instance
->pageid
.'" />'; // course
38 $this->content
->text
.= '<label class="accesshide" for="searchform_search">'.$search.'</label>'.
39 '<input id="searchform_search" name="search" type="text" size="16" />';
40 $this->content
->text
.= '<button id="searchform_button" type="submit" title="'.$search.'">'.$button.'</button><br />';
41 $this->content
->text
.= '<a href="'.$CFG->wwwroot
.'/mod/forum/search.php?id='.$this->instance
->pageid
.'">'.$advancedsearch.'</a>';
42 $this->content
->text
.= helpbutton('search', $advancedsearch, 'moodle', true, false, '', true);
43 $this->content
->text
.= '</fieldset></form></div>';
45 return $this->content
;
48 function applicable_formats() {
49 return array('site' => true, 'course' => true);