Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 310 and 401] [Versions 401 and 402] [Versions 401 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.

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

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

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

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

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

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

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

create_item_pagebreak($feedback)   X-Ref
Create pagebreak.

param: object $feedback feedback record
return: mixed 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