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