3 // Edit text filter settings
5 require_once('../config.php');
6 require_once($CFG->libdir
.'/tablelib.php');
8 // check for allowed access
11 error( 'Only administrators can use the filters administration page' );
13 if (!$site = get_site()) {
14 error( 'Site is not defined in filters administration page' );
20 $param->filter
= required_param('filter', PARAM_PATH
);
21 $param->submit
= optional_param('submit', 0, PARAM_BOOL
);
22 $param->reset
= optional_param('reset', 0, PARAM_BOOL
);
24 $filtername = substr($param->filter
, strpos( $param->filter
, '/' )+
1 ) ;
26 // $CFG->pagepath is used to generate the body and id attributes for the body tag
27 // of the page. It is also used to generate the link to the Moodle Docs for this view.
28 $CFG->pagepath
= 'filter/' . $filtername . '/config';
30 // get translated strings for use on page
32 $txt->managefilters
= get_string( 'managefilters' );
33 $txt->administration
= get_string( 'administration' );
34 $txt->configuration
= get_string( 'configuration' );
36 //======================
38 //======================
40 // if reset pressed let filter config page handle it
42 if (!empty($param->reset
)) {
46 if ($config = data_submitted()) {
49 if (!confirm_sesskey()) {
50 error( get_string('confirmsesskeybad', 'error' ) );
53 $configpath = $CFG->dirroot
.'/filter/'.$filtername.'/filterconfig.php';
54 if (file_exists($configpath)) {
55 require_once($configpath);
56 $functionname = $filtername.'_process_config';
57 if (function_exists($functionname)) {
58 $functionname($config);
64 // run through submitted data
65 // reject if does not start with filter_
66 foreach ($config as $name => $value) {
67 set_config( $name,$value );
70 redirect( "$CFG->wwwroot/$CFG->admin/filters.php", get_string('changessaved'), 1);
74 //==============================
76 //==============================
78 $filtername = ucfirst($filtername);
79 print_header( "$site->shortname: $txt->managefilters", "$site->fullname",
80 "<a href=\"index.php\">$txt->administration</a> -> <a href=\"configure.php\">$txt->configuration</a> " .
81 "-> <a href=\"filters.php\">$txt->managefilters</a> -> $filtername" );
83 print_heading( $txt->managefilters
);
85 print_simple_box("<center>".get_string("configwarning", "admin")."</center>", "center", "50%");
88 print_simple_box_start("center",'');
91 <form action
="filter.php?filter=<?php echo urlencode($param->filter); ?>" method
="post">
92 <input type
="hidden" name
="sesskey" value
="<?php echo sesskey(); ?>" />
94 <?php
include "$CFG->dirroot/$param->filter/filterconfig.html"; ?
>
97 <input type
="submit" name
="submit" value
="<?php print_string('savechanges'); ?>" />
98 <input type
="submit" name
="reset" value
="<?php echo print_string('resettodefaults'); ?>" />
103 print_simple_box_end();
105 print_simple_box_end();