Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 310 and 311] [Versions 310 and 400] [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403]

Base class for the table used by a {@link quiz_attempts_report}.

Copyright: 2010 The Open University
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 690 lines (26 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: quiz_attempts_report_table  - X-Ref

Base class for the table used by a {@link quiz_attempts_report}.

__construct($uniqueid, $quiz, $context, $qmsubselect,mod_quiz_attempts_report_options $options, \core\dml\sql_join $groupstudentsjoins, \core\dml\sql_join $studentsjoins,$questions, $reporturl)   X-Ref
Constructor

param: string $uniqueid
param: object $quiz
param: context $context
param: string $qmsubselect
param: mod_quiz_attempts_report_options $options
param: \core\dml\sql_join $groupstudentsjoins Contains joins, wheres, params
param: \core\dml\sql_join $studentsjoins Contains joins, wheres, params
param: array $questions
param: moodle_url $reporturl

col_checkbox($attempt)   X-Ref
Generate the display of the checkbox column.

param: object $attempt the table row being output.
return: string HTML content to go inside the td.

col_picture($attempt)   X-Ref
Generate the display of the user's picture column.

param: object $attempt the table row being output.
return: string HTML content to go inside the td.

col_fullname($attempt)   X-Ref
Generate the display of the user's full name column.

param: object $attempt the table row being output.
return: string HTML content to go inside the td.

col_state($attempt)   X-Ref
Generate the display of the attempt state column.

param: object $attempt the table row being output.
return: string HTML content to go inside the td.

col_timestart($attempt)   X-Ref
Generate the display of the start time column.

param: object $attempt the table row being output.
return: string HTML content to go inside the td.

col_timefinish($attempt)   X-Ref
Generate the display of the finish time column.

param: object $attempt the table row being output.
return: string HTML content to go inside the td.

col_duration($attempt)   X-Ref
Generate the display of the time taken column.

param: object $attempt the table row being output.
return: string HTML content to go inside the td.

col_feedbacktext($attempt)   X-Ref
Generate the display of the feedback column.

param: object $attempt the table row being output.
return: string HTML content to go inside the td.

get_row_class($attempt)   X-Ref
No description

make_review_link($data, $attempt, $slot)   X-Ref
Make a link to review an individual question in a popup window.

param: string $data HTML fragment. The text to make into the link.
param: object $attempt data for the row of the table being output.
param: int $slot the number used to identify this question within this usage.

slot_state($attempt, $slot)   X-Ref

param: object $attempt the row data
param: int $slot
return: question_state

is_flagged($questionusageid, $slot)   X-Ref

param: int $questionusageid
param: int $slot
return: bool

slot_fraction($attempt, $slot)   X-Ref

param: object $attempt the row data
param: int $slot
return: float

icon_for_fraction($fraction)   X-Ref
Return an appropriate icon (green tick, red cross, etc.) for a grade.

param: float $fraction grade on a scale 0..1.
return: string html fragment.

load_extra_data()   X-Ref
Load any extra data after main query. At this point you can call {@link 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.


load_question_latest_steps(qubaid_condition $qubaids = null)   X-Ref
Load information about the latest state of selected questions in selected attempts.

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

param: qubaid_condition|null $qubaids used to restrict which usages are included
return: array of records. See the SQL in this function to see the fields available.

requires_extra_data()   X-Ref
Does this report require loading any more data after the main query. After the main query then
you can use $this->get

return: bool should {@link query_db()} call {@link load_extra_data}?

requires_latest_steps_loaded()   X-Ref
Does this report require the detailed information for each question from the
question_attempts_steps table?

return: bool should {@link load_extra_data} call {@link load_question_latest_steps}?

is_latest_step_column($column)   X-Ref
Is this a column that depends on joining to the latest state information?
If so, return the corresponding slot. If not, return false.

param: string $column a column name
return: int false if no, else a slot.

get_required_latest_state_fields($slot, $alias)   X-Ref
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().

param: int $slot the slot for the column we want.
param: string $alias the table alias for latest state information relating to that slot.
return: string definitions of extra fields to add to the SELECT list of the query.

base_sql(\core\dml\sql_join $allowedstudentsjoins)   X-Ref
Contruct all the parts of the main database query.

param: \core\dml\sql_join $allowedstudentsjoins (joins, wheres, params) defines allowed users for the report.
return: array with 4 elements ($fields, $from, $where, $params) that can be used to

update_sql_after_count($fields, $from, $where, $params)   X-Ref
A chance for subclasses to modify the SQL after the count query has been generated,
and before the full query is constructed.

param: string $fields SELECT list.
param: string $from JOINs part of the SQL.
param: string $where WHERE clauses.
param: array $params Query params.
return: array with 4 elements ($fields, $from, $where, $params) as from base_sql.

setup_sql_queries($allowedjoins)   X-Ref
Set up the SQL queries (count rows, and get data).

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

add_latest_state_join($slot)   X-Ref
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.

param: int $slot the question to add information for.

get_qubaids_condition()   X-Ref
Get an appropriate qubaid_condition for loading more data about the
attempts we are displaying.

return: qubaid_condition

query_db($pagesize, $useinitialsbar = true)   X-Ref
No description

get_sort_columns()   X-Ref
No description

wrap_html_start()   X-Ref
No description

wrap_html_finish()   X-Ref
No description

submit_buttons()   X-Ref
Output any submit buttons required by the $this->includecheckboxes form.


checkbox_col_header(string $columnname)   X-Ref
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.

param: string $columnname The name of the checkbox column.
return: string