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