mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
Merge branch 'MDL-72355-master' of git://github.com/mickhawkins/moodle
This commit is contained in:
commit
7a1b3e0f2c
7 changed files with 27 additions and 45 deletions
|
@ -64,7 +64,6 @@ class block_calendar_month extends block_base {
|
||||||
}
|
}
|
||||||
|
|
||||||
$options = [
|
$options = [
|
||||||
'showexportlink' => false,
|
|
||||||
'showfullcalendarlink' => true
|
'showfullcalendarlink' => true
|
||||||
];
|
];
|
||||||
list($footerdata, $footertemplate) = calendar_get_footer_options($calendar, $options);
|
list($footerdata, $footertemplate) = calendar_get_footer_options($calendar, $options);
|
||||||
|
|
|
@ -53,11 +53,6 @@ class footer_options_exporter extends exporter {
|
||||||
*/
|
*/
|
||||||
protected $token;
|
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.
|
* @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 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.
|
* @param array $options Display options for the footer. If an option is not set, a default value will be provided.
|
||||||
* It consists of:
|
* 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.
|
* - showfullcalendarlink - bool - Whether to show the full calendar link or not. Defaults to false.
|
||||||
*/
|
*/
|
||||||
public function __construct(\calendar_information $calendar, $userid, $token, array $options = []) {
|
public function __construct(\calendar_information $calendar, $userid, $token, array $options = []) {
|
||||||
$this->calendar = $calendar;
|
$this->calendar = $calendar;
|
||||||
$this->userid = $userid;
|
$this->userid = $userid;
|
||||||
$this->token = $token;
|
$this->token = $token;
|
||||||
$this->showexportlink = $options['showexportlink'] ?? true;
|
|
||||||
$this->showfullcalendarlink = $options['showfullcalendarlink'] ?? false;
|
$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.
|
* Get manage subscription link.
|
||||||
*
|
*
|
||||||
|
@ -140,21 +123,12 @@ class footer_options_exporter extends exporter {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($CFG->enablecalendarexport)) {
|
if (!empty($CFG->enablecalendarexport) && $managesubscriptionlink = $this->get_manage_subscriptions_link()) {
|
||||||
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)[
|
$values->footerlinks[] = (object)[
|
||||||
'url' => $managesubscriptionlink,
|
'url' => $managesubscriptionlink,
|
||||||
'linkname' => get_string('managesubscriptions', 'calendar'),
|
'linkname' => get_string('managesubscriptions', 'calendar'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return (array) $values;
|
return (array) $values;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3706,7 +3706,6 @@ function calendar_get_timestamp($d, $m, $y, $time = 0) {
|
||||||
* @param calendar_information $calendar The calendar information object.
|
* @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.
|
* @param array $options Display options for the footer. If an option is not set, a default value will be provided.
|
||||||
* It consists of:
|
* 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.
|
* - showfullcalendarlink - bool - Whether to show the full calendar link or not. Defaults to false.
|
||||||
*
|
*
|
||||||
* @return array The data for template and template name.
|
* @return array The data for template and template name.
|
||||||
|
|
|
@ -327,7 +327,11 @@ class core_calendar_renderer extends plugin_renderer_base {
|
||||||
$exportcalendarbutton->class .= ' float-sm-right float-right';
|
$exportcalendarbutton->class .= ' float-sm-right float-right';
|
||||||
$output = $this->output->heading(get_string('managesubscriptions', 'calendar'));
|
$output = $this->output->heading(get_string('managesubscriptions', 'calendar'));
|
||||||
$output .= html_writer::start_div('header d-flex flex-wrap mt-5');
|
$output .= html_writer::start_div('header d-flex flex-wrap mt-5');
|
||||||
$output .= html_writer::tag('h3', get_string('yoursubscriptions', 'calendar'), ['class' => 'mr-auto']);
|
$headerattr = [
|
||||||
|
'class' => 'mr-auto',
|
||||||
|
'aria-describedby' => 'subscription_details_table',
|
||||||
|
];
|
||||||
|
$output .= html_writer::tag('h3', get_string('yoursubscriptions', 'calendar'), $headerattr);
|
||||||
$output .= $this->output->render($importcalendarbutton);
|
$output .= $this->output->render($importcalendarbutton);
|
||||||
$output .= $this->output->render($exportcalendarbutton);
|
$output .= $this->output->render($exportcalendarbutton);
|
||||||
$output .= html_writer::end_div();
|
$output .= html_writer::end_div();
|
||||||
|
|
|
@ -18,7 +18,7 @@ Feature: Import and edit calendar events
|
||||||
Scenario: Import then edit a calendar event.
|
Scenario: Import then edit a calendar event.
|
||||||
Given I log in as "teacher1"
|
Given I log in as "teacher1"
|
||||||
And I view the calendar for "1" "2016"
|
And I view the calendar for "1" "2016"
|
||||||
And I click on "Manage subscriptions" "link"
|
And I click on "Import or export calendars" "link"
|
||||||
And I press "Import calendar"
|
And I press "Import calendar"
|
||||||
And I set the following fields to these values:
|
And I set the following fields to these values:
|
||||||
| Calendar name | Test Import |
|
| Calendar name | Test Import |
|
||||||
|
@ -43,7 +43,7 @@ Feature: Import and edit calendar events
|
||||||
Then I should see "Event on 2-20-2017"
|
Then I should see "Event on 2-20-2017"
|
||||||
And I should see "Event on 2-25-2017"
|
And I should see "Event on 2-25-2017"
|
||||||
And I should not see "Event on 2-15-2017"
|
And I should not see "Event on 2-15-2017"
|
||||||
And I click on "Manage subscriptions" "link"
|
And I click on "Import or export calendars" "link"
|
||||||
And I press "Remove"
|
And I press "Remove"
|
||||||
And I view the calendar for "2" "2017"
|
And I view the calendar for "2" "2017"
|
||||||
And I should not see "Event on 2-25-2017"
|
And I should not see "Event on 2-25-2017"
|
||||||
|
@ -52,7 +52,7 @@ Feature: Import and edit calendar events
|
||||||
Scenario: Import events using different event types.
|
Scenario: Import events using different event types.
|
||||||
Given I log in as "admin"
|
Given I log in as "admin"
|
||||||
And I view the calendar for "1" "2016"
|
And I view the calendar for "1" "2016"
|
||||||
And I click on "Manage subscriptions" "link"
|
And I click on "Import or export calendars" "link"
|
||||||
And I press "Import calendar"
|
And I press "Import calendar"
|
||||||
And I set the following fields to these values:
|
And I set the following fields to these values:
|
||||||
| Calendar name | Test Import |
|
| Calendar name | Test Import |
|
||||||
|
|
|
@ -18,7 +18,8 @@ Feature: Export calendar events
|
||||||
|
|
||||||
Scenario: Viewing calendar export options
|
Scenario: Viewing calendar export options
|
||||||
Given I follow "Full calendar"
|
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"
|
Then I should see "All events"
|
||||||
And I should see "Events related to courses"
|
And I should see "Events related to courses"
|
||||||
And I should see "Events related to groups"
|
And I should see "Events related to groups"
|
||||||
|
@ -26,7 +27,8 @@ Feature: Export calendar events
|
||||||
|
|
||||||
Scenario: Generating calendar URL for all events
|
Scenario: Generating calendar URL for all events
|
||||||
Given I follow "Full calendar"
|
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 "All events" to "1"
|
||||||
And I set the field "Recent and next 60 days" to "1"
|
And I set the field "Recent and next 60 days" to "1"
|
||||||
When I click on "Get calendar URL" "button"
|
When I click on "Get calendar URL" "button"
|
||||||
|
@ -34,7 +36,8 @@ Feature: Export calendar events
|
||||||
|
|
||||||
Scenario: Generating calendar URL for course events
|
Scenario: Generating calendar URL for course events
|
||||||
Given I follow "Full calendar"
|
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 "Events related to courses" to "1"
|
||||||
And I set the field "Recent and next 60 days" to "1"
|
And I set the field "Recent and next 60 days" to "1"
|
||||||
When I click on "Get calendar URL" "button"
|
When I click on "Get calendar URL" "button"
|
||||||
|
@ -42,7 +45,8 @@ Feature: Export calendar events
|
||||||
|
|
||||||
Scenario: Generating calendar URL for group events
|
Scenario: Generating calendar URL for group events
|
||||||
Given I follow "Full calendar"
|
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 "Events related to groups" to "1"
|
||||||
And I set the field "Recent and next 60 days" to "1"
|
And I set the field "Recent and next 60 days" to "1"
|
||||||
When I click on "Get calendar URL" "button"
|
When I click on "Get calendar URL" "button"
|
||||||
|
@ -50,7 +54,8 @@ Feature: Export calendar events
|
||||||
|
|
||||||
Scenario: Generating calendar URL for category events
|
Scenario: Generating calendar URL for category events
|
||||||
Given I follow "Full calendar"
|
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 "Events related to categories" to "1"
|
||||||
And I set the field "Recent and next 60 days" to "1"
|
And I set the field "Recent and next 60 days" to "1"
|
||||||
When I click on "Get calendar URL" "button"
|
When I click on "Get calendar URL" "button"
|
||||||
|
@ -58,7 +63,8 @@ Feature: Export calendar events
|
||||||
|
|
||||||
Scenario: Generating calendar URL for user events
|
Scenario: Generating calendar URL for user events
|
||||||
Given I follow "Full calendar"
|
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 "My personal events" to "1"
|
||||||
And I set the field "Recent and next 60 days" to "1"
|
And I set the field "Recent and next 60 days" to "1"
|
||||||
When I click on "Get calendar URL" "button"
|
When I click on "Get calendar URL" "button"
|
||||||
|
|
|
@ -177,7 +177,7 @@ $string['invalidtimedurationuntil'] = 'The date and time you selected for durati
|
||||||
$string['invalideventtype'] = 'The event type you have selected is invalid.';
|
$string['invalideventtype'] = 'The event type you have selected is invalid.';
|
||||||
$string['iwanttoexport'] = 'Export';
|
$string['iwanttoexport'] = 'Export';
|
||||||
$string['less'] = 'Less';
|
$string['less'] = 'Less';
|
||||||
$string['managesubscriptions'] = 'Manage subscriptions';
|
$string['managesubscriptions'] = 'Import or export calendars';
|
||||||
$string['manyevents'] = '{$a} events';
|
$string['manyevents'] = '{$a} events';
|
||||||
$string['mon'] = 'Mon';
|
$string['mon'] = 'Mon';
|
||||||
$string['monday'] = 'Monday';
|
$string['monday'] = 'Monday';
|
||||||
|
@ -279,7 +279,7 @@ $string['when'] = 'When';
|
||||||
$string['whendate'] = 'When: {$a}';
|
$string['whendate'] = 'When: {$a}';
|
||||||
$string['yesterday'] = 'Yesterday';
|
$string['yesterday'] = 'Yesterday';
|
||||||
$string['youcandeleteallrepeats'] = 'This event is part of a repeating event series. You can delete this event only, or all {$a} events in the series at once.';
|
$string['youcandeleteallrepeats'] = 'This event is part of a repeating event series. You can delete this event only, or all {$a} events in the series at once.';
|
||||||
$string['yoursubscriptions'] = 'Your subscriptions';
|
$string['yoursubscriptions'] = 'Imported calendars';
|
||||||
|
|
||||||
// Deprecated since Moodle 4.0.
|
// Deprecated since Moodle 4.0.
|
||||||
$string['calendarurl'] = 'Calendar URL: {$a}';
|
$string['calendarurl'] = 'Calendar URL: {$a}';
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue