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 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
namespace qbank_columnsortorder\event;
18
 
19
use core\event\qbank_plugin_disabled;
20
use core\event\qbank_plugin_enabled;
21
use qbank_columnsortorder\column_manager;
22
 
23
/**
24
 * Observer for qbank plugin enabled/disabled events
25
 *
26
 * @package   qbank_columnsortorder
27
 * @copyright 2023 onwards Catalyst IT EU {@link https://catalyst-eu.net}
28
 * @author    Mark Johnson <mark.johnson@catalyst-eu.net>
29
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
30
 */
31
class plugin_observer {
32
 
33
    /**
34
     * When a plugin is enabled, enable its columns.
35
     *
36
     * @param qbank_plugin_enabled $event
37
     * @return void
38
     */
39
    public static function plugin_enabled(qbank_plugin_enabled $event): void {
40
        (new column_manager())->enable_columns($event->other['pluginname']);
41
    }
42
 
43
    /**
44
     * When a plugin is disabled, disable its columns.
45
     *
46
     * @param qbank_plugin_disabled $event
47
     * @return void
48
     */
49
    public static function plugin_disabled(qbank_plugin_disabled $event): void {
50
        (new column_manager())->disable_columns($event->other['pluginname']);
51
    }
52
}