[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/mod/assign/feedback/editpdf/classes/ -> document_services.php (summary)

This file contains the ingest manager for the assignfeedback_editpdf plugin

Copyright: 2012 Davo Smith
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 804 lines (33 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

document_services:: (14 methods):
  get_assignment_from_param()
  hash()
  strip_images()
  list_compatible_submission_files_for_attempt()
  get_combined_pdf_for_attempt()
  generate_combined_pdf_for_attempt()
  page_number_for_attempt()
  generate_page_images_for_attempt()
  get_page_images_for_attempt()
  get_downloadable_feedback_filename()
  generate_feedback_document()
  copy_pages_to_readonly_area()
  get_feedback_document()
  delete_feedback_document()


Class: document_services  - X-Ref

Functions for generating the annotated pdf.

This class controls the ingest of student submission files to a normalised
PDF 1.4 document with all submission files concatinated together. It also
provides the functions to generate a downloadable pdf with all comments and
annotations embedded.
get_assignment_from_param($assignment)   X-Ref
This function will take an int or an assignment instance and
return an assignment instance. It is just for convenience.

param: int|\assign $assignment
return: assign

hash($assignment, $userid, $attemptnumber)   X-Ref
Get a hash that will be unique and can be used in a path name.

param: int|\assign $assignment
param: int $userid
param: int $attemptnumber (-1 means latest attempt)

strip_images($html)   X-Ref
Use a DOM parser to accurately replace images with their alt text.

param: string $html
return: string New html with no image tags.

list_compatible_submission_files_for_attempt($assignment, $userid, $attemptnumber)   X-Ref
This function will search for all files that can be converted
and concatinated into a PDF (1.4) - for any submission plugin
for this students attempt.

param: int|\assign $assignment
param: int $userid
param: int $attemptnumber (-1 means latest attempt)
return: array(stored_file)

get_combined_pdf_for_attempt($assignment, $userid, $attemptnumber)   X-Ref
This function return the combined pdf for all valid submission files.

param: int|\assign $assignment
param: int $userid
param: int $attemptnumber (-1 means latest attempt)
return: stored_file

generate_combined_pdf_for_attempt($assignment, $userid, $attemptnumber)   X-Ref
This function will take all of the compatible files for a submission
and combine them into one PDF.

param: int|\assign $assignment
param: int $userid
param: int $attemptnumber (-1 means latest attempt)
return: stored_file

page_number_for_attempt($assignment, $userid, $attemptnumber, $readonly = false)   X-Ref
This function will return the number of pages of a pdf.

param: int|\assign $assignment
param: int $userid
param: int $attemptnumber (-1 means latest attempt)
param: bool $readonly When true we get the number of pages for the readonly version.
return: int number of pages

generate_page_images_for_attempt($assignment, $userid, $attemptnumber)   X-Ref
This function will generate and return a list of the page images from a pdf.

param: int|\assign $assignment
param: int $userid
param: int $attemptnumber (-1 means latest attempt)
return: array(stored_file)

get_page_images_for_attempt($assignment, $userid, $attemptnumber, $readonly = false)   X-Ref
This function returns a list of the page images from a pdf.

The readonly version is different than the normal one. The readonly version contains a copy
of the pages in the state they were when the PDF was annotated, by doing so we prevent the
the pages that are displayed to change as soon as the submission changes.

Though there is an edge case, if the PDF was annotated before MDL-45580, then it is possible
that we do not find any readonly version of the pages. In that case, we will get the normal
pages and copy them to the readonly area. This ensures that the pages will remain in that
state until the submission is updated. When the normal files do not exist, we throw an exception
because the readonly pages should only ever be displayed after a teacher has annotated the PDF,
they would not exist until they do.

param: int|\assign $assignment
param: int $userid
param: int $attemptnumber (-1 means latest attempt)
param: bool $readonly If true, then we are requesting the readonly version.
return: array(stored_file)

get_downloadable_feedback_filename($assignment, $userid, $attemptnumber)   X-Ref
This function returns sensible filename for a feedback file.

param: int|\assign $assignment
param: int $userid
param: int $attemptnumber (-1 means latest attempt)
return: string

generate_feedback_document($assignment, $userid, $attemptnumber)   X-Ref
This function takes the combined pdf and embeds all the comments and annotations.

This also moves the annotations and comments from drafts to not drafts. And it will
copy all the images stored to the readonly area, so that they can be viewed online, and
not be overwritten when a new submission is sent.

param: int|\assign $assignment
param: int $userid
param: int $attemptnumber (-1 means latest attempt)
return: stored_file

copy_pages_to_readonly_area($assignment, $grade)   X-Ref
Copy the pages image to the readonly area.

param: int|\assign $assignment The assignment.
param: \stdClass $grade The grade record.
return: void

get_feedback_document($assignment, $userid, $attemptnumber)   X-Ref
This function returns the generated pdf (if it exists).

param: int|\assign $assignment
param: int $userid
param: int $attemptnumber (-1 means latest attempt)
return: stored_file

delete_feedback_document($assignment, $userid, $attemptnumber)   X-Ref
This function deletes the generated pdf for a student.

param: int|\assign $assignment
param: int $userid
param: int $attemptnumber (-1 means latest attempt)
return: bool



Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1