3 // searches for admin settings
5 require_once('../config.php');
6 require_once($CFG->libdir
.'/adminlib.php');
8 $query = trim(stripslashes(optional_param('query', '', PARAM_NOTAGS
))); // Search string
10 $adminroot =& admin_get_root(); // need all settings here
11 $adminroot->search
= $query; // So we can reference it in search boxes later in this invocation
16 admin_externalpage_setup('search'); // now hidden page
18 // now we'll deal with the case that the admin has submitted the form with changed settings
19 if ($data = data_submitted() and confirm_sesskey()) {
20 if (admin_write_settings($data)) {
21 $statusmsg = get_string('changessaved');
23 $adminroot =& admin_get_root(true); //reload tree
25 if (!empty($adminroot->errors
)) {
26 $errormsg = get_string('errorwithsettings', 'admin');
27 $firsterror = reset($adminroot->errors
);
28 $focus = $firsterror->id
;
32 // and finally, if we get here, then there are matching settings and we have to print a form
34 admin_externalpage_print_header($focus);
36 if ($errormsg !== '') {
39 } else if ($statusmsg !== '') {
40 notify ($statusmsg, 'notifysuccess');
43 $resultshtml = admin_search_settings_html($query); // case insensitive search only
45 echo '<form action="search.php" method="post" id="adminsettings">';
47 echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
48 echo '<input type="hidden" name="query" value="'.s($query).'" />';
51 echo '<div class="clearer"><!-- --></div>';
52 if ($resultshtml != '') {
55 echo get_string('noresults','admin');