/** * @pre SetRange() must have already been called. */ function Retrieve() { // Don't get any events from the database right now //parent::Retrieve(); // Calculate links to next, previous, and this whole term $prev_term = $this->mSelectedWeekStart->AcademicYear() - ($this->mSelectedWeekStart->AcademicTerm() == 0 ? 1 : 0) . '-' . Academic_time::GetAcademicTermNameUnique(($this->mSelectedWeekStart->AcademicTerm() + 5) % 6) . '-1'; //$this_term = // $this->mSelectedWeekStart->AcademicYear() . '-' . // $this->mSelectedWeekStart->AcademicTermNameUnique(); $next_term = $this->mSelectedWeekStart->AcademicYear() + ($this->mSelectedWeekStart->AcademicTerm() == 5 ? 1 : 0) . '-' . Academic_time::GetAcademicTermNameUnique(($this->mSelectedWeekStart->AcademicTerm() + 1) % 6) . '-1'; $this->SetData('links', array('prev_term' => site_url($this->mUriBase . $prev_term), 'this_term' => '', 'next_term' => site_url($this->mUriBase . $next_term))); $this->SetData('term', array('name' => $this->mSelectedWeekStart->AcademicTermName() . ' ' . $this->mSelectedWeekStart->AcademicTermTypeName())); // Get this monday $CI =& get_instance(); $monday = Academic_time::NewToday()->BackToMonday()->Timestamp(); $weeks = array(); $last_term = -1; for ($week = $this->mStartTime; $week->Timestamp() < $this->mEndTime->Timestamp(); $week = $next_week) { // Find the end of the week $next_week = $week->Adjust('1week'); if (FALSE) { // Titles before each new term if ($last_term !== $week->AcademicTerm()) { $weeks[] = array('link' => site_url($this->mUriBase . $week->AcademicYear() . '-' . $week->AcademicTermNameUnique()), 'name' => strtoupper($week->AcademicTermName() . ' ' . $week->AcademicTermTypeName() . ' ' . $week->AcademicYearName()), 'events' => 0, 'select' => FALSE, 'old' => FALSE, 'heading' => TRUE, 'start_date' => ''); $last_term = $week->AcademicTerm(); } } $old = $week->Timestamp() < $monday; // Is the week in the past? $selected = $this->mSelectedWeekStart->Timestamp() <= $week->Timestamp() && $this->mSelectedWeekEnd->Timestamp() >= $next_week->Timestamp(); $weeks[] = array('link' => $this->GenerateUri($week, $next_week), 'name' => 'Week ' . $week->AcademicWeek(), 'events' => 0, 'select' => $selected, 'old' => $old, 'heading' => FALSE); } $this->SetData('weeks', $weeks); }