4 * Requires and includes
6 include_once $CFG->dirroot."/search/lib.php";
8 $defaultfiletypes = "PDF,TXT,HTML,PPT,XML,DOC,HTM";
12 <div style="text-align:center;">
13 <table cellspacing="5" width="90%">
15 <td valign="top" align="right">
16 <b><?php print_string('configsearchtext', 'block_search') ?>:</b>
18 <td valign="top" align="left">
19 <input id="block_search_text" type="text" name="block_search_text" value="<?php
20 if(isset($CFG->block_search_text)) {
21 p($CFG->block_search_text);
23 p(get_string('searchmoodle', 'block_search'));
28 <td valign="top" align="right">
29 <b><?php print_string('configbuttonlabel', 'block_search') ?>:</b>
31 <td valign="top" align="left">
32 <input id="block_search_button" type="text" name="block_search_button" value="<?php
33 if(isset($CFG->block_search_button)) {
34 p($CFG->block_search_button);
36 p(get_string('go', 'block_search'));
41 <td valign="top" align="right">
42 <b><?php print_string('configenablefileindexing', 'block_search') ?>:</b>
44 <td valign="top" align="left">
45 <input id="block_enable_file_indexing" type="radio" name="block_search_enable_file_indexing" value="1" <?php
46 if(isset($CFG->block_search_enable_file_indexing) && $CFG->block_search_enable_file_indexing) {
47 echo " checked=\"checked\" ";
48 } ?> /> <?php print_string('yes') ?> -
49 <input id="block_search_enable_file_indexing" type="radio" name="block_search_enable_file_indexing" value="0" <?php
50 if(!isset($CFG->block_search_enable_file_indexing) || !$CFG->block_search_enable_file_indexing) {
51 echo " checked=\"checked\" ";
52 } ?> /> <?php print_string('no') ?>
57 <td valign="top" align="right">
58 <b><?php print_string('configfiletypes', 'block_search') ?>:</b>
60 <td valign="top" align="left">
61 <input id="block_search_filetypes" type="text" name="block_search_filetypes" value="<?php
62 if(!isset($CFG->block_search_filetypes)) {
63 $CFG->block_search_filetypes = $defaultfiletypes;
65 p($CFG->block_search_filetypes);
71 <td valign="top" align="right">
72 <b><?php print_string('usemoodleroot', 'block_search') ?>:</b>
74 <td valign="top" align="left">
76 $usemoodleroot = (isset($CFG->block_search_usemoodleroot)) ? 'checked="checked"' : '' ;
77 $notusemoodleroot = (!isset($CFG->block_search_usemoodleroot)) ? 'checked="checked"' : '' ;
79 <input id="block_search_usemoodleroot" type="radio" name="block_search_usemoodleroot" <?php echo $usemoodleroot ?> value="1"/> <?php print_string('yes') ?> -
80 <input id="block_search_usemoodleroot" type="radio" name="block_search_usemoodleroot" <?php echo $notusemoodleroot ?> value="0"/> <?php print_string('no') ?>
85 <td valign="top" align="right">
86 <b><?php print_string('configlimitindexbody', 'block_search') ?>:</b>
88 <td valign="top" align="left">
89 <input id="block_search_limit_index_body" type="text" size="8" name="block_search_limit_index_body" value="<?php
90 if(isset($CFG->block_search_limit_index_body)) {
91 p($CFG->block_search_limit_index_body);
94 } ?>"/> <?php print_string('bytes', 'block_search') ?><br/><br/>
100 <legend align="top"><?php print_string('pdfhandling', 'block_search') ?></legend>
101 <table cellspacing="5" width="90%">
103 <td valign="top" align="right">
104 <b><?php print_string('configpdftotextcmd', 'block_search') ?>:</b>
106 <td valign="top" align="left">
107 <input id="block_search_pdf_to_text_cmd" type="text" size="60" name="block_search_pdf_to_text_cmd" value="<?php
108 if(isset($CFG->block_search_pdf_to_text_cmd)) {
109 p($CFG->block_search_pdf_to_text_cmd);
111 if ($CFG->ostype == 'WINDOWS'){
112 p("lib/xpdf/win32/pdftotext.exe -eol dos -enc UTF-8 -q");
115 p("lib/xpdf/linux/pdftotext -enc UTF-8 -eol unix -q");
124 <legend align="top"><?php print_string('wordhandling', 'block_search') ?></legend>
125 <table cellspacing="5" width="90%">
127 <td valign="top" align="right">
128 <b><?php print_string('configwordtotextcmd', 'block_search') ?>:</b>
130 <td valign="top" align="left">
131 <input id="block_search_word_to_text_cmd" type="text" size="60" name="block_search_word_to_text_cmd" value="<?php
132 if(isset($CFG->block_search_word_to_text_cmd)) {
133 p($CFG->block_search_word_to_text_cmd);
135 if ($CFG->ostype == 'WINDOWS'){
136 p("lib/antiword/win32/antiword/antiword.exe ");
139 p("lib/antiword/linux/usr/bin/antiword");
145 <td valign="top" align="right">
146 <b><?php print_string('configwordtotextenv', 'block_search') ?>:</b>
148 <td valign="top" align="left">
149 <input id="block_search_word_to_text_env" type="text" size="60" name="block_search_word_to_text_env" value="<?php
150 if(isset($CFG->block_search_word_to_text_env)) {
151 echo $CFG->block_search_word_to_text_env;
153 if ($CFG->ostype == 'WINDOWS'){
154 p("HOME={$CFG->dirroot}\\lib\\antiword\\win32");
157 p("ANTIWORDHOME={$CFG->dirroot}/lib/antiword/linux/usr/share/antiword");
166 $types = split(',', $CFG->block_search_filetypes);
168 foreach($types as $type) {
169 $utype = strtoupper($type);
170 $type = strtolower($type);
172 if (preg_match("/\\b$type\\b/i", $defaultfiletypes)) continue;
175 <legend align="top"><?php echo get_string('handlingfor', 'block_search').' '.$utype ?></legend>
176 <table cellspacing="5" width="90%">
178 <td valign="top" align="right">
179 <b><?php print_string('configtypetotxtcmd', 'block_search') ?>:</b>
181 <td valign="top" align="left">
182 <input id="block_search_<?php p($type) ?>_to_text_cmd" type="text" size="60" name="block_search_<?php p($type) ?>_to_text_cmd" value="<?php
183 $propname = "block_search_{$type}_to_text_cmd";
184 if(isset($CFG->$propname)) {
192 <td valign="top" align="right">
193 <b><?php print_string('configtypetotxtenv', 'block_search') ?>:</b>
195 <td valign="top" align="left">
196 <input id="block_search_<?php p($type) ?>_to_text_env" type="text" size="60" name="block_search_<?php p($type) ?>_to_text_env" value="<?php
197 $propname = "block_search_{$type}_to_text_env";
198 if(isset($CFG->$propname)) {
199 echo $CFG->$propname;
211 <legend align="top"><?php echo get_string('searchdiscovery', 'block_search') ?></legend>
217 $searchnames = search_collect_searchables(true);
218 list($searchable_list, $params) = $DB->get_in_or_equal($searchnames);
227 <legend align="top"><?php echo get_string('modulessearchswitches', 'block_search') ?></legend>
228 <table cellspacing="5" width="90%">
233 $found_searchable_modules = 0;
234 if ($modules = $DB->get_records_select('modules', "name $searchable_list", $params, 'name', 'id,name')){
235 foreach($modules as $module){
237 $keyname = "search_in_{$module->name}";
238 $checkedup = (!isset($CFG->$keyname) || $CFG->$keyname) ? 'checked="checked"' : '' ;
239 $checkeddown = !(!isset($CFG->$keyname) || $CFG->$keyname) ? 'checked="checked"' : '' ;
240 echo "<input type=\"radio\" name=\"search_in_{$module->name}\" value=\"0\" {$checkeddown} /> " . get_string('no');
241 echo " - <input type=\"radio\" name=\"search_in_{$module->name}\" value=\"1\" {$checkedup} /> " . get_string('yes');
242 echo " - ".get_string('modulename', $module->name).'<br/>';
244 echo "</td><td align=\"left\">";
246 $found_searchable_modules = 1;
249 if (!$found_searchable_modules) {
250 print_string('nosearchablemodules', 'block_search');
260 <legend align="top"><?php echo get_string('blockssearchswitches', 'block_search') ?></legend>
261 <table cellspacing="5" width="90%">
266 $found_searchable_blocks = 0;
267 if ($blocks = $DB->get_records_select('block', "name $searchable_list", $params, 'name', 'id,name')){
268 foreach($blocks as $block){
270 $keyname = "search_in_{$block->name}";
271 $checked = (!isset($CFG->$keyname) || $CFG->$keyname) ? 'checked="checked"' : '' ;
272 echo "<input type=\"checkbox\" name=\"search_in_{$block->name}\" value=\"1\" {$checked} />";
274 // multiple fallback strategy to get the name of the block
275 $blocklabel = get_string('pluginname', 'block_'.$block->name);
276 echo " - ".$blocklabel.'<br/>';
278 echo "</td><td align=\"left\">";
280 $found_searchable_blocks = 1;
283 if (!$found_searchable_blocks) {
284 print_string('nosearchableblocks', 'block_search');
293 <table cellspacing="5" width="90%">
295 <td valign="top" align="right" colspan="2">
296 <input type="submit" value="<?php print_string('savechanges'); ?>" />