Automatic installer.php lang files by installer_builder (20071225)
[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) {
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
67 $ADMIN->add('modules', new admin_category('filtersettings', get_string('managefilters')));
68 // "filtersettings" settingpage
69 $temp = new admin_settingpage('managefilters', get_string('filtersettings', 'admin'));
70 if ($ADMIN->fulltree) {
71 $temp->add(new admin_setting_managefilters());
72 $temp->add(new admin_setting_heading('managefilterscommonheading', get_string('commonsettings', 'admin'), ''));
73 $temp->add(new admin_setting_configselect('cachetext', get_string('cachetext', 'admin'), get_string('configcachetext', 'admin'), 60, array(604800 => get_string('numdays','',7),
74 86400 => get_string('numdays','',1),
75 43200 => get_string('numhours','',12),
76 10800 => get_string('numhours','',3),
77 7200 => get_string('numhours','',2),
78 3600 => get_string('numhours','',1),
79 2700 => get_string('numminutes','',45),
80 1800 => get_string('numminutes','',30),
81 900 => get_string('numminutes','',15),
82 600 => get_string('numminutes','',10),
83 540 => get_string('numminutes','',9),
84 480 => get_string('numminutes','',8),
85 420 => get_string('numminutes','',7),
86 360 => get_string('numminutes','',6),
87 300 => get_string('numminutes','',5),
88 240 => get_string('numminutes','',4),
89 180 => get_string('numminutes','',3),
90 120 => get_string('numminutes','',2),
91 60 => get_string('numminutes','',1),
92 30 => get_string('numseconds','',30),
93 0 => get_string('no'))));
94 $temp->add(new admin_setting_configselect('filteruploadedfiles', get_string('filteruploadedfiles', 'admin'), get_string('configfilteruploadedfiles', 'admin'), 0, array('0' => get_string('none'),
95 '1' => get_string('allfiles'),
96 '2' => get_string('htmlfilesonly'))));
97 $temp->add(new admin_setting_configcheckbox('filtermatchoneperpage', get_string('filtermatchoneperpage', 'admin'), get_string('configfiltermatchoneperpage', 'admin'), 0));
98 $temp->add(new admin_setting_configcheckbox('filtermatchonepertext', get_string('filtermatchonepertext', 'admin'), get_string('configfiltermatchonepertext', 'admin'), 0));
99 $temp->add(new admin_setting_configcheckbox('filterall', get_string('filterall', 'admin'), get_string('configfilterall', 'admin'), 0));
100 }
101 $ADMIN->add('filtersettings', $temp);
102
103 if (empty($CFG->textfilters)) {
104 $activefilters = array();
105 } else {
106 $activefilters = explode(',', $CFG->textfilters);
107 }
108 $filterlocations = array('mod','filter');
109 foreach ($filterlocations as $filterlocation) {
110 $filters = get_list_of_plugins($filterlocation);
111
112 $filterbyname = array();
113
114 foreach ($filters as $filter) {
115 $strfiltername = get_string('filtername', $filter);
116 // Deal with filters which are lacking the language string
117 if ($strfiltername == '[[filtername]]') {
118 $textlib = textlib_get_instance();
119 $strfiltername = $textlib->strtotitle($filter);
120 }
121 $filterbyname[$strfiltername] = "$filterlocation/$filter";
122 }
123 ksort($filterbyname);
124
125 foreach ($filterbyname as $strfiltername=>$filterfull) {
126 if (file_exists("$CFG->dirroot/$filterfull/filtersettings.php")) {
127 $settings = new admin_settingpage('filtersetting'.str_replace('/', '', $filterfull), $strfiltername, 'moodle/site:config', !in_array($filterfull, $activefilters));
128 if ($ADMIN->fulltree) {
129 include("$CFG->dirroot/$filterfull/filtersettings.php");
130 }
131 $ADMIN->add('filtersettings', $settings);
132
133 } else if (file_exists("$CFG->dirroot/$filterfull/filterconfig.html")) {
134 $ADMIN->add('filtersettings', new admin_externalpage('filtersetting'.str_replace('/', '', $filterfull), $strfiltername, "$CFG->wwwroot/$CFG->admin/filter.php?filter=$filterfull", !in_array($filterfull, $activefilters)));
135 }
136 }
137 }
138}
139?>