220a90c5 |
1 | <?php //$Id$ |
2 | |
3 | if ($hassiteconfig) { |
4 | |
ff4b9fcb |
5 | $ADMIN->add('modules', new admin_category('modsettings', get_string('activitymodules'))); |
220a90c5 |
6 | $ADMIN->add('modsettings', new admin_page_managemods()); |
823e64a7 |
7 | if ($modules = $DB->get_records('modules')) { |
220a90c5 |
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; |
c37415a0 |
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')) { |
220a90c5 |
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'); |
30 | } |
31 | $ADMIN->add('modsettings', $settings); |
220a90c5 |
32 | } |
33 | } |
34 | } |
35 | |
b032b490 |
36 | // hidden script for converting journals to online assignments (or something like that) linked from elsewhere |
37 | $ADMIN->add('modsettings', new admin_externalpage('oacleanup', 'Online Assignment Cleanup', $CFG->wwwroot.'/'.$CFG->admin.'/oacleanup.php', 'moodle/site:config', true)); |
220a90c5 |
38 | |
39 | $ADMIN->add('modules', new admin_category('blocksettings', get_string('blocks'))); |
40 | $ADMIN->add('blocksettings', new admin_page_manageblocks()); |
5d4afe01 |
41 | $ADMIN->add('blocksettings', new admin_externalpage('stickyblocks', get_string('stickyblocks', 'admin'), "$CFG->wwwroot/$CFG->admin/stickyblocks.php")); |
823e64a7 |
42 | if (!empty($CFG->blocks_version) and $blocks = $DB->get_records('block')) { |
220a90c5 |
43 | $blockbyname = array(); |
44 | |
45 | foreach ($blocks as $block) { |
01ca2df0 |
46 | if(($blockobject = block_instance($block->name)) === false) { |
47 | // Failed to load |
48 | continue; |
220a90c5 |
49 | } |
01ca2df0 |
50 | $blockbyname[$blockobject->get_title()] = $block; |
220a90c5 |
51 | } |
52 | ksort($blockbyname); |
53 | |
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'); |
60 | } |
61 | $ADMIN->add('blocksettings', $settings); |
62 | |
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)); |
65 | } |
66 | } |
67 | } |
68 | |
c5d2d0dd |
69 | |
220a90c5 |
70 | $ADMIN->add('modules', new admin_category('filtersettings', get_string('managefilters'))); |
71 | // "filtersettings" settingpage |
72 | $temp = new admin_settingpage('managefilters', get_string('filtersettings', 'admin')); |
73 | if ($ADMIN->fulltree) { |
109e3cb2 |
74 | $items = array(); |
75 | $items[] = new admin_setting_managefilters(); |
76 | $items[] = new admin_setting_heading('managefilterscommonheading', get_string('commonsettings', 'admin'), ''); |
77 | $items[] = new admin_setting_configselect('cachetext', get_string('cachetext', 'admin'), get_string('configcachetext', 'admin'), 60, array(604800 => get_string('numdays','',7), |
220a90c5 |
78 | 86400 => get_string('numdays','',1), |
79 | 43200 => get_string('numhours','',12), |
80 | 10800 => get_string('numhours','',3), |
81 | 7200 => get_string('numhours','',2), |
82 | 3600 => get_string('numhours','',1), |
83 | 2700 => get_string('numminutes','',45), |
84 | 1800 => get_string('numminutes','',30), |
85 | 900 => get_string('numminutes','',15), |
86 | 600 => get_string('numminutes','',10), |
87 | 540 => get_string('numminutes','',9), |
88 | 480 => get_string('numminutes','',8), |
89 | 420 => get_string('numminutes','',7), |
90 | 360 => get_string('numminutes','',6), |
91 | 300 => get_string('numminutes','',5), |
92 | 240 => get_string('numminutes','',4), |
93 | 180 => get_string('numminutes','',3), |
94 | 120 => get_string('numminutes','',2), |
95 | 60 => get_string('numminutes','',1), |
96 | 30 => get_string('numseconds','',30), |
109e3cb2 |
97 | 0 => get_string('no'))); |
98 | $items[] = new admin_setting_configselect('filteruploadedfiles', get_string('filteruploadedfiles', 'admin'), get_string('configfilteruploadedfiles', 'admin'), 0, array('0' => get_string('none'), |
220a90c5 |
99 | '1' => get_string('allfiles'), |
109e3cb2 |
100 | '2' => get_string('htmlfilesonly'))); |
101 | $items[] = new admin_setting_configcheckbox('filtermatchoneperpage', get_string('filtermatchoneperpage', 'admin'), get_string('configfiltermatchoneperpage', 'admin'), 0); |
102 | $items[] = new admin_setting_configcheckbox('filtermatchonepertext', get_string('filtermatchonepertext', 'admin'), get_string('configfiltermatchonepertext', 'admin'), 0); |
103 | $items[] = new admin_setting_configcheckbox('filterall', get_string('filterall', 'admin'), get_string('configfilterall', 'admin'), 0); |
104 | foreach ($items as $item) { |
105 | $item->set_updatedcallback('reset_text_filters_cache'); |
106 | $temp->add($item); |
107 | } |
220a90c5 |
108 | } |
109 | $ADMIN->add('filtersettings', $temp); |
110 | |
111 | if (empty($CFG->textfilters)) { |
112 | $activefilters = array(); |
113 | } else { |
114 | $activefilters = explode(',', $CFG->textfilters); |
115 | } |
116 | $filterlocations = array('mod','filter'); |
117 | foreach ($filterlocations as $filterlocation) { |
118 | $filters = get_list_of_plugins($filterlocation); |
119 | |
120 | $filterbyname = array(); |
121 | |
122 | foreach ($filters as $filter) { |
123 | $strfiltername = get_string('filtername', $filter); |
124 | // Deal with filters which are lacking the language string |
125 | if ($strfiltername == '[[filtername]]') { |
126 | $textlib = textlib_get_instance(); |
127 | $strfiltername = $textlib->strtotitle($filter); |
128 | } |
129 | $filterbyname[$strfiltername] = "$filterlocation/$filter"; |
130 | } |
131 | ksort($filterbyname); |
132 | |
133 | foreach ($filterbyname as $strfiltername=>$filterfull) { |
134 | if (file_exists("$CFG->dirroot/$filterfull/filtersettings.php")) { |
135 | $settings = new admin_settingpage('filtersetting'.str_replace('/', '', $filterfull), $strfiltername, 'moodle/site:config', !in_array($filterfull, $activefilters)); |
136 | if ($ADMIN->fulltree) { |
137 | include("$CFG->dirroot/$filterfull/filtersettings.php"); |
138 | } |
139 | $ADMIN->add('filtersettings', $settings); |
140 | |
141 | } else if (file_exists("$CFG->dirroot/$filterfull/filterconfig.html")) { |
142 | $ADMIN->add('filtersettings', new admin_externalpage('filtersetting'.str_replace('/', '', $filterfull), $strfiltername, "$CFG->wwwroot/$CFG->admin/filter.php?filter=$filterfull", !in_array($filterfull, $activefilters))); |
143 | } |
144 | } |
145 | } |
67a87e7d |
146 | |
a50ef3d3 |
147 | require_once($CFG->libdir. '/portfoliolib.php'); |
148 | |
67a87e7d |
149 | $catname =get_string('portfolios', 'portfolio'); |
150 | $manage = get_string('manageportfolios', 'portfolio'); |
151 | $url = "$CFG->wwwroot/$CFG->admin/portfolio.php"; |
152 | |
90658eef |
153 | $ADMIN->add('modules', new admin_category('portfoliosettings', $catname, empty($CFG->enableportfolios))); |
67a87e7d |
154 | |
a50ef3d3 |
155 | // jump through hoops to do what we want |
156 | $temp = new admin_settingpage('manageportfolios', get_string('manageportfolios', 'portfolio')); |
a50ef3d3 |
157 | $temp->add(new admin_setting_manageportfolio()); |
158 | |
159 | $ADMIN->add('portfoliosettings', $temp); |
160 | $ADMIN->add('portfoliosettings', new admin_externalpage('portfolionew', get_string('addnewportfolio', 'portfolio'), $url, 'moodle/site:config', true), '', $url); |
161 | $ADMIN->add('portfoliosettings', new admin_externalpage('portfoliodelete', get_string('deleteportfolio', 'portfolio'), $url, 'moodle/site:config', true), '', $url); |
162 | $ADMIN->add('portfoliosettings', new admin_externalpage('portfoliocontroller', get_string('manageportfolios', 'portfolio'), $url, 'moodle/site:config', true), '', $url); |
163 | |
08d5e18b |
164 | foreach (portfolio_instances(false, false) as $portfolio) { |
67a87e7d |
165 | require_once($CFG->dirroot . '/portfolio/type/' . $portfolio->get('plugin') . '/lib.php'); |
166 | $classname = 'portfolio_plugin_' . $portfolio->get('plugin'); |
a50ef3d3 |
167 | $ADMIN->add( |
168 | 'portfoliosettings', |
08d5e18b |
169 | new admin_externalpage( |
170 | 'portfoliosettings' . $portfolio->get('id'), |
171 | get_string('configure', 'portfolio') . ' ' . $portfolio->get('name'), |
172 | $url . '?edit=' . $portfolio->get('id'), |
173 | 'moodle/site:config', |
174 | !$portfolio->get('visible') |
175 | ), |
a50ef3d3 |
176 | $portfolio->get('name'), |
177 | $url . ' ?edit=' . $portfolio->get('id') |
178 | ); |
67a87e7d |
179 | } |
4a65c39a |
180 | |
181 | // repository setting |
182 | require_once("$CFG->dirroot/repository/lib.php"); |
183 | $catname =get_string('repositories', 'repository'); |
04bd6d2d |
184 | $managerepo = get_string('manage', 'repository'); |
185 | $url = $CFG->wwwroot.'/'.$CFG->admin.'/repository.php'; |
4a65c39a |
186 | $ADMIN->add('modules', new admin_category('repositorysettings', $catname)); |
04bd6d2d |
187 | $temp = new admin_settingpage('managerepositories', $managerepo); |
5a8ca187 |
188 | $temp->add(new admin_setting_heading('managerepositories', get_string('activerepository', 'repository'), '')); |
4a65c39a |
189 | $temp->add(new admin_setting_managerepository()); |
5a8ca187 |
190 | $temp->add(new admin_setting_heading('managerepositoriescommonheading', get_string('commonsettings', 'admin'), '')); |
4f2b9a4f |
191 | $temp->add(new admin_setting_configtext('repository_cache_expire', get_string('cacheexpire', 'repository'), get_string('configcacheexpire', 'repository'), 120)); |
4a65c39a |
192 | $ADMIN->add('repositorysettings', $temp); |
4f2b9a4f |
193 | $ADMIN->add('repositorysettings', new admin_externalpage('repositorynew', |
0d099914 |
194 | get_string('addplugin', 'repository'), $url, 'moodle/site:config', true), |
4a65c39a |
195 | '', $url); |
196 | $ADMIN->add('repositorysettings', new admin_externalpage('repositorydelete', |
197 | get_string('deleterepository', 'repository'), $url, 'moodle/site:config', true), |
198 | '', $url); |
199 | $ADMIN->add('repositorysettings', new admin_externalpage('repositorycontroller', |
200 | get_string('managerepositories', 'repository'), $url, 'moodle/site:config', true), |
201 | '', $url); |
0d099914 |
202 | $ADMIN->add('repositorysettings', new admin_externalpage('repositoryinstancenew', |
203 | get_string('createrepository', 'repository'), $url, 'moodle/site:config', true), |
204 | '', $url); |
205 | $ADMIN->add('repositorysettings', new admin_externalpage('repositoryinstanceedit', |
206 | get_string('editrepositoryinstance', 'repository'), $url, 'moodle/site:config', true), |
207 | '', $url); |
a6600395 |
208 | foreach (repository_get_types() |
209 | as $repositorytype) |
4a65c39a |
210 | { |
a6600395 |
211 | //display setup page for plugins with: general options or instance options or multiple instances |
212 | if (repository_static_function($repositorytype->get_typename(), 'has_admin_config') |
213 | || repository_static_function($repositorytype->get_typename(), 'has_instance_config') |
214 | || repository_static_function($repositorytype->get_typename(), 'has_multiple_instances')) { |
4a65c39a |
215 | $ADMIN->add('repositorysettings', |
a6600395 |
216 | new admin_externalpage('repositorysettings'.$repositorytype->get_typename(), |
217 | $repositorytype->get_readablename(), |
218 | $url . '?edit=' . $repositorytype->get_typename()), |
4a65c39a |
219 | 'moodle/site:config'); |
220 | } |
221 | } |
220a90c5 |
222 | } |