220a90c5 |
1 | <?php //$Id$ |
2 | |
3 | if ($hassiteconfig) { |
4 | |
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(); |
9 | |
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); |
16 | } |
17 | $modulebyname[$strmodulename] = $module; |
18 | } |
19 | ksort($modulebyname); |
20 | |
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'); |
28 | } |
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)); |
32 | } |
33 | } |
34 | } |
35 | |
36 | |
37 | $ADMIN->add('modules', new admin_category('blocksettings', get_string('blocks'))); |
38 | $ADMIN->add('blocksettings', new admin_page_manageblocks()); |
39 | if (!empty($CFG->blocks_version) and $blocks = get_records('block')) { |
40 | $blockbyname = array(); |
41 | |
42 | foreach ($blocks as $block) { |
43 | $strblockname = get_string('blockname', 'block_'.$block->name); |
44 | // Deal with blocks which are lacking the language string |
45 | if ($strblockname == '[[blockname]]') { |
46 | $textlib = textlib_get_instance(); |
47 | $strblockname = $textlib->strtotitle($block->name); |
48 | } |
49 | $blockbyname[$strblockname] = $block; |
50 | } |
51 | ksort($blockbyname); |
52 | |
53 | foreach ($blockbyname as $strblockname=>$block) { |
54 | $blockname = $block->name; |
55 | if (file_exists($CFG->dirroot.'/blocks/'.$blockname.'/settings.php')) { |
56 | $settings = new admin_settingpage('blocksetting'.$blockname, $strblockname, 'moodle/site:config', !$block->visible); |
57 | if ($ADMIN->fulltree) { |
58 | include($CFG->dirroot.'/blocks/'.$blockname.'/settings.php'); |
59 | } |
60 | $ADMIN->add('blocksettings', $settings); |
61 | |
62 | } else if (file_exists($CFG->dirroot.'/blocks/'.$blockname.'/config_global.html')) { |
63 | $ADMIN->add('blocksettings', new admin_externalpage('blocksetting'.$blockname, $strblockname, "$CFG->wwwroot/$CFG->admin/block.php?block=$block->id", 'moodle/site:config', !$block->visible)); |
64 | } |
65 | } |
66 | } |
67 | |
68 | $ADMIN->add('modules', new admin_category('filtersettings', get_string('managefilters'))); |
69 | // "filtersettings" settingpage |
70 | $temp = new admin_settingpage('managefilters', get_string('filtersettings', 'admin')); |
71 | if ($ADMIN->fulltree) { |
72 | $temp->add(new admin_setting_managefilters()); |
73 | $temp->add(new admin_setting_heading('managefilterscommonheading', get_string('commonsettings', 'admin'), '')); |
74 | $temp->add(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 | $temp->add(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 | $temp->add(new admin_setting_configcheckbox('filtermatchoneperpage', get_string('filtermatchoneperpage', 'admin'), get_string('configfiltermatchoneperpage', 'admin'), 0)); |
99 | $temp->add(new admin_setting_configcheckbox('filtermatchonepertext', get_string('filtermatchonepertext', 'admin'), get_string('configfiltermatchonepertext', 'admin'), 0)); |
100 | $temp->add(new admin_setting_configcheckbox('filterall', get_string('filterall', 'admin'), get_string('configfilterall', 'admin'), 0)); |
101 | } |
102 | $ADMIN->add('filtersettings', $temp); |
103 | |
104 | if (empty($CFG->textfilters)) { |
105 | $activefilters = array(); |
106 | } else { |
107 | $activefilters = explode(',', $CFG->textfilters); |
108 | } |
109 | $filterlocations = array('mod','filter'); |
110 | foreach ($filterlocations as $filterlocation) { |
111 | $filters = get_list_of_plugins($filterlocation); |
112 | |
113 | $filterbyname = array(); |
114 | |
115 | foreach ($filters as $filter) { |
116 | $strfiltername = get_string('filtername', $filter); |
117 | // Deal with filters which are lacking the language string |
118 | if ($strfiltername == '[[filtername]]') { |
119 | $textlib = textlib_get_instance(); |
120 | $strfiltername = $textlib->strtotitle($filter); |
121 | } |
122 | $filterbyname[$strfiltername] = "$filterlocation/$filter"; |
123 | } |
124 | ksort($filterbyname); |
125 | |
126 | foreach ($filterbyname as $strfiltername=>$filterfull) { |
127 | if (file_exists("$CFG->dirroot/$filterfull/filtersettings.php")) { |
128 | $settings = new admin_settingpage('filtersetting'.str_replace('/', '', $filterfull), $strfiltername, 'moodle/site:config', !in_array($filterfull, $activefilters)); |
129 | if ($ADMIN->fulltree) { |
130 | include("$CFG->dirroot/$filterfull/filtersettings.php"); |
131 | } |
132 | $ADMIN->add('filtersettings', $settings); |
133 | |
134 | } else if (file_exists("$CFG->dirroot/$filterfull/filterconfig.html")) { |
135 | $ADMIN->add('filtersettings', new admin_externalpage('filtersetting'.str_replace('/', '', $filterfull), $strfiltername, "$CFG->wwwroot/$CFG->admin/filter.php?filter=$filterfull", !in_array($filterfull, $activefilters))); |
136 | } |
137 | } |
138 | } |
139 | } |
140 | ?> |