Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
<?php
2
// This file is part of the Contact Form plugin for Moodle - https://moodle.org/
3
//
4
// Contact Form 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
// Contact Form 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 Contact Form.  If not, see <https://www.gnu.org/licenses/>.
16
 
17
/**
18
 * This plugin for Moodle is used to send emails through a web form.
19
 *
20
 * @package    local_contact
21
 * @copyright  2016-2024 TNG Consulting Inc. - www.tngconsulting.ca
22
 * @author     Michael Milette
23
 * @license    https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
24
 */
25
 
26
defined('MOODLE_INTERNAL') || die;
27
 
28
if ($hassiteconfig) {
29
    // Heading.
30
    $settings = new admin_settingpage('local_contact', get_string('pluginname', 'local_contact'));
31
    $ADMIN->add('localplugins', $settings);
32
 
33
    // Custom sender (from) email address.
34
    $default = '';
35
    $name = 'local_contact/senderaddress';
36
    $title = get_string('senderaddress', 'local_contact');
37
    $description = get_string('senderaddress_description', 'local_contact');
38
    $setting = new admin_setting_configtext($name, $title, $description, $default, PARAM_RAW);
39
    $setting->set_updatedcallback('theme_reset_all_caches');
40
    $settings->add($setting);
41
 
42
    // List of tags and recipient email addresses.
43
    $default = '';
44
    $name = 'local_contact/recipient_list';
45
    $title = get_string('recipient_list', 'local_contact');
46
    $description = get_string('recipient_list_description', 'local_contact');
47
    $setting = new admin_setting_configtextarea($name, $title, $description, $default);
48
    $settings->add($setting);
49
 
50
    // Don't use reply-to.
51
    $default = 0;
52
    $name = 'local_contact/noreplyto';
53
    $title = get_string('noreplyto', 'local_contact');
54
    $description = get_string('noreplyto_description', 'local_contact');
55
    $setting = new admin_setting_configcheckbox($name, $title, $description, $default);
56
    $settings->add($setting);
57
 
58
    // Require the user to be logged-in in order to send the form.
59
    $default = 0;
60
    $name = 'local_contact/loginrequired';
61
    $title = get_string('loginrequired', 'local_contact');
62
    $description = get_string('loginrequired_description', 'local_contact');
63
    $setting = new admin_setting_configcheckbox($name, $title, $description, $default);
64
    $settings->add($setting);
65
 
66
    // Do not include site name in email subject line.
67
    $default = 0;
68
    $name = 'local_contact/nosubjectsitename';
69
    $title = get_string('nosubjectsitename', 'local_contact');
70
    $description = get_string('nosubjectsitename_description', 'local_contact');
71
    $setting = new admin_setting_configcheckbox($name, $title, $description, $default);
72
    $settings->add($setting);
73
 
74
    // Enable a file attachment.
75
    $default = 0;
76
    $name = 'local_contact/attachment';
77
    $title = get_string('attachment', 'local_contact');
78
    $description = get_string('attachment_description', 'local_contact');
79
    $setting = new admin_setting_configcheckbox($name, $title, $description, $default);
80
    $settings->add($setting);
81
 
82
    // Override and disable ReCAPTCHA, if the private and public keys are setup in Moodle.
83
    if (!empty($CFG->recaptchaprivatekey) && !empty($CFG->recaptchapublickey)) {
84
        // Information on using recaptcha with Contact Form.
85
        $name = 'local_contact/recapchainfo';
86
        $title = get_string('recapchainfo', 'local_contact');
87
        if (empty(get_config('local_contact', 'norecaptcha'))) {
88
            $description = get_string('recapchainfo_description', 'local_contact');
89
        } else {
90
            $description = '';
91
        }
92
        $setting = new admin_setting_heading($name, $title, $description);
93
        $settings->add($setting);
94
 
95
        // Disable Recapcha - if configured.
96
        $name = 'local_contact/norecaptcha';
97
        $title = get_string('norecaptcha', 'local_contact');
98
        $description = get_string('norecaptcha_description', 'local_contact');
99
        $setting = new admin_setting_configcheckbox($name, $title, $description, 0);
100
        $settings->add($setting);
101
    }
102
}