3 /** This is the global search shortcut block - a single query can be entered, and
4 * the user will be redirected to the query page where they can enter more
5 * advanced queries, and view the results of their search. When searching from
6 * this block, the broadest possible selection of documents is searched.
9 * @subpackage search block
10 * @author: Michael Champanis (mchampan), reengineered by Valery Fremaux
14 class block_search
extends block_base
{
17 $this->title
= get_string('pluginname', 'block_search');
20 // only one instance of this block is required
21 function instance_allow_multiple() {
23 } //instance_allow_multiple
25 // label and button values can be set in admin
26 function has_config() {
30 function get_content() {
33 if (empty($CFG->enableglobalsearch
)) {
37 //cache block contents
38 if ($this->content
!== NULL) {
39 return $this->content
;
42 $this->content
= new stdClass
;
45 $this->content
->text
=
46 '<form id="searchquery" method="get" action="'. $CFG->wwwroot
.'/search/query.php"><div>'
47 . '<label for="block_search_q">' . get_string('searchmoodle', 'block_search') . '</label>'
48 . '<input id="block_search_q" type="text" name="query_string" />'
49 . '<input type="submit" value="' . s(get_string('go', 'block_search')) . '" />'
53 $this->content
->footer
= '';
55 return $this->content
;
58 function specialisation() {
63 * wraps up to search engine cron
68 include($CFG->dirroot
.'/search/cron.php');