forked from moodleou/moodle-mod_forumng
/
settings.php
137 lines (117 loc) · 5.77 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
<?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
*/
require_once($CFG->dirroot.'/mod/forumng/mod_forumng.php');
$module = new stdClass;
require($CFG->dirroot.'/mod/forumng/version.php');
$settings->add(new admin_setting_heading('forumng_version', '',
get_string('displayversion', 'forumng', $module->displayversion)));
$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));
$options = mod_forumng::get_subscription_options();
$options[-1]=get_string('perforumoption', 'forumng');
$settings->add(new admin_setting_configselect('forumng_subscription',
get_string('subscription', 'forumng'),
get_string('configsubscription', 'forumng'), -1, $options));
$options = mod_forumng::get_feedtype_options();
$options[-1]=get_string('perforumoption', 'forumng');
$settings->add(new admin_setting_configselect('forumng_feedtype',
get_string('feedtype', 'forumng'),
get_string('configfeedtype', 'forumng'), -1, $options));
$options = mod_forumng::get_feeditems_options();
$options[-1]=get_string('perforumoption', 'forumng');
$settings->add(new admin_setting_configselect('forumng_feeditems',
get_string('feeditems', 'forumng'),
get_string('configfeeditems', 'forumng'), -1, $options));
$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));
//Start hour of deleting or archiving old discussions
$options = array();
for ($i = 0; $i < 24; $i++) {
$options[$i*3600] = $i;
}
$settings->add(new admin_setting_configselect('forumng_housekeepingstarthour',
get_string('housekeepingstarthour', 'forumng'),
get_string('confighousekeepingstarthour', 'forumng'), 0, $options));
$settings->add(new admin_setting_configselect('forumng_housekeepingstophour',
get_string('housekeepingstophour', 'forumng'),
get_string('confighousekeepingstophour', 'forumng'), 5*3600, $options));
// Option about read tracking
$settings->add(new admin_setting_configcheckbox('forumng_showusername',
get_string('showusername', 'forumng'),
get_string('configshowusername', 'forumng'), 0));
$settings->add(new admin_setting_configcheckbox('forumng_showidnumber',
get_string('showidnumber', 'forumng'),
get_string('configshowidnumber', 'forumng'), 0));
$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));