3 // Edit text filter settings
5 require_once('../config.php');
6 require_once($CFG->libdir
.'/adminlib.php');
7 require_once($CFG->libdir
.'/tablelib.php');
9 admin_externalpage_setup('managefilters');
14 $param->filter
= required_param('filter', PARAM_PATH
);
15 $param->submit
= optional_param('submit', 0, PARAM_BOOL
);
16 $param->reset
= optional_param('reset', 0, PARAM_BOOL
);
18 $filtername = substr($param->filter
, strpos( $param->filter
, '/' )+
1 ) ;
20 // $CFG->pagepath is used to generate the body and id attributes for the body tag
21 // of the page. It is also used to generate the link to the Moodle Docs for this view.
22 $CFG->pagepath
= 'filter/' . $filtername . '/config';
24 // get translated strings for use on page
26 $txt->managefilters
= get_string( 'managefilters' );
27 $txt->administration
= get_string( 'administration' );
28 $txt->configuration
= get_string( 'configuration' );
30 //======================
32 //======================
34 // if reset pressed let filter config page handle it
36 if (!empty($param->reset
)) {
40 if ($config = data_submitted()) {
43 if (!confirm_sesskey()) {
44 error( get_string('confirmsesskeybad', 'error' ) );
47 $configpath = $CFG->dirroot
.'/filter/'.$filtername.'/filterconfig.php';
48 if (file_exists($configpath)) {
49 require_once($configpath);
50 $functionname = $filtername.'_process_config';
51 if (function_exists($functionname)) {
52 $functionname($config);
58 // run through submitted data
59 // reject if does not start with filter_
60 foreach ($config as $name => $value) {
61 set_config($name, stripslashes($value));
64 redirect("$CFG->wwwroot/$CFG->admin/filters.php");
68 //==============================
70 //==============================
72 $filtername = ucfirst($filtername);
73 admin_externalpage_print_header();
74 print_heading( $filtername );
76 print_simple_box(get_string("configwarning", "admin"), "center", "50%");
79 print_simple_box_start("center",'');
82 <form action
="filter.php?filter=<?php echo urlencode($param->filter); ?>" method
="post">
83 <div style
="text-align: center">
84 <input type
="hidden" name
="sesskey" value
="<?php echo sesskey(); ?>" />
86 <?php
include "$CFG->dirroot/$param->filter/filterconfig.html"; ?
>
88 <input type
="submit" name
="submit" value
="<?php print_string('savechanges'); ?>" />
89 <input type
="submit" name
="reset" value
="<?php echo print_string('resettodefaults'); ?>" />
94 print_simple_box_end();
96 admin_externalpage_print_footer();