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 401 and 402] [Versions 401 and 403]

(no description)

File Size: 1314 lines (56 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: user  - X-Ref

Class providing an API for the user report building and displaying.

__construct(int $courseid, ?object $gpr, object $context, int $userid, bool $viewasuser = null)   X-Ref
Constructor. Sets local copies of user preferences and initialises grade_tree.

param: int $courseid
param: null|object $gpr grade plugin return tracking object
param: object $context
param: int $userid The id of the user
param: bool $viewasuser Set this to true when the current user is a mentor/parent of the targetted user.

inject_rowspans(array &$element)   X-Ref
Recurse through a tree of elements setting the rowspan property on each element

param: array $element Either the top element or, during recursion, the current element
return: int The number of elements processed

setup_table()   X-Ref
Prepares the headers and attributes of the flexitable.


fill_table()   X-Ref
Provide an entry point to build the table.

return: bool

fill_table_recursive(array &$element)   X-Ref
Fill the table with data.

param: array $element - The table data for the current row.

fill_contributions_column(array $element)   X-Ref
This function is called after the table has been built and the aggregationhints
have been collected. We need this info to walk up the list of parents of each
grade_item.

param: array $element - An array containing the table data for the current row.

print_table(bool $return = false)   X-Ref
Prints or returns the HTML from the flexitable.

param: bool $return Whether or not to return the data instead of printing it directly.
return: string|void

process_data($data)   X-Ref
Processes the data sent by the form (grades and feedbacks).

param: array $data Take in some data to provide to the base function.
return: void Success or Failure (array of errors).

process_action($target, $action)   X-Ref
Stub function.

param: string $target
param: string $action
return: void

calculate_averages()   X-Ref
Builds the grade item averages.


output_report_zerostate()   X-Ref
Build the html for the zero state of the user report.

return: string HTML to display

viewed()   X-Ref
Trigger the grade_report_viewed event