Moodle PHP Documentation 4.3
Moodle 4.3.5 (Build: 20240610) (7dcfaa79f78)
forumreport_summary\summary_table Class Reference

The class for displaying the forum report table. More...

Inheritance diagram for forumreport_summary\summary_table:
table_sql flexible_table

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_data ($row, $classname='')
 This method actually directly echoes the row passed to it now or adds it to the download.
 
 add_data_keyed ($rowwithkeys, $classname='')
 Add a row of data to the table.
 
 add_filter (int $filtertype, array $values=[])
 Adds the relevant SQL to apply a filter to the report.
 
 add_separator ()
 Add a seperator line to table.
 
 build_table ()
 Build the table from the fetched data.
 
 close_recordset ()
 Closes recordset (for use after building the table).
 
 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.
 
 collapsible ($bool)
 Sets the is_collapsible variable to the given boolean.
 
 column_class ($column, $classname)
 Sets the given $column index to the given $classname in $this->column_class.
 
 column_sticky (string $column, bool $sticky=true)
 Sets a sticky attribute to a column.
 
 column_style ($column, $property, $value)
 Sets the given $column index and $property index to the given $value in $this->column_style.
 
 column_style_all ($property, $value)
 Sets all columns' $propertys to the given $value in $this->column_style.
 
 column_suppress ($column)
 What this method does is set the column so that if the same data appears in consecutive rows, then it is not repeated.
 
 define_baseurl ($url)
 Sets $this->baseurl.
 
 define_columns ($columns)
 
 define_header_column (string $column)
 Mark a specific column as being a table header using the column name defined in define_columns.
 
 define_headers ($headers)
 
 define_help_for_headers ($helpicons)
 Defines a help icon for the header.
 
 download ($format)
 Download the summary report in the selected format.
 
 download_buttons ()
 Get the html for the download buttons.
 
 export_class_instance ($exportclass=null)
 Get, and optionally set, the export class.
 
 finish_html ()
 This function is not part of the public api.
 
 finish_output ($closeexportclassdoc=true)
 You should call this to finish outputting the table data after adding data to the table with add_data or add_data_keyed.
 
 format_and_add_array_of_rows ($rowstoadd, $finish=true)
 Add a number of rows to the table at once.
 
 format_row ($row)
 Call appropriate methods on this table class to perform any processing on values before displaying in table.
 
 format_text ($text, $format=FORMAT_MOODLE, $options=NULL, $courseid=NULL)
 Used from col_* functions when text is to be displayed.
 
 get_context ()
 Get the context for the table.
 
 get_default_per_page ()
 Get the default per page.
 
 get_filterset ()
 Get the currently defined filterset.
 
 get_initial_first ()
 This function is not part of the public api.
 
 get_initial_last ()
 This function is not part of the public api.
 
 get_page_size ()
 
 get_page_start ()
 
 get_perpage ()
 Fetch the number of items to be displayed per page.
 
 get_row_cells_html (string $rowid, array $row, ?array $suppresslastrow)
 Generate html code for the row cells.
 
 get_row_class ($row)
 Get any extra classes names to add to this row in the HTML.
 
 get_row_from_keyed ($rowwithkeys)
 This function is not part of the public api.
 
 get_row_html ($row, $classname='')
 Generate html code for the passed row.
 
 get_sort_columns ()
 Get the columns to sort by, in the form required by construct_order_by().
 
 get_sql_sort ()
 
 get_sql_where ()
 
 guess_base_url ()
 Attempt to guess the base URL.
 
 initialbars ($bool)
 Sets the use_initials variable to the given boolean.
 
 is_downloadable ($downloadable=null)
 Probably don't need to call this directly.
 
 is_downloading ($download=null, $filename='', $sheettitle='')
 Call this to pass the download type.
 
 is_persistent ($persistent=null)
 Call with boolean true to store table layout changes in the user_preferences table.
 
 is_sortable ($column=null)
 Is the column sortable?
 
 make_styles_string ($styles)
 This function is not part of the public api.
 
 mark_table_to_reset ()
 Mark the table preferences to be reset.
 
 no_sorting ($column)
 Do not sort using this column.
 
 other_cols ($column, $row)
 You can override this method in a child class.
 
 out ($pagesize, $useinitialsbar, $downloadhelpbutton='')
 Convenience method to call a number of methods for you to display the table.
 
 pageable ($bool)
 Sets the use_pages variable to the given boolean.
 
 pagesize ($perpage, $total)
 Sets the pagesize variable to the given integer, the totalrows variable to the given integer, and the use_pages variable to true.
 
 print_headers ()
 This function is not part of the public api.
 
 print_html ()
 This method is deprecated although the old api is still supported.
 
 print_initials_bar ()
 This function is not part of the public api.
 
 print_nothing_to_display ()
 Override the default implementation to set a decent heading level.
 
 print_row ($row, $classname='')
 This function is not part of the public api.
 
 query_db ($pagesize, $useinitialsbar=false)
 Query the db.
 
 render_caption ()
 This function renders a table caption.
 
 set_attribute ($attribute, $value)
 Gives the given $value to the $attribute index of $this->attributes.
 
 set_caption (string $caption, ?array $captionattributes)
 This function set caption for table.
 
 set_columnsattributes (array $attributes)
 Sets the given $attributes to $this->columnsattributes.
 
 set_control_variables ($variables)
 Assigns each given variable in the array to the corresponding index in the request class variable.
 
 set_count_sql ($sql, array $params=NULL)
 This is only needed if you want to use different sql to count rows.
 
 set_default_per_page (int $defaultperpage)
 Set the default per page.
 
 set_filterset (filterset $filterset)
 Set the filterset in the table class.
 
 set_first_initial (string $initial)
 Set the preferred first name initial in an initials bar.
 
 set_hidden_columns (array $columns)
 Set the list of hidden columns.
 
 set_last_initial (string $initial)
 Set the preferred last name initial in an initials bar.
 
 set_page_number (int $pagenumber)
 Set the page number.
 
 set_sortdata (array $sortdata)
 Set the preferred table sorting attributes.
 
 set_sql ($fields, $from, $where, array $params=[])
 Overriding the parent method because it should not be used here.
 
 setup ()
 Must be called after table is defined.
 
 show_download_buttons_at ($showat)
 Where to show download buttons.
 
 sortable ($bool, $defaultcolumn=NULL, $defaultorder=SORT_ASC)
 Sets the is_sortable variable to the given boolean, sort_default_column to the given string, and the sort_default_order to the given integer.
 
 start_html ()
 This function is not part of the public api.
 
 start_output ()
 This function is not part of the public api.
 
 text_sorting ($column)
 Use text sorting functions for this column (required for text columns with Oracle).
 
 wrap_html_finish ()
 Overriding method to render the bulk actions and items per page pagination options directly below the table.
 
 wrap_html_start ()
 Hook that can be overridden in child classes to wrap a table in a form for example.
 

