Moodle PHP Documentation 5.0
Moodle 5.0.1+ (Build: 20250711) (61af040cd5f)
|
The class for displaying the forum report table. More...
Public Member Functions | |
__construct (int $courseid, array $filters, bool $allowbulkoperations, bool $canseeprivatereplies, int $perpage, bool $canexport, bool $iscoursereport, bool $accessallforums) | |
Forum report table constructor. | |
add_filter (int $filtertype, array $values=[]) | |
Adds the relevant SQL to apply a filter to the report. | |
col_attachmentcount (\stdClass $data) | |
Generate the attachmentcount column. | |
col_earliestpost (\stdClass $data) | |
Generate the earliestpost column. | |
col_export (\stdClass $data) | |
Generate the export column. | |
col_fullname ($data) | |
Generate the fullname column. | |
col_latestpost (\stdClass $data) | |
Generate the latestpost column. | |
col_postcount (\stdClass $data) | |
Generate the postcount column. | |
col_replycount (\stdClass $data) | |
Generate the replycount column. | |
col_select ($data) | |
Generate the select column. | |
download ($format) | |
Download the summary report in the selected format. | |
get_perpage () | |
Fetch the number of items to be displayed per page. | |
out ($pagesize, $useinitialsbar, $downloadhelpbutton='') | |
Convenience method to call a number of methods for you to display the table. | |
print_nothing_to_display () | |
Override the default implementation to set a notification. | |
query_db ($pagesize, $useinitialsbar=false) | |
Query the db. | |
set_sql ($fields, $from, $where, array $params=[]) | |
Overriding the parent method because it should not be used here. | |
wrap_html_finish () | |
Overriding method to render the bulk actions and items per page pagination options directly below the table. | |
Protected Member Functions | |
apply_filters (array $filters) | |
Apply the relevant filters to the report. | |
create_log_summary_temp_table () | |
Creates a temp table to store summary data from the log table for this request. | |
define_base_filter_sql () | |
Instantiate the properties to store filter values. | |
define_base_sql () | |
Define the object to store all for the table SQL and initialises the base SQL required. | |
define_table_configs () | |
Define various table config options. | |
drop_log_summary_temp_table () | |
Drops the temp table. | |
fill_log_summary_temp_table () | |
Fills the log summary temp table. | |
get_filter_groups (array $groups) | |
Get the final list of groups to filter by, based on the groups submitted, and those the user has access to. | |
get_filter_name (int $filtertype) | |
Provides the string name of each filter type, to be used by errors. | |
get_full_sql (bool $fullselect=true) | |
Prepares a complete SQL statement from the base query and any filters defined. | |
get_internal_log_reader () | |
Returns an internal and enabled log reader. | |
set_forum_properties (array $forumids) | |
Sets properties that are determined by forum filter values. | |
show_word_char_counts () | |
Protected Attributes | |
bool | $accessallforums = false |
True if user has access to all forums in the course (and is running course report), otherwise false. | |
bool | $allowbulkoperations = false |
Whether the user has the capability/capabilities to perform bulk operations. | |
bool | $canseeprivatereplies |
Whether the user can see all private replies or not. | |
stdClass | $cms = [] |
The course module object(s) of the forum(s) being reported on. | |
int | $courseid |
The course ID containing the forum(s) being reported on. | |
array | $exportfilterdata = [] |
Validated filter data, for use in GET parameters by export links. | |
array | $forumcontexts = [] |
of context objects for the forums included in the report. | |
bool | $iscoursereport = false |
True if reporting on all forums in course user has access to, false if reporting on a single forum. | |
core log sql_reader null | $logreader = null |
int | $perpage = self::DEFAULT_PER_PAGE |
The number of rows to be displayed per page. | |
array | $perpageoptions = [50, 100, 200] |
The values available for pagination size per page. | |
context_course context_module | $userfieldscontext = null |
The context where the report is being run (either a specific forum or the course). | |
int | $userid |
The user ID if only one user's summary will be generated. | |
The class for displaying the forum report table.
forumreport_summary\summary_table::__construct | ( | int | $courseid, |
array | $filters, | ||
bool | $allowbulkoperations, | ||
bool | $canseeprivatereplies, | ||
int | $perpage, | ||
bool | $canexport, | ||
bool | $iscoursereport, | ||
bool | $accessallforums ) |
Forum report table constructor.
int | $courseid | The ID of the course the forum(s) exist within. |
array | $filters | Report filters in the format 'type' => [values]. |
bool | $allowbulkoperations | Is the user allowed to perform bulk operations? |
bool | $canseeprivatereplies | Whether the user can see all private replies or not. |
int | $perpage | The number of rows to display per page. |
bool | $canexport | Is the user allowed to export records? |
bool | $iscoursereport | Whether the user is running a course level report |
bool | $accessallforums | If user is running a course level report, do they have access to all forums in the course? |
forumreport_summary\summary_table::add_filter | ( | int | $filtertype, |
array | $values = [] ) |
Adds the relevant SQL to apply a filter to the report.
int | $filtertype | Filter type as defined by class constants. |
array | $values | Optional array of values passed into the filter type. |
void |
coding_exception |
|
protected |
Apply the relevant filters to the report.
array | $filters | Report filters in the format 'type' => [values]. |
void. |
forumreport_summary\summary_table::col_attachmentcount | ( | \stdClass | $data | ) |
Generate the attachmentcount column.
stdClass | $data | The row data. |
int | number of files attached to posts by user. |
forumreport_summary\summary_table::col_earliestpost | ( | \stdClass | $data | ) |
Generate the earliestpost column.
stdClass | $data | The row data. |
string | Timestamp of user's earliest post, or a dash if no posts exist. |
forumreport_summary\summary_table::col_export | ( | \stdClass | $data | ) |
Generate the export column.
stdClass | $data | The row data. |
string | The link to export content belonging to the row. |
forumreport_summary\summary_table::col_fullname | ( | $data | ) |
Generate the fullname column.
stdClass | $data | The row data. |
string | User's full name. |
forumreport_summary\summary_table::col_latestpost | ( | \stdClass | $data | ) |
Generate the latestpost column.
stdClass | $data | The row data. |
string | Timestamp of user's most recent post, or a dash if no posts exist. |
forumreport_summary\summary_table::col_postcount | ( | \stdClass | $data | ) |
Generate the postcount column.
stdClass | $data | The row data. |
int | number of discussion posts made by user. |
forumreport_summary\summary_table::col_replycount | ( | \stdClass | $data | ) |
Generate the replycount column.
stdClass | $data | The row data. |
int | number of replies made by user. |
forumreport_summary\summary_table::col_select | ( | $data | ) |
Generate the select column.
stdClass | $data |
string |
|
protected |
Creates a temp table to store summary data from the log table for this request.
null |
|
protected |
Instantiate the properties to store filter values.
void. |
|
protected |
Define the object to store all for the table SQL and initialises the base SQL required.
void. |
|
protected |
Define various table config options.
void. |
forumreport_summary\summary_table::download | ( | $format | ) |
Download the summary report in the selected format.
string | $format | The format to download the report. |
|
protected |
Drops the temp table.
This should be called once the processing for the summary table has been done.
|
protected |
Fills the log summary temp table.
null |
|
protected |
Get the final list of groups to filter by, based on the groups submitted, and those the user has access to.
array | $groups | The group IDs submitted. |
array | Group objects of groups to use in groups filter. If no filtering required (all groups selected), returns []. |
|
protected |
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.
int | $filtertype | Type of filter |
string | Name of the filter |
|
protected |
Prepares a complete SQL statement from the base query and any filters defined.
bool | $fullselect | Whether to select all relevant columns. False selects a count only (used to calculate pagination). |
string | The complete SQL statement. |
|
protected |
Returns an internal and enabled log reader.
core::log::sql_reader|false |
forumreport_summary\summary_table::get_perpage | ( | ) |
Fetch the number of items to be displayed per page.
int |
forumreport_summary\summary_table::out | ( | $pagesize, | |
$useinitialsbar, | |||
$downloadhelpbutton = '' ) |
Convenience method to call a number of methods for you to display the table.
Overrides the parent so SQL for filters is handled.
int | $pagesize | Number of rows to fetch. |
bool | $useinitialsbar | Whether to include the initials bar with the table. |
string | $downloadhelpbutton | Unused. |
void. |
forumreport_summary\summary_table::print_nothing_to_display | ( | ) |
Override the default implementation to set a notification.
void. |
forumreport_summary\summary_table::query_db | ( | $pagesize, | |
$useinitialsbar = false ) |
Query the db.
Store results in the table object for use by build_table.
int | $pagesize | Size of page for paginated displayed table. |
bool | $useinitialsbar | Overridden but unused. |
void |
|
protected |
Sets properties that are determined by forum filter values.
array | $forumids | The forum IDs passed in by the filter. |
void |
forumreport_summary\summary_table::set_sql | ( | $fields, | |
$from, | |||
$where, | |||
array | $params = [] ) |
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.
string | $fields | Unused. |
string | $from | Unused. |
string | $where | Unused. |
array | $params | Unused. |
void. |
coding_exception |
forumreport_summary\summary_table::wrap_html_finish | ( | ) |
Overriding method to render the bulk actions and items per page pagination options directly below the table.
void |
|
protected |
The user ID if only one user's summary will be generated.
This will apply to users without permission to view others' summaries.