GiftExporter
in package
Serialize a Quiz1 quiz as Moodle GIFT text.
GIFT has no pattern-match profile. Those questions are written as short answer (fill in the blank) and come back as fill_blank on import.
Table of Contents
Methods
- escape() : mixed
- Escape GIFT control characters.
- export() : string
- answerBlock() : mixed
- commentLine() : mixed
- formatGiftWeight() : mixed
- multipleResponseWeights() : array<int, float>
- Positive weights on correct answers sum to 100. Each incorrect is -100 so a wrong selection zeros the Moodle score (Quiz1 is all-or-nothing).
- plainOrHtml() : mixed
- promptText() : mixed
- question() : mixed
- trueFalseBlock() : mixed
- Moodle GIFT: {T#incorrect#correct} or {F#incorrect#correct}.
Methods
escape()
Escape GIFT control characters.
public
static escape(mixed $text) : mixed
Parameters
- $text : mixed
export()
public
static export(Quiz1 $quiz) : string
Parameters
- $quiz : Quiz1
Tags
Return values
string —UTF-8 GIFT
answerBlock()
private
static answerBlock(Question $question) : mixed
Parameters
- $question : Question
commentLine()
private
static commentLine(mixed $text) : mixed
Parameters
- $text : mixed
formatGiftWeight()
private
static formatGiftWeight(mixed $weight) : mixed
Parameters
- $weight : mixed
multipleResponseWeights()
Positive weights on correct answers sum to 100. Each incorrect is -100 so a wrong selection zeros the Moodle score (Quiz1 is all-or-nothing).
private
static multipleResponseWeights(Question $question) : array<int, float>
Parameters
- $question : Question
Return values
array<int, float> —index in nonEmptyAnswers() => weight
plainOrHtml()
private
static plainOrHtml(mixed $html) : mixed
Parameters
- $html : mixed
promptText()
private
static promptText(mixed $prompt) : mixed
Parameters
- $prompt : mixed
question()
private
static question(Question $question) : mixed
Parameters
- $question : Question
trueFalseBlock()
Moodle GIFT: {T#incorrect#correct} or {F#incorrect#correct}.
private
static trueFalseBlock(Question $question) : mixed
Parameters
- $question : Question