Static Public Member Functions

static construct_order_by ($cols, $textsortcols=array())
 Prepare an an order by clause from the list of columns to be sorted.
 
static get_filterset_class ()
 Get the class used as a filterset.
 
static get_sort_for_table ($uniqueid)
 Get the order by clause from the session or user preferences, for the table with id $uniqueid.
 

Public Attributes

 $attributes = array()
 
 $baseurl = NULL
 
string $caption
 $caption The caption of table
 
array $captionattributes
 $captionattributes The caption attributes of table
 
 $column_class = array()
 
 $column_nosort = array('userpic')
 
 $column_style = array()
 
 $column_suppress = array()
 
 $columns = array()
 
 $countparams = NULL
 
 $countsql = NULL
 
 $currentrow = 0
 
 $currpage = 0
 
string $download = ''
 which download plugin to use.
 
bool $downloadable = false
 whether data is downloadable from table.
 
table_dataformat_export_format $exportclass = null
 
 $headers = array()
 
bool $is_collapsible = true
 Overriding default for this.
 
bool $is_sortable = true
 Overriding default for this.
 
 $maxsortkeys = 2
 
 $pagesize = 30
 
array Traversable $rawdata = NULL
 Data fetched from the db.
 
 $request = array()
 
boolean $setup = false
 Stores if setup has already been called on this flixible table.
 
 $showdownloadbuttonsat = array(TABLE_P_TOP)
 Array of positions in which to display download controls.
 
 $sort_default_column = NULL
 
 $sort_default_order = SORT_ASC
 
stdClass $sql
 The various SQL segments that will be combined to form queries to fetch various information.
 
bool $started_output = false
 Has start output been called yet?
 
 $totalrows = 0
 
 $uniqueid = NULL
 
 $use_initials = false
 
 $use_pages = false
 
string $useridfield = 'id'
 Key of field returned by db query that is the id field of the user table or equivalent.
 
const DEFAULT_PER_PAGE = 50
 Default number of rows to display per page.
 
const FILTER_DATES = 3
 Dates filter type.
 
const FILTER_FORUM = 1
 Forum filter type.
 
const FILTER_GROUPS = 2
 Groups filter type.
 
const LOG_SUMMARY_TEMP_TABLE = 'forum_report_summary_counts'
 Table to store summary data extracted from the log table.
 

Protected Member Functions

 apply_filters (array $filters)
 Apply the relevant filters to the report.
 
 can_be_reset ()
 Are there some table preferences that can be reset?
 
 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_component ()
 Get dynamic class component.
 
 get_dynamic_table_html_end ()
 Get the dynamic table end wrapper.
 
 get_dynamic_table_html_start ()
 Get the dynamic table start wrapper.
 
 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_handler ()
 Get dynamic class handler.
 
 get_internal_log_reader ()
 Returns an internal and enabled log reader.
 
 get_primary_sort_order ()
 Return primary sorting column/order, either the first preferred "sortby" value or defaults defined for the table.
 
 get_sort_order ()
 Return sorting attributes values.
 
 initialise_table_preferences ()
 Initialise table preferences.
 
 is_resetting_preferences ()
 Is the table marked for reset preferences?
 
 print_one_initials_bar ($alpha, $current, $class, $title, $urlvar)
 Helper function, used by print_initials_bar() to output one initial bar.
 
 render_reset_button ()
 Generate the HTML for the table preferences reset button.
 
 save_preferences ($oldprefs)
 Save preferences.
 
 set_forum_properties (array $forumids)
 Sets properties that are determined by forum filter values.
 
 set_hide_show_preferences ()
 Set hide and show preferences.
 
 set_initials_preferences ()
 Fill in the preferences for the initials bar.
 
 set_sorting_preferences ()
 Calculate the preferences for sort order based on user-supplied values and get params.
 
 show_hide_link ($column, $index)
 Generate the HTML for the collapse/uncollapse icon.
 
 show_word_char_counts ()
 
 sort_icon ($isprimary, $order)
 Generate the HTML for the sort icon.
 
 sort_link ($text, $column, $isprimary, $order)
 Generate the HTML for the sort link.
 
 sort_order_name ($isprimary, $order)
 Generate the correct tool tip for changing the sort order.
 

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.
 
array $columnsticky = []
 The sticky attribute of each table column.
 
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.
 
string $filename
 $filename
 
filterset $filterset = null
 The currently applied filerset This is required for dynamic tables, but can be used by other tables too if desired.
 
array $forumcontexts = []
 of context objects for the forums included in the report.
 
string $headercolumn = null
 A column which should be considered as a header column.
 
array $hiddencolumns
 $hiddencolumns List of hidden columns.
 
string $ifirst
 The manually set first name initial preference.
 
string $ilast
 The manually set last name initial preference.
 
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.
 
bool $resetting
 $resetting Whether the table preferences is resetting.
 
string $sheettitle
 $sheettitle
 
array $sortdata
 The fields to sort.
 
context_course context_module $userfieldscontext = null
 The context where the report is being run (either a specific forum or the course).
 
string[] $userfullnamecolumns = ['fullname']
 Columns that are expected to contain a users fullname.
 
int $userid
 The user ID if only one user's summary will be generated.
 

Detailed Description

The class for displaying the forum report table.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Constructor & Destructor Documentation

◆ __construct()

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.

Parameters
int$courseidThe ID of the course the forum(s) exist within.
array$filtersReport filters in the format 'type' => [values].
bool$allowbulkoperationsIs the user allowed to perform bulk operations?
bool$canseeprivaterepliesWhether the user can see all private replies or not.
int$perpageThe number of rows to display per page.
bool$canexportIs the user allowed to export records?
bool$iscoursereportWhether the user is running a course level report
bool$accessallforumsIf user is running a course level report, do they have access to all forums in the course?

Member Function Documentation

◆ add_data()

flexible_table::add_data ( $row,
$classname = '' )
inherited

This method actually directly echoes the row passed to it now or adds it to the download.

If this is the first row and start_output has not already been called this method also calls start_output to open the table or send headers for the downloaded. Can be used as before. print_html now calls finish_html to close table.

Parameters
array$rowa numerically keyed row of data to add to the table.
string$classnameCSS class name to add to this row's tr tag.
Return values
boolsuccess.

◆ add_data_keyed()

flexible_table::add_data_keyed ( $rowwithkeys,
$classname = '' )
inherited

Add a row of data to the table.

This function takes an array or object with column names as keys or property names.

It ignores any elements with keys that are not defined as columns. It puts in empty strings into the row when there is no element in the passed array corresponding to a column in the table. It puts the row elements in the proper order (internally row table data is stored by in arrays with a numerical index corresponding to the column number).

Parameters
object | array$rowwithkeysarray keys or object property names are column names, as defined in call to define_columns.
string$classnameCSS class name to add to this row's tr tag.

◆ add_filter()

forumreport_summary\summary_table::add_filter ( int $filtertype,
array $values = [] )

Adds the relevant SQL to apply a filter to the report.

Parameters
int$filtertypeFilter type as defined by class constants.
array$valuesOptional array of values passed into the filter type.
Return values
void
Exceptions
coding_exception

◆ apply_filters()

forumreport_summary\summary_table::apply_filters ( array $filters)
protected

Apply the relevant filters to the report.

Parameters
array$filtersReport filters in the format 'type' => [values].
Return values
void.

◆ build_table()

table_sql::build_table ( )
inherited

Build the table from the fetched data.

Take the data returned from the db_query and go through all the rows processing each col using either col_{columnname} method or other_cols method or if other_cols returns NULL then put the data straight into the table.

After calling this function, don't forget to call close_recordset.

Reimplemented in mod_feedback_responses_table, quiz_last_responses_table, and quiz_overview_table.

◆ can_be_reset()

flexible_table::can_be_reset ( )
protectedinherited

Are there some table preferences that can be reset?

If true, then the "reset table preferences" widget should be displayed.

Return values
bool

◆ col_attachmentcount()

forumreport_summary\summary_table::col_attachmentcount ( \stdClass $data)

Generate the attachmentcount column.

Parameters
stdClass$dataThe row data.
Return values
intnumber of files attached to posts by user.

◆ col_earliestpost()

forumreport_summary\summary_table::col_earliestpost ( \stdClass $data)

