Autosave Manager.  
 More...
|  | 
|  | __construct (int $contextid, string $pagehash, string $pageinstance, string $elementid, ?stdClass $user=null) | 
|  | Constructor for the autosave manager. 
 | 
|  | 
|  | create_autosave_record (string $drafttext, ?int $draftid=null) | 
|  | Create an autosave record for the session. 
 | 
|  | 
|  | get_autosave_record () | 
|  | Get the autosave record for this session. 
 | 
|  | 
|  | remove_autosave_record () | 
|  | Remove the autosave record. 
 | 
|  | 
|  | resume_autosave_session (?int $draftid=null) | 
|  | Resume an autosave session, updating the draft file area if relevant. 
 | 
|  | 
|  | update_autosave_record (string $drafttext) | 
|  | Update the text of the autosave session. 
 | 
|  | 
|  | 
|  | is_autosave_stale (stdClass $record) | 
|  | Check whether the autosave data is stale. 
 | 
|  | 
|  | update_draftid_for_record (stdClass $record, int $newdraftid) | 
|  | Move the files relating to the autosave session to a new draft file area. 
 | 
|  | 
|  | 
| int | $contextid | 
|  | The contextid. 
 | 
|  | 
| string | $elementid | 
|  | The elementid for this editor. 
 | 
|  | 
| string | $pagehash | 
|  | The page hash reference. 
 | 
|  | 
| string | $pageinstance | 
|  | The page instance reference. 
 | 
|  | 
| stdClass | $user | 
|  | The user record. 
 | 
|  | 
◆ __construct()
      
        
          | tiny_autosave\autosave_manager::__construct | ( | int | $contextid, | 
        
          |  |  | string | $pagehash, | 
        
          |  |  | string | $pageinstance, | 
        
          |  |  | string | $elementid, | 
        
          |  |  | ?stdClass | $user = null ) | 
      
 
Constructor for the autosave manager. 
- Parameters
- 
  
    | int | $contextid | The contextid of the session |  | string | $pagehash | The page hash |  | string | $pageinstance | The page instance |  | string | $elementid | The element id |  | null | stdClass | $user | The user object for the owner of the autosave |  
 
 
 
◆ create_autosave_record()
      
        
          | tiny_autosave\autosave_manager::create_autosave_record | ( | string | $drafttext, | 
        
          |  |  | ?int | $draftid = null ) | 
      
 
Create an autosave record for the session. 
- Parameters
- 
  
    | string | $drafttext | The draft text to save |  | null | int | $draftid | The draft file area if one is used |  
 
- Return values
- 
  
    | stdClass | The autosave record |  
 
 
 
◆ get_autosave_record()
      
        
          | tiny_autosave\autosave_manager::get_autosave_record | ( |  | ) |  | 
      
 
Get the autosave record for this session. 
- Return values
- 
  
  
 
 
◆ is_autosave_stale()
  
  | 
        
          | tiny_autosave\autosave_manager::is_autosave_stale | ( | stdClass | $record | ) |  |  | protected | 
 
Check whether the autosave data is stale. 
Records are considered stale if either of the following conditions are true:
- The record is older than the stale period
- Any of the files in the draft area are newer than the autosave data itself
- Parameters
- 
  
    | stdClass | $record | The autosave record |  
 
- Return values
- 
  
    | bool | Whether the record is stale |  
 
 
 
◆ resume_autosave_session()
      
        
          | tiny_autosave\autosave_manager::resume_autosave_session | ( | ?int | $draftid = null | ) |  | 
      
 
Resume an autosave session, updating the draft file area if relevant. 
- Parameters
- 
  
    | null | int | $draftid | The draft file area to update |  
 
- Return values
- 
  
    | stdClass | The updated autosave record |  
 
 
 
◆ update_autosave_record()
      
        
          | tiny_autosave\autosave_manager::update_autosave_record | ( | string | $drafttext | ) |  | 
      
 
Update the text of the autosave session. 
- Parameters
- 
  
    | string | $drafttext | The text to save |  
 
- Return values
- 
  
    | stdClass | The updated record |  
 
 
 
◆ update_draftid_for_record()
  
  | 
        
          | tiny_autosave\autosave_manager::update_draftid_for_record | ( | stdClass | $record, |  
          |  |  | int | $newdraftid ) |  | protected | 
 
Move the files relating to the autosave session to a new draft file area. 
- Parameters
- 
  
    | stdClass | $record | The autosave record |  | int | $newdraftid | The new draftid to move files to |  
 
- Return values
- 
  
    | stdClass | The updated autosave record |  
 
 
 
The documentation for this class was generated from the following file: