protected function linkForSchedule(KurogoObject $event, $data = null) { $subtitle = DateFormatter::formatDateRange($event->getRange(), DateFormatter::NO_STYLE, DateFormatter::SHORT_STYLE); $current = $this->getArg('time', time(), FILTER_VALIDATE_INT); $beginningOfDay = mktime(0, 0, 0, date('n', $current), date('j', $current)); $endOfDay = mktime(23, 59, 59, date('n', $current), date('j', $current)); $eventStart = $event->getStart(); $eventEnd = $event->getEnd(); if ($eventStart < $beginningOfDay) { // if starts more than one day before, put the date if ($eventStart < strtotime('-1 day', $beginningOfDay)) { $startDate = DateFormatter::formatDate($eventStart, DateFormatter::SHORT_STYLE, DateFormatter::NO_STYLE); } else { $startDate = $this->getLocalizedString('THE_PREVIOUS_DAY'); //'the previous day' } $subtitle = $this->getLocalizedString('IF_STARTS_EARLIER_DATE', $startDate) . $subtitle; } if ($eventEnd > $endOfDay) { // if ends more than one day after, put the date if ($eventEnd > strtotime('+1 day', $endOfDay)) { $endDate = DateFormatter::formatDate($eventEnd, DateFormatter::SHORT_STYLE, DateFormatter::NO_STYLE); } else { $endDate = $this->getLocalizedString('THE_FOLLOWING_DAY'); //'the following day' } $subtitle .= $this->getLocalizedString('IF_ENDS_LATER_DATE', $endDate); } $options = array('id' => $event->getID(), 'time' => $event->getStart()); if (isset($data['section'])) { $options['section'] = $data['section']; } if (isset($data['groupID'])) { $options['groupID'] = $data['groupID']; } $class = ''; if ($this->SHOW_EVENT_DETAILS) { $url = $this->buildBreadcrumbURL('schedule', $options, true); } else { $url = false; } if ($event->getRange()->contains(new TimeRange(time()))) { $class = 'open'; } else { $class = 'closed'; } return array('title' => $event->getTitle(), 'subtitle' => $subtitle, 'url' => $url, 'listclass' => $this->SHOW_HOURS_STATUS ? $class : null); }