<?php // Put special headings at top of days foreach ($dayinfo as $id => $info) { $eventBoxCode[$id] = ''; $dayempty[$id] = TRUE; foreach ($info['special_headings'] as $name) { $eventBoxCode[$id] .= '<div class="calviewEBCSpecialDayHeading">' . $name . '</div>'; } } // Then put the events foreach ($events as $events_array_index => $event) { $replace = array('%%arrid%%' => $events_array_index + 1, '%%refid%%' => $event['ref_id'], '%%name%%' => $event['name'], '%%date%%' => $event['date'], '%%day%%' => $event['day'], '%%starttime%%' => $event['starttime'], '%%endtime%%' => $event['endtime'], '%%blurb%%' => $event['blurb'], '%%shortloc%%' => $event['shortloc'], '%%type%%' => $event['type'], '%%organisation%%' => $event['organisation'], '%%organisation_link%%' => '/directory/' . $event['organisation_directory']); $mypath = pathinfo(__FILE__); $snippets_dir = $mypath['dirname'] . "/snippets"; @($eventBoxCode[$event['day']] .= apinc($snippets_dir . "/listviewEventBox.inc", $replace)); $dayempty[$event['day']] = FALSE; } // Now process the days, outputting HTML $pre_ac_title = ''; foreach ($dayinfo as $id => $info) { if (!$dayempty[$id]) { $ac_title = 'Week ' . $info['academic_week'] . ' of the ' . $info['academic_term'] . ' ' . $info['academic_year']; if ($ac_title !== $pre_ac_title) { echo '<H2>' . $ac_title . '</H2>' . "\n"; $pre_ac_title = $ac_title; } $title = $info['day_of_week'] . ' ' . $info['date'] . ' ' . $info['month_long']; echo '<H3>' . $title . '</H3>' . "\n"; echo $eventBoxCode[$id]; }
foreach ($Events as $events_array_index => $event_main) { //var_dump($event_main); foreach ($event_main->Occurrences as $event) { //var_dump($event); if (isset($days_JSON[$event->StartTime->Midnight()->Timestamp()])) { $days_JSON[$event->StartTime->Midnight()->Timestamp()] .= ",\n"; } /* ($events_array_index <= (count ($events) - 1)) $fcom = ''; else $fcom = ',';*/ $replace = array('%%arrid%%' => $events_array_index, '%%refid%%' => $event->OccurrenceId, '%%name%%' => htmlspecialchars($event_main->Name), '%%date%%' => $event->StartTime->Format('Ymd'), '%%starttime%%' => $event->StartTime->Format('Hi'), '%%endtime%%' => $event->EndTime->Format('Hi'), '%%day%%' => $event->Day, '%%blurb%%' => htmlspecialchars($event_main->Description), '%%shortloc%%' => htmlspecialchars($event->LocationDescription)); if (isset($days_JSON[$event->Day])) { $days_JSON[$event->Day] .= ','; } @($days_JSON[$event->Day] .= apinc($snippets_dir . "/singleEventJSArr.inc", $replace)); } } $ops = ""; foreach ($days_JSON as $did => $JSD) { if (strlen($JSD) == 0) { $ccom = ''; } else { $ccom = ','; } $ops .= "\n\t'{$did}': {\n{$days_JSON[$did]}\n\t}{$ccom}\n"; } $ops = trim($ops); $ops = substr($ops, 0, strlen($ops) - 1); $js_ops = "\ncalevents = ({ \n\t{$ops}\n})"; ?>