Moodle PHP Documentation 4.3
Moodle 4.3.5 (Build: 20240610) (7dcfaa79f78)
mod_h5pactivity\output\result\choice Class Reference

Class to display H5P choice result. More...

Inheritance diagram for mod_h5pactivity\output\result\choice:
mod_h5pactivity\output\result renderable templatable

Public Member Functions

 export_for_template (renderer_base $output)
 Export this data so it can be used as the context for a mustache template.
 

Static Public Member Functions

static create_from_record (stdClass $result)
 return the correct result output depending on the interactiontype
 

Public Attributes

const CHECKED = 3
 Checked answer state.
 
const CORRECT = 1
 Correct answer state.
 
const FAIL = 6
 Pass answer state.
 
const INCORRECT = 2
 Incorrect answer state.
 
const PASS = 5
 Pass answer state.
 
const TEXT = 8
 Text answer state.
 
const UNCHECKED = 4
 Unchecked answer state.
 
const UNKNOWN = 7
 Unknown answer state.
 

Protected Member Functions

 export_options ()
 Return the options data structure.
 
 get_answer (int $state, string $answer=null)
 Return an answer data to show results.
 
 get_answerlabel ()
 Return a label for result user attempt answer.
 
 get_correctlabel ()
 Return a label for result user correct answer.
 
 get_description (stdClass $data)
 Extract description from data element.
 
 get_descriptions (array $data)
 Extract descriptions from array.
 
 get_optionslabel ()
 Return a label for result user options/choices.
 

Protected Attributes

mixed $additionals
 additional decoded data
 
mixed $correctpattern = []
 correctpattern decoded data
 
mixed $response
 response decoded data
 
stdClass $result
 result record
 

Detailed Description

Class to display H5P choice result.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Member Function Documentation

◆ create_from_record()

static mod_h5pactivity\output\result::create_from_record ( stdClass $result)
staticinherited

return the correct result output depending on the interactiontype

Parameters
stdClass$resulth5pactivity_attempts_results record
Return values
result|nullthe result output class if any

◆ export_for_template()

mod_h5pactivity\output\result::export_for_template ( renderer_base $output)
inherited

Export this data so it can be used as the context for a mustache template.

Parameters
renderer_base$output
Return values
stdClass

Implements templatable.

Reimplemented in mod_h5pactivity\output\result\longfillin, and mod_h5pactivity\output\result\other.

◆ export_options()

mod_h5pactivity\output\result\choice::export_options ( )
protected

Return the options data structure.

Return values
arrayof options

Reimplemented from mod_h5pactivity\output\result.

◆ get_answer()

mod_h5pactivity\output\result::get_answer ( int $state,
string $answer = null )
protectedinherited

Return an answer data to show results.

Parameters
int$statethe answer state
string$answerthe extra text to display (default null)
Return values
stdClasswith "answer" text and the state attribute to be displayed

◆ get_answerlabel()

mod_h5pactivity\output\result::get_answerlabel ( )
protectedinherited

Return a label for result user attempt answer.

Specific result types can override this method to customize the result options table header.

Return values
stringto use in options table

◆ get_correctlabel()

mod_h5pactivity\output\result::get_correctlabel ( )
protectedinherited

Return a label for result user correct answer.

Specific result types can override this method to customize the result options table header.

Return values
stringto use in options table

Reimplemented in mod_h5pactivity\output\result\sequencing.

◆ get_description()

mod_h5pactivity\output\result::get_description ( stdClass $data)
protectedinherited

Extract description from data element.

Parameters
stdClass$dataadditional attribute to parse
Return values
stringthe resulting string

◆ get_descriptions()

mod_h5pactivity\output\result::get_descriptions ( array $data)
protectedinherited

Extract descriptions from array.

Parameters
array$dataadditional attribute to parse
Return values
string[]the resulting strings

◆ get_optionslabel()

mod_h5pactivity\output\result::get_optionslabel ( )
protectedinherited

Return a label for result user options/choices.

Specific result types can override this method to customize the result options table header.

Return values
stringto use in options table

Reimplemented in mod_h5pactivity\output\result\fillin, mod_h5pactivity\output\result\matching, and mod_h5pactivity\output\result\sequencing.


The documentation for this class was generated from the following file: