function GetDays(&$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->Midnight(); $end = $start->Adjust('7day'); } $stretch_end = $end->Adjust($this->mDefaultOverlap); $sources->SetRange($start->Timestamp(), $stretch_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_days'); $days = new CalendarViewDays(); $days->SetCalendarData($calendar_data); $days->SetStartEnd($start->Timestamp(), $end->Timestamp()); $days->SetPaths($this->mPaths); $days->SetRangeFormat($Format); $days->SetRangeFilter(NULL !== $Filter ? '/' . $Filter : ''); $days->SetCategories($this->mCategories); $days->EnableCreate(isset($this->mPermissions['create']) && $sources->GetSource(0)->IsSupported('create')); $data = array('Filters' => $this->GetFilters($sources), 'ViewMode' => $days, '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('days', $focus, $Filter); return new FramesView('calendar/my_calendar', $data); }
function GetDays(&$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->Midnight(); $end = $start->Adjust('7day'); } $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_days'); $days = new CalendarViewDays(); $days->SetCalendarData($calendar_data); $days->SetStartEnd($start->Timestamp(), $end->Timestamp()); $days->SetRangeUrl($this->mRangeUrl, $Format, NULL !== $Filter ? '/' . $Filter : ''); $days->SetCategories($this->mCategories); $data = array('Filters' => $this->GetFilters($sources), 'ViewMode' => $days, 'RangeDescription' => $range['description'], 'ReadOnly' => $this->mReadOnly, 'Path' => $this->mPaths); $this->SetupTabs('days', $start, $Filter); return new FramesView('calendar/my_calendar', $data); }