2 // This file is part of Moodle - http://moodle.org/
4 // Moodle is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
9 // Moodle is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
18 * Form to edit a users forum preferences.
20 * These are stored as columns in the user table, which
21 * is why they are in /user and not /mod/forum.
23 * @copyright 1999 Martin Dougiamas http://dougiamas.com
24 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
28 if (!defined('MOODLE_INTERNAL')) {
29 die('Direct access to this script is forbidden.'); // It must be included from a Moodle page.
32 require_once($CFG->dirroot
.'/lib/formslib.php');
35 * Class user_edit_forum_form.
37 * @copyright 1999 Martin Dougiamas http://dougiamas.com
38 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
40 class user_edit_forum_form
extends moodleform
{
45 public function definition () {
48 $mform = $this->_form
;
51 $choices['0'] = get_string('emaildigestoff');
52 $choices['1'] = get_string('emaildigestcomplete');
53 $choices['2'] = get_string('emaildigestsubjects');
54 $mform->addElement('select', 'maildigest', get_string('emaildigest'), $choices);
55 $mform->setDefault('maildigest', core_user
::get_property_default('maildigest'));
56 $mform->addHelpButton('maildigest', 'emaildigest');
59 $choices['1'] = get_string('autosubscribeyes');
60 $choices['0'] = get_string('autosubscribeno');
61 $mform->addElement('select', 'autosubscribe', get_string('autosubscribe'), $choices);
62 $mform->setDefault('autosubscribe', core_user
::get_property_default('autosubscribe'));
65 $choices['1'] = get_string('yes');
66 $choices['0'] = get_string('no');
67 $mform->addElement('select', 'useexperimentalui', get_string('useexperimentalui', 'mod_forum'), $choices);
68 $mform->setDefault('useexperimentalui', '0');
70 if (!empty($CFG->forum_trackreadposts
)) {
71 $mform->addElement('header', 'trackreadposts', get_string('trackreadposts_header', 'mod_forum'));
73 $choices['0'] = get_string('trackforumsno');
74 $choices['1'] = get_string('trackforumsyes');
75 $mform->addElement('select', 'trackforums', get_string('trackforums'), $choices);
76 $mform->setDefault('trackforums', core_user
::get_property_default('trackforums'));
79 1 => get_string('markasreadonnotificationyes', 'mod_forum'),
80 0 => get_string('markasreadonnotificationno', 'mod_forum'),
82 $mform->addElement('select', 'markasreadonnotification', get_string('markasreadonnotification', 'mod_forum'), $choices);
83 $mform->addHelpButton('markasreadonnotification', 'markasreadonnotification', 'mod_forum');
84 $mform->disabledIf('markasreadonnotification', 'trackforums', 'eq', "0");
85 $mform->setDefault('markasreadonnotification', 1);
88 // Add some extra hidden fields.
89 $mform->addElement('hidden', 'id');
90 $mform->setType('id', PARAM_INT
);
91 $mform->addElement('hidden', 'course', $COURSE->id
);
92 $mform->setType('course', PARAM_INT
);
94 $this->add_action_buttons(true, get_string('savechanges'));