This class represents the promise to save some files from a particular draft file area into a particular file area.  
 More...
|  | 
|  | __construct ($draftitemid, $component, $uncleanedfilearea, $text=null) | 
|  | Constructor. 
 | 
|  | 
|  | __toString () | 
|  | 
|  | get_files () | 
|  | Get the files that were submitted. 
 | 
|  | 
|  | save_files ($itemid, $context) | 
|  | Actually save the files. 
 | 
|  | 
|  | 
| static | clean_file_area_name (string $uncleanedfilearea) | 
|  | Clean up a possible file area name to ensure that it matches the required rules. 
 | 
|  | 
|  | 
|  | compute_value ($draftitemid, $text) | 
|  | Compute the value that should be stored in the question_attempt_step_data table. 
 | 
|  | 
|  | 
| string | $component | 
|  | the owning component name. 
 | 
|  | 
| int | $draftitemid | 
|  | the id of the draft file area to save files from. 
 | 
|  | 
| string | $filearea | 
|  | the file area name. 
 | 
|  | 
| string | $value = null | 
|  | the value to store in the question_attempt_step_data to represent these files. 
 | 
|  | 
This class represents the promise to save some files from a particular draft file area into a particular file area. 
It is used beause the necessary information about what to save is to hand in the question_attempt::process_response_files() method, but we don't know if this question attempt will actually be saved in the database until later, when the question_engine_unit_of_work is saved, if it is.
- Copyright
- 2011 The Open University 
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 
◆ __construct()
      
        
          | question_file_saver::__construct | ( |  | $draftitemid, | 
        
          |  |  |  | $component, | 
        
          |  |  |  | $uncleanedfilearea, | 
        
          |  |  |  | $text = null ) | 
      
 
Constructor. 
- Parameters
- 
  
    | int | $draftitemid | the draft area to save the files from. |  | string | $component | the component for the file area to save into. |  | string | $uncleanedfilearea | the name of the file area to save into - but before it has been cleaned up. |  | string | $text | optional content containing file links. |  
 
 
 
◆ clean_file_area_name()
  
  | 
        
          | static question_file_saver::clean_file_area_name | ( | string | $uncleanedfilearea | ) |  |  | static | 
 
Clean up a possible file area name to ensure that it matches the required rules. 
- Parameters
- 
  
    | string | $uncleanedfilearea | the proposed file area name (e.g. 'response_-attachments'). |  
 
- Return values
- 
  
    | string | a similar valid file area name. E.g: response_attachments. |  
 
 
 
◆ compute_value()
  
  | 
        
          | question_file_saver::compute_value | ( |  | $draftitemid, |  
          |  |  |  | $text ) |  | protected | 
 
Compute the value that should be stored in the question_attempt_step_data table. 
Contains a hash that (almost) uniquely encodes all the files.
- Parameters
- 
  
    | int | $draftitemid | the draft file area itemid. |  | string | $text | optional content containing file links. |  
 
- Return values
- 
  
  
 
 
◆ get_files()
      
        
          | question_file_saver::get_files | ( |  | ) |  | 
      
 
 
◆ save_files()
      
        
          | question_file_saver::save_files | ( |  | $itemid, | 
        
          |  |  |  | $context ) | 
      
 
Actually save the files. 
- Parameters
- 
  
    | integer | $itemid | the item id for the file area to save into. |  | context | $context | the context where the files should be saved. |  
 
 
 
The documentation for this class was generated from the following file: