Skip to content
Snippets Groups Projects
Commit ce637772 authored by Moritz Strohm's avatar Moritz Strohm Committed by David Siegfried
Browse files

calendar/date/add: add the calendar owner instead of the current user as...

calendar/date/add: add the calendar owner instead of the current user as default participant, fixes #3923

Closes #3923

Merge request studip/studip!2777
parent 58b1b71c
No related branches found
No related tags found
No related merge requests found
...@@ -27,9 +27,8 @@ class Calendar_DateController extends AuthenticatedController ...@@ -27,9 +27,8 @@ class Calendar_DateController extends AuthenticatedController
$range_id = $range_and_id[1]; $range_id = $range_and_id[1];
} }
if (!$range) { if (!$range) {
//Show the personal calendar of the current user: $range_id = Request::option('user_id', $GLOBALS['user']->id);
$range = 'user'; $range = 'user';
$range_id = $GLOBALS['user']->id;
} }
$owner = null; $owner = null;
...@@ -325,15 +324,12 @@ class Calendar_DateController extends AuthenticatedController ...@@ -325,15 +324,12 @@ class Calendar_DateController extends AuthenticatedController
if ($this->date->isNew()) { if ($this->date->isNew()) {
if (!($owner instanceof Course)) { if (!($owner instanceof Course)) {
//Assign the date to the calendar of the current user by default: //Assign the date to the calendar of the owner by default:
$user = User::findCurrent(); $this->calendar_assignment_items[] = [
if ($user) { 'value' => $owner->id,
$this->calendar_assignment_items[] = [ 'name' => $owner->getFullName(),
'value' => $user->id, 'deletable' => true
'name' => $user->getFullName(), ];
'deletable' => true
];
}
} }
} else { } else {
$exceptions = CalendarDateException::findBySql( $exceptions = CalendarDateException::findBySql(
......
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