Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
quiz_attempts_report_table Class Reference

Base class for the table used by a quiz_attempts_report. More...

Inheritance diagram for quiz_attempts_report_table:
table_sql flexible_table quiz_last_responses_table quiz_overview_table quiz_first_or_all_responses_table

Public Member Functions

 __construct ($uniqueid, $quiz, $context, $qmsubselect, mod_quiz_attempts_report_options $options, core\dml\sql_join $groupstudentsjoins, core\dml\sql_join $studentsjoins, $questions, $reporturl)
 Constructor. More...
 
 add_data ($row, $classname='')
 This method actually directly echoes the row passed to it now or adds it to the download. More...
 
 add_data_keyed ($rowwithkeys, $classname='')
 Add a row of data to the table. More...
 
 add_separator ()
 Add a seperator line to table.
 
 base_sql (\core\dml\sql_join $allowedstudentsjoins)
 Contruct all the parts of the main database query. More...
 
 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. More...
 
 checkbox_col_header (string $columnname)
 Generates the contents for the checkbox column header. More...
 
 close_recordset ()
 Closes recordset (for use after building the table).
 
 col_checkbox ($attempt)
 Generate the display of the checkbox column. More...
 
 col_duration ($attempt)
 Generate the display of the time taken column. More...
 
 col_feedbacktext ($attempt)
 Generate the display of the feedback column. More...
 
 col_fullname ($attempt)
 Generate the display of the user's full name column. More...
 
 col_picture ($attempt)
 Generate the display of the user's picture column. More...
 
 col_state ($attempt)
 Generate the display of the attempt state column. More...
 
 col_timefinish ($attempt)
 Generate the display of the finish time column. More...
 
 col_timestart ($attempt)
 Generate the display of the start time column. More...
 
 collapsible ($bool)
 Sets the is_collapsible variable to the given boolean. More...
 
 column_class ($column, $classname)
 Sets the given $column index to the given $classname in $this->column_class. More...
 
 column_style ($column, $property, $value)
 Sets the given $column index and $property index to the given $value in $this->column_style. More...
 
 column_style_all ($property, $value)
 Sets all columns' $propertys to the given $value in $this->column_style. More...
 
 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. More...
 
 define_baseurl ($url)
 Sets $this->baseurl. More...
 
 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. More...
 
 define_headers ($headers)
 
 define_help_for_headers ($helpicons)
 Defines a help icon for the header. More...
 
 download_buttons ()
 Get the html for the download buttons. More...
 
 export_class_instance ($exportclass=null)
 Get, and optionally set, the export class. More...
 
 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. More...
 
 format_row ($row)
 Call appropriate methods on this table class to perform any processing on values before displaying in table. More...
 
 format_text ($text, $format=FORMAT_MOODLE, $options=NULL, $courseid=NULL)
 Used from col_* functions when text is to be displayed. More...
 
 get_initial_first ()
 This function is not part of the public api. More...
 
 get_initial_last ()
 This function is not part of the public api. More...
 
 get_page_size ()
 
 get_page_start ()
 
 get_row_class ($attempt)
 Get any extra classes names to add to this row in the HTML. More...
 
 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. More...
 
 get_sort_columns ()
 Get the columns to sort by, in the form required by construct_order_by(). More...
 
 get_sql_sort ()
 
 get_sql_where ()
 
 initialbars ($bool)
 Sets the use_initials variable to the given boolean. More...
 
 is_downloadable ($downloadable=null)
 Probably don't need to call this directly. More...
 
 is_downloading ($download=null, $filename='', $sheettitle='')
 Call this to pass the download type. More...
 
 is_persistent ($persistent=null)
 Call with boolean true to store table layout changes in the user_preferences table. More...
 
 is_sortable ($column=null)
 Is the column sortable? More...
 
 make_review_link ($data, $attempt, $slot)
 Make a link to review an individual question in a popup window. More...
 
 make_styles_string ($styles)
 This function is not part of the public api. More...
 
 no_sorting ($column)
 Do not sort using this column. More...
 
 other_cols ($column, $row)
 You can override this method in a child class. More...
 
 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. More...
 
 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. More...
 
 print_headers ()
 This function is not part of the public api.
 
 print_html ()
 This method is deprecated although the old api is still supported. More...
 
 print_initials_bar ()
 This function is not part of the public api.
 
 print_nothing_to_display ()
 This function is not part of the public api.
 
 print_row ($row, $classname='')
 This function is not part of the public api.
 
 query_db ($pagesize, $useinitialsbar=true)
 Query the db. More...
 
 set_attribute ($attribute, $value)
 Gives the given $value to the $attribute index of $this->attributes. More...
 
 set_control_variables ($variables)
 Assigns each given variable in the array to the corresponding index in the request class variable. More...
 
 set_count_sql ($sql, array $params=NULL)
 This is only needed if you want to use different sql to count rows. More...
 
 set_sql ($fields, $from, $where, array $params=array())
 Set the sql to query the db. More...
 
 setup ()
 Must be called after table is defined. More...
 
 setup_sql_queries ($allowedjoins)
 Set up the SQL queries (count rows, and get data). More...
 
 show_download_buttons_at ($showat)
 Where to show download buttons. More...
 
 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. More...
 
 start_html ()
 This function is not part of the public api.
 
 start_output ()
 This function is not part of the public api. More...
 
 text_sorting ($column)
 Use text sorting functions for this column (required for text columns with Oracle). More...
 
 wrap_html_finish ()
 Hook that can be overridden in child classes to wrap a table in a form for example. More...
 
 wrap_html_start ()
 Hook that can be overridden in child classes to wrap a table in a form for example. More...
 

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. More...
 
