Let the admin choose if a textfield is to be shown as plain text or as a password...
[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());
7 if ($modules = get_records('modules')) {
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;
23 if (file_exists($CFG->dirroot.'/mod/'.$modulename.'/settings.php')) {
24 // do not show disabled modules in tree, keep only settings link on manage page
25 $settings = new admin_settingpage('modsetting'.$modulename, $strmodulename, 'moodle/site:config', !$module->visible);
26 if ($ADMIN->fulltree) {
27 include($CFG->dirroot.'/mod/'.$modulename.'/settings.php');
28 }
29 $ADMIN->add('modsettings', $settings);
30 } else if (file_exists($CFG->dirroot.'/mod/'.$modulename.'/config.html')) {
31 $ADMIN->add('modsettings', new admin_externalpage('modsetting'.$modulename, $strmodulename, "$CFG->wwwroot/$CFG->admin/module.php?module=$modulename", 'moodle/site:config', !$module->visible));
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"));
220a90c5 40 if (!empty($CFG->blocks_version) and $blocks = get_records('block')) {
41 $blockbyname = array();
42
43 foreach ($blocks as $block) {
44 $strblockname = get_string('blockname', 'block_'.$block->name);
45 // Deal with blocks which are lacking the language string
46 if ($strblockname == '[[blockname]]') {
47 $textlib = textlib_get_instance();
48 $strblockname = $textlib->strtotitle($block->name);
49 }
50 $blockbyname[$strblockname] = $block;
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
69 $ADMIN->add('modules', new admin_category('filtersettings', get_string('managefilters')));
70 // "filtersettings" settingpage
71 $temp = new admin_settingpage('managefilters', get_string('filtersettings', 'admin'));
72 if ($ADMIN->fulltree) {
73 $temp->add(new admin_setting_managefilters());
74 $temp->add(new admin_setting_heading('managefilterscommonheading', get_string('commonsettings', 'admin'), ''));
75 $temp->add(new admin_setting_configselect('cachetext', get_string('cachetext', 'admin'), get_string('configcachetext', 'admin'), 60, array(604800 => get_string('numdays','',7),
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),
95 0 => get_string('no'))));
96 $temp->add(new admin_setting_configselect('filteruploadedfiles', get_string('filteruploadedfiles', 'admin'), get_string('configfilteruploadedfiles', 'admin'), 0, array('0' => get_string('none'),
97 '1' => get_string('allfiles'),
98 '2' => get_string('htmlfilesonly'))));
99 $temp->add(new admin_setting_configcheckbox('filtermatchoneperpage', get_string('filtermatchoneperpage', 'admin'), get_string('configfiltermatchoneperpage', 'admin'), 0));
100 $temp->add(new admin_setting_configcheckbox('filtermatchonepertext', get_string('filtermatchonepertext', 'admin'), get_string('configfiltermatchonepertext', 'admin'), 0));
101 $temp->add(new admin_setting_configcheckbox('filterall', get_string('filterall', 'admin'), get_string('configfilterall', 'admin'), 0));
102 }
103 $ADMIN->add('filtersettings', $temp);
104
105 if (empty($CFG->textfilters)) {
106 $activefilters = array();
107 } else {
108 $activefilters = explode(',', $CFG->textfilters);
109 }
110 $filterlocations = array('mod','filter');
111 foreach ($filterlocations as $filterlocation) {
112 $filters = get_list_of_plugins($filterlocation);
113
114 $filterbyname = array();
115
116 foreach ($filters as $filter) {
117 $strfiltername = get_string('filtername', $filter);
118 // Deal with filters which are lacking the language string
119 if ($strfiltername == '[[filtername]]') {
120 $textlib = textlib_get_instance();
121 $strfiltername = $textlib->strtotitle($filter);
122 }
123 $filterbyname[$strfiltername] = "$filterlocation/$filter";
124 }
125 ksort($filterbyname);
126
127 foreach ($filterbyname as $strfiltername=>$filterfull) {
128 if (file_exists("$CFG->dirroot/$filterfull/filtersettings.php")) {
129 $settings = new admin_settingpage('filtersetting'.str_replace('/', '', $filterfull), $strfiltername, 'moodle/site:config', !in_array($filterfull, $activefilters));
130 if ($ADMIN->fulltree) {
131 include("$CFG->dirroot/$filterfull/filtersettings.php");
132 }
133 $ADMIN->add('filtersettings', $settings);
134
135 } else if (file_exists("$CFG->dirroot/$filterfull/filterconfig.html")) {
136 $ADMIN->add('filtersettings', new admin_externalpage('filtersetting'.str_replace('/', '', $filterfull), $strfiltername, "$CFG->wwwroot/$CFG->admin/filter.php?filter=$filterfull", !in_array($filterfull, $activefilters)));
137 }
138 }
139 }
140}
141?>