protected function initializeIndex() { $breadcrumbs = $this->page != 'pane'; // get location data models $locationDataModels = array(); $groupedLocations = array(); foreach ($this->feeds as $feedID => $feed) { $locationDataModels[$feedID] = $this->loadFeed($feedID); $groupedLocations[$feedID]['title'] = isset($feed['title']) ? $feed['title'] : null; } foreach ($locationDataModels as $feedID => $model) { if ($this->getOptionalModuleVar('SHOW_OPEN_AT_TOP', 0)) { $model->setSortByOpen(); } $locations = $model->getLocations(); $locationLinks = array(); foreach ($locations as $location) { if ($location->hasAttribute('events')) { $subtitle = ''; $currentEvents = $location->getCurrentEvents(time()); $nextEvent = $location->getNextEvent(true); if (count($currentEvents) > 0) { $events = array(); $lastTime = null; foreach ($currentEvents as $event) { if ($event->getEnd() > $lastTime) { $lastTime = $event->getEnd(); } $eventSummary = $event->getTitle(); if (strlen($eventSummary)) { $events[] = $eventSummary . ': ' . EventsDataModel::timeText($event, true); } else { $events[] = EventsDataModel::timeText($event, true); } } $subtitle .= implode("<br />", $events); } else { if ($nextEvent) { $eventSummary = $nextEvent->getTitle(); if (strlen($eventSummary)) { $subtitle .= $this->getLocalizedString('NEXT_EVENT') . $eventSummary . ': ' . EventsDataModel::timeText($nextEvent); } else { $subtitle .= $this->getLocalizedString('NEXT_EVENT') . EventsDataModel::timeText($nextEvent); } } } } else { // Dining module requires events attribute so skip this location // if it does not contain any events. Events don't necessarily need // to be currently occurring, but each location needs an events data model. continue; } $summary = $location->getAttribute('summary'); if (strlen($summary)) { $subtitle = $summary . '<br />' . $subtitle; } $locationLinks[] = array('title' => $location->getTitle(), 'subtitle' => $subtitle, 'url' => $this->buildBreadcrumbURL('detail', array('groupID' => $feedID, 'id' => $location->getID()), $breadcrumbs), 'listclass' => $this->SHOW_HOURS_STATUS ? $location->getListClass() : null); } $groupedLocations[$feedID]['items'] = $locationLinks; } $this->assign('groupedLocations', $groupedLocations); }