static get_sort_for_table ($uniqueid)
 Get the order by clause from the session or user preferences, for the table with id $uniqueid. More...
 

Public Attributes

 $attributes = array()
 
 $baseurl = NULL
 
 $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. More...
 
bool $downloadable = false
 whether data is downloadable from table. More...
 
 $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
 
object $sql = NULL
 sql for querying db. More...
 
bool $started_output = false
 Has start output been called yet?
 
 $totalrows = 0
 
 $uniqueid = NULL
 
 $use_initials = false
 
 $use_pages = false
 
 $useridfield = 'userid'
 

Protected Member Functions

 add_latest_state_join ($slot)
 Add the information about the latest state of the question with slot $slot to the query. More...
 
 can_be_reset ()
 Are there some table preferences that can be reset? More...
 
 get_qubaids_condition ()
 Get an appropriate qubaid_condition for loading more data about the attempts we are displaying. More...
 
 get_required_latest_state_fields ($slot, $alias)
 Get any fields that might be needed when sorting on date for a particular slot. More...
 
 icon_for_fraction ($fraction)
 Return an appropriate icon (green tick, red cross, etc.) for a grade. More...
 
 is_flagged ($questionusageid, $slot)
 
 is_latest_step_column ($column)
 Is this a column that depends on joining to the latest state information? If so, return the corresponding slot. More...
 
 load_extra_data ()
 Load any extra data after main query. More...
 
 load_question_latest_steps (qubaid_condition $qubaids=null)
 Load information about the latest state of selected questions in selected attempts. More...
 
 print_one_initials_bar ($alpha, $current, $class, $title, $urlvar)
 Helper function, used by print_initials_bar() to output one initial bar. More...
 
 render_reset_button ()
 Generate the HTML for the table preferences reset button. More...
 
 requires_extra_data ()
 Does this report require loading any more data after the main query. More...
 
 requires_latest_steps_loaded ()
 Does this report require the detailed information for each question from the question_attempts_steps table? More...
 
 show_hide_link ($column, $index)
 Generate the HTML for the collapse/uncollapse icon. More...
 
 slot_fraction ($attempt, $slot)
 
 slot_state ($attempt, $slot)
 
 sort_icon ($isprimary, $order)
 Generate the HTML for the sort icon. More...
 
 sort_link ($text, $column, $isprimary, $order)
 Generate the HTML for the sort link. More...
 
 sort_order_name ($isprimary, $order)
 Generate the correct tool tip for changing the sort order. More...
 
 submit_buttons ()
 Output any submit buttons required by the $this->includecheckboxes form.
 
 update_sql_after_count ($fields, $from, $where, $params)
 A chance for subclasses to modify the SQL after the count query has been generated, and before the full query is constructed. More...
 

Protected Attributes

context $context
 the quiz context.
 
array $displayoptions
 the display options.
 
$filename $filename
 
core dml sql_join $groupstudentsjoins
 Contains joins, wheres, params to find students in the currently selected group, if applicable.
 
string $headercolumn = null
 A column which should be considered as a header column.
 
bool $includecheckboxes
 whether to include the column with checkboxes to select each attempt.
 
array $lateststeps = null
 information about the latest step of each question. More...
 
object $options
 mod_quiz_attempts_report_options the options affecting this report.
 
string $qmsubselect
 HTML fragment to select the first/best/last attempt, if appropriate.
 
object $questions
 the questions that comprise this quiz. More...
 
object $quiz
 the quiz settings for the quiz we are reporting on.
 
moodle_url $reporturl
 the URL of this report.
 
$sheettitle $sheettitle
 
core dml sql_join $studentsjoins
 Contains joins, wheres, params to find the students in the course.
 
string $togglegroup = 'quiz-attempts'
 The toggle group name for the checkboxes in the checkbox column.
 

Detailed Description

Base class for the table used by a quiz_attempts_report.

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

Constructor & Destructor Documentation

◆ __construct()

quiz_attempts_report_table::__construct (   $uniqueid,
  $quiz,
  $context,
  $qmsubselect,
mod_quiz_attempts_report_options  $options,
core\dml\sql_join  $groupstudentsjoins,
core\dml\sql_join  $studentsjoins,
  $questions,
  $reporturl 
)

Constructor.

Parameters
string$uniqueid
object$quiz
context$context
string$qmsubselect
mod_quiz_attempts_report_options$options
core\dml\sql_join$groupstudentsjoinsContains joins, wheres, params
core\dml\sql_join$studentsjoinsContains joins, wheres, params
array$questions
moodle_url$reporturl

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_latest_state_join()

quiz_attempts_report_table::add_latest_state_join (   $slot)
protected

Add the information about the latest state of the question with slot $slot to the query.

The extra information is added as a join to a 'table' with alias qa$slot, with columns that are a union of the columns of the question_attempts and question_attempts_states tables.

Parameters
int$slotthe question to add information for.

◆ base_sql()

quiz_attempts_report_table::base_sql ( \core\dml\sql_join  $allowedstudentsjoins)

Contruct all the parts of the main database query.

Parameters
core\dml\sql_join$allowedstudentsjoins(joins, wheres, params) defines allowed users for the report.
Return values
arraywith 4 elements ($fields, $from, $where, $params) that can be used to build the actual database query.

◆ build_table()

table_sql::build_table ( )
inherited

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 quiz_last_responses_table, quiz_overview_table, and mod_feedback_responses_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

◆ checkbox_col_header()

quiz_attempts_report_table::checkbox_col_header ( string  $columnname)

Generates the contents for the checkbox column header.

It returns the HTML for a master core\output\checkbox_toggleall component that selects/deselects all quiz attempts.

Parameters
string$columnnameThe name of the checkbox column.
Return values
string

◆ col_checkbox()

quiz_attempts_report_table::col_checkbox (   $attempt)

Generate the display of the checkbox column.

Parameters
object$attemptthe table row being output.
Return values
stringHTML content to go inside the td.

Reimplemented in quiz_first_or_all_responses_table.

◆ col_duration()

quiz_attempts_report_table::col_duration (   $attempt)

Generate the display of the time taken column.

Parameters
object$attemptthe table row being output.
Return values
stringHTML content to go inside the td.

◆ col_feedbacktext()

quiz_attempts_report_table::col_feedbacktext (   $attempt)

Generate the display of the feedback column.

Parameters
object$attemptthe table row being output.
Return values
stringHTML content to go inside the td.

◆ col_fullname()

quiz_attempts_report_table::col_fullname (   $attempt)

Generate the display of the user's full name column.

Parameters
object$attemptthe table row being output.
Return values
stringHTML content to go inside the td.

Reimplemented from flexible_table.

◆ col_picture()

quiz_attempts_report_table::col_picture (   $attempt)

Generate the display of the user's picture column.

Parameters
object$attemptthe table row being output.
Return values
stringHTML content to go inside the td.

◆ col_state()

