original_string: 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;
          }
      }
code: 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;
          }
      }
code_tokens: 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 ; } }
docstring: Records the course object
  
  @global moodle_page $PAGE
  @global moodle_database $DB
  @param int $courseid
docstring_tokens: Records the course object