Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,22 @@
* @return does not return
*/
function pdfannotator_display_embed($pdfannotator, $cm, $course, $file, $page = 1, $annoid = null, $commid = null) {
global $CFG, $PAGE, $OUTPUT, $USER;
global $PAGE, $OUTPUT, $USER;

// The revision attribute's existance is demanded by moodle for versioning and could be saved in the pdfannotator table in the future.
// Note, however, that we forbid file replacement in order to prevent a change of meaning in other people's comments.
$pdfannotator->revision = 1;

$context = context_module::instance($cm->id);
$path = '/' . $context->id . '/mod_pdfannotator/content/' . $pdfannotator->revision . $file->get_filepath() . $file->get_filename();
$fullurl = file_encode_url($CFG->wwwroot . '/pluginfile.php', $path, false);
$fullurl = \moodle_url::make_pluginfile_url(
$context->id,
'mod_pdfannotator',
'content',
$pdfannotator->revision,
$file->get_filepath(),
$file->get_filename(),
true
)->out(false);

$documentobject = new stdClass();
$documentobject->annotatorid = $pdfannotator->id;
Expand Down