Skip to content
Snippets Groups Projects
Commit 41e83152 authored by Mike Henry's avatar Mike Henry
Browse files

Issue #80 move $commentid loop

parent c417e7a5
No related branches found
No related tags found
No related merge requests found
...@@ -376,13 +376,13 @@ function pdfannotator_pluginfile($course, $cm, $context, $filearea, $args, $forc ...@@ -376,13 +376,13 @@ function pdfannotator_pluginfile($course, $cm, $context, $filearea, $args, $forc
return false; return false;
} }
$commentid = 0; // $commentid = 0;
foreach ($args as $param) { // foreach ($args as $param) {
if ($DB->record_exists('pdfannotator_comments', ['id' => $param])) { // if ($DB->record_exists('pdfannotator_comments', ['id' => $param])) {
$commentid = $param; // $commentid = $param;
break; // break;
} // }
} // }
array_shift($args); // Ignore revision - designed to prevent caching problems only. array_shift($args); // Ignore revision - designed to prevent caching problems only.
$fs = get_file_storage(); $fs = get_file_storage();
...@@ -423,6 +423,14 @@ function pdfannotator_pluginfile($course, $cm, $context, $filearea, $args, $forc ...@@ -423,6 +423,14 @@ function pdfannotator_pluginfile($course, $cm, $context, $filearea, $args, $forc
} }
if ($filearea === 'post') { if ($filearea === 'post') {
$commentid = 0;
foreach ($args as $param) {
if ($DB->record_exists('pdfannotator_comments', ['id' => $param])) {
$commentid = $param;
break;
}
}
$fullpath = rtrim("/$context->id/mod_pdfannotator/$filearea/$commentid/$relativepath", '/'); $fullpath = rtrim("/$context->id/mod_pdfannotator/$filearea/$commentid/$relativepath", '/');
if (!$file = $fs->get_file_by_hash(sha1($fullpath)) or $file->is_directory()) { if (!$file = $fs->get_file_by_hash(sha1($fullpath)) or $file->is_directory()) {
//Annotations from other documents might have another contextid. //Annotations from other documents might have another contextid.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment