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