Added new strings for question grade matching
[moodle-linuxchix.git] / admin / module.php
blobe1e8be547578e4ad8edf527f065046b45504b30b
1 <?PHP // $Id$
2 // module.php - allows admin to edit all local configuration variables for a module
4 require_once('../config.php');
6 require_login();
8 if (!isadmin()) {
9 error("Only an admin can use this page");
12 if (!$site = get_site()) {
13 error("Site isn't defined!");
16 /// If data submitted, then process and store.
18 if ($config = data_submitted()) {
19 $module = optional_param('module', '', PARAM_SAFEDIR);
21 if (!confirm_sesskey()) {
22 error(get_string('confirmsesskeybad', 'error'));
25 if ($module != '') {
26 require_once("$CFG->dirroot/mod/$module/lib.php");
27 // if the config.html contains a hidden form field giving
28 // the module name then the form does not have to prefix all
29 // its variable names, we will do it here.
30 $moduleprefix = $module.'_';
31 // let the module process the form data if it has to,
32 // $config is passed to this function by reference
33 $moduleconfig = $module.'_process_options';
34 if (function_exists($moduleconfig)) {
35 $moduleconfig($config);
37 } else {
38 $moduleprefix = '';
41 unset($config->sesskey);
42 unset($config->module);
44 foreach ($config as $name => $value) {
45 set_config($moduleprefix.$name, $value);
47 redirect("$CFG->wwwroot/$CFG->admin/modules.php", get_string("changessaved"), 1);
48 exit;
51 /// Otherwise print the form.
52 $module = required_param('module', PARAM_SAFEDIR);
53 require_once("$CFG->dirroot/mod/$module/lib.php");
55 $stradmin = get_string("administration");
56 $strconfiguration = get_string("configuration");
57 $strmanagemodules = get_string("managemodules");
58 $strmodulename = get_string("modulename", $module);
60 // $CFG->pagepath is used to generate the body and id attributes for the body tag
61 // of the page. It is also used to generate the link to the Moodle Docs for this view.
62 $CFG->pagepath = 'mod/' . $module . '/config';
64 print_header("$site->shortname: $strmodulename: $strconfiguration", $site->fullname,
65 "<a href=\"index.php\">$stradmin</a> -> ".
66 "<a href=\"configure.php\">$strconfiguration</a> -> ".
67 "<a href=\"modules.php\">$strmanagemodules</a> -> $strmodulename");
69 print_heading($strmodulename);
71 print_simple_box("<center>".get_string("configwarning", 'admin')."</center>", "center", "60%");
72 echo "<br />";
74 print_simple_box_start("center", "");
75 include("$CFG->dirroot/mod/$module/config.html");
76 print_simple_box_end();
78 print_footer();