Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error about wrong parameter type for format_text() #116

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
12 changes: 6 additions & 6 deletions locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1095,7 +1095,7 @@ function pdfannotator_get_questions($courseid, $context, $questionfilter) {
}

$question->content = pdfannotator_get_relativelink($question->content, $question->commentid, $context);
$question->content = format_text($question->content, $options = ['filter' => true]);
$question->content = format_text($question->content, FORMAT_MOODLE, $options = ['filter' => true]);
$question->link = (new moodle_url('/mod/pdfannotator/view.php', array('id' => $question->cmid,
'page' => $question->page, 'annoid' => $question->annoid, 'commid' => $question->commentid)))->out();

Expand Down Expand Up @@ -1172,7 +1172,7 @@ function pdfannotator_get_posts_by_this_user($courseid, $context) {
$params = array('id' => $post->cmid, 'page' => $post->page, 'annoid' => $post->annotationid, 'commid' => $post->commid);
$post->link = (new moodle_url('/mod/pdfannotator/view.php', $params))->out();
$post->content = pdfannotator_get_relativelink($post->content, $post->commid, $context);
$post->content = format_text($post->content, $options = ['filter' => true]);
$post->content = format_text($post->content, FORMAT_MOODLE, $options = ['filter' => true]);
}
return $posts;
}
Expand Down Expand Up @@ -1330,10 +1330,10 @@ function pdfannotator_get_reports($courseid, $context, $reportfilter = 0) {
$report->link = (new moodle_url('/mod/pdfannotator/view.php',
array('id' => $report->cmid, 'page' => $report->page, 'annoid' => $report->annotationid, 'commid' => $report->commentid)))->out();
$report->reportedcomment = pdfannotator_get_relativelink($report->reportedcomment, $report->commentid, $context);
$report->reportedcomment = format_text($report->reportedcomment, $options = ['filter' => true]);
$report->reportedcomment = format_text($report->reportedcomment, FORMAT_MOODLE, $options = ['filter' => true]);
$questionid = $DB->get_record('pdfannotator_comments', ['annotationid' => $report->annotationid, 'isquestion' => 1], 'id');
$report->report = pdfannotator_get_relativelink($report->report, $questionid, $context);
$report->report = format_text($report->report, $options = ['filter' => true]);
$report->report = format_text($report->report, FORMAT_MOODLE, $options = ['filter' => true]);
}
return $reports;
}
Expand Down Expand Up @@ -1887,9 +1887,9 @@ function pdfannotator_answerstable_add_row($thiscourse, $table, $answer, $cmid,
global $CFG, $PAGE;

$answer->answer = pdfannotator_get_relativelink($answer->answer, $answer->answerid, $context);
$answer->answer = format_text($answer->answer, $options = ['filter' => true]);
$answer->answer = format_text($answer->answer, FORMAT_MOODLE, $options = ['filter' => true]);
$answer->answeredquestion = pdfannotator_get_relativelink($answer->answeredquestion, $answer->questionid, $context);
$answer->answeredquestion = format_text($answer->answeredquestion, $options = ['filter' => true]);
$answer->answeredquestion = format_text($answer->answeredquestion, FORMAT_MOODLE, $options = ['filter' => true]);


if (isset($answer->displayquestionhidden)) {
Expand Down