[ Index ] |
PHP Cross Reference of moodle-2.8 |
[Summary view] [Print] [Text view]
1 <?php 2 3 // searches for admin settings 4 5 require_once('../config.php'); 6 require_once($CFG->libdir.'/adminlib.php'); 7 8 $query = trim(optional_param('query', '', PARAM_NOTAGS)); // Search string 9 10 $PAGE->set_context(context_system::instance()); 11 12 admin_externalpage_setup('search', '', array('query' => $query)); // now hidden page 13 14 $adminroot = admin_get_root(); // need all settings here 15 $adminroot->search = $query; // So we can reference it in search boxes later in this invocation 16 $statusmsg = ''; 17 $errormsg = ''; 18 $focus = ''; 19 20 // now we'll deal with the case that the admin has submitted the form with changed settings 21 if ($data = data_submitted() and confirm_sesskey()) { 22 if (admin_write_settings($data)) { 23 $statusmsg = get_string('changessaved'); 24 } 25 $adminroot = admin_get_root(true); //reload tree 26 27 if (!empty($adminroot->errors)) { 28 $errormsg = get_string('errorwithsettings', 'admin'); 29 $firsterror = reset($adminroot->errors); 30 $focus = $firsterror->id; 31 } 32 } 33 34 // and finally, if we get here, then there are matching settings and we have to print a form 35 // to modify them 36 echo $OUTPUT->header($focus); 37 38 if ($errormsg !== '') { 39 echo $OUTPUT->notification($errormsg); 40 41 } else if ($statusmsg !== '') { 42 echo $OUTPUT->notification($statusmsg, 'notifysuccess'); 43 } 44 45 $resultshtml = admin_search_settings_html($query); // case insensitive search only 46 47 echo '<form action="search.php" method="post" id="adminsettings">'; 48 echo '<div>'; 49 echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />'; 50 echo '<input type="hidden" name="query" value="'.s($query).'" />'; 51 echo '</div>'; 52 echo '<fieldset>'; 53 echo '<div class="clearer"><!-- --></div>'; 54 if ($resultshtml != '') { 55 echo $resultshtml; 56 } else { 57 echo get_string('noresults','admin'); 58 } 59 echo '</fieldset>'; 60 echo '</form>'; 61 62 echo $OUTPUT->footer(); 63 64
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:29:05 2014 | Cross-referenced by PHPXref 0.7.1 |