mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
global search MDL-25099 setting global search block to 'hidden' when feature is disabled in experimental settings.
This commit is contained in:
parent
2031735b1b
commit
693fc4a29f
@ -7,8 +7,12 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
|||||||
// Experimental settings page
|
// Experimental settings page
|
||||||
$ADMIN->add('development', new admin_category('experimental', get_string('experimental','admin')));
|
$ADMIN->add('development', new admin_category('experimental', get_string('experimental','admin')));
|
||||||
|
|
||||||
|
require_once($CFG->dirroot .'/search/lib.php');
|
||||||
$temp = new admin_settingpage('experimentalsettings', get_string('experimentalsettings', 'admin'));
|
$temp = new admin_settingpage('experimentalsettings', get_string('experimentalsettings', 'admin'));
|
||||||
$temp->add(new admin_setting_configcheckbox('enableglobalsearch', get_string('enableglobalsearch', 'admin'), get_string('configenableglobalsearch', 'admin'), 0));
|
$englobalsearch = new admin_setting_configcheckbox('enableglobalsearch', get_string('enableglobalsearch', 'admin'), get_string('configenableglobalsearch', 'admin'), 0);
|
||||||
|
$englobalsearch->set_updatedcallback('search_updatedcallback');
|
||||||
|
$temp->add($englobalsearch);
|
||||||
|
|
||||||
$temp->add(new admin_setting_configcheckbox('experimentalsplitrestore', get_string('experimentalsplitrestore', 'admin'), get_string('configexperimentalsplitrestore', 'admin'), 0));
|
$temp->add(new admin_setting_configcheckbox('experimentalsplitrestore', get_string('experimentalsplitrestore', 'admin'), get_string('configexperimentalsplitrestore', 'admin'), 0));
|
||||||
$temp->add(new admin_setting_configcheckbox('enableimsccimport', get_string('enable_cc_import', 'imscc'), get_string('enable_cc_import_description', 'imscc'), 0));
|
$temp->add(new admin_setting_configcheckbox('enableimsccimport', get_string('enable_cc_import', 'imscc'), get_string('enable_cc_import_description', 'imscc'), 0));
|
||||||
$temp->add(new admin_setting_configcheckbox('enablesafebrowserintegration', get_string('enablesafebrowserintegration', 'admin'), get_string('configenablesafebrowserintegration', 'admin'), 0));
|
$temp->add(new admin_setting_configcheckbox('enablesafebrowserintegration', get_string('enablesafebrowserintegration', 'admin'), get_string('configenablesafebrowserintegration', 'admin'), 0));
|
||||||
|
10
blocks/search/db/install.php
Normal file
10
blocks/search/db/install.php
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
function xmldb_block_search_install() {
|
||||||
|
global $DB;
|
||||||
|
|
||||||
|
// Disable this block by default as its experimental.
|
||||||
|
$DB->set_field('block', 'visible', 0, array('name'=>'search'));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -83,5 +83,12 @@ function xmldb_block_search_upgrade($oldversion) {
|
|||||||
upgrade_block_savepoint(true, 2010110900, 'search');
|
upgrade_block_savepoint(true, 2010110900, 'search');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($oldversion < 2010111100) {
|
||||||
|
// set block to hidden if global search is disabled.
|
||||||
|
if ($CFG->enableglobalsearch != 1) {
|
||||||
|
$DB->set_field('block', 'visible', 0, array('name'=>'search')); // Hide block
|
||||||
|
}
|
||||||
|
upgrade_block_savepoint(true, 2010111100, 'search');
|
||||||
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
@ -15,5 +15,5 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
$plugin->version = 2010110900;
|
$plugin->version = 2010111100;
|
||||||
$plugin->cron = 1;
|
$plugin->cron = 1;
|
||||||
|
@ -186,4 +186,12 @@ function search_pexit($str = "") {
|
|||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function search_updatedcallback($name) {
|
||||||
|
global $CFG, $DB;
|
||||||
|
// set block to hidden when global search is disabled.
|
||||||
|
if ($CFG->enableglobalsearch != 1) {
|
||||||
|
$DB->set_field('block', 'visible', 0, array('name'=>'search')); // Hide block
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user