Qti12Exporter
in package
Serialize a Quiz1 quiz as Common Cartridge QTI 1.2.1 assessment XML.
Target: IMS Common Cartridge 1.2 assessment profile of QTI 1.2.1 — not a generic QTI 1.2 serializer. Generic Setup export stays spec-only. Canvas Setup may add question_type / points_possible item metadata.
Mappings (internal type → cc_profile): multiple_choice → cc.multiple_choice.v0p1 response_lid Single multiple_response → cc.multiple_response.v0p1 response_lid Multiple, all-or-nothing true_false → cc.true_false.v0p1 response_lid Single fill_blank → cc.fib.v0p1 response_str + varequal case="No" pattern_match → cc.pattern_match.v0p1 response_str + varsubstring essay → cc.essay.v0p1 response_str, not computer-scored
QTI ident values are derived from Quiz1 database ids at export time. They are not stored and must not be used as primary keys.
Table of Contents
Constants
- NS : mixed = \Tsugi\Util\CC::QTI_NS
- RESPONSE_IDENT : mixed = 'response'
- SCHEMA : mixed = \Tsugi\Util\CC::QTI_SCHEMA_LOCATION
Methods
- answerIdent() : mixed
- canvasQuestionType() : mixed
- export() : string
- itemIdent() : mixed
- quizIdent() : mixed
- withPatternMatchAsFib() : mixed
- Canvas does not implement cc.pattern_match.v0p1; it remaps those items to Fill in the Blank and warns. Emit FIB ourselves for Canvas exports.
- addChoicePresentation() : mixed
- addFibPresentation() : mixed
- addMetaField() : mixed
- fillCorrectCondition() : mixed
- item() : mixed
- itemFeedback() : mixed
- itemSolutionFeedback() : mixed
- CC QTI essay sample solution: itemfeedback/solution/solutionmaterial/material/mattext
- mattext() : mixed
- CC requires mattext content in CDATA. text/html when markup is present.
- resprocessing() : mixed
- textEl() : mixed
Constants
NS
public
mixed
NS
= \Tsugi\Util\CC::QTI_NS
RESPONSE_IDENT
public
mixed
RESPONSE_IDENT
= 'response'
SCHEMA
public
mixed
SCHEMA
= \Tsugi\Util\CC::QTI_SCHEMA_LOCATION
Methods
answerIdent()
public
static answerIdent(Answer $answer) : mixed
Parameters
- $answer : Answer
canvasQuestionType()
public
static canvasQuestionType(mixed $type) : mixed
Parameters
- $type : mixed
export()
public
static export(Quiz1 $quiz[, array{pattern_match_as_fib?: bool, assessment_ident?: string, canvas_item_metadata?: bool, schema_location?: string} $options = array() ]) : string
Parameters
- $quiz : Quiz1
- $options : array{pattern_match_as_fib?: bool, assessment_ident?: string, canvas_item_metadata?: bool, schema_location?: string} = array()
Tags
Return values
string —UTF-8 XML
itemIdent()
public
static itemIdent(Question $question) : mixed
Parameters
- $question : Question
quizIdent()
public
static quizIdent(Quiz1 $quiz) : mixed
Parameters
- $quiz : Quiz1
withPatternMatchAsFib()
Canvas does not implement cc.pattern_match.v0p1; it remaps those items to Fill in the Blank and warns. Emit FIB ourselves for Canvas exports.
public
static withPatternMatchAsFib(Quiz1 $quiz) : mixed
Generic/Sakai keep varsubstring pattern match.
Parameters
- $quiz : Quiz1
addChoicePresentation()
private
static addChoicePresentation(DOMDocument $dom, DOMElement $presentation, Question $question) : mixed
Parameters
- $dom : DOMDocument
- $presentation : DOMElement
- $question : Question
addFibPresentation()
private
static addFibPresentation(DOMDocument $dom, DOMElement $presentation, Question $question) : mixed
Parameters
- $dom : DOMDocument
- $presentation : DOMElement
- $question : Question
addMetaField()
private
static addMetaField(DOMDocument $dom, DOMElement $qtimetadata, mixed $label, mixed $entry) : mixed
Parameters
- $dom : DOMDocument
- $qtimetadata : DOMElement
- $label : mixed
- $entry : mixed
fillCorrectCondition()
private
static fillCorrectCondition(DOMDocument $dom, DOMElement $cv, Question $question) : mixed
Parameters
- $dom : DOMDocument
- $cv : DOMElement
- $question : Question
item()
private
static item(DOMDocument $dom, Question $question[, mixed $canvas_meta = false ]) : mixed
Parameters
- $dom : DOMDocument
- $question : Question
- $canvas_meta : mixed = false
itemFeedback()
private
static itemFeedback(DOMDocument $dom, mixed $ident, mixed $html) : mixed
Parameters
- $dom : DOMDocument
- $ident : mixed
- $html : mixed
itemSolutionFeedback()
CC QTI essay sample solution: itemfeedback/solution/solutionmaterial/material/mattext
private
static itemSolutionFeedback(DOMDocument $dom, mixed $html) : mixed
Parameters
- $dom : DOMDocument
- $html : mixed
mattext()
CC requires mattext content in CDATA. text/html when markup is present.
private
static mattext(DOMDocument $dom, mixed $content) : mixed
Parameters
- $dom : DOMDocument
- $content : mixed
resprocessing()
private
static resprocessing(DOMDocument $dom, Question $question) : mixed
Parameters
- $dom : DOMDocument
- $question : Question
textEl()
private
static textEl(DOMDocument $dom, mixed $name, mixed $text) : mixed
Parameters
- $dom : DOMDocument
- $name : mixed
- $text : mixed