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); }
function GetWeeks(&$sources, $DateRange = NULL, $Filter = NULL, $Format = 'ac:re') { $CI =& get_instance(); // Read date range $range = $CI->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); $calendar_data = new CalendarData(); $CI->messages->AddMessages($sources->FetchEvents($calendar_data)); // Display data $CI->load->library('calendar_view_weeks'); $weeks = new CalendarViewWeeks(); $weeks->SetCalendarData($calendar_data); $weeks->SetStartEnd($start->Timestamp(), $end->Timestamp()); $weeks->SetRangeUrl($this->mRangeUrl, $Format, NULL !== $Filter ? '/' . $Filter : ''); $weeks->SetCategories($this->mCategories); $data = array('Filters' => $this->GetFilters($sources), 'ViewMode' => $weeks, 'RangeDescription' => $range['description'], 'ReadOnly' => $this->mReadOnly, 'Path' => $this->mPaths); $this->SetupTabs('weeks', $start, $Filter); return new FramesView('calendar/my_calendar', $data); }