Skip to content

Commit 6a044e7

Browse files
committed
fix settings problems, subplugin descriptions, version.php of subplugins, counters in the tabs
1 parent 082c107 commit 6a044e7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+169
-63
lines changed

CHANGES.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CHANGELOG
2+
=========
3+
4+
4.5.0 (2025-03-13)
5+
------------------
6+
* [FEATURE]
7+
* [FIXED]
8+
* Moodle 4.5 compatible version

classes/local/form/form_trigger_instance.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ public function __construct($url, $workflowid, $trigger = null, $subpluginname =
101101
* Defines forms elements
102102
*/
103103
public function definition() {
104+
global $OUTPUT;
105+
104106
$mform = $this->_form;
105107

106108
$mform->addElement('hidden', 'id'); // Save the record's id.

classes/tabs.php

Lines changed: 65 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,34 +40,90 @@ class tabs {
4040
* @throws \coding_exception
4141
* @throws moodle_exception
4242
*/
43-
public static function get_tabrow() {
43+
public static function get_tabrow($activelink = false, $deactivatelink = false, $draftlink = false) {
44+
global $DB;
4445

45-
$targeturl = new \moodle_url('/admin/settings.php', ['section' => 'lifecycle']);
46+
$classnotnull = 'badge badge-primary badge-pill ml-1';
47+
$classnull = 'badge badge-secondary badge-pill ml-1';
48+
49+
// Get number of drafts.
50+
$sql = "select count(id)
51+
from {tool_lifecycle_workflow}
52+
where timeactive IS NULL AND timedeactive IS NULL";
53+
$i = $DB->count_records_sql($sql);
54+
$drafts = \html_writer::span($i, $i > 0 ? $classnotnull : $classnull);
55+
56+
// Get number of active workflows.
57+
$sql = "select count(id)
58+
from {tool_lifecycle_workflow}
59+
where timeactive IS NOT NULL";
60+
$i = $DB->count_records_sql($sql);
61+
$activewf = \html_writer::span($i, $i > 0 ? $classnotnull : $classnull);
62+
63+
// Get number of deactivated workflows.
64+
$sql = "select count(id)
65+
from {tool_lifecycle_workflow}
66+
where timeactive IS NULL AND timedeactive IS NOT NULL";
67+
$i = $DB->count_records_sql($sql);
68+
$deactivatedewf = \html_writer::span($i, $i > 0 ? $classnotnull : $classnull);
69+
70+
// Get number of delayed courses.
71+
$sql = "select count(id)
72+
from {tool_lifecycle_delayed}";
73+
$i = $DB->count_records_sql($sql);
74+
$delayedcourses = \html_writer::span($i, $i > 0 ? $classnotnull : $classnull);
75+
76+
// Get number of lifecycle course backups.
77+
$sql = "select count(id)
78+
from {tool_lifecycle_backups}";
79+
$i = $DB->count_records_sql($sql);
80+
$coursebackups = \html_writer::span($i, $i > 0 ? $classnotnull : $classnull);
81+
82+
// Get number of stores lifecycle errors.
83+
$sql = "select count(id)
84+
from {tool_lifecycle_proc_error}";
85+
$i = $DB->count_records_sql($sql);
86+
$lcerrors = \html_writer::span($i, $i > 0 ? $classnotnull : $classnull);
87+
88+
// General Settings and Subplugins.
89+
$targeturl = new \moodle_url('/admin/category.php', ['category' => 'lifecycle']);
4690
$tabrow[] = new \tabobject('settings', $targeturl,
4791
get_string('general_config_header', 'tool_lifecycle'));
4892

93+
// Tab to the draft workflows page.
4994
$targeturl = new \moodle_url('/admin/tool/lifecycle/workflowdrafts.php', ['id' => 'workflowdrafts']);
5095
$tabrow[] = new \tabobject('workflowdrafts', $targeturl,
51-
get_string('workflow_drafts_header', 'tool_lifecycle'));
96+
get_string('workflow_drafts_header', 'tool_lifecycle').$drafts,
97+
get_string('workflow_drafts_header', 'tool_lifecycle'), $draftlink);
5298

99+
// Tab to the active workflows page.
53100
$targeturl = new \moodle_url('/admin/tool/lifecycle/activeworkflows.php', ['id' => 'activeworkflows']);
54101
$tabrow[] = new \tabobject('activeworkflows', $targeturl,
55-
get_string('active_workflows_header', 'tool_lifecycle'));
102+
get_string('active_workflows_header', 'tool_lifecycle').$activewf,
103+
get_string('active_workflows_header', 'tool_lifecycle'), $activelink);
56104

105+
// Tab to the deactivated workflows page.
57106
$targeturl = new \moodle_url('/admin/tool/lifecycle/deactivatedworkflows.php', ['id' => 'deactivatedworkflows']);
58107
$tabrow[] = new \tabobject('deactivatedworkflows', $targeturl,
59-
get_string('deactivated_workflows_header', 'tool_lifecycle'));
60-
61-
$targeturl = new \moodle_url('/admin/tool/lifecycle/coursebackups.php', ['id' => 'coursebackups']);
62-
$tabrow[] = new \tabobject('coursebackups', $targeturl,
63-
get_string('course_backups_list_header', 'tool_lifecycle'));
108+
get_string('deactivated_workflows_header', 'tool_lifecycle').$deactivatedewf,
109+
get_string('deactivated_workflows_header', 'tool_lifecycle'), $deactivatelink);
64110

111+
// Tab to the delayed courses list page.
65112
$targeturl = new \moodle_url('/admin/tool/lifecycle/delayedcourses.php', ['id' => 'delayedcourses']);
66113
$tabrow[] = new \tabobject('delayedcourses', $targeturl,
114+
get_string('delayed_courses_header', 'tool_lifecycle').$delayedcourses,
67115
get_string('delayed_courses_header', 'tool_lifecycle'));
68116

117+
// Tab to the course backups list page.
118+
$targeturl = new \moodle_url('/admin/tool/lifecycle/coursebackups.php', ['id' => 'coursebackups']);
119+
$tabrow[] = new \tabobject('coursebackups', $targeturl,
120+
get_string('course_backups_list_header', 'tool_lifecycle').$coursebackups,
121+
get_string('course_backups_list_header', 'tool_lifecycle'));
122+
123+
// Tab to the lifecycle errors page.
69124
$targeturl = new \moodle_url('/admin/tool/lifecycle/errors.php', ['id' => 'errors']);
70125
$tabrow[] = new \tabobject('errors', $targeturl,
126+
get_string('process_errors_header', 'tool_lifecycle').$lcerrors,
71127
get_string('process_errors_header', 'tool_lifecycle'));
72128

73129
return $tabrow;

lang/de/tool_lifecycle.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@
150150
$string['step_settings_header'] = 'Einstellungen des Schritts';
151151
$string['step_show'] = 'Anzeigen';
152152
$string['step_sortindex'] = 'Hoch/Runter';
153-
$string['step_subpluginname'] = 'Subpluginname';
153+
$string['step_subpluginname'] = 'Schritt Typ';
154154
$string['step_subpluginname_help'] = 'Name des Schritt/Trigger-Subplugins (nur für Admins sichtbar).';
155155
$string['step_type'] = 'Typ';
156156
$string['steps_installed'] = 'Installierte Schritt-Subplugins';
@@ -172,7 +172,7 @@
172172
$string['trigger_instancename_help'] = 'Titel der Trigger-Instanz (nur sichtbar für Admins).';
173173
$string['trigger_settings_header'] = 'Einstellungen des Triggers';
174174
$string['trigger_sortindex'] = 'Hoch/Runter';
175-
$string['trigger_subpluginname'] = 'Subplugin Name';
175+
$string['trigger_subpluginname'] = 'Trigger Typ';
176176
$string['trigger_subpluginname_help'] = 'Name des Schritt/Trigger-Subplugins (nur für Admins sichtbar).';
177177
$string['trigger_workflow'] = 'Workflow';
178178
$string['triggers_installed'] = 'Installierte Trigger';

lang/en/tool_lifecycle.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@
182182
$string['step_settings_header'] = 'Settings of the step';
183183
$string['step_show'] = 'Show';
184184
$string['step_sortindex'] = 'Up/Down';
185-
$string['step_subpluginname'] = 'Subplugin name';
185+
$string['step_subpluginname'] = 'Step type';
186186
$string['step_subpluginname_help'] = 'Step subplugin/trigger title (visible for admins only).';
187187
$string['step_type'] = 'Type';
188188
$string['steps_installed'] = 'Installed Steps';
@@ -204,7 +204,7 @@
204204
$string['trigger_instancename_help'] = 'Trigger instance title (visible for admins only).';
205205
$string['trigger_settings_header'] = 'Settings of the trigger';
206206
$string['trigger_sortindex'] = 'Up/Down';
207-
$string['trigger_subpluginname'] = 'Subplugin name';
207+
$string['trigger_subpluginname'] = 'Trigger type';
208208
$string['trigger_subpluginname_help'] = 'Step subplugin/trigger title (visible for admins only).';
209209
$string['trigger_workflow'] = 'Workflow';
210210
$string['triggers_installed'] = 'Installed Triggers';

settings.php

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@
3333
$triggers = core_component::get_plugin_list('lifecycletrigger');
3434
$steps = core_component::get_plugin_list('lifecyclestep');
3535

36+
$ADMIN->add('tools', new admin_category('lifecycle',
37+
get_string('pluginname', 'tool_lifecycle')));
38+
$settings = new admin_settingpage('lifecycle_settings',
39+
get_string('general_config_header', 'tool_lifecycle'));
40+
3641
if (!$ADMIN->fulltree) {
3742
$stepsortriggersettings = false;
3843
// Check if there are trigger settings pages.
@@ -44,7 +49,7 @@
4449
}
4550
}
4651
}
47-
// If no trigger settings pages check if there are step settings pages.
52+
// Check if there are step settings pages.
4853
if (!$stepsortriggersettings && $steps) {
4954
foreach ($steps as $step => $path) {
5055
if (file_exists($settingsfile = $path . '/settings.php')) {
@@ -54,10 +59,6 @@
5459
}
5560
}
5661
if ($stepsortriggersettings) {
57-
$settings->add(new admin_category('lifecycle',
58-
get_string('pluginname', 'tool_lifecycle')
59-
));
60-
$settings->add('lifecycle', admin_settingpage('lifecycle', get_string('general_config_header', 'tool_lifecycle')));
6162
// Include settings page of each trigger subplugin, if there is one.
6263
if ($triggers) {
6364
foreach ($triggers as $trigger => $path) {
@@ -74,9 +75,6 @@
7475
}
7576
}
7677
}
77-
} else {
78-
$settings = new admin_settingpage('lifecycle', get_string('pluginname', 'tool_lifecycle'));
79-
$ADMIN->add('tools', $settings);
8078
}
8179
} else { // No fulltree, settings detail page.
8280
$tabrow = tabs::get_tabrow();
@@ -85,7 +83,6 @@
8583
$output = print_tabs($tabs, $id, null, null, true);
8684

8785
// Main config page.
88-
$settings = new admin_settingpage('lifecycle', get_string('pluginname', 'tool_lifecycle'));
8986
$settings->add(new admin_setting_heading('lifecycle_settings_heading',
9087
$output, html_writer::span(get_string('general_settings_header', 'tool_lifecycle'), 'h3')));
9188
$settings->add(new admin_setting_configduration('tool_lifecycle/duration',
@@ -106,7 +103,8 @@
106103
get_string('triggers_installed', 'tool_lifecycle'), ''));
107104
foreach ($triggers as $trigger => $path) {
108105
$settings->add(new admin_setting_description('lifecycletriggersetting_'.$trigger,
109-
get_string('pluginname', 'lifecycletrigger_' . $trigger), ''));
106+
get_string('pluginname', 'lifecycletrigger_' . $trigger),
107+
get_string('plugindescription', 'lifecycletrigger_' . $trigger)));
110108
}
111109
} else {
112110
$settings->add(new admin_setting_heading('adminsettings_notriggers',
@@ -118,12 +116,13 @@
118116
get_string('steps_installed', 'tool_lifecycle'), ''));
119117
foreach ($steps as $step => $path) {
120118
$settings->add(new admin_setting_description('lifecyclestepsetting_'.$step,
121-
get_string('pluginname', 'lifecyclestep_' . $step), ''));
119+
get_string('pluginname', 'lifecyclestep_' . $step),
120+
get_string('plugindescription', 'lifecyclestep_' . $step)));
122121
}
123122
} else {
124123
$settings->add(new admin_setting_heading('adminsettings_nosteps',
125124
get_string('adminsettings_nosteps', 'tool_lifecycle'), ''));
126125
}
127-
$ADMIN->add('tools', $settings);
126+
$ADMIN->add('lifecycle', $settings);
128127
}
129128
}