quiz_attempts_report_table::col_state (   $attempt)

Generate the display of the attempt state column.

Parameters
object$attemptthe table row being output.
Return values
stringHTML content to go inside the td.

Reimplemented in quiz_first_or_all_responses_table.

◆ col_timefinish()

quiz_attempts_report_table::col_timefinish (   $attempt)

Generate the display of the finish time column.

Parameters
object$attemptthe table row being output.
Return values
stringHTML content to go inside the td.

◆ col_timestart()

quiz_attempts_report_table::col_timestart (   $attempt)

Generate the display of the start time column.

Parameters
object$attemptthe table row being output.
Return values
stringHTML content to go inside the td.

◆ 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_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
SQLfragment that can be used in an ORDER BY clause.

◆ 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

◆ download_buttons()

flexible_table::download_buttons ( )
inherited

Get the html for the download buttons.

Usually only use internally

Reimplemented in mod_feedback_responses_table.

◆ export_class_instance()

flexible_table::export_class_instance (   $exportclass = null)
inherited

Get, and optionally set, the export class.

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

◆ 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, 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_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_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_qubaids_condition()

quiz_attempts_report_table::get_qubaids_condition ( )
protected

Get an appropriate qubaid_condition for loading more data about the attempts we are displaying.

Return values
qubaid_condition

◆ get_required_latest_state_fields()

quiz_attempts_report_table::get_required_latest_state_fields (   $slot,
  $alias 
)
protected

Get any fields that might be needed when sorting on date for a particular slot.

Note: these values are only used for sorting. The values displayed are taken from $this->lateststeps loaded in load_extra_data().

Parameters
int$slotthe slot for the column we want.
string$aliasthe table alias for latest state information relating to that slot.
Return values
stringdefinitions of extra fields to add to the SELECT list of the query.

Reimplemented in quiz_last_responses_table, and quiz_overview_table.

◆ get_row_class()

quiz_attempts_report_table::get_row_class (   $row)

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 from table_sql.

Reimplemented in quiz_first_or_all_responses_table.

◆ 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()

quiz_attempts_report_table::get_sort_columns ( )

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

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

Reimplemented from flexible_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
SQLfragment that can be used in an ORDER BY clause.

◆ get_sql_sort()

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

Reimplemented in 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.

◆ icon_for_fraction()

quiz_attempts_report_table::icon_for_fraction (   $fraction)
protected

Return an appropriate icon (green tick, red cross, etc.) for a grade.

Parameters
float$fractiongrade on a scale 0..1.
Return values
stringhtml fragment.

◆ 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.

◆ 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$downloaddataformat type. One of csv, xhtml, ods, etc
string$filenamefilename for downloads without file extension.
string$sheettitletitle for downloaded data.
Return values
stringdownload dataformat type. One of csv, xhtml, ods, etc

◆ is_flagged()

quiz_attempts_report_table::is_flagged (   $questionusageid,
  $slot 
)
protected
Parameters
int$questionusageid
int$slot
Return values
bool

Reimplemented in quiz_first_or_all_responses_table.

◆ is_latest_step_column()

quiz_attempts_report_table::is_latest_step_column (   $column)
protected

Is this a column that depends on joining to the latest state information? If so, return the corresponding slot.

If not, return false.

Parameters
string$columna column name
Return values
intfalse if no, else a slot.

Reimplemented in quiz_last_responses_table, and quiz_overview_table.

◆ 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_sortable()

flexible_table::is_sortable (   $column = null)
inherited

Is the column sortable?

Parameters
stringcolumn name, null means table
Return values
bool

◆ load_extra_data()

quiz_attempts_report_table::load_extra_data ( )
protected

Load any extra data after main query.

At this point you can call get_qubaids_condition to get the condition that limits the query to just the question usages shown in this report page or alternatively for all attempts if downloading a full report.

Reimplemented in quiz_first_or_all_responses_table.

◆ load_question_latest_steps()

quiz_attempts_report_table::load_question_latest_steps ( qubaid_condition  $qubaids = null)
protected

Load information about the latest state of selected questions in selected attempts.

The results are returned as an two dimensional array $qubaid => $slot => $dataobject

