Tsugi

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

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

trueFalseBlock()

Moodle GIFT: {T#incorrect#correct} or {F#incorrect#correct}.

private static trueFalseBlock(Question $question) : mixed
Parameters
$question : Question

        
On this page

Search results