220a90c5 |
1 | <?php //$Id$ |
2 | |
b63a6a63 |
3 | /* |
4 | * Please note that is file is always loaded last - it means that you can inject entries into other categories too. |
5 | */ |
6 | |
bee4bce2 |
7 | if ($hassiteconfig || has_capability('moodle/question:config', $systemcontext)) { |
220a90c5 |
8 | |
214b1cf7 |
9 | require_once($CFG->libdir. '/portfoliolib.php'); |
10 | |
ff4b9fcb |
11 | $ADMIN->add('modules', new admin_category('modsettings', get_string('activitymodules'))); |
220a90c5 |
12 | $ADMIN->add('modsettings', new admin_page_managemods()); |
823e64a7 |
13 | if ($modules = $DB->get_records('modules')) { |
220a90c5 |
14 | $modulebyname = array(); |
15 | |
16 | foreach ($modules as $module) { |
17 | $strmodulename = get_string('modulename', $module->name); |
18 | // Deal with modules which are lacking the language string |
19 | if ($strmodulename == '[[modulename]]') { |
20 | $textlib = textlib_get_instance(); |
21 | $strmodulename = $textlib->strtotitle($module->name); |
22 | } |
23 | $modulebyname[$strmodulename] = $module; |
24 | } |
25 | ksort($modulebyname); |
26 | |
27 | foreach ($modulebyname as $strmodulename=>$module) { |
28 | $modulename = $module->name; |
c37415a0 |
29 | if (file_exists($CFG->dirroot.'/mod/'.$modulename.'/settingstree.php')) { |
30 | include($CFG->dirroot.'/mod/'.$modulename.'/settingstree.php'); |
31 | } else if (file_exists($CFG->dirroot.'/mod/'.$modulename.'/settings.php')) { |
220a90c5 |
32 | // do not show disabled modules in tree, keep only settings link on manage page |
33 | $settings = new admin_settingpage('modsetting'.$modulename, $strmodulename, 'moodle/site:config', !$module->visible); |
34 | if ($ADMIN->fulltree) { |
35 | include($CFG->dirroot.'/mod/'.$modulename.'/settings.php'); |
36 | } |
37 | $ADMIN->add('modsettings', $settings); |
220a90c5 |
38 | } |
39 | } |
40 | } |
41 | |
b032b490 |
42 | // hidden script for converting journals to online assignments (or something like that) linked from elsewhere |
43 | $ADMIN->add('modsettings', new admin_externalpage('oacleanup', 'Online Assignment Cleanup', $CFG->wwwroot.'/'.$CFG->admin.'/oacleanup.php', 'moodle/site:config', true)); |
220a90c5 |
44 | |
45 | $ADMIN->add('modules', new admin_category('blocksettings', get_string('blocks'))); |
46 | $ADMIN->add('blocksettings', new admin_page_manageblocks()); |
5d4afe01 |
47 | $ADMIN->add('blocksettings', new admin_externalpage('stickyblocks', get_string('stickyblocks', 'admin'), "$CFG->wwwroot/$CFG->admin/stickyblocks.php")); |
ab2eb65c |
48 | if ($blocks = $DB->get_records('block')) { |
220a90c5 |
49 | $blockbyname = array(); |
50 | |
51 | foreach ($blocks as $block) { |
01ca2df0 |
52 | if(($blockobject = block_instance($block->name)) === false) { |
53 | // Failed to load |
54 | continue; |
220a90c5 |
55 | } |
01ca2df0 |
56 | $blockbyname[$blockobject->get_title()] = $block; |
220a90c5 |
57 | } |
58 | ksort($blockbyname); |
59 | |
60 | foreach ($blockbyname as $strblockname=>$block) { |
61 | $blockname = $block->name; |
62 | if (file_exists($CFG->dirroot.'/blocks/'.$blockname.'/settings.php')) { |
63 | $settings = new admin_settingpage('blocksetting'.$blockname, $strblockname, 'moodle/site:config', !$block->visible); |
64 | if ($ADMIN->fulltree) { |
65 | include($CFG->dirroot.'/blocks/'.$blockname.'/settings.php'); |
66 | } |
67 | $ADMIN->add('blocksettings', $settings); |
68 | |
69 | } else if (file_exists($CFG->dirroot.'/blocks/'.$blockname.'/config_global.html')) { |
70 | $ADMIN->add('blocksettings', new admin_externalpage('blocksetting'.$blockname, $strblockname, "$CFG->wwwroot/$CFG->admin/block.php?block=$block->id", 'moodle/site:config', !$block->visible)); |
71 | } |
72 | } |
73 | } |
74 | |
c5d2d0dd |
75 | |
a5747cf8 |
76 | /// Editor plugins |
77 | $ADMIN->add('modules', new admin_category('editorsettings', get_string('editors', 'editor'))); |
78 | $temp = new admin_settingpage('manageeditors', get_string('editorsettings', 'editor')); |
79 | $temp->add(new admin_setting_manageeditors()); |
80 | $ADMIN->add('editorsettings', $temp); |
81 | |
82 | |
83 | /// Filter plugins |
220a90c5 |
84 | $ADMIN->add('modules', new admin_category('filtersettings', get_string('managefilters'))); |
dcdf3b29 |
85 | |
86 | $ADMIN->add('filtersettings', new admin_page_managefilters()); |
87 | |
220a90c5 |
88 | // "filtersettings" settingpage |
dcdf3b29 |
89 | $temp = new admin_settingpage('commonfiltersettings', get_string('commonfiltersettings', 'admin')); |
220a90c5 |
90 | if ($ADMIN->fulltree) { |
5b8fa09b |
91 | $cachetimes = array( |
92 | 604800 => get_string('numdays','',7), |
93 | 86400 => get_string('numdays','',1), |
94 | 43200 => get_string('numhours','',12), |
95 | 10800 => get_string('numhours','',3), |
96 | 7200 => get_string('numhours','',2), |
97 | 3600 => get_string('numhours','',1), |
98 | 2700 => get_string('numminutes','',45), |
99 | 1800 => get_string('numminutes','',30), |
100 | 900 => get_string('numminutes','',15), |
101 | 600 => get_string('numminutes','',10), |
102 | 540 => get_string('numminutes','',9), |
103 | 480 => get_string('numminutes','',8), |
104 | 420 => get_string('numminutes','',7), |
105 | 360 => get_string('numminutes','',6), |
106 | 300 => get_string('numminutes','',5), |
107 | 240 => get_string('numminutes','',4), |
108 | 180 => get_string('numminutes','',3), |
109 | 120 => get_string('numminutes','',2), |
110 | 60 => get_string('numminutes','',1), |
111 | 30 => get_string('numseconds','',30), |
112 | 0 => get_string('no') |
113 | ); |
109e3cb2 |
114 | $items = array(); |
5b8fa09b |
115 | $items[] = new admin_setting_configselect('cachetext', get_string('cachetext', 'admin'), get_string('configcachetext', 'admin'), 60, $cachetimes); |
116 | $items[] = new admin_setting_configselect('filteruploadedfiles', get_string('filteruploadedfiles', 'admin'), get_string('configfilteruploadedfiles', 'admin'), 0, |
117 | array('0' => get_string('none'), '1' => get_string('allfiles'), '2' => get_string('htmlfilesonly'))); |
109e3cb2 |
118 | $items[] = new admin_setting_configcheckbox('filtermatchoneperpage', get_string('filtermatchoneperpage', 'admin'), get_string('configfiltermatchoneperpage', 'admin'), 0); |
119 | $items[] = new admin_setting_configcheckbox('filtermatchonepertext', get_string('filtermatchonepertext', 'admin'), get_string('configfiltermatchonepertext', 'admin'), 0); |
109e3cb2 |
120 | foreach ($items as $item) { |
121 | $item->set_updatedcallback('reset_text_filters_cache'); |
122 | $temp->add($item); |
123 | } |
220a90c5 |
124 | } |
125 | $ADMIN->add('filtersettings', $temp); |
126 | |
5b8fa09b |
127 | $activefilters = filter_get_globally_enabled(); |
b810a4d3 |
128 | $filternames = filter_get_all_installed(); |
129 | foreach ($filternames as $filterpath => $strfiltername) { |
130 | if (file_exists("$CFG->dirroot/$filterpath/filtersettings.php")) { |
131 | $settings = new admin_settingpage('filtersetting'.str_replace('/', '', $filterpath), |
5b8fa09b |
132 | $strfiltername, 'moodle/site:config', !isset($activefilters[$filterpath])); |
b810a4d3 |
133 | if ($ADMIN->fulltree) { |
134 | include("$CFG->dirroot/$filterpath/filtersettings.php"); |
220a90c5 |
135 | } |
b810a4d3 |
136 | $ADMIN->add('filtersettings', $settings); |
220a90c5 |
137 | } |
138 | } |
67a87e7d |
139 | |
b810a4d3 |
140 | $catname = get_string('portfolios', 'portfolio'); |
67a87e7d |
141 | $manage = get_string('manageportfolios', 'portfolio'); |
142 | $url = "$CFG->wwwroot/$CFG->admin/portfolio.php"; |
143 | |
90658eef |
144 | $ADMIN->add('modules', new admin_category('portfoliosettings', $catname, empty($CFG->enableportfolios))); |
67a87e7d |
145 | |
a50ef3d3 |
146 | // jump through hoops to do what we want |
147 | $temp = new admin_settingpage('manageportfolios', get_string('manageportfolios', 'portfolio')); |
bee4bce2 |
148 | $temp->add(new admin_setting_heading('manageportfolios', get_string('activeportfolios', 'portfolio'), '')); |
a50ef3d3 |
149 | $temp->add(new admin_setting_manageportfolio()); |
bee4bce2 |
150 | $temp->add(new admin_setting_heading('manageportfolioscommon', get_string('commonsettings', 'admin'), get_string('commonsettingsdesc', 'portfolio'))); |
151 | $fileinfo = portfolio_filesize_info(); // make sure this is defined in one place since its used inside portfolio too to detect insane settings |
152 | $fileoptions = $fileinfo['options']; |
153 | $temp->add(new admin_setting_configselect( |
154 | 'portfolio_moderate_filesize_threshold', |
155 | get_string('moderatefilesizethreshold', 'portfolio'), |
156 | get_string('moderatefilesizethresholddesc', 'portfolio'), |
157 | $fileinfo['moderate'], $fileoptions)); |
158 | $temp->add(new admin_setting_configselect( |
159 | 'portfolio_high_filesize_threshold', |
160 | get_string('highfilesizethreshold', 'portfolio'), |
161 | get_string('highfilesizethresholddesc', 'portfolio'), |
162 | $fileinfo['high'], $fileoptions)); |
163 | |
164 | $temp->add(new admin_setting_configtext( |
165 | 'portfolio_moderate_db_threshold', |
166 | get_string('moderatedbsizethreshold', 'portfolio'), |
167 | get_string('moderatedbsizethresholddesc', 'portfolio'), |
168 | 20, PARAM_INTEGER, 3)); |
169 | |
170 | $temp->add(new admin_setting_configtext( |
171 | 'portfolio_high_db_threshold', |
172 | get_string('highdbsizethreshold', 'portfolio'), |
173 | get_string('highdbsizethresholddesc', 'portfolio'), |
174 | 50, PARAM_INTEGER, 3)); |
a50ef3d3 |
175 | |
176 | $ADMIN->add('portfoliosettings', $temp); |
177 | $ADMIN->add('portfoliosettings', new admin_externalpage('portfolionew', get_string('addnewportfolio', 'portfolio'), $url, 'moodle/site:config', true), '', $url); |
178 | $ADMIN->add('portfoliosettings', new admin_externalpage('portfoliodelete', get_string('deleteportfolio', 'portfolio'), $url, 'moodle/site:config', true), '', $url); |
179 | $ADMIN->add('portfoliosettings', new admin_externalpage('portfoliocontroller', get_string('manageportfolios', 'portfolio'), $url, 'moodle/site:config', true), '', $url); |
180 | |
08d5e18b |
181 | foreach (portfolio_instances(false, false) as $portfolio) { |
67a87e7d |
182 | require_once($CFG->dirroot . '/portfolio/type/' . $portfolio->get('plugin') . '/lib.php'); |
183 | $classname = 'portfolio_plugin_' . $portfolio->get('plugin'); |
a50ef3d3 |
184 | $ADMIN->add( |
185 | 'portfoliosettings', |
08d5e18b |
186 | new admin_externalpage( |
187 | 'portfoliosettings' . $portfolio->get('id'), |
658837bb |
188 | $portfolio->get('name'), |
08d5e18b |
189 | $url . '?edit=' . $portfolio->get('id'), |
190 | 'moodle/site:config', |
191 | !$portfolio->get('visible') |
192 | ), |
a50ef3d3 |
193 | $portfolio->get('name'), |
194 | $url . ' ?edit=' . $portfolio->get('id') |
195 | ); |
67a87e7d |
196 | } |
4a65c39a |
197 | |
198 | // repository setting |
199 | require_once("$CFG->dirroot/repository/lib.php"); |
200 | $catname =get_string('repositories', 'repository'); |
04bd6d2d |
201 | $managerepo = get_string('manage', 'repository'); |
202 | $url = $CFG->wwwroot.'/'.$CFG->admin.'/repository.php'; |
4a65c39a |
203 | $ADMIN->add('modules', new admin_category('repositorysettings', $catname)); |
04bd6d2d |
204 | $temp = new admin_settingpage('managerepositories', $managerepo); |
5a8ca187 |
205 | $temp->add(new admin_setting_heading('managerepositories', get_string('activerepository', 'repository'), '')); |
4a65c39a |
206 | $temp->add(new admin_setting_managerepository()); |
5a8ca187 |
207 | $temp->add(new admin_setting_heading('managerepositoriescommonheading', get_string('commonsettings', 'admin'), '')); |
5430f05b |
208 | $temp->add(new admin_setting_configtext('repositorycacheexpire', get_string('cacheexpire', 'repository'), get_string('configcacheexpire', 'repository'), 120)); |
4a65c39a |
209 | $ADMIN->add('repositorysettings', $temp); |
4f2b9a4f |
210 | $ADMIN->add('repositorysettings', new admin_externalpage('repositorynew', |
0d099914 |
211 | get_string('addplugin', 'repository'), $url, 'moodle/site:config', true), |
4a65c39a |
212 | '', $url); |
213 | $ADMIN->add('repositorysettings', new admin_externalpage('repositorydelete', |
214 | get_string('deleterepository', 'repository'), $url, 'moodle/site:config', true), |
215 | '', $url); |
216 | $ADMIN->add('repositorysettings', new admin_externalpage('repositorycontroller', |
217 | get_string('managerepositories', 'repository'), $url, 'moodle/site:config', true), |
218 | '', $url); |
0d099914 |
219 | $ADMIN->add('repositorysettings', new admin_externalpage('repositoryinstancenew', |
220 | get_string('createrepository', 'repository'), $url, 'moodle/site:config', true), |
221 | '', $url); |
222 | $ADMIN->add('repositorysettings', new admin_externalpage('repositoryinstanceedit', |
223 | get_string('editrepositoryinstance', 'repository'), $url, 'moodle/site:config', true), |
224 | '', $url); |
dbc01944 |
225 | foreach (repository::get_types() |
a6600395 |
226 | as $repositorytype) |
4a65c39a |
227 | { |
edb50637 |
228 | //display setup page for plugins with: general options or multiple instances (e.g. has instance config) |
dbc01944 |
229 | $typeoptionnames = repository::static_function($repositorytype->get_typename(), 'get_type_option_names'); |
230 | $instanceoptionnames = repository::static_function($repositorytype->get_typename(), 'get_instance_option_names'); |
edb50637 |
231 | if (!empty($typeoptionnames) || !empty($instanceoptionnames)) { |
4a65c39a |
232 | $ADMIN->add('repositorysettings', |
a6600395 |
233 | new admin_externalpage('repositorysettings'.$repositorytype->get_typename(), |
234 | $repositorytype->get_readablename(), |
235 | $url . '?edit=' . $repositorytype->get_typename()), |
4a65c39a |
236 | 'moodle/site:config'); |
237 | } |
238 | } |
bee4bce2 |
239 | |
240 | // Question type settings. |
241 | $ADMIN->add('modules', new admin_category('qtypesettings', get_string('questiontypes', 'admin'))); |
242 | $ADMIN->add('qtypesettings', new admin_page_manageqtypes()); |
243 | require_once($CFG->libdir . '/questionlib.php'); |
244 | global $QTYPES; |
245 | foreach ($QTYPES as $qtype) { |
246 | $settingsfile = $qtype->plugin_dir() . '/settings.php'; |
247 | if (file_exists($settingsfile)) { |
248 | $settings = new admin_settingpage('qtypesetting' . $qtype->name(), |
249 | $qtype->local_name(), 'moodle/question:config'); |
250 | if ($ADMIN->fulltree) { |
251 | include($settingsfile); |
252 | } |
253 | $ADMIN->add('qtypesettings', $settings); |
254 | } |
255 | } |
220a90c5 |
256 | } |
b63a6a63 |
257 | |
258 | |
259 | /// Now add reports |
260 | |
261 | foreach (get_list_of_plugins($CFG->admin.'/report') as $plugin) { |
262 | $settings_path = "$CFG->dirroot/$CFG->admin/report/$plugin/settings.php"; |
263 | if (file_exists($settings_path)) { |
264 | include($settings_path); |
265 | continue; |
266 | } |
267 | |
268 | $index_path = "$CFG->dirroot/$CFG->admin/report/$plugin/index.php"; |
269 | if (!file_exists($index_path)) { |
270 | continue; |
271 | } |
272 | // old style 3rd party plugin without settings.php |
36641dd2 |
273 | $www_path = "$CFG->dirroot/$CFG->admin/report/$plugin/index.php"; |
c5fce2fa |
274 | $reportname = get_string($plugin, 'report_' . $plugin); |
275 | $ADMIN->add('reports', new admin_externalpage('report'.$plugin, $reportname, $www_path, 'moodle/site:viewreports')); |
b63a6a63 |
276 | } |
277 | |