From e0460c578561b2209a6036c4a209e5b878de9ee5 Mon Sep 17 00:00:00 2001
From: Justus Dieckmann <justusdieckmann@wwu.de>
Date: Thu, 19 Sep 2019 20:55:51 +0200
Subject: [PATCH] Delays: Init delayedcourses.php

---
 delayedcourses.php         | 39 ++++++++++++++++++++++++++++++++++++++
 lang/en/tool_lifecycle.php |  3 +++
 settings.php               |  3 +++
 3 files changed, 45 insertions(+)
 create mode 100644 delayedcourses.php

diff --git a/delayedcourses.php b/delayedcourses.php
new file mode 100644
index 0000000..c978a1b
--- /dev/null
+++ b/delayedcourses.php
@@ -0,0 +1,39 @@
+<?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/>.
+
+/**
+ * Display the delays of courses
+ *
+ * @package tool_lifecycle
+ * @copyright  2019 Justus Dieckmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+require_once(__DIR__ . '/../../../config.php');
+require_once($CFG->libdir . '/adminlib.php');
+
+$PAGE->set_context(context_system::instance());
+require_login();
+require_capability('moodle/site:config', context_system::instance());
+
+admin_externalpage_setup('tool_lifecycle_delayed_courses');
+
+$PAGE->set_url(new \moodle_url('/admin/tool/lifecycle/delayedcourses.php'));
+
+$PAGE->set_title(get_string('delayed_courses_header', 'tool_lifecycle'));
+$PAGE->set_heading(get_string('delayed_courses_header', 'tool_lifecycle'));
+
+echo $OUTPUT->header();
+echo $OUTPUT->footer();
diff --git a/lang/en/tool_lifecycle.php b/lang/en/tool_lifecycle.php
index fefe2ed..156a9bf 100644
--- a/lang/en/tool_lifecycle.php
+++ b/lang/en/tool_lifecycle.php
@@ -175,6 +175,7 @@ $string['restore_subplugins_invalid'] = 'Wrong format of the backup file. The st
 $string['restore_step_does_not_exist'] = 'The step {$a} is not installed, but is included in the backup file. Please installed it first and try again.';
 $string['restore_trigger_does_not_exist'] = 'The trigger {$a} is not installed, but is included in the backup file. Please installed it first and try again.';
 
+// Events
 $string['process_triggered_event'] = 'A process has been triggered';
 $string['process_proceeded_event'] = 'A process has been proceeded';
 $string['process_rollback_event'] = 'A process has been rolled back';
@@ -188,3 +189,5 @@ $string['privacy:metadata:tool_lifecycle_action_log:stepindex'] = 'Index of the
 $string['privacy:metadata:tool_lifecycle_action_log:time'] = 'Time when the action was done.';
 $string['privacy:metadata:tool_lifecycle_action_log:userid'] = 'ID of the user that did the action.';
 $string['privacy:metadata:tool_lifecycle_action_log:action'] = 'Identifier of the action that was done.';
+// Delays
+$string['delayed_courses_header'] = 'Delayed courses';
diff --git a/settings.php b/settings.php
index 11bac45..f2da89c 100644
--- a/settings.php
+++ b/settings.php
@@ -42,6 +42,9 @@ if ($hassiteconfig) {
     $ADMIN->add('lifecycle_category', new tool_lifecycle\admin_page_course_backups());
     $ADMIN->add('lifecycle_category', new tool_lifecycle\admin_page_sublugins());
     $ADMIN->add('lifecycle_category', new tool_lifecycle\admin_page_deactivated_workflows());
+    $ADMIN->add('lifecycle_category', new admin_externalpage('tool_lifecycle_delayed_courses',
+            get_string('delayed_courses_header', 'tool_lifecycle'),
+            new moodle_url('/admin/tool/lifecycle/delayedcourses.php')));
 
     if ($ADMIN->fulltree) {
         $triggers = core_component::get_plugin_list('lifecycletrigger');
-- 
GitLab