aboutsummaryrefslogtreecommitdiff
path: root/app/controllers/calendar/calendar.php
diff options
context:
space:
mode:
authorPeter Thienel <thienel@data-quest.de>2024-05-06 09:14:14 +0000
committerDavid Siegfried <david.siegfried@uni-vechta.de>2024-05-06 09:14:14 +0000
commite398eec260ff49cfd347246f143e629905de6f5e (patch)
tree937b303904f0869eb40b7e69117592af2156662a /app/controllers/calendar/calendar.php
parente7bfc2e80046cdbe28122c8430d9ce9dfdafb5a1 (diff)
Resolve "Terminkalender: Dialog des Termin-Exports schließt sich nicht nach Download"
Closes #4094 Merge request studip/studip!2938
Diffstat (limited to 'app/controllers/calendar/calendar.php')
-rw-r--r--app/controllers/calendar/calendar.php52
1 files changed, 32 insertions, 20 deletions
diff --git a/app/controllers/calendar/calendar.php b/app/controllers/calendar/calendar.php
index 0c24a80..d0d5743 100644
--- a/app/controllers/calendar/calendar.php
+++ b/app/controllers/calendar/calendar.php
@@ -770,29 +770,41 @@ class Calendar_CalendarController extends AuthenticatedController
PageLayout::postError(_('Bitte wählen Sie aus, welche Termine exportiert werden sollen!'));
return;
}
- $ical = '';
- $calendar_export = new ICalendarExport();
- if ($this->dates_to_export === 'user') {
- $ical = $calendar_export->exportCalendarDates(User::findCurrent()->id, $this->begin, $this->end);
- } elseif ($this->dates_to_export === 'course') {
- $ical = $calendar_export->exportCourseDates(User::findCurrent()->id, $this->begin, $this->end);
- $ical .= $calendar_export->exportCourseExDates(User::findCurrent()->id, $this->begin, $this->end);
- } elseif ($this->dates_to_export === 'all') {
- $ical = $calendar_export->exportCalendarDates(User::findCurrent()->id, $this->begin, $this->end);
- $ical .= $calendar_export->exportCourseDates(User::findCurrent()->id, $this->begin, $this->end);
- $ical .= $calendar_export->exportCourseExDates(User::findCurrent()->id, $this->begin, $this->end);
- }
- $ical = $calendar_export->writeHeader() . $ical . $calendar_export->writeFooter();
- $this->response->add_header('Content-Type', 'text/calendar;charset=utf-8');
- $this->response->add_header('Content-Disposition', 'attachment; filename="studip.ics"');
- $this->response->add_header('Content-Transfer-Encoding', 'binary');
- $this->response->add_header('Pragma', 'public');
- $this->response->add_header('Cache-Control', 'private');
- $this->response->add_header('Content-Length', strlen($ical));
- $this->render_text($ical);
+ $this->relocate($this->url_for('calendar/calendar/export_file', [
+ 'begin' => $this->begin->format('d.m.Y'),
+ 'end' => $this->end->format('d.m.Y'),
+ 'dates_to_export' => $this->dates_to_export
+ ]));
}
}
+ public function export_file_action()
+ {
+ $begin = Request::getDateTime('begin', 'd.m.Y');
+ $end = Request::getDateTime('end', 'd.m.Y');
+ $dates_to_export = Request::option('dates_to_export', 'user');
+ $ical = '';
+ $calendar_export = new ICalendarExport();
+ if ($dates_to_export === 'user') {
+ $ical = $calendar_export->exportCalendarDates(User::findCurrent()->id, $begin, $end);
+ } elseif ($dates_to_export === 'course') {
+ $ical = $calendar_export->exportCourseDates(User::findCurrent()->id, $begin, $end);
+ $ical .= $calendar_export->exportCourseExDates(User::findCurrent()->id, $begin, $end);
+ } elseif ($dates_to_export === 'all') {
+ $ical = $calendar_export->exportCalendarDates(User::findCurrent()->id, $begin, $end);
+ $ical .= $calendar_export->exportCourseDates(User::findCurrent()->id, $begin, $end);
+ $ical .= $calendar_export->exportCourseExDates(User::findCurrent()->id, $begin, $end);
+ }
+ $ical = $calendar_export->writeHeader() . $ical . $calendar_export->writeFooter();
+ $this->response->add_header('Content-Type', 'text/calendar;charset=utf-8');
+ $this->response->add_header('Content-Disposition', 'attachment; filename="studip.ics"');
+ $this->response->add_header('Content-Transfer-Encoding', 'binary');
+ $this->response->add_header('Pragma', 'public');
+ $this->response->add_header('Cache-Control', 'private');
+ $this->response->add_header('Content-Length', strlen($ical));
+ $this->render_text($ical);
+ }
+
public function import_action() {}
public function import_file_action()