Fixes to the PaintWeb cron task.
[moodle/mihaisucan.git] / admin / module.php
blobe503b8292e0a5af675371a3c91672fe48953c445
1 <?PHP // $Id$
2 // module.php - allows admin to edit all local configuration variables for a module
4 require_once('../config.php');
5 require_once($CFG->libdir.'/adminlib.php');
7 /// If data submitted, then process and store.
9 if ($config = data_submitted()) {
10 $module = optional_param('module', '', PARAM_SAFEDIR);
12 if (!confirm_sesskey()) {
13 print_error('confirmsesskeybad', 'error');
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);
29 } else {
30 admin_externalpage_setup('managemodules');
32 $moduleprefix = '';
35 unset($config->sesskey);
36 unset($config->module);
38 foreach ($config as $name => $value) {
39 set_config($moduleprefix.$name, $value);
41 redirect("$CFG->wwwroot/$CFG->admin/modules.php", get_string("changessaved"), 1);
42 exit;
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);
50 $strmodulename = get_string("modulename", $module);
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';
56 admin_externalpage_print_header();
58 print_heading($strmodulename);
60 print_simple_box(get_string("configwarning", 'admin'), "center", "60%");
61 echo "<br />";
63 print_simple_box_start("center", "");
64 include("$CFG->dirroot/mod/$module/config.html");
65 print_simple_box_end();
67 admin_externalpage_print_footer();