Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
assignfeedback_editpdf\combined_document Class Reference

The combined_document class for the assignfeedback_editpdf plugin. More...

Public Member Functions

 add_source_file ($file)
 Add an additional source file to the end of the existing list. More...
 
 combine_files ($contextid, $itemid)
 Combine all source files into a single PDF and store it in the file_storage API using the supplied contextid and itemid. More...
 
 get_combined_file ()
 Retrieve the completed combined file. More...
 
 get_document_count ()
 Get the total number of documents to be combined. More...
 
 get_page_count ()
 Get the total number of pages in the combined document. More...
 
 get_source_files ()
 Retrieve the complete list of source files. More...
 
 get_status ()
 Check the current status of the document combination. More...
 
 is_partial_conversion ()
 Return true of the combined file contained only some of the submission files. More...
 
 refresh_files ()
 Refresh the files. More...
 
 set_combined_file ($file)
 Set the completed combined file. More...
 
 set_source_files ($files)
 Set all source files which are to be combined. More...
 

Public Attributes

const STATUS_COMPLETE = 2
 Status value representing a successful conversion.
 
const STATUS_FAILED = -1
 Status value representing a permanent error.
 
const STATUS_PENDING_INPUT = 0
 Status value representing a conversion waiting to start.
 
const STATUS_READY = 1
 Status value representing all documents ready to be combined.
 
const STATUS_READY_PARTIAL = 3
 Status value representing all documents are ready to be combined as are supported.
 

Protected Member Functions

 get_stored_file_record ($contextid, $itemid, $partial=false)
 Helper to fetch the stored_file record. More...
 
 mark_combination_failed ()
 Mark the combination attempt as having encountered a permanent failure. More...
 
 store_combined_file ($tmpfile, $contextid, $itemid, $partial=false)
 Store the combined file in the file_storage API. More...
 
 store_empty_document ($contextid, $itemid)
 Store the empty document file in the file_storage API. More...
 

Protected Attributes

 $combinationstatus = null
 The combination status.
 
 $combinedfile
 The resultant combined file.
 
 $pagecount = 0
 The number of pages in the combined PDF.
 
 $sourcefiles = []
 The list of files which make this document.
 

Detailed Description

The combined_document class for the assignfeedback_editpdf plugin.

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

Member Function Documentation

◆ add_source_file()

assignfeedback_editpdf\combined_document::add_source_file (   $file)

Add an additional source file to the end of the existing list.

Parameters
stored_file | conversion$fileThe file to add to the end of the list.
Return values
$this

◆ combine_files()

assignfeedback_editpdf\combined_document::combine_files (   $contextid,
  $itemid 
)

Combine all source files into a single PDF and store it in the file_storage API using the supplied contextid and itemid.

Parameters
int$contextidThe contextid for the file to be stored under
int$itemidThe itemid for the file to be stored under
Return values
$this

◆ get_combined_file()

assignfeedback_editpdf\combined_document::get_combined_file ( )

Retrieve the completed combined file.

Return values
stored_file

◆ get_document_count()

assignfeedback_editpdf\combined_document::get_document_count ( )

Get the total number of documents to be combined.

Return values
int

◆ get_page_count()

assignfeedback_editpdf\combined_document::get_page_count ( )

Get the total number of pages in the combined document.

If there are no pages, or it is not yet possible to count them a value of 0 is returned.

Return values
int

◆ get_source_files()

assignfeedback_editpdf\combined_document::get_source_files ( )

Retrieve the complete list of source files.

Return values
stored_file|conversion[]

◆ get_status()

assignfeedback_editpdf\combined_document::get_status ( )

Check the current status of the document combination.

Note that the combined document may not contain all the source files if some of the source files were not able to be converted. An example is an audio file with a pdf cover sheet. Only the cover sheet will be included in the combined document.

Return values
int

◆ get_stored_file_record()

assignfeedback_editpdf\combined_document::get_stored_file_record (   $contextid,
  $itemid,
  $partial = false 
)
protected

Helper to fetch the stored_file record.

Parameters
int$contextidThe contextid for the file to be stored under
int$itemidThe itemid for the file to be stored under
boolean$partialThe combined file contains only some of the source files.
Return values
stdClass

◆ is_partial_conversion()

assignfeedback_editpdf\combined_document::is_partial_conversion ( )

Return true of the combined file contained only some of the submission files.

Return values
boolean

◆ mark_combination_failed()

assignfeedback_editpdf\combined_document::mark_combination_failed ( )
protected

Mark the combination attempt as having encountered a permanent failure.

Return values
$this

◆ refresh_files()

assignfeedback_editpdf\combined_document::refresh_files ( )

Refresh the files.

This includes polling any pending conversions to see if they are complete.

Return values
$this

◆ set_combined_file()

assignfeedback_editpdf\combined_document::set_combined_file (   $file)

Set the completed combined file.

Parameters
stored_file$fileThe completed document for all files to be combined.
Return values
$this

◆ set_source_files()

assignfeedback_editpdf\combined_document::set_source_files (   $files)

Set all source files which are to be combined.

Parameters
stored_file | conversion[]$filesThe complete list of all source files to be combined.
Return values
$this

◆ store_combined_file()

assignfeedback_editpdf\combined_document::store_combined_file (   $tmpfile,
  $contextid,
  $itemid,
  $partial = false 
)
protected

Store the combined file in the file_storage API.

Parameters
string$tmpfileThe path to the file on disk to be stored.
int$contextidThe contextid for the file to be stored under
int$itemidThe itemid for the file to be stored under
boolean$partialThe combined pdf contains only some of the source files.
Return values
$this

◆ store_empty_document()

assignfeedback_editpdf\combined_document::store_empty_document (   $contextid,
  $itemid 
)
protected

Store the empty document file in the file_storage API.

Parameters
int$contextidThe contextid for the file to be stored under
int$itemidThe itemid for the file to be stored under
Return values
$this

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