5 $ADMIN->add('modules', new admin_category('modsettings', get_string('activities')));
6 $ADMIN->add('modsettings', new admin_page_managemods());
7 if ($modules = get_records('modules')) {
8 $modulebyname = array();
10 foreach ($modules as $module) {
11 $strmodulename = get_string('modulename', $module->name
);
12 // Deal with modules which are lacking the language string
13 if ($strmodulename == '[[modulename]]') {
14 $textlib = textlib_get_instance();
15 $strmodulename = $textlib->strtotitle($module->name
);
17 $modulebyname[$strmodulename] = $module;
21 foreach ($modulebyname as $strmodulename=>$module) {
22 $modulename = $module->name
;
23 if (file_exists($CFG->dirroot
.'/mod/'.$modulename.'/settings.php')) {
24 // do not show disabled modules in tree, keep only settings link on manage page
25 $settings = new admin_settingpage('modsetting'.$modulename, $strmodulename, 'moodle/site:config', !$module->visible
);
26 if ($ADMIN->fulltree
) {
27 include($CFG->dirroot
.'/mod/'.$modulename.'/settings.php');
29 $ADMIN->add('modsettings', $settings);
30 } else if (file_exists($CFG->dirroot
.'/mod/'.$modulename.'/config.html')) {
31 $ADMIN->add('modsettings', new admin_externalpage('modsetting'.$modulename, $strmodulename, "$CFG->wwwroot/$CFG->admin/module.php?module=$modulename", 'moodle/site:config', !$module->visible
));
37 $ADMIN->add('modules', new admin_category('blocksettings', get_string('blocks')));
38 $ADMIN->add('blocksettings', new admin_page_manageblocks());
39 $ADMIN->add('blocksettings', new admin_externalpage('stickyblocks', get_string('stickyblocks', 'admin'), "$CFG->wwwroot/$CFG->admin/stickyblocks.php"));
40 if (!empty($CFG->blocks_version
) and $blocks = get_records('block')) {
41 $blockbyname = array();
43 foreach ($blocks as $block) {
44 if(($blockobject = block_instance($block->name
)) === false) {
48 $blockbyname[$blockobject->get_title()] = $block;
52 foreach ($blockbyname as $strblockname=>$block) {
53 $blockname = $block->name
;
54 if (file_exists($CFG->dirroot
.'/blocks/'.$blockname.'/settings.php')) {
55 $settings = new admin_settingpage('blocksetting'.$blockname, $strblockname, 'moodle/site:config', !$block->visible
);
56 if ($ADMIN->fulltree
) {
57 include($CFG->dirroot
.'/blocks/'.$blockname.'/settings.php');
59 $ADMIN->add('blocksettings', $settings);
61 } else if (file_exists($CFG->dirroot
.'/blocks/'.$blockname.'/config_global.html')) {
62 $ADMIN->add('blocksettings', new admin_externalpage('blocksetting'.$blockname, $strblockname, "$CFG->wwwroot/$CFG->admin/block.php?block=$block->id", 'moodle/site:config', !$block->visible
));
67 $ADMIN->add('modules', new admin_category('filtersettings', get_string('managefilters')));
68 // "filtersettings" settingpage
69 $temp = new admin_settingpage('managefilters', get_string('filtersettings', 'admin'));
70 if ($ADMIN->fulltree
) {
72 $items[] = new admin_setting_managefilters();
73 $items[] = new admin_setting_heading('managefilterscommonheading', get_string('commonsettings', 'admin'), '');
74 $items[] = new admin_setting_configselect('cachetext', get_string('cachetext', 'admin'), get_string('configcachetext', 'admin'), 60, array(604800 => get_string('numdays','',7),
75 86400 => get_string('numdays','',1),
76 43200 => get_string('numhours','',12),
77 10800 => get_string('numhours','',3),
78 7200 => get_string('numhours','',2),
79 3600 => get_string('numhours','',1),
80 2700 => get_string('numminutes','',45),
81 1800 => get_string('numminutes','',30),
82 900 => get_string('numminutes','',15),
83 600 => get_string('numminutes','',10),
84 540 => get_string('numminutes','',9),
85 480 => get_string('numminutes','',8),
86 420 => get_string('numminutes','',7),
87 360 => get_string('numminutes','',6),
88 300 => get_string('numminutes','',5),
89 240 => get_string('numminutes','',4),
90 180 => get_string('numminutes','',3),
91 120 => get_string('numminutes','',2),
92 60 => get_string('numminutes','',1),
93 30 => get_string('numseconds','',30),
94 0 => get_string('no')));
95 $items[] = new admin_setting_configselect('filteruploadedfiles', get_string('filteruploadedfiles', 'admin'), get_string('configfilteruploadedfiles', 'admin'), 0, array('0' => get_string('none'),
96 '1' => get_string('allfiles'),
97 '2' => get_string('htmlfilesonly')));
98 $items[] = new admin_setting_configcheckbox('filtermatchoneperpage', get_string('filtermatchoneperpage', 'admin'), get_string('configfiltermatchoneperpage', 'admin'), 0);
99 $items[] = new admin_setting_configcheckbox('filtermatchonepertext', get_string('filtermatchonepertext', 'admin'), get_string('configfiltermatchonepertext', 'admin'), 0);
100 $items[] = new admin_setting_configcheckbox('filterall', get_string('filterall', 'admin'), get_string('configfilterall', 'admin'), 0);
101 foreach ($items as $item) {
102 $item->set_updatedcallback('reset_text_filters_cache');
106 $ADMIN->add('filtersettings', $temp);
108 if (empty($CFG->textfilters
)) {
109 $activefilters = array();
111 $activefilters = explode(',', $CFG->textfilters
);
113 $filterlocations = array('mod','filter');
114 foreach ($filterlocations as $filterlocation) {
115 $filters = get_list_of_plugins($filterlocation);
117 $filterbyname = array();
119 foreach ($filters as $filter) {
120 $strfiltername = get_string('filtername', $filter);
121 // Deal with filters which are lacking the language string
122 if ($strfiltername == '[[filtername]]') {
123 $textlib = textlib_get_instance();
124 $strfiltername = $textlib->strtotitle($filter);
126 $filterbyname[$strfiltername] = "$filterlocation/$filter";
128 ksort($filterbyname);
130 foreach ($filterbyname as $strfiltername=>$filterfull) {
131 if (file_exists("$CFG->dirroot/$filterfull/filtersettings.php")) {
132 $settings = new admin_settingpage('filtersetting'.str_replace('/', '', $filterfull), $strfiltername, 'moodle/site:config', !in_array($filterfull, $activefilters));
133 if ($ADMIN->fulltree
) {
134 include("$CFG->dirroot/$filterfull/filtersettings.php");
136 $ADMIN->add('filtersettings', $settings);
138 } else if (file_exists("$CFG->dirroot/$filterfull/filterconfig.html")) {
139 $ADMIN->add('filtersettings', new admin_externalpage('filtersetting'.str_replace('/', '', $filterfull), $strfiltername, "$CFG->wwwroot/$CFG->admin/filter.php?filter=$filterfull", !in_array($filterfull, $activefilters)));