[ Index ]

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

title

Body

[close]

/admin/ -> enrol_config.php (source)

   1  <?PHP  // $Id: enrol_config.php,v 1.15.4.1 2008/04/02 06:09:57 dongsheng Exp $
   2         // enrol_config.php - allows admin to edit all enrollment variables
   3         //                    Yes, enrol is correct English spelling.
   4  
   5      require_once("../config.php");
   6      require_once($CFG->libdir.'/adminlib.php');
   7  
   8      admin_externalpage_setup('enrolment');
   9  
  10      $enrol = required_param('enrol', PARAM_ALPHA);
  11      $CFG->pagepath = 'enrol/' . $enrol;
  12  
  13  
  14      require_once("$CFG->dirroot/enrol/enrol.class.php");   /// Open the factory class
  15  
  16      $enrolment = enrolment_factory::factory($enrol);
  17  
  18  /// If data submitted, then process and store.
  19  
  20      if ($frm = data_submitted()) {
  21          if (!confirm_sesskey()) {
  22              print_error('confirmsesskeybad', 'error');
  23          }
  24          if ($enrolment->process_config($frm)) {
  25              redirect("enrol.php?sesskey=$USER->sesskey", get_string("changessaved"), 1);
  26          }
  27      } else {
  28          $frm = $CFG;
  29      }
  30  
  31  /// Otherwise fill and print the form.
  32  
  33      /// get language strings
  34      $str = get_strings(array('enrolmentplugins', 'configuration', 'users', 'administration'));
  35  
  36      unset($options);
  37  
  38      $modules = get_list_of_plugins("enrol");
  39      foreach ($modules as $module) {
  40          $options[$module] = get_string("enrolname", "enrol_$module");
  41      }
  42      asort($options);
  43  
  44      admin_externalpage_print_header();
  45  
  46      echo "<form $CFG->frametarget id=\"enrolmenu\" method=\"post\" action=\"enrol_config.php\">";
  47      echo "<div>";
  48      echo "<input type=\"hidden\" name=\"sesskey\" value=\"".$USER->sesskey."\" />";
  49      echo "<input type=\"hidden\" name=\"enrol\" value=\"".$enrol."\" />";
  50  
  51  /// Print current enrolment type description
  52      print_simple_box_start("center", "80%");
  53      print_heading($options[$enrol]);
  54  
  55      print_simple_box_start("center", "60%", '', 5, 'informationbox');
  56      print_string("description", "enrol_$enrol");
  57      print_simple_box_end();
  58  
  59      echo "<hr />";
  60  
  61      $enrolment->config_form($frm);
  62  
  63      echo "<p class=\"centerpara\"><input type=\"submit\" value=\"".get_string("savechanges")."\" /></p>\n";
  64      print_simple_box_end();
  65      echo "</div>";
  66      echo "</form>";
  67  
  68      admin_externalpage_print_footer();
  69  
  70      exit;
  71  ?>


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