-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathsettings.php
152 lines (129 loc) · 6.45 KB
/
settings.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Administration settings form.
* @package mod
* @subpackage forumng
* @copyright 2011 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$plugin = new stdClass();
require_once($CFG->dirroot . '/mod/forumng/settingslib.php');
require_once($CFG->dirroot.'/mod/forumng/version.php');
require_once($CFG->dirroot.'/mod/forumng/mod_forumng_utils.php');
if (!empty($plugin->release)) {
$settings->add(new admin_setting_heading('forumng_version', '',
get_string('displayversion', 'forumng', $plugin->release)));
}
$settings->add(new admin_setting_configcheckbox('forumng_replytouser',
get_string('replytouser', 'forumng'),
get_string('configreplytouser', 'forumng'), 1));
$settings->add(new admin_setting_configtext('forumng_usebcc',
get_string('usebcc', 'forumng'),
get_string('configusebcc', 'forumng'), 0, PARAM_INT));
$settings->add(new admin_setting_configtext('forumng_donotmailafter',
get_string('donotmailafter', 'forumng'),
get_string('configdonotmailafter', 'forumng'), 48, PARAM_INT));
// Number of discussions on a page
$settings->add(new admin_setting_configtext('forumng_discussionsperpage',
get_string('discussionsperpage', 'forumng'),
get_string('configdiscussionsperpage', 'forumng'), 20, PARAM_INT));
if (isset($CFG->maxbytes)) {
$sizes = get_max_upload_sizes($CFG->maxbytes);
} else {
$sizes = get_max_upload_sizes(0);
}
unset($sizes[0]);
$sizes[-1] = get_string('forbidattachments', 'forumng');
$settings->add(new admin_setting_configselect('forumng_attachmentmaxbytes',
get_string('attachmentmaxbytes', 'forumng'),
get_string('configattachmentmaxbytes', 'forumng'), 512000, $sizes));
// Option about read tracking
$settings->add(new admin_setting_configcheckbox('forumng_trackreadposts',
get_string('trackreadposts', 'forumng'), get_string('configtrackreadposts', 'forumng'), 1));
// Number of days that a post is considered old and we don't store unread data
$settings->add(new admin_setting_configtext('forumng_readafterdays',
get_string('readafterdays', 'forumng'),
get_string('configreadafterdays', 'forumng'), 60, PARAM_INT));
// RSS feeds
if (empty($CFG->enablerssfeeds)) {
$options = array(0 => get_string('rssglobaldisabled', 'admin'));
$str = get_string('configenablerssfeeds', 'forumng').'<br />'.
get_string('configenablerssfeedsdisabled2', 'admin');
} else {
$options = array(0=>get_string('no'), 1=>get_string('yes'));
$str = get_string('configenablerssfeeds', 'forumng');
}
$settings->add(new admin_setting_configselect('forumng_enablerssfeeds',
get_string('enablerssfeeds', 'admin'), $str, 0, $options));
$settings->add(new forumng_admin_setting_configselect_subscription('forumng_subscription',
get_string('subscription', 'forumng'),
get_string('configsubscription', 'forumng'), -1, null));
$settings->add(new forumng_admin_setting_configselect_feedtype('forumng_feedtype',
get_string('feedtype', 'forumng'),
get_string('configfeedtype', 'forumng'), -1, null));
$settings->add(new forumng_admin_setting_configselect_feeditems('forumng_feeditems',
get_string('feeditems', 'forumng'),
get_string('configfeeditems', 'forumng'), -1, null));
$options = array(
0=>get_string('permanentdeletion_never', 'forumng'),
1=>get_string('permanentdeletion_soon', 'forumng'),
1*60*60*24=>'1 '.get_string('day'),
14*60*60*24=>'14 '.get_string('days'),
30*60*60*24=>'30 '.get_string('days'),
365*60*60*24=>'1 '.get_string('year'));
$settings->add(new admin_setting_configselect('forumng_permanentdeletion',
get_string('permanentdeletion', 'forumng'),
get_string('configpermanentdeletion', 'forumng'), 30*60*60*24, $options));
// Option about read tracking
$settings->add(new admin_setting_configtext('forumng_reportunacceptable',
get_string('reportunacceptable', 'forumng'),
get_string('configreportunacceptable', 'forumng'), '', PARAM_NOTAGS));
$settings->add(new admin_setting_configcheckbox('forumng_enableadvanced',
get_string('enableadvanced', 'forumng'),
get_string('configenableadvanced', 'forumng'), 0));
$settings->add(new admin_setting_configduration('forumng_emailafter',
get_string('emailafter', 'forumng'),
get_string('configemailafter', 'forumng'), 120));
$settings->add(new admin_setting_configtextarea('forumng_customeditortoolbar',
get_string('customeditortoolbar', 'forumng'),
get_string('configcustomeditortoolbar', 'forumng'), 'style1 = bold, italic
style3 = link,
collapse = collapse,
style4 = underline, strike, subscript, superscript
list = unorderedlist, orderedlist,emoticon
files = image
insert = oumaths, chemistry, charmap, table,fontcolor
html = clear,html',
PARAM_TEXT));
// Maximum time to spend in cron. The default value is set so that it finishes before the 20 minute
// cron cycle.
$settings->add(new admin_setting_configduration('mod_forumng/cronlimit',
get_string('cronlimit', 'forumng'),
get_string('cronlimit_desc', 'forumng'), 18 * 60));
// Manage old discussions after. The default value is 24 months.
$options = mod_forumng_utils::create_remove_options();
$settings->add(new admin_setting_configselect('forumng_removeolddiscussions',
get_string('removeolddiscussionsafter', 'forumng'),
get_string('configremoveolddiscussions', 'forumng'), 0, $options));
$options = mod_forumng_utils::create_action_options();
$settings->add(new admin_setting_configselect('forumng_withremoveddiscussions',
get_string('withremoveddiscussions', 'forumng'),
get_string('configremoveolddiscussions', 'forumng'), 0, $options));
$settings->add(new admin_setting_configcheckbox('mod_forumng/savecheck',
get_string('savecheck', 'forumng'),
get_string('savecheck_desc', 'forumng'), 1));