Class mod_feedback_responses_table.
More...
|
| __construct (mod_feedback_structure $feedbackstructure, $group=0) |
| Constructor.
|
|
| build_table () |
| 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.
|
|
| col_completed_timemodified ($student) |
| Prepares column completed_timemodified for display.
|
|
| col_courseid ($row) |
| Prepares column courseid for display.
|
|
| col_deleteentry ($row) |
| Prepares column deleteentry for display.
|
|
| col_groups ($row) |
| Prepares column groups for display.
|
|
| col_userpic ($row) |
| Prepares column userpic for display.
|
|
| define_columns ($columns) |
| Defines columns.
|
|
| display () |
| Displays the table.
|
|
| download () |
| Download the data.
|
|
| download_buttons () |
| Returns html code for displaying "Download" button if applicable.
|
|
| export_external_structure ($page=0, $perpage=0) |
| Exports the table as an external structure handling pagination.
|
|
| get_context () |
| Current context.
|
|
| get_reponse_navigation_links ($record) |
| Returns links to previous/next responses in the list.
|
|
| get_total_responses_count () |
| Returns total number of reponses (without any filters applied)
|
|
| other_cols ($column, $row) |
| Allows to set the display column value for all columns without "col_xxxxx" method.
|
|
| out ($pagesize, $useinitialsbar, $downloadhelpbutton='') |
| Convenience method to call a number of methods for you to display the table.
|
|
| query_db ($pagesize, $useinitialsbar=true) |
| Query the db.
|
|
|
const | PREVIEWCOLUMNSLIMIT = 10 |
| Maximum number of feedback questions to display in the "Show responses" table.
|
|
const | ROWCHUNKSIZE = 100 |
| When additional queries are needed to retrieve more than TABLEJOINLIMIT questions answers, do it in chunks every x rows.
|
|
const | TABLEJOINLIMIT = 59 |
| Maximum number of feedback questions answers to retrieve in one SQL query.
|
|
|
| add_all_values_to_output () |
| Adds common values to the table that do not change the number or order of entries and are only needed when outputting or downloading data.
|
|
| add_data_for_external ($row) |
| Add data for the external structure that will be returned.
|
|
| build_table_chunk (&$rows, &$columnsgroups) |
| Retrieve additional columns.
|
|
| get_link_single_entry ($row) |
| Returns a link for viewing a single response.
|
|
| get_responses_for_external ($row) |
| Return user responses data ready for the external function.
|
|
| init ($group=0) |
| Initialises table.
|
|
|
bool | $buildforexternal = false |
| whether we are building this table for a external function
|
|
array | $dataforexternal = [] |
| the data structure containing the table data for the external function
|
|
string | $downloadparamname = 'download' |
|
mod_feedback_structure | $feedbackstructure |
|
int | $grandtotal = null |
|
int | $hasmorecolumns = 0 |
| number of columns that were not retrieved in the main SQL query (no more than TABLEJOINLIMIT tables with values can be joined).
|
|
bool | $pageable |
| true if elements per page > 0, otherwise false.
|
|
bool | $showall = false |
|
string | $showallparamname = 'showall' |
|
◆ __construct()
◆ add_data_for_external()
mod_feedback_responses_table::add_data_for_external |
( |
| $row | ) |
|
|
protected |
◆ build_table()
mod_feedback_responses_table::build_table |
( |
| ) |
|
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.
This overwrites the parent method because full SQL query may fail on Mysql because of the limit in the number of tables in the join. Therefore we only join 59 tables in the main query and add the rest here.
- Return values
-
◆ build_table_chunk()
mod_feedback_responses_table::build_table_chunk |
( |
& | $rows, |
|
|
& | $columnsgroups ) |
|
protected |
Retrieve additional columns.
Database engine may have a limit on number of joins.
- Parameters
-
array | $rows | Array of rows with already retrieved data, new values will be added to this array |
array | $columnsgroups | array of arrays of columns. Each element has up to self::TABLEJOINLIMIT items. This is easy to calculate but because we can call this method many times we calculate it once and pass by reference for performance reasons |
◆ col_completed_timemodified()
mod_feedback_responses_table::col_completed_timemodified |
( |
| $student | ) |
|
Prepares column completed_timemodified for display.
- Parameters
-
- Return values
-
◆ col_courseid()
mod_feedback_responses_table::col_courseid |
( |
| $row | ) |
|
Prepares column courseid for display.
- Parameters
-
- Return values
-
◆ col_deleteentry()
mod_feedback_responses_table::col_deleteentry |
( |
| $row | ) |
|
Prepares column deleteentry for display.
- Parameters
-
- Return values
-
◆ col_groups()
mod_feedback_responses_table::col_groups |
( |
| $row | ) |
|
Prepares column groups for display.
- Parameters
-
- Return values
-
◆ col_userpic()
mod_feedback_responses_table::col_userpic |
( |
| $row | ) |
|
Prepares column userpic for display.
- Parameters
-
- Return values
-
◆ define_columns()
mod_feedback_responses_table::define_columns |
( |
| $columns | ) |
|
Defines columns.
- Parameters
-
array | $columns | an array of identifying names for columns. If columns are sorted then column names must correspond to a field in sql. |
◆ export_external_structure()
mod_feedback_responses_table::export_external_structure |
( |
| $page = 0, |
|
|
| $perpage = 0 ) |
Exports the table as an external structure handling pagination.
- Parameters
-
int | $page | page number (for pagination) |
int | $perpage | elements per page |
- Since
- Moodle 3.3
- Return values
-
array | returns the table ready to be used by an external function |
◆ get_context()
mod_feedback_responses_table::get_context |
( |
| ) |
|
Current context.
- Return values
-
◆ get_link_single_entry()
mod_feedback_responses_table::get_link_single_entry |
( |
| $row | ) |
|
|
protected |
◆ get_reponse_navigation_links()
mod_feedback_responses_table::get_reponse_navigation_links |
( |
| $record | ) |
|
Returns links to previous/next responses in the list.
- Parameters
-
- Return values
-
array | array of three elements [$prevresponseurl, $returnurl, $nextresponseurl] |
◆ get_responses_for_external()
mod_feedback_responses_table::get_responses_for_external |
( |
| $row | ) |
|
|
protected |
Return user responses data ready for the external function.
- Parameters
-
stdClass | $row | the table row containing the responses |
- Return values
-
array | returns the responses ready to be used by an external function |
- Since
- Moodle 3.3
◆ get_total_responses_count()
mod_feedback_responses_table::get_total_responses_count |
( |
| ) |
|
Returns total number of reponses (without any filters applied)
- Return values
-
◆ init()
mod_feedback_responses_table::init |
( |
| $group = 0 | ) |
|
|
protected |
◆ other_cols()
mod_feedback_responses_table::other_cols |
( |
| $column, |
|
|
| $row ) |
Allows to set the display column value for all columns without "col_xxxxx" method.
- Parameters
-
string | $column | column name |
stdClass | $row | current record result of SQL query |
◆ out()
mod_feedback_responses_table::out |
( |
| $pagesize, |
|
|
| $useinitialsbar, |
|
|
| $downloadhelpbutton = '' ) |
Convenience method to call a number of methods for you to display the table.
- Parameters
-
int | $pagesize | |
bool | $useinitialsbar | |
string | $downloadhelpbutton | |
◆ query_db()
mod_feedback_responses_table::query_db |
( |
| $pagesize, |
|
|
| $useinitialsbar = true ) |
Query the db.
Store results in the table object for use by build_table.
- Parameters
-
int | $pagesize | size of page for paginated displayed table. |
bool | $useinitialsbar | do you want to use the initials bar. Bar will only be used if there is a fullname column defined for the table. |
◆ ROWCHUNKSIZE
const mod_feedback_responses_table::ROWCHUNKSIZE = 100 |
When additional queries are needed to retrieve more than TABLEJOINLIMIT questions answers, do it in chunks every x rows.
Value too small will mean too many DB queries, value too big may cause memory overflow.
◆ TABLEJOINLIMIT
const mod_feedback_responses_table::TABLEJOINLIMIT = 59 |
Maximum number of feedback questions answers to retrieve in one SQL query.
Mysql has a limit of 60, we leave 1 for joining with users table.
The documentation for this class was generated from the following file:
- mod/feedback/classes/responses_table.php