/** * update records with fields that aren't handled by the parent class * tracks because they are multi select and require relations be made in a separate table * moodlecourseid because they require relations be made in a separate table * @global object $CURMAN * @param bool $createnew */ public function data_update_record($createnew = false) { global $CURMAN; $status = parent::data_update_record($createnew); if (isset($this->track) && is_array($this->track)) { $param['classid'] = $this->id; $param['courseid'] = $this->courseid; foreach ($this->track as $t) { $param['trackid'] = $t; $trackassignobj = new trackassignmentclass($param); $trackassignobj->add(); } } if (!empty($this->moodlecourseid)) { moodle_attach_class($this->id, $this->moodlecourseid); } return $status; }