MDL-24625 Dropped $CFG->block_search_text and $CFG->block_search_button
[moodle.git] / blocks / search / block_search.php
blob436af7fe8c058df3766bb6c741f9121889c026eb
1 <?php
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.
8 * @package search
9 * @subpackage search block
10 * @author: Michael Champanis (mchampan), reengineered by Valery Fremaux
11 * @date: 2006 06 25
14 class block_search extends block_base {
16 function init() {
17 $this->title = get_string('pluginname', 'block_search');
18 } //init
20 // only one instance of this block is required
21 function instance_allow_multiple() {
22 return false;
23 } //instance_allow_multiple
25 // label and button values can be set in admin
26 function has_config() {
27 return true;
28 } //has_config
30 function get_content() {
31 global $CFG;
33 if (empty($CFG->enableglobalsearch)) {
34 return '';
37 //cache block contents
38 if ($this->content !== NULL) {
39 return $this->content;
40 } //if
42 $this->content = new stdClass;
44 //basic search form
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')) . '" />'
50 . '</div></form>';
52 //no footer, thanks
53 $this->content->footer = '';
55 return $this->content;
56 } //get_content
58 function specialisation() {
59 //empty!
60 } //specialisation
62 /**
63 * wraps up to search engine cron
65 function cron(){
66 global $CFG;
68 include($CFG->dirroot.'/search/cron.php');
71 } //block_search