From e3b46110eabe9a92d3e858e3957d2d2fea2830aa Mon Sep 17 00:00:00 2001 From: Benjamin Walker Date: Fri, 13 Sep 2024 17:19:04 +1000 Subject: [PATCH] Add import form to tabs --- classes/output/tabs.php | 6 ++++++ import.php | 10 +++++----- lang/en/tool_excimer.php | 1 + 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/classes/output/tabs.php b/classes/output/tabs.php index 625032d..b119d33 100644 --- a/classes/output/tabs.php +++ b/classes/output/tabs.php @@ -90,6 +90,12 @@ public function export_for_template(\renderer_base $output): array { 'title' => get_string('report_page_groups', 'tool_excimer'), 'text' => get_string('tab_page_groups', 'tool_excimer'), ], + [ + 'id' => 'import', + 'link' => [['link' => new \moodle_url('/admin/tool/excimer/import.php')]], + 'title' => get_string('import_profile', 'tool_excimer'), + 'text' => get_string('tab_import', 'tool_excimer'), + ], ], ]; diff --git a/import.php b/import.php index 3171626..dba788f 100644 --- a/import.php +++ b/import.php @@ -39,14 +39,13 @@ // Check for caps. require_capability('moodle/site:config', context_system::instance()); -$overviewurl = new moodle_url('/admin/category.php?category=tool_excimer_reports'); $url = new moodle_url('/admin/tool/excimer/import.php'); $PAGE->set_url($url); $customdata = []; $form = new import_form($PAGE->url->out(false), $customdata); if ($form->is_cancelled()) { - redirect($overviewurl); + redirect($url); } if (($data = $form->get_data())) { @@ -58,7 +57,7 @@ if (empty($id)) { // Failed to save the imported profile. \core\notification::error(get_string('import_error', 'tool_excimer')); - redirect($overviewurl); + redirect($url); } // The import was a success, so redirect to the imported profile. @@ -81,8 +80,9 @@ $PAGE->set_heading(get_string('pluginname', 'tool_excimer')); echo $OUTPUT->header(); -// Output headings. -echo $OUTPUT->heading($heading); +$renderer = $PAGE->get_renderer('tool_excimer'); +$tabs = new tool_excimer\output\tabs($url); +echo $renderer->render_tabs($tabs); // And display the form, and its validation errors if there are any. $form->display(); diff --git a/lang/en/tool_excimer.php b/lang/en/tool_excimer.php index 8212360..b658827 100644 --- a/lang/en/tool_excimer.php +++ b/lang/en/tool_excimer.php @@ -106,6 +106,7 @@ $string['unfinished'] = 'Unfinished'; $string['tab_page_groups'] = 'Page Groups'; $string['tab_page_course'] = 'Courses'; +$string['tab_import'] = 'Import'; // Month Selector. $string['displaying_month'] = 'Displaying month';