Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Differences Between: [Versions 400 and 402] [Versions 400 and 403]

This file contains the editor class for the assignfeedback_editpdf plugin

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

Defines 1 class


Class: page_editor  - X-Ref

This class performs crud operations on comments and annotations from a page of a response.

No capability checks are done - they should be done by the calling class.

get_comments($gradeid, $pageno, $draft)   X-Ref
Get all comments for a page.

return: comment[]
param: int $gradeid
param: int $pageno
param: bool $draft

set_comments($gradeid, $pageno, $comments)   X-Ref
Set all comments for a page.

return: int - the number of comments.
param: int $gradeid
param: int $pageno
param: comment[] $comments

get_comment($commentid)   X-Ref
Get a single comment by id.

return: comment or false
param: int $commentid

add_comment(comment $comment)   X-Ref
Add a comment to a page.

return: bool
param: comment $comment

remove_comment($commentid)   X-Ref
Remove a comment from a page.

return: bool
param: int $commentid

get_annotations($gradeid, $pageno, $draft)   X-Ref
Get all annotations for a page.

return: annotation[]
param: int $gradeid
param: int $pageno
param: bool $draft

set_annotations($gradeid, $pageno, $annotations)   X-Ref
Set all annotations for a page.

return: int - the number of annotations.
param: int $gradeid
param: int $pageno
param: annotation[] $annotations

get_annotation($annotationid)   X-Ref
Get a single annotation by id.

return: annotation or false
param: int $annotationid

unrelease_drafts($gradeid)   X-Ref
Unrelease drafts

return: bool
param: int $gradeid

release_drafts($gradeid)   X-Ref
Release the draft comments and annotations to students.

return: bool
param: int $gradeid

has_annotations_or_comments($gradeid, $includedraft)   X-Ref
Has annotations or comments.

return: bool
param: int $gradeid

revert_drafts($gradeid)   X-Ref
Aborts all draft annotations and reverts to the last version released to students.

return: bool
param: int $gradeid

add_annotation(annotation $annotation)   X-Ref
Add a annotation to a page.

return: bool
param: annotation $annotation

remove_annotation($annotationid)   X-Ref
Remove a annotation from a page.

return: bool
param: int $annotationid

copy_drafts_from_to($assignment, $grade, $sourceuserid)   X-Ref
Copy annotations, comments, pages, and other required content from the source user to the current group member
being procssed when using applytoall.

return: bool
param: int|\assign $assignment
param: stdClass $grade
param: int $sourceuserid

replace_files_from_to($fs, $contextid, $sourceitemid, $itemid, $area, $includesubdirs = false)   X-Ref
Replace the area files in the specified area with those in the source item id.

param: \file_storage $fs The file storage class
param: int $contextid The ID of the context for the assignment.
param: int $sourceitemid The itemid to copy from - typically the source grade id.
param: int $itemid The itemid to copy to - typically the target grade id.
param: string $area The file storage area.
param: bool $includesubdirs Whether to copy the content of sub-directories too.

delete_draft_content($gradeid)   X-Ref
Delete the draft annotations and comments.

This is intended to be used when the version of the PDF has changed and the annotations
might not be relevant any more, therefore we should delete them.

return: bool
param: int $gradeid The grade ID.

set_page_rotation($gradeid, $pageno, $isrotated, $pathnamehash, $degree = 0)   X-Ref
Set page rotation value.

param: int $gradeid grade id.
param: int $pageno page number.
param: bool $isrotated whether the page is rotated or not.
param: string $pathnamehash path name hash
param: int $degree rotation degree.

get_page_rotation($gradeid, $pageno)   X-Ref
Get Page Rotation Value.

return: mixed
param: int $gradeid grade id.
param: int $pageno page number.