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 | |
220a90c5 |
76 | $ADMIN->add('modules', new admin_category('filtersettings', get_string('managefilters'))); |
77 | // "filtersettings" settingpage |
78 | $temp = new admin_settingpage('managefilters', get_string('filtersettings', 'admin')); |
79 | if ($ADMIN->fulltree) { |
109e3cb2 |
80 | $items = array(); |
81 | $items[] = new admin_setting_managefilters(); |
82 | $items[] = new admin_setting_heading('managefilterscommonheading', get_string('commonsettings', 'admin'), ''); |
83 | $items[] = new admin_setting_configselect('cachetext', get_string('cachetext', 'admin'), get_string('configcachetext', 'admin'), 60, array(604800 => get_string('numdays','',7), |
220a90c5 |
84 | 86400 => get_string('numdays','',1), |
85 | 43200 => get_string('numhours','',12), |
86 | 10800 => get_string('numhours','',3), |
87 | 7200 => get_string('numhours','',2), |
88 | 3600 => get_string('numhours','',1), |
89 | 2700 => get_string('numminutes','',45), |
90 | 1800 => get_string('numminutes','',30), |
91 | 900 => get_string('numminutes','',15), |
92 | 600 => get_string('numminutes','',10), |
93 | 540 => get_string('numminutes','',9), |
94 | 480 => get_string('numminutes','',8), |
95 | 420 => get_string('numminutes','',7), |
96 | 360 => get_string('numminutes','',6), |
97 | 300 => get_string('numminutes','',5), |
98 | 240 => get_string('numminutes','',4), |
99 | 180 => get_string('numminutes','',3), |
100 | 120 => get_string('numminutes','',2), |
101 | 60 => get_string('numminutes','',1), |
102 | 30 => get_string('numseconds','',30), |
109e3cb2 |
103 | 0 => get_string('no'))); |
104 | $items[] = new admin_setting_configselect('filteruploadedfiles', get_string('filteruploadedfiles', 'admin'), get_string('configfilteruploadedfiles', 'admin'), 0, array('0' => get_string('none'), |
220a90c5 |
105 | '1' => get_string('allfiles'), |
109e3cb2 |
106 | '2' => get_string('htmlfilesonly'))); |
107 | $items[] = new admin_setting_configcheckbox('filtermatchoneperpage', get_string('filtermatchoneperpage', 'admin'), get_string('configfiltermatchoneperpage', 'admin'), 0); |
108 | $items[] = new admin_setting_configcheckbox('filtermatchonepertext', get_string('filtermatchonepertext', 'admin'), get_string('configfiltermatchonepertext', 'admin'), 0); |
109 | $items[] = new admin_setting_configcheckbox('filterall', get_string('filterall', 'admin'), get_string('configfilterall', 'admin'), 0); |
110 | foreach ($items as $item) { |
111 | $item->set_updatedcallback('reset_text_filters_cache'); |
112 | $temp->add($item); |
113 | } |
220a90c5 |
114 | } |
115 | $ADMIN->add('filtersettings', $temp); |
116 | |
117 | if (empty($CFG->textfilters)) { |
118 | $activefilters = array(); |
119 | } else { |
120 | $activefilters = explode(',', $CFG->textfilters); |
121 | } |
b810a4d3 |
122 | $filternames = filter_get_all_installed(); |
123 | foreach ($filternames as $filterpath => $strfiltername) { |
124 | if (file_exists("$CFG->dirroot/$filterpath/filtersettings.php")) { |
125 | $settings = new admin_settingpage('filtersetting'.str_replace('/', '', $filterpath), |
126 | $strfiltername, 'moodle/site:config', !in_array($filterpath, $activefilters)); |
127 | if ($ADMIN->fulltree) { |
128 | include("$CFG->dirroot/$filterpath/filtersettings.php"); |
220a90c5 |
129 | } |
b810a4d3 |
130 | $ADMIN->add('filtersettings', $settings); |
220a90c5 |
131 | } |
132 | } |
67a87e7d |
133 | |
b810a4d3 |
134 | $catname = get_string('portfolios', 'portfolio'); |
67a87e7d |
135 | $manage = get_string('manageportfolios', 'portfolio'); |
136 | $url = "$CFG->wwwroot/$CFG->admin/portfolio.php"; |
137 | |
90658eef |
138 | $ADMIN->add('modules', new admin_category('portfoliosettings', $catname, empty($CFG->enableportfolios))); |
67a87e7d |
139 | |
a50ef3d3 |
140 | // jump through hoops to do what we want |
141 | $temp = new admin_settingpage('manageportfolios', get_string('manageportfolios', 'portfolio')); |
bee4bce2 |
142 | $temp->add(new admin_setting_heading('manageportfolios', get_string('activeportfolios', 'portfolio'), '')); |
a50ef3d3 |
143 | $temp->add(new admin_setting_manageportfolio()); |
bee4bce2 |
144 | $temp->add(new admin_setting_heading('manageportfolioscommon', get_string('commonsettings', 'admin'), get_string('commonsettingsdesc', 'portfolio'))); |
145 | $fileinfo = portfolio_filesize_info(); // make sure this is defined in one place since its used inside portfolio too to detect insane settings |
146 | $fileoptions = $fileinfo['options']; |
147 | $temp->add(new admin_setting_configselect( |
148 | 'portfolio_moderate_filesize_threshold', |
149 | get_string('moderatefilesizethreshold', 'portfolio'), |
150 | get_string('moderatefilesizethresholddesc', 'portfolio'), |
151 | $fileinfo['moderate'], $fileoptions)); |
152 | $temp->add(new admin_setting_configselect( |
153 | 'portfolio_high_filesize_threshold', |
154 | get_string('highfilesizethreshold', 'portfolio'), |
155 | get_string('highfilesizethresholddesc', 'portfolio'), |
156 | $fileinfo['high'], $fileoptions)); |
157 | |
158 | $temp->add(new admin_setting_configtext( |
159 | 'portfolio_moderate_db_threshold', |
160 | get_string('moderatedbsizethreshold', 'portfolio'), |
161 | get_string('moderatedbsizethresholddesc', 'portfolio'), |
162 | 20, PARAM_INTEGER, 3)); |
163 | |
164 | $temp->add(new admin_setting_configtext( |
165 | 'portfolio_high_db_threshold', |
166 | get_string('highdbsizethreshold', 'portfolio'), |
167 | get_string('highdbsizethresholddesc', 'portfolio'), |
168 | 50, PARAM_INTEGER, 3)); |
a50ef3d3 |
169 | |
170 | $ADMIN->add('portfoliosettings', $temp); |
171 | $ADMIN->add('portfoliosettings', new admin_externalpage('portfolionew', get_string('addnewportfolio', 'portfolio'), $url, 'moodle/site:config', true), '', $url); |
172 | $ADMIN->add('portfoliosettings', new admin_externalpage('portfoliodelete', get_string('deleteportfolio', 'portfolio'), $url, 'moodle/site:config', true), '', $url); |
173 | $ADMIN->add('portfoliosettings', new admin_externalpage('portfoliocontroller', get_string('manageportfolios', 'portfolio'), $url, 'moodle/site:config', true), '', $url); |
174 | |
08d5e18b |
175 | foreach (portfolio_instances(false, false) as $portfolio) { |
67a87e7d |
176 | require_once($CFG->dirroot . '/portfolio/type/' . $portfolio->get('plugin') . '/lib.php'); |
177 | $classname = 'portfolio_plugin_' . $portfolio->get('plugin'); |
a50ef3d3 |
178 | $ADMIN->add( |
179 | 'portfoliosettings', |
08d5e18b |
180 | new admin_externalpage( |
181 | 'portfoliosettings' . $portfolio->get('id'), |
658837bb |
182 | $portfolio->get('name'), |
08d5e18b |
183 | $url . '?edit=' . $portfolio->get('id'), |
184 | 'moodle/site:config', |
185 | !$portfolio->get('visible') |
186 | ), |
a50ef3d3 |
187 | $portfolio->get('name'), |
188 | $url . ' ?edit=' . $portfolio->get('id') |
189 | ); |
67a87e7d |
190 | } |
4a65c39a |
191 | |
192 | // repository setting |
193 | require_once("$CFG->dirroot/repository/lib.php"); |
194 | $catname =get_string('repositories', 'repository'); |
04bd6d2d |
195 | $managerepo = get_string('manage', 'repository'); |
196 | $url = $CFG->wwwroot.'/'.$CFG->admin.'/repository.php'; |
4a65c39a |
197 | $ADMIN->add('modules', new admin_category('repositorysettings', $catname)); |
04bd6d2d |
198 | $temp = new admin_settingpage('managerepositories', $managerepo); |
5a8ca187 |
199 | $temp->add(new admin_setting_heading('managerepositories', get_string('activerepository', 'repository'), '')); |
4a65c39a |
200 | $temp->add(new admin_setting_managerepository()); |
5a8ca187 |
201 | $temp->add(new admin_setting_heading('managerepositoriescommonheading', get_string('commonsettings', 'admin'), '')); |
4f2b9a4f |
202 | $temp->add(new admin_setting_configtext('repository_cache_expire', get_string('cacheexpire', 'repository'), get_string('configcacheexpire', 'repository'), 120)); |
4a65c39a |
203 | $ADMIN->add('repositorysettings', $temp); |
4f2b9a4f |
204 | $ADMIN->add('repositorysettings', new admin_externalpage('repositorynew', |
0d099914 |
205 | get_string('addplugin', 'repository'), $url, 'moodle/site:config', true), |
4a65c39a |
206 | '', $url); |
207 | $ADMIN->add('repositorysettings', new admin_externalpage('repositorydelete', |
208 | get_string('deleterepository', 'repository'), $url, 'moodle/site:config', true), |
209 | '', $url); |
210 | $ADMIN->add('repositorysettings', new admin_externalpage('repositorycontroller', |
211 | get_string('managerepositories', 'repository'), $url, 'moodle/site:config', true), |
212 | '', $url); |
0d099914 |
213 | $ADMIN->add('repositorysettings', new admin_externalpage('repositoryinstancenew', |
214 | get_string('createrepository', 'repository'), $url, 'moodle/site:config', true), |
215 | '', $url); |
216 | $ADMIN->add('repositorysettings', new admin_externalpage('repositoryinstanceedit', |
217 | get_string('editrepositoryinstance', 'repository'), $url, 'moodle/site:config', true), |
218 | '', $url); |
dbc01944 |
219 | foreach (repository::get_types() |
a6600395 |
220 | as $repositorytype) |
4a65c39a |
221 | { |
edb50637 |
222 | //display setup page for plugins with: general options or multiple instances (e.g. has instance config) |
dbc01944 |
223 | $typeoptionnames = repository::static_function($repositorytype->get_typename(), 'get_type_option_names'); |
224 | $instanceoptionnames = repository::static_function($repositorytype->get_typename(), 'get_instance_option_names'); |
edb50637 |
225 | if (!empty($typeoptionnames) || !empty($instanceoptionnames)) { |
4a65c39a |
226 | $ADMIN->add('repositorysettings', |
a6600395 |
227 | new admin_externalpage('repositorysettings'.$repositorytype->get_typename(), |
228 | $repositorytype->get_readablename(), |
229 | $url . '?edit=' . $repositorytype->get_typename()), |
4a65c39a |
230 | 'moodle/site:config'); |
231 | } |
232 | } |
bee4bce2 |
233 | |
234 | // Question type settings. |
235 | $ADMIN->add('modules', new admin_category('qtypesettings', get_string('questiontypes', 'admin'))); |
236 | $ADMIN->add('qtypesettings', new admin_page_manageqtypes()); |
237 | require_once($CFG->libdir . '/questionlib.php'); |
238 | global $QTYPES; |
239 | foreach ($QTYPES as $qtype) { |
240 | $settingsfile = $qtype->plugin_dir() . '/settings.php'; |
241 | if (file_exists($settingsfile)) { |
242 | $settings = new admin_settingpage('qtypesetting' . $qtype->name(), |
243 | $qtype->local_name(), 'moodle/question:config'); |
244 | if ($ADMIN->fulltree) { |
245 | include($settingsfile); |
246 | } |
247 | $ADMIN->add('qtypesettings', $settings); |
248 | } |
249 | } |
220a90c5 |
250 | } |
b63a6a63 |
251 | |
252 | |
253 | /// Now add reports |
254 | |
255 | foreach (get_list_of_plugins($CFG->admin.'/report') as $plugin) { |
256 | $settings_path = "$CFG->dirroot/$CFG->admin/report/$plugin/settings.php"; |
257 | if (file_exists($settings_path)) { |
258 | include($settings_path); |
259 | continue; |
260 | } |
261 | |
262 | $index_path = "$CFG->dirroot/$CFG->admin/report/$plugin/index.php"; |
263 | if (!file_exists($index_path)) { |
264 | continue; |
265 | } |
266 | // old style 3rd party plugin without settings.php |
36641dd2 |
267 | $www_path = "$CFG->dirroot/$CFG->admin/report/$plugin/index.php"; |
c5fce2fa |
268 | $reportname = get_string($plugin, 'report_' . $plugin); |
269 | $ADMIN->add('reports', new admin_externalpage('report'.$plugin, $reportname, $www_path, 'moodle/site:viewreports')); |
b63a6a63 |
270 | } |
271 | |