Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
question_file_loader Class Reference

This class is the mirror image of question_file_saver. More...

Inheritance diagram for question_file_loader:
question_response_files

Public Member Functions

 __construct (question_attempt_step $step, $name, $value, $contextid)
 Constuctor.
 
 __toString ()
 
 get_files ()
 Get the files that were submitted.
 
 get_question_file_saver ()
 Copy these files into a draft area, and return the corresponding question_file_saver that can save them again.
 

Protected Attributes

int $contextid
 the context id that the files belong to.
 
string $name
 the field name for these files - which is used to construct the file area name.
 
question_attempt_step $step
 the step that these files belong to.
 
string $value
 the value to stored in the question_attempt_step_data to represent these files.
 

Detailed Description

This class is the mirror image of question_file_saver.

It allows files to be accessed again later (e.g. when re-grading) using that same API as when doing the original grading.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Constructor & Destructor Documentation

◆ __construct()

question_file_loader::__construct ( question_attempt_step $step,
$name,
$value,
$contextid )

Constuctor.

Parameters
question_attempt_step$stepthe step that these files belong to.
string$namestring the field name for these files - which is used to construct the file area name.
string$valuethe value to stored in the question_attempt_step_data to represent these files.
int$contextidthe context id that the files belong to.

Member Function Documentation

◆ get_files()

question_file_loader::get_files ( )

Get the files that were submitted.

Return values
arrayof stored_files objects.

Implements question_response_files.

◆ get_question_file_saver()

question_file_loader::get_question_file_saver ( )

Copy these files into a draft area, and return the corresponding question_file_saver that can save them again.

This is used by question_attempt::start_based_on(), which is used (for example) by the quizzes 'Each attempt builds on last' feature.

Return values
question_file_saverthat can re-save these files again.

The documentation for this class was generated from the following file: