Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
|
The quiz statistics report provides summary information about each question in a quiz, compared to the whole quiz. More...
Public Member Functions | |
display ($quiz, $cm, $course) | |
Display the report. More... | |
get_all_stats_and_analysis ( $quiz, $whichattempts, $whichtries, core\dml\sql_join $groupstudentsjoins, $questions, $progress=null) | |
Get the quiz and question statistics, either by loading the cached results, or by recomputing them. More... | |
get_current_group ($cm, $course, $context) | |
Get the current group for the user user looking at the report. More... | |
load_and_initialise_questions_for_calculations ($quiz) | |
Load the questions in this quiz and add some properties to the objects needed in the reports. More... | |
print_header_and_tabs ($cm, $course, $quiz, $reportmode='overview') | |
Initialise some parts of $PAGE and start output. More... | |
Public Attributes | |
const | NO_GROUPS_ALLOWED = -2 |
Protected Member Functions | |
analyse_responses_for_all_questions_and_subquestions ($questions, $subquestions, $qubaids, $whichtries, $progress=null) | |
Analyse responses for all questions and sub questions in this quiz. More... | |
analyse_responses_for_questions ($questions, $qubaids, $whichtries, $progress=null, $done=array()) | |
Analyse responses for an array of questions or sub questions. More... | |
clear_cached_data ($qubaids) | |
Clear the cached data for a particular report configuration. More... | |
download_quiz_info_table ($quizinfo) | |
Download the table of overall quiz statistics. More... | |
everything_download_options (moodle_url $reporturl) | |
Return a little form for the user to request to download the full report, including quiz stats and response analysis for all questions and sub-questions. More... | |
get_progress_trace_instance () | |
Appropriate instance depending if we want html output for the user or not. More... | |
output_all_question_response_analysis ($qubaids, $questions, $questionstats, $reporturl, $whichtries=question_attempt::LAST_TRY) | |
Output all response analysis for all questions, sub-questions and variants. More... | |
output_caching_info ($lastcachetime, $quizid, $groupstudentsjoins, $whichattempts, $reporturl) | |
Return HTML for a message that says when the stats were last calculated and a 'recalculate now' button. More... | |
output_individual_question_data ($quiz, $questionstat) | |
Display the statistical and introductory information about a question. More... | |
output_individual_question_response_analysis ($question, $variantno, $s, $reporturl, $qubaids, $whichtries=question_attempt::LAST_TRY) | |
Display the response analysis for a question. More... | |
output_quiz_info_table ($quizinfo) | |
Return HTML for table of overall quiz statistics. More... | |
output_quiz_structure_analysis_table ($questionstats) | |
Output the table that lists all the questions in the quiz with their statistics. More... | |
output_statistics_graph ($quizorid, $qubaids) | |
Output the HTML needed to show the statistics graph. More... | |
render_question_text ($question) | |
Output question text in a box with urls appropriate for a preview of the question. More... | |
Protected Attributes | |
context_module | $context |
context of this quiz. | |
core progress base null | $progress = null |
$progress Handles progress reporting or not. | |
quiz_statistics_table | $table |
instance of table class used for main questions stats table. | |
The quiz statistics report provides summary information about each question in a quiz, compared to the whole quiz.
It also provides a drill-down to more detailed information about each question.
|
protected |
Analyse responses for all questions and sub questions in this quiz.
object[] | $questions | as returned by self::load_and_initialise_questions_for_calculations |
object[] | $subquestions | full question objects. |
qubaid_condition | $qubaids | the question usages whose responses to analyse. |
string | $whichtries | which tries to analyse question_attempt::FIRST_TRY, LAST_TRY or ALL_TRIES. |
null | core::progress::base | $progress | Used to indicate progress of task. |
|
protected |
Analyse responses for an array of questions or sub questions.
object[] | $questions | as returned by self::load_and_initialise_questions_for_calculations. |
qubaid_condition | $qubaids | the question usages whose responses to analyse. |
string | $whichtries | which tries to analyse question_attempt::FIRST_TRY, LAST_TRY or ALL_TRIES. |
null | core::progress::base | $progress | Used to indicate progress of task. |
int[] | $done | array keys are ids of questions that have been analysed before calling method. |
array | array keys are ids of questions that were analysed after this method call. |
|
protected |
Clear the cached data for a particular report configuration.
This will trigger a re-computation the next time the report is displayed.
$qubaids | qubaid_condition |
quiz_statistics_report::display | ( | $quiz, | |
$cm, | |||
$course | |||
) |
Display the report.
Reimplemented from quiz_default_report.
|
protected |
Download the table of overall quiz statistics.
array | $quizinfo | as returned by get_formatted_quiz_info_data(). |
|
protected |
Return a little form for the user to request to download the full report, including quiz stats and response analysis for all questions and sub-questions.
moodle_url | $reporturl | the base URL of the report. |
string | HTML. |
quiz_statistics_report::get_all_stats_and_analysis | ( | $quiz, | |
$whichattempts, | |||
$whichtries, | |||
core\dml\sql_join | $groupstudentsjoins, | ||
$questions, | |||
$progress = null |
|||
) |
Get the quiz and question statistics, either by loading the cached results, or by recomputing them.
object | $quiz | the quiz settings. |
string | $whichattempts | which attempts to use, represented internally as one of the constants as used in $quiz->grademethod ie. QUIZ_GRADEAVERAGE, QUIZ_GRADEHIGHEST, QUIZ_ATTEMPTLAST or QUIZ_ATTEMPTFIRST we calculate stats based on which attempts would affect the grade for each student. |
string | $whichtries | which tries to analyse for response analysis. Will be one of question_attempt::FIRST_TRY, LAST_TRY or ALL_TRIES. |
core::dml::sql_join | $groupstudentsjoins | Contains joins, wheres, params for students in this group. |
array | $questions | full question data. |
core::progress::base | null | $progress |
array | with 2 elements: - $quizstats The statistics for overall attempt scores. |
|
inherited |
Get the current group for the user user looking at the report.
object | $cm | the course_module information. |
object | $coures | the course settings. |
context | $context | the quiz context. |
int | the current group id, if applicable. 0 for all users, NO_GROUPS_ALLOWED if the user cannot see any group. |
|
protected |
Appropriate instance depending if we want html output for the user or not.
core::progress::base | child of core\progress\base to handle the display (or not) of task progress. |
quiz_statistics_report::load_and_initialise_questions_for_calculations | ( | $quiz | ) |
Load the questions in this quiz and add some properties to the objects needed in the reports.
object | $quiz | the quiz. |
array | of questions for this quiz. |
|
protected |
Output all response analysis for all questions, sub-questions and variants.
For download in a number of formats.
$qubaids | |
$questions | |
$questionstats | |
$reporturl | |
$whichtries | string |
|
protected |
Return HTML for a message that says when the stats were last calculated and a 'recalculate now' button.
int | $lastcachetime | the time the stats were last cached. |
int | $quizid | the quiz id. |
array | $groupstudentsjoins | (joins, wheres, params) for students in the group or empty array if groups not used. |
string | $whichattempts | which attempts to use, represented internally as one of the constants as used in $quiz->grademethod ie. QUIZ_GRADEAVERAGE, QUIZ_GRADEHIGHEST, QUIZ_ATTEMPTLAST or QUIZ_ATTEMPTFIRST we calculate stats based on which attempts would affect the grade for each student. |
moodle_url | $reporturl | url for this report |
string | HTML. |
|
protected |
Display the statistical and introductory information about a question.
Only called when not downloading.
object | $quiz | the quiz settings. |
core_question::statistics::questions::calculated | $questionstat | the question to report on. |
|
protected |
Display the response analysis for a question.
object | $question | the question to report on. |
int | null | $variantno | the variant |
int | $s | |
moodle_url | $reporturl | the URL to redisplay this report. |
qubaid_condition | $qubaids | |
string | $whichtries |
|
protected |
Return HTML for table of overall quiz statistics.
array | $quizinfo | as returned by get_formatted_quiz_info_data(). |
string | the HTML. |
|
protected |
Output the table that lists all the questions in the quiz with their statistics.
core_question::statistics::questions::all_calculated_for_qubaid_condition | $questionstats | the stats for all questions in the quiz including subqs and variants. |
|
protected |
Output the HTML needed to show the statistics graph.
int | object | $quizorid | The quiz, or its ID. |
qubaid_condition | $qubaids | the question usages whose responses to analyse. |
string | $whichattempts | Which attempts constant. |
|
inherited |
Initialise some parts of $PAGE and start output.
object | $cm | the course_module information. |
object | $coures | the course settings. |
object | $quiz | the quiz settings. |
string | $reportmode | the report name. |
Reimplemented in quiz_grading_report.
|
protected |
Output question text in a box with urls appropriate for a preview of the question.
object | $question | question data. |
string | HTML of question text, ready for display. |