/**
  * Add a new corequisite for a course.
  *
  * @param int $cid The course ID to add as a corequisite.
  * @param bool True on success, False otherwise.
  */
 function add_corequisite($cid, $add_to_curriculum = false)
 {
     if (empty($this->id)) {
         return false;
     }
     if ($this->is_prerequisite($cid) || $this->is_corequisite($cid)) {
         return false;
     }
     $cp = new stdClass();
     $cp->curriculumcourseid = $this->id;
     $cp->courseid = $cid;
     $cp->id = $this->_db->insert_record(coursecorequisite::TABLE, $cp);
     $result = !empty($cp->id);
     if ($result && $add_to_curriculum) {
         $data = new object();
         $data->curriculumid = $this->curriculumid;
         $data->courseid = $cid;
         $data->timeperiod = 'year';
         $currprereq = new curriculumcourse($data);
         if (!$currprereq->is_recorded()) {
             $currprereq->save();
         }
     }
     return $result;
 }