Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1441 ariadna 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
 * Manage penalty plugins
19
 *
20
 * @package   core_grades
21
 * @copyright 2024 Catalyst IT Australia Pty Ltd
22
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23
 */
24
 
25
use core_grades\table\gradepenalty_management_table;
26
use core\notification;
27
use core\url;
28
 
29
require_once('../../config.php');
30
require_once('../../course/lib.php');
31
require_once("$CFG->libdir/adminlib.php");
32
require_once("$CFG->libdir/tablelib.php");
33
 
34
admin_externalpage_setup('managepenaltyplugins');
35
 
36
$plugin = optional_param('plugin', '', PARAM_PLUGIN);
37
$action = optional_param('action', '', PARAM_ALPHA);
38
 
39
// If Javascript is disabled, we need to handle the form submission.
40
if (!empty($action) && !empty($plugin) && confirm_sesskey()) {
41
    $manager = core_plugin_manager::resolve_plugininfo_class('gradepenalty');
42
    $pluginname = get_string('pluginname', 'gradepenalty_' . $plugin);
43
 
44
    if ($action === 'disable' && $manager::enable_plugin($plugin, 0)) {
45
        notification::add(
46
            get_string('plugin_disabled', 'core_admin', $pluginname),
47
            notification::SUCCESS
48
        );
49
        admin_get_root(true, false);
50
    } else if ($action === 'enable' && $manager::enable_plugin($plugin, 1)) {
51
        notification::add(
52
            get_string('plugin_enabled', 'core_admin', $pluginname),
53
            notification::SUCCESS
54
        );
55
 
56
        admin_get_root(true, false);
57
    }
58
 
59
    // Redirect back to the settings page.
60
    redirect(new url('/grade/penalty/manage_penalty_plugins.php'));
61
}
62
 
63
echo $OUTPUT->header();
64
echo $OUTPUT->heading(get_string("gradepenalty", 'core_grades'));
65
$table = new gradepenalty_management_table();
66
$table->out();
67
echo $OUTPUT->footer();