Merge branch 'MDL-75909-311' of https://github.com/andrewnicols/moodle into MOODLE_31...
[moodle.git] / admin / settings / messaging.php
blob2221e72a5ae319a2a7d64037f36b00c566473820
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', new lang_string('messagingssettings', 'admin'));
28 $temp->add(new admin_setting_configcheckbox('messaging',
29 new lang_string('messaging', 'admin'),
30 new lang_string('configmessaging', 'admin'),
31 1));
32 $temp->add(new admin_setting_configcheckbox('messagingallusers',
33 new lang_string('messagingallusers', 'admin'),
34 new lang_string('configmessagingallusers', 'admin'),
37 $temp->add(new admin_setting_configcheckbox('messagingdefaultpressenter',
38 new lang_string('messagingdefaultpressenter', 'admin'),
39 new lang_string('configmessagingdefaultpressenter', 'admin'),
42 $options = array(
43 DAYSECS => new lang_string('secondstotime86400'),
44 WEEKSECS => new lang_string('secondstotime604800'),
45 2620800 => new lang_string('nummonths', 'moodle', 1),
46 7862400 => new lang_string('nummonths', 'moodle', 3),
47 15724800 => new lang_string('nummonths', 'moodle', 6),
48 0 => new lang_string('never')
50 $temp->add(new admin_setting_configselect(
51 'messagingdeletereadnotificationsdelay',
52 new lang_string('messagingdeletereadnotificationsdelay', 'admin'),
53 new lang_string('configmessagingdeletereadnotificationsdelay', 'admin'),
54 604800,
55 $options)
57 $temp->add(new admin_setting_configselect(
58 'messagingdeleteallnotificationsdelay',
59 new lang_string('messagingdeleteallnotificationsdelay', 'admin'),
60 new lang_string('configmessagingdeleteallnotificationsdelay', 'admin'),
61 2620800,
62 $options)
64 $temp->add(new admin_setting_configcheckbox('messagingallowemailoverride',
65 new lang_string('messagingallowemailoverride', 'admin'),
66 new lang_string('configmessagingallowemailoverride', 'admin'),
67 0));
68 $ADMIN->add('messaging', $temp);
69 $ADMIN->add('messaging', new admin_page_managemessageoutputs());
71 // Notification outputs plugins.
72 $plugins = core_plugin_manager::instance()->get_plugins_of_type('message');
73 core_collator::asort_objects_by_property($plugins, 'displayname');
74 foreach ($plugins as $plugin) {
75 /** @var \core\plugininfo\message $plugin */
76 $plugin->load_settings($ADMIN, 'messaging', $hassiteconfig);