protected function RecurYearly(&$results, &$default) { // Start at the beginning of the year of base $yearstart = new Academic_time(mktime(0, 0, 0, 1, 1, $default->Year())); $count = NULL; if (NULL !== $this->mCount) { $count = $this->mCount; } while ((NULL === $count || $count > 0) && (NULL === $this->mEffectiveUntil || $yearstart->Timestamp() <= $this->mEffectiveUntil)) { $yearresults = array(); $this->YearInner($yearresults, $default, $yearstart); $this->HandleInners($results, $yearresults, $default, $count); $yearstart = $yearstart->Adjust('+' . $this->mInterval . 'years'); } }
function GetWeeks(&$sources, $DateRange = NULL, $Filter = NULL, $Format = 'ac:re') { // Read date range $range = $this->date_uri->ReadUri($DateRange, TRUE); $now = new Academic_time(time()); if ($range['valid']) { $start = $range['start']; $end = $range['end']; } else { $start = $now->BackToMonday(); $end = $start->Adjust('4weeks'); } $sources->SetRange($start->Timestamp(), $end->Timestamp()); $this->ReadFilter($sources, $Filter); $create_sources = $this->GetCreateSources($sources); $calendar_data = new CalendarData(); $this->messages->AddMessages($sources->FetchEvents($calendar_data)); // Display data $this->load->library('calendar_frontend'); $this->load->library('calendar_view_weeks'); $weeks = new CalendarViewWeeks(); $weeks->SetCalendarData($calendar_data); $weeks->SetStartEnd($start->Timestamp(), $end->Timestamp()); $weeks->SetPaths($this->mPaths); $weeks->SetRangeFormat($Format); $weeks->SetRangeFilter(NULL !== $Filter ? '/' . $Filter : ''); $weeks->SetCategories($this->mCategories); $data = array('Filters' => $this->GetFilters($sources), 'ViewMode' => $weeks, 'RangeDescription' => $range['description'], 'Path' => $this->mPaths, 'CreateSources' => $create_sources); if ($now->Timestamp() >= $start->Timestamp() && $now->Timestamp() < $end->Timestamp()) { $focus = $now->Midnight(); } else { $focus = $start; } $this->SetupTabs('weeks', $focus, $Filter); return new FramesView('calendar/my_calendar', $data); }