[ Index ]

PHP Cross Reference of Moodle 1.9.3 [Build 15-Oct-2008]

title

Body

[close]

/admin/ -> search.php (source)

   1  <?php // $Id: search.php,v 1.15.4.2 2007/12/29 16:48:47 skodak Exp $
   2  
   3  // searches for admin settings
   4  
   5  require_once ('../config.php');
   6  require_once($CFG->libdir.'/adminlib.php');
   7  
   8  $query = trim(stripslashes(optional_param('query', '', PARAM_NOTAGS)));  // Search string
   9  
  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
  12  $statusmsg = '';
  13  $errormsg  = '';
  14  $focus = '';
  15  
  16  admin_externalpage_setup('search'); // now hidden page
  17  
  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');
  22      }
  23      $adminroot =& admin_get_root(true); //reload tree
  24  
  25      if (!empty($adminroot->errors)) {
  26          $errormsg = get_string('errorwithsettings', 'admin');
  27          $firsterror = reset($adminroot->errors);
  28          $focus = $firsterror->id;
  29      }
  30  }
  31  
  32  // and finally, if we get here, then there are matching settings and we have to print a form
  33  // to modify them
  34  admin_externalpage_print_header($focus);
  35  
  36  if ($errormsg !== '') {
  37      notify ($errormsg);
  38  
  39  } else if ($statusmsg !== '') {
  40      notify ($statusmsg, 'notifysuccess');
  41  }
  42  
  43  $resultshtml = admin_search_settings_html($query); // case insensitive search only
  44  
  45  echo '<form action="search.php" method="post" id="adminsettings">';
  46  echo '<div>';
  47  echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
  48  echo '<input type="hidden" name="query" value="'.s($query).'" />';
  49  echo '</div>';
  50  echo '<fieldset>';
  51  echo '<div class="clearer"><!-- --></div>';
  52  if ($resultshtml != '') {
  53      echo $resultshtml;
  54  } else {
  55      echo get_string('noresults','admin');
  56  }
  57  echo '</fieldset>';
  58  echo '</form>';
  59  
  60  print_footer();
  61  
  62  ?>


Generated: Wed Jan 14 11:33:29 2009 Cross-referenced by PHPXref 0.7