source: moodle/trunk/fuentes/admin/tool/messageinbound/settings.php @ 136

Last change on this file since 136 was 136, checked in by mabarracus, 4 years ago

Ported code to xenial

File size: 4.6 KB
Line 
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.
13//
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/>.
16
17/**
18 * Inbound Message Settings.
19 *
20 * @package    tool_messageinbound
21 * @copyright  2014 Andrew Nicols
22 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23 */
24
25defined('MOODLE_INTERNAL') || die;
26
27if ($hassiteconfig) {
28    $category = new admin_category('messageinbound', new lang_string('incomingmailconfiguration', 'tool_messageinbound'));
29
30    // Create a settings page for all of the mail server settings.
31    $settings = new admin_settingpage('messageinbound_mailsettings', new lang_string('mailsettings', 'tool_messageinbound'));
32
33    $settings->add(new admin_setting_heading('messageinbound_generalconfiguration',
34            new lang_string('messageinboundgeneralconfiguration', 'tool_messageinbound'),
35            new lang_string('messageinboundgeneralconfiguration_desc', 'tool_messageinbound'), ''));
36    $settings->add(new admin_setting_configcheckbox('messageinbound_enabled',
37            new lang_string('messageinboundenabled', 'tool_messageinbound'),
38            new lang_string('messageinboundenabled_desc', 'tool_messageinbound'), 0));
39
40    // These settings are used when generating a Inbound Message address.
41    $settings->add(new admin_setting_heading('messageinbound_mailboxconfiguration',
42            new lang_string('mailboxconfiguration', 'tool_messageinbound'),
43            new lang_string('messageinboundmailboxconfiguration_desc', 'tool_messageinbound'), ''));
44    $settings->add(new admin_setting_configtext('messageinbound_mailbox',
45            new lang_string('mailbox', 'tool_messageinbound'),
46            null, '', PARAM_RAW));
47    $settings->add(new admin_setting_configtext('messageinbound_domain',
48            new lang_string('domain', 'tool_messageinbound'),
49            null, '', PARAM_RAW));
50
51    // These settings are used when checking the incoming mailbox for mail.
52    $settings->add(new admin_setting_heading('messageinbound_serversettings',
53            new lang_string('incomingmailserversettings', 'tool_messageinbound'),
54            new lang_string('incomingmailserversettings_desc', 'tool_messageinbound'), ''));
55    $settings->add(new admin_setting_configtext('messageinbound_host',
56            new lang_string('messageinboundhost', 'tool_messageinbound'),
57            new lang_string('configmessageinboundhost', 'tool_messageinbound'), '', PARAM_RAW));
58
59    $options = array(
60        ''          => get_string('noencryption',   'tool_messageinbound'),
61        'ssl'       => get_string('ssl',            'tool_messageinbound'),
62        'sslv2'     => get_string('sslv2',          'tool_messageinbound'),
63        'sslv3'     => get_string('sslv3',          'tool_messageinbound'),
64        'tls'       => get_string('tls',            'tool_messageinbound'),
65        'tlsv1'     => get_string('tlsv1',          'tool_messageinbound'),
66    );
67    $settings->add(new admin_setting_configselect('messageinbound_hostssl',
68            new lang_string('messageinboundhostssl', 'tool_messageinbound'),
69            new lang_string('messageinboundhostssl_desc', 'tool_messageinbound'), 'ssl', $options));
70
71    $settings->add(new admin_setting_configtext('messageinbound_hostuser',
72            new lang_string('messageinboundhostuser', 'tool_messageinbound'),
73            new lang_string('messageinboundhostuser_desc', 'tool_messageinbound'), '', PARAM_NOTAGS));
74    $settings->add(new admin_setting_configpasswordunmask('messageinbound_hostpass',
75            new lang_string('messageinboundhostpass', 'tool_messageinbound'),
76            new lang_string('messageinboundhostpass_desc', 'tool_messageinbound'), ''));
77
78    $category->add('messageinbound', $settings);
79
80    // Link to the external page for Inbound Message handler configuration.
81    $category->add('messageinbound', new admin_externalpage('messageinbound_handlers',
82            new lang_string('message_handlers', 'tool_messageinbound'),
83            "$CFG->wwwroot/$CFG->admin/tool/messageinbound/index.php"));
84
85    // Add the category to the admin tree.
86    $ADMIN->add('server', $category);
87}
Note: See TracBrowser for help on using the repository browser.