Skip to content

Commit b1deea1

Browse files
committed
add run link to timetrigger row
1 parent fdb876d commit b1deea1

File tree

8 files changed

+72
-5
lines changed

8 files changed

+72
-5
lines changed

classes/urls.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,5 +61,7 @@ class urls {
6161
const CONFIRMATION = '/admin/tool/lifecycle/confirmation.php';
6262
/** @var string subplugins page for a list of installed subplugins */
6363
const SUBPLUGINS = '/admin/tool/lifecycle/subplugins.php?id=subplugins';
64+
/** @var string run page for execute the scheduled lifecycle task ad hoc */
65+
const RUN = '/admin/tool/lifecycle/run.php?id=run';
6466

6567
}

db/subplugins.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"plugintypes" : {
3-
"lifecycletrigger" : "admin\/tool\/lifecycle\/trigger",
4-
"lifecyclestep" : "admin\/tool\/lifecycle\/step"
3+
"lifecycletrigger" : "admin/tool/lifecycle/trigger",
4+
"lifecyclestep" : "admin/tool/lifecycle/step"
55
}
66
}

lang/de/tool_lifecycle.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@
227227
$string['restore_workflow_not_found'] = 'Falsches Format der Sicherungsdatei. Der Workflow konnte nicht gefunden werden.';
228228
$string['rollback'] = 'Zurücksetzung';
229229
$string['rolledback'] = 'Zurückgesetzt';
230+
$string['runtask'] = 'Führe Lifecycle System-Task aus';
230231
$string['searchcourses'] = 'Kurs-Suche';
231232
$string['see_in_workflow'] = 'In Workflow ansehen';
232233
$string['show_delays'] = 'Wähle die Ansicht';

lang/en/tool_lifecycle.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@
227227
$string['restore_workflow_not_found'] = 'Wrong format of the backup file. The workflow could not be found.';
228228
$string['rollback'] = 'Rollback';
229229
$string['rolledback'] = 'Rolled back';
230+
$string['runtask'] = 'Run scheduled lifecycle task';
230231
$string['searchcourses'] = 'Search for courses';
231232
$string['see_in_workflow'] = 'See in workflow';
232233
$string['show_delays'] = 'Kind of view';

run.php

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
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+
* Displays the installed subplugins (steps and trigger).
19+
*
20+
* @package tool_lifecycle
21+
* @copyright 2025 Thomas Niedermaier University Münster
22+
* @copyright 2022 Justus Dieckmann WWU
23+
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
24+
*/
25+
26+
use tool_lifecycle\tabs;
27+
use tool_lifecycle\task\lifecycle_task;
28+
use tool_lifecycle\urls;
29+
30+
require_once(__DIR__ . '/../../../config.php');
31+
require_once($CFG->libdir . '/adminlib.php');
32+
33+
require_login();
34+
35+
$syscontext = context_system::instance();
36+
$PAGE->set_url(new \moodle_url(urls::RUN));
37+
$PAGE->set_context($syscontext);
38+
39+
$PAGE->set_pagetype('admin-setting-' . 'tool_lifecycle');
40+
$PAGE->set_pagelayout('admin');
41+
42+
$renderer = $PAGE->get_renderer('tool_lifecycle');
43+
44+
$heading = get_string('pluginname', 'tool_lifecycle')." / ".get_string('runtask', 'tool_lifecycle');
45+
echo $renderer->header($heading);
46+
$tabrow = tabs::get_tabrow();
47+
$id = 'settings';
48+
$renderer->tabs($tabrow, $id);
49+
50+
echo \html_writer::start_div('');
51+
52+
$task = new lifecycle_task();
53+
$task->execute();
54+
55+
echo \html_writer::end_div();
56+
57+
echo $renderer->footer();

step/adminapprove/tests/admin_approve_test.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@
1616

1717
namespace lifecyclestep_adminapprove;
1818

19-
namespace lifecyclestep_adminapprove;
20-
2119
defined('MOODLE_INTERNAL') || die();
20+
2221
require_once(__DIR__ . '/../../../tests/generator/lib.php');
2322

2423
use tool_lifecycle\local\manager\process_manager;

templates/workflowoverview.mustache

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,13 @@
151151
<h5 class="my-2">{{#str}} courseselectionrun_title, tool_lifecycle{{/str}} <span data-toggle="tooltip" title="{{#str}} overview:timetrigger_help, tool_lifecycle{{/str}}"><i class="fa fa-circle-question"></i></span></h5>
152152
{{#nomanualtriggerinvolved}}
153153
<div class="mb-2 mx-2">
154-
{{#str}} nextrun, tool_lifecycle, {{{nextrun}}} {{/str}}<br>
154+
{{#str}} nextrun, tool_lifecycle, {{{nextrun}}} {{/str}}
155+
<a href="{{{runlink}}}">
156+
<span class="" data-toggle="tooltip" title="{{#str}} runtask, tool_lifecycle {{/str}}">
157+
{{#str}} run {{/str}}
158+
</span>
159+
</a>
160+
<br>
155161
<span class="text-muted">{{#str}} lastrun, tool_lifecycle, {{lastrun}} {{/str}}</span>
156162
</div>
157163
{{/nomanualtriggerinvolved}}

workflowoverview.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,7 @@
516516
'disableworkflowlink' => $disableworkflowlink,
517517
'abortdisableworkflowlink' => $abortdisableworkflowlink,
518518
'workflowprocesseslink' => $workflowprocesseslink,
519+
'runlink' => new \moodle_url(urls::RUN),
519520
];
520521
if ($showdetails) {
521522
// The triggers total box.

0 commit comments

Comments
 (0)