foreach ($events as $event) { $dateTitle = formatDayTitle($event); if (!array_key_exists($dateTitle, $days)) { $days[$dateTitle] = Array(); } $summary = $event->get_summary(); // bolden all-caps at the beginning of the string $summary = preg_replace('/^([ A-Z0-9:\.\-]{2,})/', "<b>$1</b>", $summary, 1); $days[$dateTitle][] = $summary; } $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>"; }
public static function search_events($searchTerms, $month=NULL, $year=NULL) { if ($year === NULL) { $year = date('Y'); } if ($month === NULL) { $month = date('n'); } $fiscal_year = ($month <= 6) ? $year : $year + 1; if (array_key_exists($fiscal_year, self::$icals)) { $ical = self::$icals[$fiscal_year]; } else { return array(); } // adjust day starts for time zones // honestly i am not 100% sure these are the right params $month_start = day_of(mktime(0, 0, 0, $month, 1, $year)); $month_end = increment_month($month_start); $monthRange = new TimeRange($month_start, $month_end); //$result = array(); //foreach (self::$icals as $ical) { // $result = array_merge($result, $ical->search_events($searchTerms, $monthRange)); //} $result = $ical->search_events($searchTerms, $monthRange); return $result; }