filters: MDL-7336 code to let people edit local filter config

This commit is contained in:
tjhunt
2009-04-13 07:14:27 +00:00
parent 0f74bb01ff
commit 604eb7be03
5 changed files with 143 additions and 10 deletions
+14 -3
View File
@@ -61,7 +61,7 @@ class filter_manager {
protected static $singletoninstance;
protected function __construct() {
$stringfilternames = filter_get_string_filters();
$this->stringfilternames = filter_get_string_filters();
}
/**
@@ -602,6 +602,17 @@ function filter_set_local_config($filter, $contextid, $name, $value) {
}
}
/**
* Remove a particular local config variable for a filter in a context.
* @param string $filter The filter name, for example 'filter/tex' or 'mod/glossary'.
* @param integer $contextid The id of the context to get the local config for.
* @param string $name the setting name.
*/
function filter_unset_local_config($filter, $contextid, $name) {
global $DB;
$DB->delete_records('filter_config', array('filter' => $filter, 'contextid' => $contextid, 'name' => $name));
}
/**
* Get local config variables for a filter in a context. Normally (when your
* filter is running) you don't need to call this, becuase the config is fetched
@@ -764,8 +775,8 @@ function filter_has_global_settings($filter) {
*/
function filter_has_local_settings($filter) {
global $CFG;
// TODO
return false;
$settingspath = $CFG->dirroot . '/' . $filter . '/filterlocalsettings.php';
return is_readable($settingspath);
}
/**