private function setup_course($courseid) {
        global $PAGE, $DB;
        if (!empty($this->course) && $this->course->id == $courseid) {
            // already set, stop
            return;
        }
        if ($courseid == $PAGE->course->id) {
            $this->course = $PAGE->course;
        } else if (!$this->course = $DB->get_record('course', array('id' => $courseid))) {
            $this->course = null;
        }
    }