public function load_data() {
        global $DB;

        $context = context_module::instance($this->cmid);

        if (empty($this->fileid)) {
            if (empty($this->sid) || empty($this->area)) {
                throw new portfolio_caller_exception('invalidfileandsubmissionid', 'mod_assign');
            }

            $submission = $DB->get_record('assign_submission', array('id' => $this->sid));
        } else {
            $submissionid = $DB->get_field('files', 'itemid', array('id' => $this->fileid, 'contextid' => $context->id));
            if ($submissionid) {
                $submission = $DB->get_record('assign_submission', array('id' => $submissionid));
            }
        }

        if (empty($submission)) {
            throw new portfolio_caller_exception('filenotfound');
        } else if ($submission->userid == 0) {
            // This must be a group submission.
            if (!groups_is_member($submission->groupid, $this->user->id)) {
                throw new portfolio_caller_exception('filenotfound');
            }
        } else if ($this->user->id != $submission->userid) {
            throw new portfolio_caller_exception('filenotfound');
        }

        // Export either an area of files or a single file (see function for more detail).
        // The first arg is an id or null. If it is an id, the rest of the args are ignored.
        // If it is null, the rest of the args are used to load a list of files from get_areafiles.
        $this->set_file_and_format_data($this->fileid,
                                        $context->id,
                                        $this->component,
                                        $this->area,
                                        $this->sid,
                                        'timemodified',
                                        false);

    }