$prev = increment_month($time, -1); $next = increment_month($time, 1); $prev_month = date('n', $prev); $prev_yr = date('Y', $prev); $next_month = date('n', $next); $next_yr = date('Y', $next); // expensive way to see if there are past/future events $nav_links = Array(); $prev_events = AcademicCalendar::get_events($prev_month, $prev_yr); if (count($prev_events) > 0) { $prev_title = date('F Y', $prev); $prev_url = academicURL($prev_yr, $prev_month); $nav_links[] = "<a href=\"$prev_url\">< $prev_title</a>"; } $next_events = AcademicCalendar::get_events($next_month, $next_yr); if (count($next_events) > 0) { $next_title = date('F Y', $next); $next_url = academicURL($next_yr, $next_month); $nav_links[] = "<a href=\"$next_url\">$next_title ></a>"; } require "$page->branch/academic.html"; $page->output(); ?>
} $data[] = $catData; } break; case 'holidays': case 'academic': // TODO: see whether any of this code can be consolidated with // mobi-web/calendar/academic.php and mobi-web/calendar/holidays.php require_once LIBDIR . "AcademicCalendar.php"; $month = isset($_REQUEST['month']) ? $_REQUEST['month'] : date('n'); $year = isset($_REQUEST['year']) ? $_REQUEST['year'] : date('Y'); if ($_REQUEST['command'] == 'holidays') { $events = AcademicCalendar::get_holidays($year); } else { $events = AcademicCalendar::get_events($month, $year); } foreach ($events as $event) { /* $event_dict = Array(); // we'll give the event a random unique ID since there's nothing // useful we can do with it on the backend $event_dict['id'] = crc32($event->get_uid()) >> 1; // 32 bit unsigned before shift $event_dict['title'] = $event->get_summary(); $event_dict['start'] = $event->get_start(); $event_dict['end'] = $event->get_end(); // location and description are always blank but just for completeness... if ($location = $event->get_location()) { $event_dict['location'] = $location; }