Merge branch 'MDL-79920-main' of https://github.com/davewoloszyn/moodle
[moodle.git] / admin / settings / messaging.php
blob50686e5a5cfa6daeb2d6993b7838f8fa5f7d2ac5
1 <?php
2 // This file is part of Moodle - http://moodle.org/
3 //
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.
8 //
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/>.
17 /**
18 * Adds messaging related settings links for Messaging category to admin tree.
20 * @copyright 2019 Amaia Anabitarte <amaia@moodle.com>
21 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
24 defined('MOODLE_INTERNAL') || die();
26 if ($hassiteconfig) {
27 $temp = new admin_settingpage('messages',
28 new lang_string('messagingssettings', 'admin'),
29 'moodle/site:config',
30 empty($CFG->messaging)
33 $temp->add(new admin_setting_configcheckbox('messagingallusers',
34 new lang_string('messagingallusers', 'admin'),
35 new lang_string('configmessagingallusers', 'admin'),
38 $temp->add(new admin_setting_configcheckbox('messagingdefaultpressenter',
39 new lang_string('messagingdefaultpressenter', 'admin'),
40 new lang_string('configmessagingdefaultpressenter', 'admin'),
43 $options = array(
44 DAYSECS => new lang_string('secondstotime86400'),
45 WEEKSECS => new lang_string('secondstotime604800'),
46 2620800 => new lang_string('nummonths', 'moodle', 1),
47 7862400 => new lang_string('nummonths', 'moodle', 3),
48 15724800 => new lang_string('nummonths', 'moodle', 6),
49 0 => new lang_string('never')
51 $temp->add(new admin_setting_configselect(
52 'messagingdeletereadnotificationsdelay',
53 new lang_string('messagingdeletereadnotificationsdelay', 'admin'),
54 new lang_string('configmessagingdeletereadnotificationsdelay', 'admin'),
55 604800,
56 $options)
58 $temp->add(new admin_setting_configselect(
59 'messagingdeleteallnotificationsdelay',
60 new lang_string('messagingdeleteallnotificationsdelay', 'admin'),
61 new lang_string('configmessagingdeleteallnotificationsdelay', 'admin'),
62 2620800,
63 $options)
65 $temp->add(new admin_setting_configcheckbox('messagingallowemailoverride',
66 new lang_string('messagingallowemailoverride', 'admin'),
67 new lang_string('configmessagingallowemailoverride', 'admin'),
68 0));
69 $ADMIN->add('messaging', $temp);
70 $ADMIN->add('messaging', new admin_page_managemessageoutputs());
72 // Notification outputs plugins.
73 $plugins = core_plugin_manager::instance()->get_plugins_of_type('message');
74 core_collator::asort_objects_by_property($plugins, 'displayname');
75 foreach ($plugins as $plugin) {
76 /** @var \core\plugininfo\message $plugin */
77 $plugin->load_settings($ADMIN, 'messaging', $hassiteconfig);