From 9eed82a7f541e96502230260910e759329617b07 Mon Sep 17 00:00:00 2001 From: Michael Hawkins Date: Mon, 23 Aug 2021 16:39:14 +0800 Subject: [PATCH] MDL-72355 calendar: Remove export link from the calendar footer Now that subscriptions and exports are accessed from the same page which is linked as "Import / export calendars", there is no need to have a separate "Export calendar" link. --- .../calendar_month/block_calendar_month.php | 1 - .../external/footer_options_exporter.php | 36 +++---------------- calendar/lib.php | 1 - calendar/tests/behat/export.feature | 18 ++++++---- 4 files changed, 17 insertions(+), 39 deletions(-) diff --git a/blocks/calendar_month/block_calendar_month.php b/blocks/calendar_month/block_calendar_month.php index 116051e9aeba9..3c76d5031b339 100644 --- a/blocks/calendar_month/block_calendar_month.php +++ b/blocks/calendar_month/block_calendar_month.php @@ -64,7 +64,6 @@ public function get_content() { } $options = [ - 'showexportlink' => false, 'showfullcalendarlink' => true ]; list($footerdata, $footertemplate) = calendar_get_footer_options($calendar, $options); diff --git a/calendar/classes/external/footer_options_exporter.php b/calendar/classes/external/footer_options_exporter.php index 9f6dad7592400..a26ed078865a0 100644 --- a/calendar/classes/external/footer_options_exporter.php +++ b/calendar/classes/external/footer_options_exporter.php @@ -53,11 +53,6 @@ class footer_options_exporter extends exporter { */ protected $token; - /** - * @var bool $showexportlink Whether the export link should be displayed or not. - */ - protected $showexportlink; - /** * @var bool $showfullcalendarlink Whether the full calendar link should be displayed or not. */ @@ -71,27 +66,15 @@ class footer_options_exporter extends exporter { * @param string $token The user sha1 token. * @param array $options Display options for the footer. If an option is not set, a default value will be provided. * It consists of: - * - showexportlink - bool - Whether to show the export link or not. Defaults to true. * - showfullcalendarlink - bool - Whether to show the full calendar link or not. Defaults to false. */ public function __construct(\calendar_information $calendar, $userid, $token, array $options = []) { $this->calendar = $calendar; $this->userid = $userid; $this->token = $token; - $this->showexportlink = $options['showexportlink'] ?? true; $this->showfullcalendarlink = $options['showfullcalendarlink'] ?? false; } - /** - * Get the export calendar link. - * - * @return string The export calendar hyperlink. - */ - protected function get_export_calendar_link(): string { - $exportcalendarurl = new moodle_url('/calendar/export.php', $this->get_link_params()); - return $exportcalendarurl->out(true); - } - /** * Get manage subscription link. * @@ -140,20 +123,11 @@ protected function get_other_values(renderer_base $output) { ]; } - if (!empty($CFG->enablecalendarexport)) { - if ($this->showexportlink) { - $values->footerlinks[] = (object)[ - 'url' => $this->get_export_calendar_link(), - 'linkname' => get_string('exportcalendar', 'calendar'), - ]; - } - - if ($managesubscriptionlink = $this->get_manage_subscriptions_link()) { - $values->footerlinks[] = (object)[ - 'url' => $managesubscriptionlink, - 'linkname' => get_string('managesubscriptions', 'calendar'), - ]; - } + if (!empty($CFG->enablecalendarexport) && $managesubscriptionlink = $this->get_manage_subscriptions_link()) { + $values->footerlinks[] = (object)[ + 'url' => $managesubscriptionlink, + 'linkname' => get_string('managesubscriptions', 'calendar'), + ]; } return (array) $values; diff --git a/calendar/lib.php b/calendar/lib.php index 4d19e836d5010..072beac11bfb5 100644 --- a/calendar/lib.php +++ b/calendar/lib.php @@ -3706,7 +3706,6 @@ function calendar_get_timestamp($d, $m, $y, $time = 0) { * @param calendar_information $calendar The calendar information object. * @param array $options Display options for the footer. If an option is not set, a default value will be provided. * It consists of: - * - showexportlink - bool - Whether to show the export link or not. Defaults to true. * - showfullcalendarlink - bool - Whether to show the full calendar link or not. Defaults to false. * * @return array The data for template and template name. diff --git a/calendar/tests/behat/export.feature b/calendar/tests/behat/export.feature index df30a2293046e..2e738a06b03b6 100644 --- a/calendar/tests/behat/export.feature +++ b/calendar/tests/behat/export.feature @@ -18,7 +18,8 @@ Feature: Export calendar events Scenario: Viewing calendar export options Given I follow "Full calendar" - When I click on "Export calendar" "link" + When I click on "Import or export calendars" "link" + And I click on "Export calendar" "button" Then I should see "All events" And I should see "Events related to courses" And I should see "Events related to groups" @@ -26,7 +27,8 @@ Feature: Export calendar events Scenario: Generating calendar URL for all events Given I follow "Full calendar" - And I click on "Export calendar" "link" + And I click on "Import or export calendars" "link" + And I click on "Export calendar" "button" And I set the field "All events" to "1" And I set the field "Recent and next 60 days" to "1" When I click on "Get calendar URL" "button" @@ -34,7 +36,8 @@ Feature: Export calendar events Scenario: Generating calendar URL for course events Given I follow "Full calendar" - And I click on "Export calendar" "link" + And I click on "Import or export calendars" "link" + And I click on "Export calendar" "button" And I set the field "Events related to courses" to "1" And I set the field "Recent and next 60 days" to "1" When I click on "Get calendar URL" "button" @@ -42,7 +45,8 @@ Feature: Export calendar events Scenario: Generating calendar URL for group events Given I follow "Full calendar" - And I click on "Export calendar" "link" + And I click on "Import or export calendars" "link" + And I click on "Export calendar" "button" And I set the field "Events related to groups" to "1" And I set the field "Recent and next 60 days" to "1" When I click on "Get calendar URL" "button" @@ -50,7 +54,8 @@ Feature: Export calendar events Scenario: Generating calendar URL for category events Given I follow "Full calendar" - And I click on "Export calendar" "link" + And I click on "Import or export calendars" "link" + And I click on "Export calendar" "button" And I set the field "Events related to categories" to "1" And I set the field "Recent and next 60 days" to "1" When I click on "Get calendar URL" "button" @@ -58,7 +63,8 @@ Feature: Export calendar events Scenario: Generating calendar URL for user events Given I follow "Full calendar" - And I click on "Export calendar" "link" + And I click on "Import or export calendars" "link" + And I click on "Export calendar" "button" And I set the field "My personal events" to "1" And I set the field "Recent and next 60 days" to "1" When I click on "Get calendar URL" "button"