begin = $begin; $this->end = $end; $this->title = $title; $this->event_classes = $event_classes; $this->text_colour = $text_colour; $this->background_colour = $background_colour; $this->editable = $editable; $this->object_class = $object_class; $this->object_id = $object_id; $this->parent_object_class = $parent_object_class; $this->parent_object_id = $parent_object_id; $this->range_type = $range_type; $this->range_id = $range_id; $this->view_urls = $view_urls; $this->api_urls = $api_urls; $this->icon = $icon; $this->border_colour = $border_colour ?: $background_colour; $this->all_day = $all_day; } public function toFullcalendarEvent() { // Note: The timezone must not be transmitted or // the events may be shifted when there is a timezone // or daylight saving time difference between the server // and the client! // To display all-day events correctly in fullcalendar // reduce the start and end to date without time and add one day // to the end date... if ($this->all_day) { $fc_date = [ 'allDay' => true, 'start' => $this->begin->format('Y-m-d'), 'end' => $this->end->modify('+1 day')->format('Y-m-d') ]; } else { $fc_date = [ 'allDay' => false, 'start' => $this->begin->format('Y-m-d\TH:i:s'), 'end' => $this->end->format('Y-m-d\TH:i:s') ]; } return $fc_date + [ 'resourceId' => $this->range_id, 'title' => $this->title, 'classNames' => $this->event_classes, 'textColor' => $this->text_colour, 'color' => $this->background_colour, 'borderColor' => $this->border_colour, 'editable' => $this->editable, 'studip_weekday_begin' => $this->begin->format('N'), 'studip_weekday_end' => $this->end->format('N'), 'studip_object_class' => $this->object_class, 'studip_object_id' => $this->object_id, 'studip_parent_object_class' => $this->parent_object_class, 'studip_parent_object_id' => $this->parent_object_id, 'studip_range_type' => $this->range_type, 'studip_range_id' => $this->range_id, 'studip_view_urls' => $this->view_urls, 'studip_api_urls' => $this->api_urls, 'icon' => $this->icon ]; } }