Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 401 and 402] [Versions 401 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.

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

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

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

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

param: int $commentid
return: comment or false

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

param: comment $comment
return: bool

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

param: int $commentid
return: bool

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

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

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

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

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

param: int $annotationid
return: annotation or false

unrelease_drafts($gradeid)   X-Ref
Unrelease drafts

param: int $gradeid
return: bool

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

param: int $gradeid
return: bool

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

param: int $gradeid
return: bool

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

param: int $gradeid
return: bool

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

param: annotation $annotation
return: bool

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

param: int $annotationid
return: bool

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.

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

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.

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

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.

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