Generate the earliestpost column.

Parameters
stdClass$dataThe row data.
Return values
stringTimestamp of user's earliest post, or a dash if no posts exist.

◆ col_export()

forumreport_summary\summary_table::col_export ( \stdClass $data)

Generate the export column.

Parameters
stdClass$dataThe row data.
Return values
stringThe link to export content belonging to the row.

◆ col_fullname()

forumreport_summary\summary_table::col_fullname ( $data)

Generate the fullname column.

Parameters
stdClass$dataThe row data.
Return values
stringUser's full name.

Reimplemented from flexible_table.

◆ col_latestpost()

forumreport_summary\summary_table::col_latestpost ( \stdClass $data)

Generate the latestpost column.

Parameters
stdClass$dataThe row data.
Return values
stringTimestamp of user's most recent post, or a dash if no posts exist.

◆ col_postcount()

forumreport_summary\summary_table::col_postcount ( \stdClass $data)

Generate the postcount column.

Parameters
stdClass$dataThe row data.
Return values
intnumber of discussion posts made by user.

◆ col_replycount()

forumreport_summary\summary_table::col_replycount ( \stdClass $data)

Generate the replycount column.

Parameters
stdClass$dataThe row data.
Return values
intnumber of replies made by user.

◆ col_select()

forumreport_summary\summary_table::col_select ( $data)

Generate the select column.

Parameters
stdClass$data
Return values
string

◆ collapsible()

flexible_table::collapsible ( $bool)
inherited

Sets the is_collapsible variable to the given boolean.

Parameters
bool$bool
Return values
void

◆ column_class()

flexible_table::column_class ( $column,
$classname )
inherited

Sets the given $column index to the given $classname in $this->column_class.

Parameters
int$column
string$classname
Return values
void

◆ column_sticky()

flexible_table::column_sticky ( string $column,
bool $sticky = true )
inherited

Sets a sticky attribute to a column.

Parameters
string$columnColumn name
bool$sticky

◆ column_style()

flexible_table::column_style ( $column,
$property,
$value )
inherited

Sets the given $column index and $property index to the given $value in $this->column_style.

Parameters
int$column
string$property
mixed$value
Return values
void

◆ column_style_all()

flexible_table::column_style_all ( $property,
$value )
inherited

Sets all columns' $propertys to the given $value in $this->column_style.

Parameters
int$property
string$value
Return values
void

◆ column_suppress()

flexible_table::column_suppress ( $column)
inherited

What this method does is set the column so that if the same data appears in consecutive rows, then it is not repeated.

For example, in the quiz overview report, the fullname column is set to be suppressed, so that when one student has made multiple attempts, their name is only printed in the row for their first attempt.

Parameters
int$columnthe index of a column.

◆ construct_order_by()

static flexible_table::construct_order_by ( $cols,
$textsortcols = array() )
staticinherited

Prepare an an order by clause from the list of columns to be sorted.

Parameters
array$colscolumn name => SORT_ASC or SORT_DESC
Return values
stringSQL fragment that can be used in an ORDER BY clause.

◆ create_log_summary_temp_table()

forumreport_summary\summary_table::create_log_summary_temp_table ( )
protected

Creates a temp table to store summary data from the log table for this request.

Return values
null

◆ define_base_filter_sql()

forumreport_summary\summary_table::define_base_filter_sql ( )
protected

Instantiate the properties to store filter values.

Return values
void.

◆ define_base_sql()

forumreport_summary\summary_table::define_base_sql ( )
protected

Define the object to store all for the table SQL and initialises the base SQL required.

Return values
void.

◆ define_baseurl()

flexible_table::define_baseurl ( $url)
inherited

Sets $this->baseurl.

Parameters
moodle_url | string$urlthe url with params needed to call up this page

◆ define_columns()

flexible_table::define_columns ( $columns)
inherited
Parameters
array$columnsan array of identifying names for columns. If columns are sorted then column names must correspond to a field in sql.

Reimplemented in mod_feedback_responses_table.

◆ define_header_column()

flexible_table::define_header_column ( string $column)
inherited

Mark a specific column as being a table header using the column name defined in define_columns.

Note: Only one column can be a header, and it will be rendered using a th tag.

Parameters
string$column

◆ define_headers()

flexible_table::define_headers ( $headers)
inherited
Parameters
array$headersnumerical keyed array of displayed string titles for each column.

◆ define_help_for_headers()

flexible_table::define_help_for_headers ( $helpicons)
inherited

Defines a help icon for the header.

Always use this function if you need to create header with sorting and help icon.

Parameters
renderable[]$helpiconsAn array of renderable objects to be used as help icons

◆ define_table_configs()

forumreport_summary\summary_table::define_table_configs ( )
protected

Define various table config options.

Return values
void.

◆ download()

forumreport_summary\summary_table::download ( $format)

Download the summary report in the selected format.

Parameters
string$formatThe format to download the report.

◆ download_buttons()

flexible_table::download_buttons ( )
inherited

◆ drop_log_summary_temp_table()

forumreport_summary\summary_table::drop_log_summary_temp_table ( )
protected

