Name = $event->Name; $this->Location = $event->Location; $utc = new DateTimeZone('UTC'); $targetTz = new DateTimeZone( UserFacade::getInstance()->getTimezonePreference( Prado::getApplication()->getUser() )->Name ); $beginDate = new DateTime($event->BeginDate, $utc); $endDate = new DateTime($event->EndDate, $utc); if ($event->AllDay) { $endDate = $endDate->modify('-1 day'); $this->DateString = $beginDate->format('Y-m-d'); if ($beginDate != $endDate) { $this->DateString .= sprintf( ' - %s', $endDate->format('Y-m-d') ); } } else { $beginDate = $beginDate->setTimezone($targetTz); $this->DateString = $beginDate->format('Y-m-d H:i'); } $calendars = array_filter( $calendars, function ($calendar) use($event) { return $calendar->UID == $event->CalendarID; } ); $this->Calendar = new CalendarDTO(); $this->Calendar->loadRecord($calendars ? array_values($calendars)[0] : $event->Calendar); } public static function __compare(EventDTO $ev1, EventDTO $ev2) { if ($ev1->DateString === $ev2->DateString) { return strcmp($ev1->Calendar->Name, $ev2->Calendar->Name); } return strcmp($ev1->DateString, $ev2->DateString); } } ?>