step/createbackup/db/upgrade.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,5 @@ function xmldb_lifecyclestep_createbackup_upgrade($oldversion) {
5353
upgrade_plugin_savepoint(true, 2019052900, 'lifecyclestep', 'createbackup');
5454
}
5555

56+
return true;
5657
}

step/createbackup/lang/de/lifecyclestep_createbackup.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
*/
2424

2525
$string['maximumbackupspercron'] = 'Maximale Anzahl an Sicherungen per cron';
26+
$string['plugindescription'] = 'Stößt ein Backup der getriggerten Kursen an.';
2627
$string['pluginname'] = 'Kurssicherungs-Schritt';
2728
$string['privacy:metadata'] = 'Dieses Subplugin speichert keine persönlichen Daten.';
2829

step/createbackup/lang/en/lifecyclestep_createbackup.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
*/
2424

2525
$string['maximumbackupspercron'] = 'Maximum number of backups per cron';
26+
$string['plugindescription'] = 'Initiates a backup of the triggered courses.';
2627
$string['pluginname'] = 'Create backup step';
2728
$string['privacy:metadata'] = 'This subplugin does not store any personal data.';
2829

step/createbackup/version.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,12 @@
1818
* Life Cycle Create Backup Step
1919
*
2020
* @package lifecyclestep_createbackup
21-
* @copyright 2017 Tobias Reischmann WWU
21+
* @copyright 2025 Thomas Niedermaier Universität Münster
2222
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2323
*/
2424

2525
defined('MOODLE_INTERNAL') || die;
2626

27-
$plugin->version = 2019052900;
27+
$plugin->version = 2025031300;
28+
$plugin->requires = 2024100700; // Requires Moodle 4.5+.
2829
$plugin->component = 'lifecyclestep_createbackup';

0 commit comments

Comments
 (0)