MDL-15498: Completion: added idnumber to progress report table (if enabled)
[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
71 $ADMIN->add('modules', new admin_category('filtersettings', get_string('managefilters')));
72 // "filtersettings" settingpage
73 $temp = new admin_settingpage('managefilters', get_string('filtersettings', 'admin'));
74 if ($ADMIN->fulltree) {
109e3cb2 75 $items = array();
76 $items[] = new admin_setting_managefilters();
77 $items[] = new admin_setting_heading('managefilterscommonheading', get_string('commonsettings', 'admin'), '');
78 $items[] = new admin_setting_configselect('cachetext', get_string('cachetext', 'admin'), get_string('configcachetext', 'admin'), 60, array(604800 => get_string('numdays','',7),
220a90c5 79 86400 => get_string('numdays','',1),
80 43200 => get_string('numhours','',12),
81 10800 => get_string('numhours','',3),
82 7200 => get_string('numhours','',2),
83 3600 => get_string('numhours','',1),
84 2700 => get_string('numminutes','',45),
85 1800 => get_string('numminutes','',30),
86 900 => get_string('numminutes','',15),
87 600 => get_string('numminutes','',10),
88 540 => get_string('numminutes','',9),
89 480 => get_string('numminutes','',8),
90 420 => get_string('numminutes','',7),
91 360 => get_string('numminutes','',6),
92 300 => get_string('numminutes','',5),
93 240 => get_string('numminutes','',4),
94 180 => get_string('numminutes','',3),
95 120 => get_string('numminutes','',2),
96 60 => get_string('numminutes','',1),
97 30 => get_string('numseconds','',30),
109e3cb2 98 0 => get_string('no')));
99 $items[] = new admin_setting_configselect('filteruploadedfiles', get_string('filteruploadedfiles', 'admin'), get_string('configfilteruploadedfiles', 'admin'), 0, array('0' => get_string('none'),
220a90c5 100 '1' => get_string('allfiles'),
109e3cb2 101 '2' => get_string('htmlfilesonly')));
102 $items[] = new admin_setting_configcheckbox('filtermatchoneperpage', get_string('filtermatchoneperpage', 'admin'), get_string('configfiltermatchoneperpage', 'admin'), 0);
103 $items[] = new admin_setting_configcheckbox('filtermatchonepertext', get_string('filtermatchonepertext', 'admin'), get_string('configfiltermatchonepertext', 'admin'), 0);
104 $items[] = new admin_setting_configcheckbox('filterall', get_string('filterall', 'admin'), get_string('configfilterall', 'admin'), 0);
105 foreach ($items as $item) {
106 $item->set_updatedcallback('reset_text_filters_cache');
107 $temp->add($item);
108 }
220a90c5 109 }
110 $ADMIN->add('filtersettings', $temp);
111
112 if (empty($CFG->textfilters)) {
113 $activefilters = array();
114 } else {
115 $activefilters = explode(',', $CFG->textfilters);
116 }
117 $filterlocations = array('mod','filter');
118 foreach ($filterlocations as $filterlocation) {
119 $filters = get_list_of_plugins($filterlocation);
120
121 $filterbyname = array();
122
123 foreach ($filters as $filter) {
124 $strfiltername = get_string('filtername', $filter);
125 // Deal with filters which are lacking the language string
126 if ($strfiltername == '[[filtername]]') {
127 $textlib = textlib_get_instance();
128 $strfiltername = $textlib->strtotitle($filter);
129 }
130 $filterbyname[$strfiltername] = "$filterlocation/$filter";
131 }
132 ksort($filterbyname);
133
134 foreach ($filterbyname as $strfiltername=>$filterfull) {
135 if (file_exists("$CFG->dirroot/$filterfull/filtersettings.php")) {
136 $settings = new admin_settingpage('filtersetting'.str_replace('/', '', $filterfull), $strfiltername, 'moodle/site:config', !in_array($filterfull, $activefilters));
137 if ($ADMIN->fulltree) {
138 include("$CFG->dirroot/$filterfull/filtersettings.php");
139 }
140 $ADMIN->add('filtersettings', $settings);
141
142 } else if (file_exists("$CFG->dirroot/$filterfull/filterconfig.html")) {
143 $ADMIN->add('filtersettings', new admin_externalpage('filtersetting'.str_replace('/', '', $filterfull), $strfiltername, "$CFG->wwwroot/$CFG->admin/filter.php?filter=$filterfull", !in_array($filterfull, $activefilters)));
144 }
145 }
146 }
67a87e7d 147
148 $catname =get_string('portfolios', 'portfolio');
149 $manage = get_string('manageportfolios', 'portfolio');
150 $url = "$CFG->wwwroot/$CFG->admin/portfolio.php";
151
152 $ADMIN->add('modules', new admin_category('portfoliosettings', $catname));
153
154 $ADMIN->add(
155 'portfoliosettings',
156 new admin_externalpage('portfoliosettingsall', $manage, $url),
157 $manage,
158 $url
159 );
160 require_once($CFG->libdir. '/portfoliolib.php');
161 foreach (portfolio_instances() as $portfolio) {
162 require_once($CFG->dirroot . '/portfolio/type/' . $portfolio->get('plugin') . '/lib.php');
163 $classname = 'portfolio_plugin_' . $portfolio->get('plugin');
164 if (call_user_func(array($classname, 'has_admin_config'))) {
165 $ADMIN->add(
166 'portfoliosettings',
167 new admin_externalpage('portfoliosettings' . $portfolio->get('id'), get_string('configure', 'portfolio') . ' ' . $portfolio->get('name'), $url . '?edit=' . $portfolio->get('id')),
168 $portfolio->get('name'),
169 $url . ' ?edit=' . $portfolio->get('id')
170 );
171 }
172 }
220a90c5 173}
174?>