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
| Property | Returns | Description |
|---|---|---|
| actualAnswers | 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. |
| batchMode | String | How questions are batched for presentation, as configured on the quiz page. |
| batchSize | Integer | The number of questions per batch, as configured on the quiz page. |
| body | String | The raw HTML body of the quiz page, used to look up question and answer wording. |
| name | String | The name of the quiz resource, as passed to ModuleFolder.getQuizInfo(String). |
| quizHtml | Source | |
| title | String | Display 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.
| Parameter | Description |
|---|---|
defaultVal | the 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.
| Parameter | Description |
|---|---|
defaultVal | the 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.
| Parameter | Description |
|---|---|
questionCode | the 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.
| Parameter | Description |
|---|---|
questionCode | the question's element class / id in the quiz HTML, used only as the cache key prefix |
answerCode | the answer option's code, used to find its label element |