Drops the temp table.

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

◆ export_class_instance()

flexible_table::export_class_instance ( $exportclass = null)
inherited

Get, and optionally set, the export class.

Parameters
table_dataformat_export_format$exportclass(optional) if passed, set the table to use this export class.
Return values
table_dataformat_export_formatthe export class in use (after any set).

◆ fill_log_summary_temp_table()

forumreport_summary\summary_table::fill_log_summary_temp_table ( )
protected

Fills the log summary temp table.

Return values
null

◆ format_and_add_array_of_rows()

flexible_table::format_and_add_array_of_rows ( $rowstoadd,
$finish = true )
inherited

Add a number of rows to the table at once.

And optionally finish output after they have been added.

Parameters
(object|array|null)[]$rowstoadd Array of rows to add to table, a null value in array adds a separator row. Or a object or array is added to table. We expect properties for the row array as would be passed to add_data_keyed.
bool$finish

◆ format_row()

flexible_table::format_row ( $row)
inherited

Call appropriate methods on this table class to perform any processing on values before displaying in table.

Takes raw data from the database and process it into human readable format, perhaps also adding html linking when displaying table as html, adding a div wrap, etc.

See for example col_fullname below which will be called for a column whose name is 'fullname'.

Parameters
array | object$rowrow of data from db used to make one row of the table.
Return values
arrayone row for the table, added using add_data_keyed method.

Reimplemented in assign_grading_table, core_reportbuilder\table\custom_report_table, core_reportbuilder\table\system_report_table, and tool_policy\acceptances_table.

◆ format_text()

flexible_table::format_text ( $text,
$format = FORMAT_MOODLE,
$options = NULL,
$courseid = NULL )
inherited

Used from col_* functions when text is to be displayed.

Does the right thing - either converts text to html or strips any html tags depending on if we are downloading and what is the download type. Params are the same as format_text function in weblib.php but some default options are changed.

◆ get_component()

flexible_table::get_component ( )
protectedinherited

Get dynamic class component.

Return values
string

◆ get_context()

flexible_table::get_context ( )
inherited

Get the context for the table.

Note: This function must be overridden by dynamic tables to ensure that the context is correctly determined from the filterset parameters.

Return values
context

Reimplemented in core_admin\table\plugin_management_table, core_reportbuilder\table\base_report_table, core_user\table\participants, and mod_feedback_responses_table.

◆ get_default_per_page()

flexible_table::get_default_per_page ( )
inherited

Get the default per page.

Return values
int

Reimplemented in core_reportbuilder\table\custom_report_table_view.

◆ get_dynamic_table_html_end()

flexible_table::get_dynamic_table_html_end ( )
protectedinherited

Get the dynamic table end wrapper.

If this is not a dynamic table, then an empty string is returned making this safe to blindly call.

Return values
string

Reimplemented in core_admin\table\plugin_management_table.

◆ get_dynamic_table_html_start()

flexible_table::get_dynamic_table_html_start ( )
protectedinherited

Get the dynamic table start wrapper.

If this is not a dynamic table, then an empty string is returned making this safe to blindly call.

Return values
string

◆ get_filter_groups()

forumreport_summary\summary_table::get_filter_groups ( array $groups)
protected

Get the final list of groups to filter by, based on the groups submitted, and those the user has access to.

Parameters
array$groupsThe group IDs submitted.
Return values
arrayGroup objects of groups to use in groups filter. If no filtering required (all groups selected), returns [].

◆ get_filter_name()

forumreport_summary\summary_table::get_filter_name ( int $filtertype)
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.

Parameters
int$filtertypeType of filter
Return values
stringName of the filter

◆ get_filterset()

flexible_table::get_filterset ( )
inherited

Get the currently defined filterset.

Return values
filterset

◆ get_filterset_class()

static flexible_table::get_filterset_class ( )
staticinherited

Get the class used as a filterset.

Return values
string

Reimplemented in core_admin\table\plugin_management_table.

◆ get_full_sql()

forumreport_summary\summary_table::get_full_sql ( bool $fullselect = true)
protected

Prepares a complete SQL statement from the base query and any filters defined.

Parameters
bool$fullselectWhether to select all relevant columns. False selects a count only (used to calculate pagination).
Return values
stringThe complete SQL statement.

◆ get_handler()

flexible_table::get_handler ( )
protectedinherited

Get dynamic class handler.

Return values
string

◆ get_initial_first()

flexible_table::get_initial_first ( )
inherited

This function is not part of the public api.

Return values
stringinitial of first name we are currently filtering by

◆ get_initial_last()

flexible_table::get_initial_last ( )
inherited

This function is not part of the public api.

Return values
stringinitial of last name we are currently filtering by

◆ get_internal_log_reader()

forumreport_summary\summary_table::get_internal_log_reader ( )
protected

Returns an internal and enabled log reader.

Return values
core\log\sql_reader|false

◆ get_page_size()

flexible_table::get_page_size ( )
inherited
Return values
intthe pagesize for LIMIT clause of SQL

◆ get_page_start()

flexible_table::get_page_start ( )
inherited
Return values
intthe offset for LIMIT clause of SQL

