Skip to content
Snippets Groups Projects
Commit 685d0e1c authored by Friederike Schwager's avatar Friederike Schwager Committed by Friederike Schwager
Browse files

display hidden comments as hidden after searching

parent a8e74347
No related branches found
No related tags found
No related merge requests found
<?php <?php
// This file is part of Moodle - http://moodle.org/ // This file is part of Moodle - http://moodle.org/
// //
// Moodle is free software: you can redistribute it and/or modify // Moodle is free software: you can redistribute it and/or modify
......
...@@ -606,13 +606,7 @@ class pdfannotator_comment { ...@@ -606,13 +606,7 @@ class pdfannotator_comment {
. "JOIN (SELECT * FROM {pdfannotator_annotations} WHERE pdfannotatorid = :docid) a " . "JOIN (SELECT * FROM {pdfannotator_annotations} WHERE pdfannotatorid = :docid) a "
. "ON a.id = c.annotationid WHERE isquestion = 1"; . "ON a.id = c.annotationid WHERE isquestion = 1";
$questions = $DB->get_records_sql($sql, array('docid' => $documentid)); $questions = $DB->get_records_sql($sql, array('docid' => $documentid));
// if (!has_capability('mod/pdfannotator:seehiddencomments', $context)) {
// foreach ($questions as $question) {
// if ($question->ishidden == 1) {
// $question->content = '<em>' . get_string('hiddenComment', 'pdfannotator') . '</em>';
// }
// }
// }
$ret = []; $ret = [];
foreach ($questions as $question) { foreach ($questions as $question) {
$ret[$question->page][] = $question; $ret[$question->page][] = $question;
...@@ -630,7 +624,7 @@ class pdfannotator_comment { ...@@ -630,7 +624,7 @@ class pdfannotator_comment {
global $DB; global $DB;
$ret = []; $ret = [];
$i = 0; $i = 0;
// $displayhidden = has_capability('mod/pdfannotator:seehiddencomments', $context); $displayhidden = has_capability('mod/pdfannotator:seehiddencomments', $context);
$sql = "SELECT c.*, a.page FROM {pdfannotator_comments} c " $sql = "SELECT c.*, a.page FROM {pdfannotator_comments} c "
. "JOIN {pdfannotator_annotations} a ON a.id = c.annotationid " . "JOIN {pdfannotator_annotations} a ON a.id = c.annotationid "
. "WHERE isquestion = 1 AND c.pdfannotatorid = :docid AND " . "WHERE isquestion = 1 AND c.pdfannotatorid = :docid AND "
...@@ -649,9 +643,9 @@ class pdfannotator_comment { ...@@ -649,9 +643,9 @@ class pdfannotator_comment {
if ($question->isdeleted == 1) { if ($question->isdeleted == 1) {
$question->content = '<em>'.get_string('deletedComment', 'pdfannotator').'</em>'; $question->content = '<em>'.get_string('deletedComment', 'pdfannotator').'</em>';
} }
// if ($question->ishidden == 1 && !$displayhidden) { if ($question->ishidden == 1 && !$displayhidden) {
// $question->content = get_string('hiddenComment', 'pdfannotator'); $question->content = get_string('hiddenComment', 'pdfannotator');
// } }
$ret[$i] = $question; // Without this array the order by page would get lost, because js sorts by id. $ret[$i] = $question; // Without this array the order by page would get lost, because js sorts by id.
$i++; $i++;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment