moodle/question/upgrade.txt
Tim Hunt 181393aad2 MDL-35053 questions: question files outside an attempt.
Sometimes it is necssary to display parts of a question outside of an
attempt. For example for staff review. When displaying the question, we
need to handle images in the question text. In the past there was a
mechanism for this that could only cope with the question text.

This commit introduces a new method that can handle displaying any
part of the question content.

This commit intentionally does not upgrade the parts of the system that
use the mecanism. That is so that this commit can be used to demonstrate
that backwards-compatibility works. The next commit will upgrade the
callers.
2013-07-26 13:10:08 +01:00

29 lines
1.5 KiB
Plaintext

This files describes API changes for code that uses the question API.
=== 2.6 ===
1) It is sometimes necessary to display bits of question content without having
and attempt (question_usage) in progress. Two examples of this are the option
in the question bank to display the questiontext, and in the quiz statistics
report, where it displays the question text above the report.
Previously, this display was done using a special method that only worked for
the question text, but which would not work for other parts of the question.
That old mechanism has been deprecated, and there is a new method that you
should use.
To display the question, replace calls to question_rewrite_questiontext_preview_urls
with calls to question_rewrite_question_preview_urls. Because the new function
is more flexibile, you have to pass more arguments.
To perform the necessary permission checks when the file is downloaded, you need
to implement the callback [component name]_question_preview_pluginfile.
(Previously you implemented [component name]_questiontext_preview_pluginfile.)
quiz_statistics_question_preview_pluginfile is an example of what to do.
question_send_questiontext_file has been deprecated. It is no longer necessary.
To ensure you are no longer using or defining any deprecated functions,
search for the regular expression:
question_rewrite_questiontext_preview_urls|_questiontext_preview_pluginfile|question_send_questiontext_file