Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
mod_h5pactivity\output\result\other Class Reference

Class to display H5P other result. More...

Inheritance diagram for mod_h5pactivity\output\result\other:
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 other 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\other::export_for_template ( renderer_base $output)

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

Parameters
renderer_base$output
Return values
stdClass

Reimplemented from mod_h5pactivity\output\result.

◆ export_options()

mod_h5pactivity\output\result::export_options ( )
protectedinherited

Return the options data structure.

Result types have to override this method generate a specific options report.

An option is an object with:

  • id: the option ID
  • description: option description text
  • useranswer (optional): what the user answer (see get_answer method)
  • correctanswer (optional): the correct answer (see get_answer method)
Return values
arrayof options

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

◆ 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: