Skip to content
Snippets Groups Projects
Commit 801a4916 authored by Moritz Strohm's avatar Moritz Strohm
Browse files

use current date when creating calendar dates, fixes #3920

Closes #3920

Merge request studip/studip!3043
parent 4f847abc
No related branches found
No related tags found
No related merge requests found
......@@ -39,7 +39,7 @@ class Calendar_CalendarController extends AuthenticatedController
_('Termin anlegen'),
$this->url_for('calendar/date/add', $params),
Icon::create('add'),
['data-dialog' => 'size=auto']
['data-dialog' => 'size=auto', 'class' => 'calendar-action']
);
}
......@@ -446,7 +446,7 @@ class Calendar_CalendarController extends AuthenticatedController
_('Termin anlegen'),
$this->url_for('calendar/date/add/course_' . $course->id),
Icon::create('add'),
['data-dialog' => 'size=default']
['data-dialog' => 'size=default', 'class' => 'calendar-action']
);
$actions->addLink(
_('Drucken'),
......
......@@ -232,6 +232,14 @@ class Calendar_DateController extends AuthenticatedController
$this->date->repetition_end = $this->date->end;
} else {
$time = new DateTime();
if (Request::submitted('timestamp')) {
$time->setTimestamp(Request::int('timestamp'));
} elseif (Request::submitted('defaultDate')) {
$date_parts = explode('-', Request::get('defaultDate'));
if (count($date_parts) === 3) {
$time->setDate($date_parts[0], $date_parts[1], $date_parts[2]);
}
}
$time = $time->add(new DateInterval('PT1H'));
$time->setTime(intval($time->format('H')), 0, 0);
$this->date->begin = $time->getTimestamp();
......
......@@ -731,9 +731,9 @@ class Fullcalendar
//Get the timestamp:
let timestamp = changedMoment.getTime() / 1000;
jQuery('a.resource-bookings-actions').each(function () {
jQuery('a.resource-bookings-actions, a.calendar-action').each(function () {
const url = new URL(this.href);
url.searchParams.set('timestamp', timestamp)
url.searchParams.set('timestamp', timestamp.toString())
url.searchParams.set('defaultDate', changed_date)
this.href = url.toString();
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment