Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

Differences Between: [Versions 310 and 402] [Versions 311 and 402] [Versions 39 and 402] [Versions 400 and 402] [Versions 401 and 402]

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.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

create_item_pagebreak($feedback)   X-Ref
Create pagebreak.

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

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.

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

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

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

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.

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