Parameters
qubaid_condition | null$qubaidsused to restrict which usages are included in the query. See qubaid_condition.
Return values
arrayof records. See the SQL in this function to see the fields available.

◆ make_review_link()

quiz_attempts_report_table::make_review_link (   $data,
  $attempt,
  $slot 
)

Make a link to review an individual question in a popup window.

Parameters
string$dataHTML fragment. The text to make into the link.
object$attemptdata for the row of the table being output.
int$slotthe number used to identify this question within this usage.

Reimplemented in quiz_first_or_all_responses_table.

◆ 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 mod_feedback_responses_table, tool_policy\acceptances_table, assign_grading_table, quiz_statistics_question_table, webservice\token_table, core_user\participants_table, quiz_last_responses_table, and quiz_overview_table.

◆ 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_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_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()

quiz_attempts_report_table::query_db (   $pagesize,
  $useinitialsbar = true 
)

Query the db.

Store results in the table object for use by build_table.

Parameters
int$pagesizesize of page for paginated displayed table.
bool$useinitialsbardo you want to use the initials bar. Bar will only be used if there is a fullname column defined for the table.

Reimplemented from table_sql.

Reimplemented in quiz_overview_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

◆ requires_extra_data()

quiz_attempts_report_table::requires_extra_data ( )
protected

Does this report require loading any more data after the main query.

After the main query then you can use $this->get

Return values
boolshould } call load_extra_data?

Reimplemented in quiz_last_responses_table.

◆ requires_latest_steps_loaded()

quiz_attempts_report_table::requires_latest_steps_loaded ( )
protected

Does this report require the detailed information for each question from the question_attempts_steps table?

Return values
boolshould } call load_question_latest_steps?

Reimplemented in quiz_overview_table.

◆ 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_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_sql()

table_sql::set_sql (   $fields,
  $from,
  $where,
array  $params = array() 
)
inherited

Set the sql to query the db.

Query will be : SELECT $fields FROM $from WHERE $where Of course you can use sub-queries, JOINS etc. by putting them in the appropriate clause of the query.

Reimplemented in forumreport_summary\summary_table.

◆ 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.

Return values
type?

Reimplemented in assign_grading_table.

◆ setup_sql_queries()

quiz_attempts_report_table::setup_sql_queries (   $allowedjoins)

Set up the SQL queries (count rows, and get data).

Parameters
core\dml\sql_join$allowedjoins(joins, wheres, params) defines allowed users for the report.

◆ 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 core_user\participants_table, assign_grading_table, tool_dataprivacy\output\expired_contexts_table, and tool_dataprivacy\output\data_requests_table.

◆ slot_fraction()

quiz_attempts_report_table::slot_fraction (   $attempt,
  $slot 
)
protected
Parameters
object$attemptthe row data
int$slot
Return values
float

Reimplemented in quiz_first_or_all_responses_table.

◆ slot_state()

quiz_attempts_report_table::slot_state (   $attempt,
  $slot 
)
protected
Parameters
object$attemptthe row data
int$slot
Return values
question_state

Reimplemented in quiz_first_or_all_responses_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_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

◆ update_sql_after_count()

quiz_attempts_report_table::update_sql_after_count (   $fields,
  $from,
  $where,
  $params 
)
protected

A chance for subclasses to modify the SQL after the count query has been generated, and before the full query is constructed.

Parameters
string$fieldsSELECT list.
string$fromJOINs part of the SQL.
string$whereWHERE clauses.
array$paramsQuery params.
Return values
arraywith 4 elements ($fields, $from, $where, $params) as from base_sql.

Reimplemented in quiz_overview_table.

◆ wrap_html_finish()

quiz_attempts_report_table::wrap_html_finish ( )

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 from flexible_table.

◆ wrap_html_start()

quiz_attempts_report_table::wrap_html_start ( )

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 from flexible_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().

◆ $lateststeps

array quiz_attempts_report_table::$lateststeps = null
protected

information about the latest step of each question.

Loaded by load_question_latest_steps(), if applicable.

◆ $questions

object quiz_attempts_report_table::$questions
protected

the questions that comprise this quiz.

◆ $sql

object table_sql::$sql = NULL
inherited

sql for querying db.

Has fields 'fields', 'from', 'where', 'params'.


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