Holds the parsed content and settings of one quiz page: its title, marking rules and correct answers, plus the raw quiz HTML for looking up question and answer wording on demand. An instance is built once per quiz by ModuleFolder.getQuizInfo(String) from the quiz's rendered page - the title, maxAttempts, passMarkPerc and batchMode/batchSize parameters, and the correct answer for each "answer..." parameter - and is then used both to mark submitted quiz attempts and to render a completed attempt back to the user with its original question and answer text.


Properties

PropertyReturnsDescription
actualAnswersMap<String,String>The correct answer for each answer field in the quiz, keyed by answer parameter name (e.g. "answer1"). Used to mark a submitted attempt.
batchModeStringHow questions are batched for presentation, as configured on the quiz page.
batchSizeIntegerThe number of questions per batch, as configured on the quiz page.
bodyStringThe raw HTML body of the quiz page, used to look up question and answer wording.
nameStringThe name of the quiz resource, as passed to ModuleFolder.getQuizInfo(String).
quizHtmlSource
titleStringDisplay title of the quiz page.

Methods

getActualAnswers() · getMaxAttempts(int defaultVal) · getPassMark(int defaultVal) · getBatchMode() · getBatchSize() · getBody() · getName() · getTitle() · getQuestionText(String questionCode) · getAnswerText(String questionCode, String answerCode)

getActualAnswers()

Returns: Map<String,String>

The correct answer for each answer field in the quiz, keyed by answer parameter name (e.g. "answer1"). Used to mark a submitted attempt.

getMaxAttempts(int defaultVal)

Returns: int

The maximum number of times a profile may attempt this quiz, as configured on the quiz page.

ParameterDescription
defaultValthe value to return if the quiz page does not configure a maximum

getPassMark(int defaultVal)

Returns: Integer

The pass mark for this quiz, as a percentage, as configured on the quiz page.

ParameterDescription
defaultValthe value to return if the quiz page does not configure a pass mark

getBatchMode()

Returns: String

How questions are batched for presentation, as configured on the quiz page.

getBatchSize()

Returns: Integer

The number of questions per batch, as configured on the quiz page.

getBody()

Returns: String

The raw HTML body of the quiz page, used to look up question and answer wording.

getName()

Returns: String

The name of the quiz resource, as passed to ModuleFolder.getQuizInfo(String).

getTitle()

Returns: String

Display title of the quiz page.

getQuestionText(String questionCode)

Returns: String

Looks up the wording of a question by parsing the quiz HTML and finding the list item element for the given question code, caching the result for subsequent calls.

ParameterDescription
questionCodethe question's element class / id in the quiz HTML

getAnswerText(String questionCode, String answerCode)

Returns: String

Looks up the wording of an answer option by parsing the quiz HTML and finding the label for the given answer code, caching the result for subsequent calls.

ParameterDescription
questionCodethe question's element class / id in the quiz HTML, used only as the cache key prefix
answerCodethe answer option's code, used to find its label element
To get full access to the Kademi Hub existing customers can login here, or new customers can register here.