weekly release 3.4dev
[moodle.git] / mod / forum / settings.php
CommitLineData
1adbd2c3 1<?php
220a90c5 2
8f685009
SH
3// This file is part of Moodle - http://moodle.org/
4//
5// Moodle is free software: you can redistribute it and/or modify
6// it under the terms of the GNU General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// Moodle is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
17
18/**
01030f1b 19 * @package mod_forum
8f685009
SH
20 * @copyright 2009 Petr Skoda (http://skodak.org)
21 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
22 */
23
dbf9e4ba 24defined('MOODLE_INTERNAL') || die;
220a90c5 25
dbf9e4ba
PS
26if ($ADMIN->fulltree) {
27 require_once($CFG->dirroot.'/mod/forum/lib.php');
220a90c5 28
dbf9e4ba
PS
29 $settings->add(new admin_setting_configselect('forum_displaymode', get_string('displaymode', 'forum'),
30 get_string('configdisplaymode', 'forum'), FORUM_MODE_NESTED, forum_get_layout_modes()));
220a90c5 31
dbf9e4ba
PS
32 // Less non-HTML characters than this is short
33 $settings->add(new admin_setting_configtext('forum_shortpost', get_string('shortpost', 'forum'),
34 get_string('configshortpost', 'forum'), 300, PARAM_INT));
220a90c5 35
dbf9e4ba
PS
36 // More non-HTML characters than this is long
37 $settings->add(new admin_setting_configtext('forum_longpost', get_string('longpost', 'forum'),
38 get_string('configlongpost', 'forum'), 600, PARAM_INT));
220a90c5 39
dbf9e4ba
PS
40 // Number of discussions on a page
41 $settings->add(new admin_setting_configtext('forum_manydiscussions', get_string('manydiscussions', 'forum'),
42 get_string('configmanydiscussions', 'forum'), 100, PARAM_INT));
220a90c5 43
dbf9e4ba 44 if (isset($CFG->maxbytes)) {
c9c01f75
DW
45 $maxbytes = 0;
46 if (isset($CFG->forum_maxbytes)) {
47 $maxbytes = $CFG->forum_maxbytes;
48 }
dbf9e4ba 49 $settings->add(new admin_setting_configselect('forum_maxbytes', get_string('maxattachmentsize', 'forum'),
c9c01f75 50 get_string('configmaxbytes', 'forum'), 512000, get_max_upload_sizes($CFG->maxbytes, 0, 0, $maxbytes)));
dbf9e4ba 51 }
30a9aff5 52
dbf9e4ba
PS
53 // Default number of attachments allowed per post in all forums
54 $settings->add(new admin_setting_configtext('forum_maxattachments', get_string('maxattachments', 'forum'),
3db7b878 55 get_string('configmaxattachments', 'forum'), 9, PARAM_INT));
220a90c5 56
8b73bac6
EM
57 // Default Read Tracking setting.
58 $options = array();
59 $options[FORUM_TRACKING_OPTIONAL] = get_string('trackingoptional', 'forum');
60 $options[FORUM_TRACKING_OFF] = get_string('trackingoff', 'forum');
bd8f5d45 61 $options[FORUM_TRACKING_FORCED] = get_string('trackingon', 'forum');
8b73bac6
EM
62 $settings->add(new admin_setting_configselect('forum_trackingtype', get_string('trackingtype', 'forum'),
63 get_string('configtrackingtype', 'forum'), FORUM_TRACKING_OPTIONAL, $options));
64
dbf9e4ba
PS
65 // Default whether user needs to mark a post as read
66 $settings->add(new admin_setting_configcheckbox('forum_trackreadposts', get_string('trackforum', 'forum'),
67 get_string('configtrackreadposts', 'forum'), 1));
220a90c5 68
20e6782f
EM
69 // Default whether user needs to mark a post as read.
70 $settings->add(new admin_setting_configcheckbox('forum_allowforcedreadtracking', get_string('forcedreadtracking', 'forum'),
71 get_string('forcedreadtracking_desc', 'forum'), 0));
72
dbf9e4ba
PS
73 // Default number of days that a post is considered old
74 $settings->add(new admin_setting_configtext('forum_oldpostdays', get_string('oldpostdays', 'forum'),
75 get_string('configoldpostdays', 'forum'), 14, PARAM_INT));
220a90c5 76
dbf9e4ba
PS
77 // Default whether user needs to mark a post as read
78 $settings->add(new admin_setting_configcheckbox('forum_usermarksread', get_string('usermarksread', 'forum'),
79 get_string('configusermarksread', 'forum'), 0));
220a90c5 80
dbf9e4ba 81 $options = array();
e710658d
RK
82 for ($i = 0; $i < 24; $i++) {
83 $options[$i] = sprintf("%02d",$i);
dbf9e4ba 84 }
e710658d 85 // Default time (hour) to execute 'clean_read_records' cron
dbf9e4ba
PS
86 $settings->add(new admin_setting_configselect('forum_cleanreadtime', get_string('cleanreadtime', 'forum'),
87 get_string('configcleanreadtime', 'forum'), 2, $options));
220a90c5 88
e710658d
RK
89 // Default time (hour) to send digest email
90 $settings->add(new admin_setting_configselect('digestmailtime', get_string('digestmailtime', 'forum'),
91 get_string('configdigestmailtime', 'forum'), 17, $options));
220a90c5 92
dbf9e4ba
PS
93 if (empty($CFG->enablerssfeeds)) {
94 $options = array(0 => get_string('rssglobaldisabled', 'admin'));
95 $str = get_string('configenablerssfeeds', 'forum').'<br />'.get_string('configenablerssfeedsdisabled2', 'admin');
220a90c5 96
dbf9e4ba
PS
97 } else {
98 $options = array(0=>get_string('no'), 1=>get_string('yes'));
99 $str = get_string('configenablerssfeeds', 'forum');
100 }
101 $settings->add(new admin_setting_configselect('forum_enablerssfeeds', get_string('enablerssfeeds', 'admin'),
102 $str, 0, $options));
220a90c5 103
c9f2d347
RL
104 if (!empty($CFG->enablerssfeeds)) {
105 $options = array(
106 0 => get_string('none'),
107 1 => get_string('discussions', 'forum'),
108 2 => get_string('posts', 'forum')
109 );
110 $settings->add(new admin_setting_configselect('forum_rsstype', get_string('rsstypedefault', 'forum'),
111 get_string('configrsstypedefault', 'forum'), 0, $options));
112
113 $options = array(
114 0 => '0',
115 1 => '1',
116 2 => '2',
117 3 => '3',
118 4 => '4',
119 5 => '5',
120 10 => '10',
121 15 => '15',
122 20 => '20',
123 25 => '25',
124 30 => '30',
125 40 => '40',
126 50 => '50'
127 );
128 $settings->add(new admin_setting_configselect('forum_rssarticles', get_string('rssarticles', 'forum'),
129 get_string('configrssarticlesdefault', 'forum'), 0, $options));
130 }
131
dbf9e4ba 132 $settings->add(new admin_setting_configcheckbox('forum_enabletimedposts', get_string('timedposts', 'forum'),
c71d1856 133 get_string('configenabletimedposts', 'forum'), 1));
dbf9e4ba 134}
1adbd2c3 135