02eef48001dddc1c9ac4a3fb4f821a6c93e200af
[moodle.git] / blocks / search_forums / block_search_forums.php
1 <?php
3 class block_search_forums extends block_base {
4     function init() {
5         $this->title = get_string('pluginname', 'block_search_forums');
6     }
8     function get_content() {
9         global $CFG, $OUTPUT;
11         if($this->content !== NULL) {
12             return $this->content;
13         }
15         $this->content = new stdClass;
16         $this->content->footer = '';
18         if (empty($this->instance)) {
19             $this->content->text   = '';
20             return $this->content;
21         }
23         $advancedsearch = get_string('advancedsearch', 'block_search_forums');
25         $search = get_string('search');
27         //Accessibility: replaced <input value=" />" type="submit"> with configurable text/'silent' character.
28         // Theme config, $CFG->block_search_button = get_arrow_right() .'<span class="accesshide">'.get_string('search').'</span>';
29         $button = (isset($CFG->block_search_button)) ? $CFG->block_search_button : get_string('go');
31         $this->content->text  = '<div class="searchform">';
32         $this->content->text .= '<form action="'.$CFG->wwwroot.'/mod/forum/search.php" style="display:inline"><fieldset class="invisiblefieldset">';
33         $this->content->text .= '<input name="id" type="hidden" value="'.$this->page->course->id.'" />';  // course
34         $this->content->text .= '<label class="accesshide" for="searchform_search">'.$search.'</label>'.
35                                 '<input id="searchform_search" name="search" type="text" size="16" />';
36         $this->content->text .= '<button id="searchform_button" type="submit" title="'.$search.'">'.$button.'</button><br />';
37         $this->content->text .= '<a href="'.$CFG->wwwroot.'/mod/forum/search.php?id='.$this->page->course->id.'">'.$advancedsearch.'</a>';
38         $this->content->text .= $OUTPUT->help_icon('search');
39         $this->content->text .= '</fieldset></form></div>';
41         return $this->content;
42     }
44     function applicable_formats() {
45         return array('site' => true, 'course' => true);
46     }
47 }