◆ get_perpage()

forumreport_summary\summary_table::get_perpage ( )

Fetch the number of items to be displayed per page.

Return values
int

◆ get_primary_sort_order()

flexible_table::get_primary_sort_order ( )
protectedinherited

Return primary sorting column/order, either the first preferred "sortby" value or defaults defined for the table.

Return values
array

◆ get_row_cells_html()

flexible_table::get_row_cells_html ( string $rowid,
array $row,
?array $suppresslastrow )
inherited

Generate html code for the row cells.

Parameters
string$rowid
array$row
array | null$suppresslastrow
Return values
string

Reimplemented in core_reportbuilder\table\custom_report_table.

◆ get_row_class()

table_sql::get_row_class ( $row)
inherited

Get any extra classes names to add to this row in the HTML.

Parameters
$rowarray the data for this row.
Return values
stringadded to the class="" attribute of the tr.

Reimplemented in assign_grading_table, core_reportbuilder\table\system_report_table, core_tag_manage_table, mod_quiz\local\reports\attempts_report_table, quiz_first_or_all_responses_table, and xhprof_table_sql.

◆ get_row_html()

flexible_table::get_row_html ( $row,
$classname = '' )
inherited

Generate html code for the passed row.

Parameters
array$rowRow data.
string$classnameclasses to add.
Return values
string\$htmlhtml code for the row passed.

◆ get_sort_columns()

flexible_table::get_sort_columns ( )
inherited

Get the columns to sort by, in the form required by construct_order_by().

Return values
arraycolumn name => SORT_... constant.

Reimplemented in assign_grading_table, core_reportbuilder\table\custom_report_table, mod_quiz\local\reports\attempts_report_table, and tool_policy\acceptances_table.

◆ get_sort_for_table()

static flexible_table::get_sort_for_table ( $uniqueid)
staticinherited

Get the order by clause from the session or user preferences, for the table with id $uniqueid.

Parameters
string$uniqueidthe identifier for a table.
Return values
stringSQL fragment that can be used in an ORDER BY clause.

◆ get_sort_order()

flexible_table::get_sort_order ( )
protectedinherited

Return sorting attributes values.

Return values
array

◆ get_sql_sort()

flexible_table::get_sql_sort ( )
inherited
Return values
stringSQL fragment that can be used in an ORDER BY clause.

Reimplemented in core_reportbuilder\table\base_report_table, and gradereport_history\output\tablelog.

◆ get_sql_where()

flexible_table::get_sql_where ( )
inherited
Return values
stringsql to add to where statement.

Reimplemented in core_tag_manage_table, and tool_policy\acceptances_table.

◆ guess_base_url()

◆ initialbars()

flexible_table::initialbars ( $bool)
inherited

Sets the use_initials variable to the given boolean.

Parameters
bool$bool
Return values
void

◆ is_downloadable()

flexible_table::is_downloadable ( $downloadable = null)
inherited

Probably don't need to call this directly.

Calling is_downloading with a param automatically sets table as downloadable.

Parameters
bool$downloadableoptional param to set whether data from table is downloadable. If ommitted this function can be used to get current state of table.
Return values
boolwhether table data is set to be downloadable.

Reimplemented in core_admin\table\plugin_management_table.

◆ is_downloading()

flexible_table::is_downloading ( $download = null,
$filename = '',
$sheettitle = '' )
inherited

Call this to pass the download type.

Use : $download = optional_param('download', '', PARAM_ALPHA); To get the download type. We assume that if you call this function with params that this table's data is downloadable, so we call is_downloadable for you (even if the param is '', which means no download this time. Also you can call this method with no params to get the current set download type.

Parameters
string | null$downloadtype of dataformat for export.
string$filenamefilename for downloads without file extension.
string$sheettitletitle for downloaded data.
Return values
stringdownload dataformat type.

◆ is_persistent()

flexible_table::is_persistent ( $persistent = null)
inherited

Call with boolean true to store table layout changes in the user_preferences table.

Note: user_preferences.value has a maximum length of 1333 characters. Call with no parameter to get current state of table persistence.

Parameters
bool$persistentOptional parameter to set table layout persistence.
Return values
boolWhether or not the table layout preferences will persist.

◆ is_resetting_preferences()

flexible_table::is_resetting_preferences ( )
protectedinherited

Is the table marked for reset preferences?

Return values
boolTrue if the table is marked to reset, false otherwise.

◆ is_sortable()

flexible_table::is_sortable ( $column = null)
inherited

Is the column sortable?

Parameters
stringcolumn name, null means table
Return values
bool

◆ make_styles_string()

flexible_table::make_styles_string ( $styles)
inherited

This function is not part of the public api.

Parameters
array$stylesCSS-property => value
Return values
stringvalues suitably to go in a style="" attribute in HTML.

◆ no_sorting()

flexible_table::no_sorting ( $column)
inherited

Do not sort using this column.

Parameters
stringcolumn name

◆ other_cols()

flexible_table::other_cols ( $column,
$row )
inherited

You can override this method in a child class.

See the description of build_table which calls this method.

