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

The class for displaying the forum report table.

Copyright: 2019 Michael Hawkins <michaelh@moodle.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 1037 lines (39 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: summary_table  - X-Ref

The class for displaying the forum report table.

__construct(int $courseid, array $filters, bool $allowbulkoperations,bool $canseeprivatereplies, int $perpage, bool $canexport, bool $iscoursereport, bool $accessallforums)   X-Ref
Forum report table constructor.

param: int $courseid The ID of the course the forum(s) exist within.
param: array $filters Report filters in the format 'type' => [values].
param: bool $allowbulkoperations Is the user allowed to perform bulk operations?
param: bool $canseeprivatereplies Whether the user can see all private replies or not.
param: int $perpage The number of rows to display per page.
param: bool $canexport Is the user allowed to export records?
param: bool $iscoursereport Whether the user is running a course level report
param: bool $accessallforums If user is running a course level report, do they have access to all forums in the course?

set_forum_properties(array $forumids)   X-Ref
Sets properties that are determined by forum filter values.

param: array $forumids The forum IDs passed in by the filter.
return: void

get_filter_name(int $filtertype)   X-Ref
Provides the string name of each filter type, to be used by errors.
Note: This does not use language strings as the value is injected into error strings.

param: int $filtertype Type of filter
return: string Name of the filter

col_select($data)   X-Ref
Generate the select column.

param: \stdClass $data
return: string

col_fullname($data)   X-Ref
Generate the fullname column.

param: \stdClass $data The row data.
return: string User's full name.

col_postcount(\stdClass $data)   X-Ref
Generate the postcount column.

param: \stdClass $data The row data.
return: int number of discussion posts made by user.

col_replycount(\stdClass $data)   X-Ref
Generate the replycount column.

param: \stdClass $data The row data.
return: int number of replies made by user.

col_attachmentcount(\stdClass $data)   X-Ref
Generate the attachmentcount column.

param: \stdClass $data The row data.
return: int number of files attached to posts by user.

col_earliestpost(\stdClass $data)   X-Ref
Generate the earliestpost column.

param: \stdClass $data The row data.
return: string Timestamp of user's earliest post, or a dash if no posts exist.

col_latestpost(\stdClass $data)   X-Ref
Generate the latestpost column.

param: \stdClass $data The row data.
return: string Timestamp of user's most recent post, or a dash if no posts exist.

col_export(\stdClass $data)   X-Ref
Generate the export column.

param: \stdClass $data The row data.
return: string The link to export content belonging to the row.

print_nothing_to_display()   X-Ref
Override the default implementation to set a decent heading level.

return: void.

query_db($pagesize, $useinitialsbar = false)   X-Ref
Query the db. Store results in the table object for use by build_table.

param: int $pagesize Size of page for paginated displayed table.
param: bool $useinitialsbar Overridden but unused.
return: void

add_filter(int $filtertype, array $values = [])   X-Ref
Adds the relevant SQL to apply a filter to the report.

param: int $filtertype Filter type as defined by class constants.
param: array $values Optional array of values passed into the filter type.
return: void

define_table_configs()   X-Ref
Define various table config options.

return: void.

define_base_sql()   X-Ref
Define the object to store all for the table SQL and initialises the base SQL required.

return: void.

define_base_filter_sql()   X-Ref
Instantiate the properties to store filter values.

return: void.

set_sql($fields, $from, $where, array $params = [])   X-Ref
Overriding the parent method because it should not be used here.
Filters are applied, so the structure of $this->sql is now different to the way this is set up in the parent.

param: string $fields Unused.
param: string $from Unused.
param: string $where Unused.
param: array $params Unused.
return: void.

out($pagesize, $useinitialsbar, $downloadhelpbutton = '')   X-Ref
Convenience method to call a number of methods for you to display the table.
Overrides the parent so SQL for filters is handled.

param: int $pagesize Number of rows to fetch.
param: bool $useinitialsbar Whether to include the initials bar with the table.
param: string $downloadhelpbutton Unused.
return: void.

apply_filters(array $filters)   X-Ref
Apply the relevant filters to the report.

param: array $filters Report filters in the format 'type' => [values].
return: void.

get_full_sql(bool $fullselect = true)   X-Ref
Prepares a complete SQL statement from the base query and any filters defined.

param: bool $fullselect Whether to select all relevant columns.
return: string The complete SQL statement.

get_internal_log_reader()   X-Ref
Returns an internal and enabled log reader.

return: \core\log\sql_reader|false

fill_log_summary_temp_table()   X-Ref
Fills the log summary temp table.

return: null

create_log_summary_temp_table()   X-Ref
Creates a temp table to store summary data from the log table for this request.

return: null

drop_log_summary_temp_table()   X-Ref
Drops the temp table.

This should be called once the processing for the summary table has been done.

get_filter_groups(array $groups)   X-Ref
Get the final list of groups to filter by, based on the groups submitted,
and those the user has access to.

param: array $groups The group IDs submitted.
return: array Group objects of groups to use in groups filter.

download($format)   X-Ref
Download the summary report in the selected format.

param: string $format The format to download the report.

show_word_char_counts()   X-Ref
No description

get_perpage()   X-Ref
Fetch the number of items to be displayed per page.

return: int

wrap_html_finish()   X-Ref
Overriding method to render the bulk actions and items per page pagination options directly below the table.

return: void