Differences Between: [Versions 310 and 403] [Versions 311 and 403] [Versions 39 and 403] [Versions 400 and 403]
Contains class mod_h5pactivity\output\result
Copyright: | 2020 Ferran Recio |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 300 lines (9 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
result:: (11 methods):
__construct()
create_from_record()
decode_response()
export_for_template()
export_options()
get_optionslabel()
get_correctlabel()
get_answerlabel()
get_descriptions()
get_description()
get_answer()
__construct(stdClass $result) X-Ref |
Constructor. param: stdClass $result a h5pactivity_attempts_results record |
create_from_record(stdClass $result) X-Ref |
return the correct result output depending on the interactiontype param: stdClass $result h5pactivity_attempts_results record return: result|null the result output class if any |
decode_response(string $value) X-Ref |
Return a decoded response structure. param: string $value the current response structure return: array an array of reponses |
export_for_template(renderer_base $output) X-Ref |
Export this data so it can be used as the context for a mustache template. param: renderer_base $output return: stdClass |
export_options() X-Ref |
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: array of options |
get_optionslabel() X-Ref |
Return a label for result user options/choices. Specific result types can override this method to customize the result options table header. return: string to use in options table |
get_correctlabel() X-Ref |
Return a label for result user correct answer. Specific result types can override this method to customize the result options table header. return: string to use in options table |
get_answerlabel() X-Ref |
Return a label for result user attempt answer. Specific result types can override this method to customize the result options table header. return: string to use in options table |
get_descriptions(array $data) X-Ref |
Extract descriptions from array. param: array $data additional attribute to parse return: string[] the resulting strings |
get_description(stdClass $data) X-Ref |
Extract description from data element. param: stdClass $data additional attribute to parse return: string the resulting string |
get_answer(int $state, string $answer = null) X-Ref |
Return an answer data to show results. param: int $state the answer state param: string $answer the extra text to display (default null) return: stdClass with "answer" text and the state attribute to be displayed |