Reimplemented in assign_grading_table, core_user\table\participants, core_webservice\token_table, mod_feedback_responses_table, quiz_last_responses_table, quiz_overview_table, quiz_statistics_question_table, and tool_policy\acceptances_table.

◆ out()

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.

Parameters
int$pagesizeNumber of rows to fetch.
bool$useinitialsbarWhether to include the initials bar with the table.
string$downloadhelpbuttonUnused.
Return values
void.

Reimplemented from table_sql.

◆ pageable()

flexible_table::pageable ( $bool)
inherited

Sets the use_pages variable to the given boolean.

Parameters
bool$bool
Return values
void

◆ pagesize()

flexible_table::pagesize ( $perpage,
$total )
inherited

Sets the pagesize variable to the given integer, the totalrows variable to the given integer, and the use_pages variable to true.

Parameters
int$perpage
int$total
Return values
void

◆ print_headers()

flexible_table::print_headers ( )
inherited

This function is not part of the public api.

Reimplemented in core_reportbuilder\table\custom_report_table, and core_reportbuilder\table\custom_report_table_view.

◆ print_html()

flexible_table::print_html ( )
inherited

This method is deprecated although the old api is still supported.

Deprecated
1.9.2 - Jun 2, 2008

◆ print_nothing_to_display()

forumreport_summary\summary_table::print_nothing_to_display ( )

Override the default implementation to set a decent heading level.

Return values
void.

Reimplemented from flexible_table.

◆ print_one_initials_bar()

flexible_table::print_one_initials_bar ( $alpha,
$current,
$class,
$title,
$urlvar )
protectedinherited

Helper function, used by print_initials_bar() to output one initial bar.

Parameters
array$alphaof letters in the alphabet.
string$currentthe currently selected letter.
string$classclass name to add to this initial bar.
string$titlethe name to put in front of this initial bar.
string$urlvarURL parameter name for this initial.
Deprecated
since Moodle 3.3

◆ query_db()

forumreport_summary\summary_table::query_db ( $pagesize,
$useinitialsbar = false )

Query the db.

Store results in the table object for use by build_table.

Parameters
int$pagesizeSize of page for paginated displayed table.
bool$useinitialsbarOverridden but unused.
Return values
void

Reimplemented from table_sql.

◆ render_caption()

flexible_table::render_caption ( )
inherited

This function renders a table caption.

Return values
string\$outputCaption of table.

◆ render_reset_button()

flexible_table::render_reset_button ( )
protectedinherited

Generate the HTML for the table preferences reset button.

Return values
stringHTML fragment, empty string if no need to reset

◆ save_preferences()

flexible_table::save_preferences ( $oldprefs)
protectedinherited

Save preferences.

Parameters
array$oldprefsOld preferences to compare against.

◆ set_attribute()

flexible_table::set_attribute ( $attribute,
$value )
inherited

Gives the given $value to the $attribute index of $this->attributes.

Parameters
string$attribute
mixed$value
Return values
void

◆ set_caption()

flexible_table::set_caption ( string $caption,
?array $captionattributes )
inherited

This function set caption for table.

Parameters
string$captionCaption of table.
array | null$captionattributesCaption attributes of table.

◆ set_columnsattributes()

flexible_table::set_columnsattributes ( array $attributes)
inherited

Sets the given $attributes to $this->columnsattributes.

Column attributes will be added to every cell in the column.

Parameters
array[]$attributese.g. ['c0_firstname' => ['data-foo' => 'bar']]

◆ set_control_variables()

flexible_table::set_control_variables ( $variables)
inherited

Assigns each given variable in the array to the corresponding index in the request class variable.

Parameters
array$variables
Return values
void

◆ set_count_sql()

table_sql::set_count_sql ( $sql,
array $params = NULL )
inherited

This is only needed if you want to use different sql to count rows.

Used for example when perhaps all db JOINS are not needed when counting records. You don't need to call this function the count_sql will be generated automatically.

We need to count rows returned by the db seperately to the query itself as we need to know how many pages of data we have to display.

◆ set_default_per_page()

flexible_table::set_default_per_page ( int $defaultperpage)
inherited

Set the default per page.

Parameters
int$defaultperpage

◆ set_filterset()

flexible_table::set_filterset ( filterset $filterset)
inherited

Set the filterset in the table class.

The use of filtersets is a requirement for dynamic tables, but can be used by other tables too if desired.

Parameters
filterset$filtersetThe filterset object to get filters and table parameters from

Reimplemented in core_reportbuilder\table\system_report_table, and core_user\table\participants.

◆ set_first_initial()

flexible_table::set_first_initial ( string $initial)
inherited

Set the preferred first name initial in an initials bar.

Parameters
string$initialThe character to set

◆ set_forum_properties()

forumreport_summary\summary_table::set_forum_properties ( array $forumids)
protected

Sets properties that are determined by forum filter values.

Parameters
array$forumidsThe forum IDs passed in by the filter.
Return values
void

◆ set_hidden_columns()

flexible_table::set_hidden_columns ( array $columns)
inherited

Set the list of hidden columns.

