-
Notifications
You must be signed in to change notification settings - Fork 40
Expand file tree
/
Copy pathsubplugins.php
More file actions
105 lines (93 loc) · 4.05 KB
/
subplugins.php
File metadata and controls
105 lines (93 loc) · 4.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Displays the installed subplugins (steps and trigger).
*
* @package tool_lifecycle
* @copyright 2025 Thomas Niedermaier University Münster
* @copyright 2022 Justus Dieckmann WWU
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
use tool_lifecycle\local\manager\lib_manager;
use tool_lifecycle\tabs;
use tool_lifecycle\urls;
require_once(__DIR__ . '/../../../config.php');
require_once($CFG->libdir . '/adminlib.php');
require_once(__DIR__ . '/locallib.php');
require_admin();
$syscontext = context_system::instance();
$PAGE->set_url(new \moodle_url(urls::SUBPLUGINS));
$PAGE->set_context($syscontext);
$PAGE->set_pagetype('admin-setting-' . 'tool_lifecycle');
$PAGE->set_pagelayout('admin');
$renderer = $PAGE->get_renderer('tool_lifecycle');
$heading = get_string('pluginname', 'tool_lifecycle')." / ".get_string('subplugins', 'tool_lifecycle');
echo $renderer->header($heading);
$tabrow = tabs::get_tabrow();
$renderer->tabs($tabrow, 'subplugins');
echo html_writer::link('https://github.com/learnweb/moodle-tool_lifecycle/wiki/List-of-Installed-Subplugins',
get_string('documentationlink', 'tool_lifecycle'), ['target' => '_blank']);
$triggers = core_component::get_plugin_list('lifecycletrigger');
if ($triggers) {
echo html_writer::div(get_string('triggers_installed', 'tool_lifecycle'), 'h2 mt-2');
foreach ($triggers as $trigger => $path) {
$lib = lib_manager::get_trigger_lib($trigger);
$triggericon = $lib->get_icon();
echo $OUTPUT->pix_icon($triggericon, $trigger, 'moodle', ['class' => 'mr-1']);
echo html_writer::div(get_string('pluginname', 'lifecycletrigger_' . $trigger),
"font-weight-bold d-inline-block");
try {
$plugindescription = get_string('plugindescription', 'lifecycletrigger_' . $trigger);
} catch (Exception $e) {
$plugindescription = "";
}
if ($plugindescription) {
echo html_writer::start_div().$plugindescription;
if ($trigger == 'customfieldsemester') {
if (lifecycle_is_plugin_installed('semester', 'customfield') === false) {
echo \html_writer::span(
get_string('customfieldsemesternotinstalled', 'tool_lifecycle', "customfieldsemester"),
'text-danger ml-1');
}
}
echo html_writer::end_div();
}
}
} else {
echo html_writer::div(get_string('adminsettings_notriggers', 'tool_lifecycle'));
}
$steps = core_component::get_plugin_list('lifecyclestep');
if ($steps) {
echo html_writer::div(get_string('steps_installed', 'tool_lifecycle'), 'h2 mt-2');
foreach ($steps as $step => $path) {
$lib = lib_manager::get_step_lib($step);
$stepicon = $lib->get_icon();
echo $OUTPUT->pix_icon($stepicon, $step, 'moodle', ['class' => 'mr-1']);
echo html_writer::div(get_string('pluginname', 'lifecyclestep_' . $step),
"font-weight-bold d-inline-block");
try {
$plugindescription = get_string('plugindescription', 'lifecyclestep_' . $step);
} catch (Exception $e) {
$plugindescription = "";
}
if ($plugindescription) {
echo html_writer::div($plugindescription);
}
}
} else {
echo html_writer::div(get_string('adminsettings_nosteps', 'tool_lifecycle'));
}
echo $renderer->footer();