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 Local welcome plugin
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
 * This plugin sends users a welcome message after logging in
19
 * and notify a moderator a new user has been added
20
 * it has a settings page that allow you to configure the messages
21
 * send.
22
 *
23
 * @package    local
24
 * @subpackage welcome
25
 * @copyright  2017 Bas Brands, basbrands.nl, bas@sonsbeekmedia.nl
26
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
27
 */
28
 
29
defined('MOODLE_INTERNAL') || die;
30
 
31
if ($hassiteconfig) {
32
 
33
    $moderator = get_admin();
34
    $site = get_site();
35
 
36
    $settings = new admin_settingpage('local_welcome', get_string('pluginname', 'local_welcome'));
37
    $ADMIN->add('localplugins', $settings);
38
 
39
    $availablefields = new moodle_url('/local/welcome/index.php');
40
 
41
    $name = 'local_welcome/message_user_enabled';
42
    $title = get_string('message_user_enabled', 'local_welcome');
43
    $description = get_string('message_user_enabled_desc', 'local_welcome', $availablefields->out());
44
    $setting = new admin_setting_configcheckbox($name, $title, $description, 1);
45
    $settings->add($setting);
46
 
47
    $name = 'local_welcome/auth_plugins';
48
    $title = get_string('auth_plugins', 'local_welcome');
49
    $description = get_string('auth_plugins_desc', 'local_welcome');
50
    $auths = get_enabled_auth_plugins();
51
    $authlist = array();
52
    foreach ($auths as $auth) {
53
        $authlist[$auth] = $auth;
54
    }
55
    $setting = new admin_setting_configmulticheckbox($name, $title, $description, 1, $authlist);
56
    $settings->add($setting);
57
 
58
    $name = 'local_welcome/message_user_subject';
59
    $default = get_string('default_user_email_subject', 'local_welcome', $site->fullname);
60
    $title = get_string('message_user_subject', 'local_welcome');
61
    $description = get_string('message_user_subject_desc', 'local_welcome');
62
    $setting = new admin_setting_configtext($name, $title, $description, $default);
63
    $settings->add($setting);
64
 
65
    $default = get_string('default_user_email', 'local_welcome', $site->fullname);
66
    $name = 'local_welcome/message_user';
67
    $title = get_string('message_user', 'local_welcome');
68
    $description = get_string('message_user_desc', 'local_welcome');
69
    $setting = new admin_setting_confightmleditor($name, $title, $description, $default);
70
    $settings->add($setting);
71
 
72
    $name = 'local_welcome/message_moderator_enabled';
73
    $title = get_string('message_moderator_enabled', 'local_welcome');
74
    $description = get_string('message_moderator_enabled_desc', 'local_welcome');
75
    $setting = new admin_setting_configcheckbox($name, $title, $description, 1);
76
    $settings->add($setting);
77
 
78
    $default = get_string('default_moderator_email_subject', 'local_welcome', $site->fullname);
79
    $name = 'local_welcome/message_moderator_subject';
80
    $title = get_string('message_moderator_subject', 'local_welcome');
81
    $description = get_string('message_moderator_subject_desc', 'local_welcome');
82
    $setting = new admin_setting_configtext($name, $title, $description, $default);
83
    $settings->add($setting);
84
 
85
    $default = get_string('default_moderator_email', 'local_welcome', $site->fullname);
86
    $name = 'local_welcome/message_moderator';
87
    $title = get_string('message_moderator', 'local_welcome');
88
    $description = get_string('message_moderator_desc', 'local_welcome');
89
    $setting = new admin_setting_confightmleditor($name, $title, $description, $default);
90
    $settings->add($setting);
91
 
92
    $name = 'local_welcome/moderator_email';
93
    $title = get_string('moderator_email', 'local_welcome');
94
    $description = get_string('moderator_email_desc', 'local_welcome');
95
    $setting = new admin_setting_configtext($name, $title, $description, $moderator->email);
96
    $settings->add($setting);
97
 
98
    $name = 'local_welcome/sender_email';
99
    $title = get_string('sender_email', 'local_welcome');
100
    $description = get_string('sender_email_desc', 'local_welcome');
101
    $setting = new admin_setting_configtext($name, $title, $description, $moderator->email);
102
    $settings->add($setting);
103
 
104
    $name = 'local_welcome/sender_firstname';
105
    $title = get_string('sender_firstname', 'local_welcome');
106
    $description = get_string('sender_firstname_desc', 'local_welcome');
107
    $setting = new admin_setting_configtext($name, $title, $description, $moderator->firstname);
108
    $settings->add($setting);
109
 
110
    $name = 'local_welcome/sender_lastname';
111
    $title = get_string('sender_lastname', 'local_welcome');
112
    $description = get_string('sender_lastname_desc', 'local_welcome');
113
    $setting = new admin_setting_configtext($name, $title, $description, $moderator->lastname);
114
    $settings->add($setting);
115
}
116