[ Index ]

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

title

Body

[close]

/admin/ -> module.php (source)

   1  <?PHP  // $Id: module.php,v 1.25.4.3 2008/04/02 06:09:57 dongsheng Exp $
   2         // module.php - allows admin to edit all local configuration variables for a module
   3  
   4      require_once ('../config.php');
   5      require_once($CFG->libdir.'/adminlib.php');
   6  
   7  /// If data submitted, then process and store.
   8  
   9      if ($config = data_submitted()) {
  10          $module = optional_param('module', '', PARAM_SAFEDIR);
  11  
  12          if (!confirm_sesskey()) {
  13              print_error('confirmsesskeybad', 'error');
  14          }
  15  
  16          if ($module != '') {
  17              include_once("$CFG->dirroot/mod/$module/lib.php");
  18              admin_externalpage_setup('modsetting'.$module);
  19              // if the config.html contains a hidden form field giving
  20              // the module name then the form does not have to prefix all
  21              // its variable names, we will do it here.
  22              $moduleprefix = $module.'_';
  23              // let the module process the form data if it has to,
  24              // $config is passed to this function by reference
  25              $moduleconfig = $module.'_process_options';
  26              if (function_exists($moduleconfig)) {
  27                  $moduleconfig($config);
  28              }
  29          } else {
  30              admin_externalpage_setup('managemodules');
  31  
  32              $moduleprefix = '';
  33          }
  34  
  35          unset($config->sesskey);
  36          unset($config->module);
  37  
  38          foreach ($config as $name => $value) {
  39              set_config($moduleprefix.$name, $value);
  40          }
  41          redirect("$CFG->wwwroot/$CFG->admin/modules.php", get_string("changessaved"), 1);
  42          exit;
  43      }
  44  
  45  /// Otherwise print the form.
  46      $module = required_param('module', PARAM_SAFEDIR);
  47      include_once("$CFG->dirroot/mod/$module/lib.php");
  48      admin_externalpage_setup('modsetting'.$module);
  49  
  50      $strmodulename = get_string("modulename", $module);
  51  
  52      // $CFG->pagepath is used to generate the body and id attributes for the body tag
  53      // of the page. It is also used to generate the link to the Moodle Docs for this view.
  54      $CFG->pagepath = 'mod/' . $module . '/config';
  55  
  56      admin_externalpage_print_header();
  57  
  58      print_heading($strmodulename);
  59  
  60      print_simple_box(get_string("configwarning", 'admin'), "center", "60%");
  61      echo "<br />";
  62  
  63      print_simple_box_start("center", "");
  64      include("$CFG->dirroot/mod/$module/config.html");
  65      print_simple_box_end();
  66  
  67      admin_externalpage_print_footer();
  68  
  69  ?>


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