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

(no description)

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

Defines 1 class

custom_report_table:: (12 methods):
  __construct()
  create()
  get_sort_columns()
  format_row()
  download_buttons()
  get_active_columns()
  print_headers()
  print_nothing_to_display()
  wrap_html_finish()
  get_row_cells_html()
  out()
  show_live_editing()


Class: custom_report_table  - X-Ref

Custom report dynamic table class

__construct(string $uniqueid, string $download = '')   X-Ref
Table constructor. Note that the passed unique ID value must match the pattern "custom-report-table-(\d+)" so that
dynamic updates continue to load the same report

param: string $uniqueid
param: string $download

create(int $reportid, string $download = '')   X-Ref
Return a new instance of the class for given report ID

param: int $reportid
param: string $download
return: static

get_sort_columns()   X-Ref
Get user preferred sort columns, overriding those of parent. If user has no preferences then use report defaults

return: array

format_row($row)   X-Ref
Format each row of returned data, executing defined callbacks for the row and each column

param: array|stdClass $row
return: array

download_buttons()   X-Ref
Download is disabled when editing the report

return: string

get_active_columns()   X-Ref
Get the columns of the custom report, returned instances being valid and available for the user

return: column[]

print_headers()   X-Ref
Override parent method for printing headers so we can render our custom controls in each cell


print_nothing_to_display()   X-Ref
Override print_nothing_to_display to ensure that column headers are always added.


wrap_html_finish()   X-Ref
Provide additional table debugging during editing


get_row_cells_html(string $rowid, array $row, ?array $suppresslastrow)   X-Ref
Override get_row_cells_html to add an extra cell with the toggle button for card view.

param: string $rowid
param: array $row
param: array|null $suppresslastrow
return: string

out($pagesize, $useinitialsbar, $downloadhelpbutton = '')   X-Ref
Overriding this method to handle live editing setting.

param: int $pagesize
param: bool $useinitialsbar
param: string $downloadhelpbutton

show_live_editing()   X-Ref
Whether or not report data should be included in the table while in editing mode

return: bool