Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Differences Between: [Versions 310 and 400] [Versions 400 and 402] [Versions 400 and 403]

mod_feedback data generator.

Copyright: 2013 Ankit Agarwal
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 553 lines (19 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: mod_feedback_generator  - X-Ref

mod_feedback data generator class.

create_instance($record = null, array $options = null)   X-Ref
No description

create_question(array $data)   X-Ref
Create question.

return: mixed Question instance
param: array $data Question data

create_response(array $data)   X-Ref
Create response.

return: stdClass feedback_completed response instance.
param: array $data Response data.

create_item_info($feedback, $record = array()   X-Ref
Create info question item.

return: int
param: object $feedback feedback record
param: array $record (optional) to override default values

create_item_label($feedback, $record = array()   X-Ref
Create label question item.

return: int
param: object $feedback feedback record
param: array $record (optional) to override default values

create_item_multichoice($feedback, $record = array()   X-Ref
Create multichoice question item.

return: int
param: object $feedback feedback record
param: array $record (optional) to override default values

create_item_multichoicerated($feedback, $record = array()   X-Ref
Create multichoicerated question item.

return: int
param: object $feedback feedback record
param: array $record (optional) to override default values

create_item_numeric($feedback, $record = array()   X-Ref
Create numeric question item.

return: int
param: object $feedback feedback record
param: array $record (optional) to override default values

create_item_textarea($feedback, $record = array()   X-Ref
Create textarea question item.

return: int
param: object $feedback feedback record
param: array $record (optional) to override default values

create_item_textfield($feedback, $record = array()   X-Ref
Create textfield question item.

return: int
param: object $feedback feedback record
param: array $record (optional) to override default values

create_item_pagebreak($feedback)   X-Ref
Create pagebreak.

return: mixed false if there already is a pagebreak on last position or the id of the pagebreak-item
param: object $feedback feedback record

format_item_values(string $questiontype, string $values)   X-Ref
Format feedback item values.

This method will replace newline characters with the proper line separator for each question type.

return: string Formatted values
param: string $questiontype Question types
param: string $values Values

get_item_response_value($record, string $response)   X-Ref
Given a response to a feedback item, return its corresponding value.

return: int|string Response value
param: mixed $record Item record
param: string $response Response name

get_choice_item_response_value(feedback_item_base $item, $record, string $response, int $offset = 1)   X-Ref
Given a response to a feedback choice item, return its corresponding value.

return: int Response choice index
param: feedback_item_base $item Feedback item
param: mixed $record Item record
param: string $response Response
param: int $offset Choice to start looking from