Parameters
array$columnsThe list of hidden columns.

◆ set_last_initial()

flexible_table::set_last_initial ( string $initial)
inherited

Set the preferred last name initial in an initials bar.

Parameters
string$initialThe character to set

◆ set_page_number()

flexible_table::set_page_number ( int $pagenumber)
inherited

Set the page number.

Parameters
int$pagenumberThe page number.

◆ set_sortdata()

flexible_table::set_sortdata ( array $sortdata)
inherited

Set the preferred table sorting attributes.

Parameters
string$sortbyThe field to sort by.
int$sortorderThe sort order.

◆ set_sql()

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.

Parameters
string$fieldsUnused.
string$fromUnused.
string$whereUnused.
array$paramsUnused.
Return values
void.
Exceptions
coding_exception

Reimplemented from table_sql.

◆ setup()

flexible_table::setup ( )
inherited

Must be called after table is defined.

Use methods above first. Cannot use functions below till after calling this method.

Reimplemented in assign_grading_table, and core_admin\table\activity_management_table.

◆ show_download_buttons_at()

flexible_table::show_download_buttons_at ( $showat)
inherited

Where to show download buttons.

Parameters
array$showatarray of postions in which to show download buttons. Containing TABLE_P_TOP and/or TABLE_P_BOTTOM

◆ show_hide_link()

flexible_table::show_hide_link ( $column,
$index )
protectedinherited

Generate the HTML for the collapse/uncollapse icon.

This is a helper method used by print_headers().

Parameters
string$columnthe column name, index into various names.
int$indexnumerical index of the column.
Return values
stringHTML fragment.

Reimplemented in assign_grading_table, core_tag_manage_table, core_user\table\participants, tool_dataprivacy\output\data_requests_table, and tool_dataprivacy\output\expired_contexts_table.

◆ sort_icon()

flexible_table::sort_icon ( $isprimary,
$order )
protectedinherited

Generate the HTML for the sort icon.

This is a helper method used by sort_link().

Parameters
bool$isprimarywhether an icon is needed (it is only needed for the primary sort column.)
int$orderSORT_ASC or SORT_DESC
Return values
stringHTML fragment.

◆ sort_link()

flexible_table::sort_link ( $text,
$column,
$isprimary,
$order )
protectedinherited

Generate the HTML for the sort link.

This is a helper method used by print_headers().

Parameters
string$textthe text for the link.
string$columnthe column name, may be a fake column like 'firstname' or a real one.
bool$isprimarywhether the is column is the current primary sort column.
int$orderSORT_ASC or SORT_DESC
Return values
stringHTML fragment.

◆ sort_order_name()

flexible_table::sort_order_name ( $isprimary,
$order )
protectedinherited

Generate the correct tool tip for changing the sort order.

This is a helper method used by sort_link().

Parameters
bool$isprimarywhether the is column is the current primary sort column.
int$orderSORT_ASC or SORT_DESC
Return values
stringthe correct title.

◆ sortable()

flexible_table::sortable ( $bool,
$defaultcolumn = NULL,
$defaultorder = SORT_ASC )
inherited

Sets the is_sortable variable to the given boolean, sort_default_column to the given string, and the sort_default_order to the given integer.

Parameters
bool$bool
string$defaultcolumn
int$defaultorder
Return values
void

◆ start_html()

flexible_table::start_html ( )
inherited

This function is not part of the public api.

Reimplemented in core_reportbuilder\table\base_report_table.

◆ start_output()

flexible_table::start_output ( )
inherited

This function is not part of the public api.

You don't normally need to call this. It is called automatically when needed when you start adding data to the table.

◆ text_sorting()

flexible_table::text_sorting ( $column)
inherited

Use text sorting functions for this column (required for text columns with Oracle).

Be warned that you cannot use this with column aliases. You can only do this with real columns. See MDL-40481 for an example.

Parameters
stringcolumn name

◆ wrap_html_finish()

forumreport_summary\summary_table::wrap_html_finish ( )

Overriding method to render the bulk actions and items per page pagination options directly below the table.

Return values
void

Reimplemented from flexible_table.

◆ wrap_html_start()

flexible_table::wrap_html_start ( )
inherited

Hook that can be overridden in child classes to wrap a table in a form for example.

Called only when there is data to display and not downloading.

Reimplemented in mod_quiz\local\reports\attempts_report_table, quiz_statistics_table, and tool_policy\acceptances_table.

Member Data Documentation

◆ $download

string flexible_table::$download = ''
inherited

which download plugin to use.

Default '' means none - print html table with paging. Property set by is_downloading which typically passes in cleaned data from $

◆ $downloadable

bool flexible_table::$downloadable = false
inherited

whether data is downloadable from table.

Determines whether to display download buttons. Set by method downloadable().

◆ $userfullnamecolumns

string [] flexible_table::$userfullnamecolumns = ['fullname']
protectedinherited

Columns that are expected to contain a users fullname.


◆ $userid

int forumreport_summary\summary_table::$userid
protected

The user ID if only one user's summary will be generated.

This will apply to users without permission to view others' summaries.


The documentation for this class was generated from the following file: