MDL-24625 Dropped $CFG->block_search_text and $CFG->block_search_button
[moodle.git] / blocks / search / block_search.php
CommitLineData
682d4032 1<?php
1428f471 2
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.
7 *
8 * @package search
9 * @subpackage search block
10 * @author: Michael Champanis (mchampan), reengineered by Valery Fremaux
11 * @date: 2006 06 25
12 */
13
14class block_search extends block_base {
15
682d4032 16 function init() {
745a9d23 17 $this->title = get_string('pluginname', 'block_search');
1428f471 18 } //init
19
682d4032 20 // only one instance of this block is required
21 function instance_allow_multiple() {
22 return false;
23 } //instance_allow_multiple
1428f471 24
682d4032 25 // label and button values can be set in admin
26 function has_config() {
27 return true;
28 } //has_config
1428f471 29
682d4032 30 function get_content() {
31 global $CFG;
721d74b0 32
33 if (empty($CFG->enableglobalsearch)) {
34 return '';
35 }
36
682d4032 37 //cache block contents
38 if ($this->content !== NULL) {
39 return $this->content;
40 } //if
1428f471 41
682d4032 42 $this->content = new stdClass;
1428f471 43
dd93d8e9 44 //basic search form
45 $this->content->text =
b7dc2256 46 '<form id="searchquery" method="get" action="'. $CFG->wwwroot .'/search/query.php"><div>'
5741fd4b 47 . '<label for="block_search_q">' . get_string('searchmoodle', 'block_search') . '</label>'
bf7b68c2 48 . '<input id="block_search_q" type="text" name="query_string" />'
5741fd4b 49 . '<input type="submit" value="' . s(get_string('go', 'block_search')) . '" />'
4f24b3e3 50 . '</div></form>';
dd93d8e9 51
682d4032 52 //no footer, thanks
53 $this->content->footer = '';
1428f471 54
55 return $this->content;
682d4032 56 } //get_content
1428f471 57
682d4032 58 function specialisation() {
59 //empty!
60 } //specialisation
1428f471 61
918fb61f 62 /**
1428f471 63 * wraps up to search engine cron
64 */
918fb61f 65 function cron(){
66 global $CFG;
1428f471 67
918fb61f 68 include($CFG->dirroot.'/search/cron.php');
69 }
1428f471 70
682d4032 71 } //block_search
72