public function get_files(stdClass $submission, stdClass $user) {
        global $DB;

        $files = array();
        $onlinetextsubmission = $this->get_onlinetext_submission($submission->id);

        // Note that this check is the same logic as the result from the is_empty function but we do
        // not call it directly because we already have the submission record.
        if ($onlinetextsubmission) {
            // Do not pass the text through format_text. The result may not be displayed in Moodle and
            // may be passed to external services such as document conversion or portfolios.
            $formattedtext = $this->assignment->download_rewrite_pluginfile_urls($onlinetextsubmission->onlinetext, $user, $this);
            $head = '<head><meta charset="UTF-8"></head>';
            $submissioncontent = '<!DOCTYPE html><html>' . $head . '<body>'. $formattedtext . '</body></html>';

            $filename = get_string('onlinetextfilename', 'assignsubmission_onlinetext');
            $files[$filename] = array($submissioncontent);

            $fs = get_file_storage();

            $fsfiles = $fs->get_area_files($this->assignment->get_context()->id,
                                           'assignsubmission_onlinetext',
                                           ASSIGNSUBMISSION_ONLINETEXT_FILEAREA,
                                           $submission->id,
                                           'timemodified',
                                           false);

            foreach ($fsfiles as $file) {
                $files[$file->get_filename()] = $file;
            }
        }

        return $files;
    }
public function get_files(stdClass $submission, stdClass $user) {
        global $DB;

        $files = array();
        $onlinetextsubmission = $this->get_onlinetext_submission($submission->id);

        // Note that this check is the same logic as the result from the is_empty function but we do
        // not call it directly because we already have the submission record.
        if ($onlinetextsubmission) {
            // Do not pass the text through format_text. The result may not be displayed in Moodle and
            // may be passed to external services such as document conversion or portfolios.
            $formattedtext = $this->assignment->download_rewrite_pluginfile_urls($onlinetextsubmission->onlinetext, $user, $this);
            $head = '<head><meta charset="UTF-8"></head>';
            $submissioncontent = '<!DOCTYPE html><html>' . $head . '<body>'. $formattedtext . '</body></html>';

            $filename = get_string('onlinetextfilename', 'assignsubmission_onlinetext');
            $files[$filename] = array($submissioncontent);

            $fs = get_file_storage();

            $fsfiles = $fs->get_area_files($this->assignment->get_context()->id,
                                           'assignsubmission_onlinetext',
                                           ASSIGNSUBMISSION_ONLINETEXT_FILEAREA,
                                           $submission->id,
                                           'timemodified',
                                           false);

            foreach ($fsfiles as $file) {
                $files[$file->get_filename()] = $file;
            }
        }

        return $files;
    }
public function get_files ( stdClass $ submission , stdClass $ user ) { global $ DB ; $ files = array ( ) ; $ onlinetextsubmission = $ this -> get_onlinetext_submission ( $ submission -> id ) ; // Note that this check is the same logic as the result from the is_empty function but we do // not call it directly because we already have the submission record. if ( $ onlinetextsubmission ) { // Do not pass the text through format_text. The result may not be displayed in Moodle and // may be passed to external services such as document conversion or portfolios. $ formattedtext = $ this -> assignment -> download_rewrite_pluginfile_urls ( $ onlinetextsubmission -> onlinetext , $ user , $ this ) ; $ head = '<head><meta charset="UTF-8"></head>' ; $ submissioncontent = '<!DOCTYPE html><html>' . $ head . '<body>' . $ formattedtext . '</body></html>' ; $ filename = get_string ( 'onlinetextfilename' , 'assignsubmission_onlinetext' ) ; $ files [ $ filename ] = array ( $ submissioncontent ) ; $ fs = get_file_storage ( ) ; $ fsfiles = $ fs -> get_area_files ( $ this -> assignment -> get_context ( ) -> id , 'assignsubmission_onlinetext' , ASSIGNSUBMISSION_ONLINETEXT_FILEAREA , $ submission -> id , 'timemodified' , false ) ; foreach ( $ fsfiles as $ file ) { $ files [ $ file -> get_filename ( ) ] = $ file ; } } return $ files ; }
Produce a list of files suitable for export that represent this submission.

@param stdClass $submission - For this is the submission data
@param stdClass $user - This is the user record for this submission
@return array - return an array of files indexed by filename
Produce a list of files suitable for export that represent this submission .