function delete() { $status = true; if (!empty($this->id)) { instructor::delete_for_class($this->id); student::delete_for_class($this->id); trackassignmentclass::delete_for_class($this->id); classmoodlecourse::delete_for_class($this->id); student_grade::delete_for_class($this->id); attendance::delete_for_class($this->id); taginstance::delete_for_class($this->id); waitlist::delete_for_class($this->id); classmoodlecourse::delete_for_class($this->id); $level = context_level_base::get_custom_context_level('class', 'block_curr_admin'); $result = delete_context($level, $this->id); $status = $this->data_delete_record(); } return $status; }