Proyectos de Subversion Moodle

Rev

Rev 1 | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 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
 * Settings
19
 *
20
 * @package     tool_mfa
21
 * @author      Mikhail Golenkov <golenkovm@gmail.com>
22
 * @copyright   Catalyst IT
23
 * @license     http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
24
 */
25
 
26
defined('MOODLE_INTERNAL') || die();
27
 
28
if ($hassiteconfig) {
29
    $ADMIN->add('tools', new admin_category('toolmfafolder', new lang_string('pluginname', 'tool_mfa'), false));
30
    $ADMIN->add('toolmfafolder', new admin_externalpage('tool_mfa_resetfactor',
31
    get_string('resetfactor', 'tool_mfa'),
32
    new moodle_url('/admin/tool/mfa/reset_factor.php')));
33
 
34
    $settings = new admin_settingpage('managemfa', new lang_string('mfasettings', 'tool_mfa'));
1441 ariadna 35
    $settings->add(new \core_admin\admin\admin_setting_plugin_manager(
36
        plugintype: 'factor',
37
        tableclass: \tool_mfa\table\admin_setting_managemfa::class,
38
        name: 'managemfatable',
39
        visiblename: new lang_string('manageaiproviders', 'core_ai'),
40
    ));
1 efrain 41
 
42
    $heading = new lang_string('settings:general', 'tool_mfa');
43
    $settings->add(new admin_setting_heading('tool_mfa/settings', $heading, ''));
44
 
45
    $name = new lang_string('settings:enabled', 'tool_mfa');
46
    $settings->add(new admin_setting_configcheckbox('tool_mfa/enabled', $name, '', false));
47
 
48
    $name = new lang_string('settings:lockout', 'tool_mfa');
49
    $description = new lang_string('settings:lockout_help', 'tool_mfa');
50
    $settings->add(new admin_setting_configtext('tool_mfa/lockout', $name, $description, 10, PARAM_INT));
51
 
52
    $name = new lang_string('settings:debugmode', 'tool_mfa');
53
    $description = new lang_string('settings:debugmode_help', 'tool_mfa');
54
    $settings->add(new admin_setting_configcheckbox('tool_mfa/debugmode', $name, $description, false));
55
 
56
    $name = new lang_string('settings:redir_exclusions', 'tool_mfa');
57
    $description = new lang_string('settings:redir_exclusions_help', 'tool_mfa');
58
    $settings->add(new admin_setting_configtextarea('tool_mfa/redir_exclusions', $name, $description, ''));
59
 
60
    $name = new lang_string('settings:guidancecheck', 'tool_mfa');
61
    $description = new lang_string('settings:guidancecheck_help', 'tool_mfa');
62
    $settings->add(new admin_setting_configcheckbox('tool_mfa/guidance', $name, $description, false));
63
 
64
    $name = new lang_string('settings:guidancepage', 'tool_mfa');
65
    $description = new lang_string('settings:guidancepage_help', 'tool_mfa');
66
    $settings->add(new admin_setting_confightmleditor('tool_mfa/guidancecontent', $name, $description, '', PARAM_RAW));
67
 
68
    $name = new lang_string('settings:guidancefiles', 'tool_mfa');
69
    $description = new lang_string('settings:guidancefiles_help', 'tool_mfa');
70
    $settings->add(new admin_setting_configstoredfile('tool_mfa/guidancefiles', $name, $description, 'guidance', 0, [
71
        'maxfiles' => -1,
72
            ]));
73
 
74
    $ADMIN->add('toolmfafolder', $settings);
75
 
76
    foreach (core_plugin_manager::instance()->get_plugins_of_type('factor') as $plugin) {
77
        $plugin->load_settings($ADMIN, 'toolmfafolder', $hassiteconfig);
78
    }
79
 
80
    $ADMIN->add('reports', new admin_category('toolmfareports', get_string('mfareports', 'tool_mfa')));
81
 
82
    $ADMIN->add('toolmfareports',
83
            new admin_externalpage('factorreport', get_string('factorreport', 'tool_mfa'),
84
            new moodle_url('/admin/tool/mfa/factor_report.php')));
85
}