Moodle PHP Documentation 4.4
Moodle 4.4.1 (Build: 20240610) (db07c09afc5)
|
The quiz statistics report provides summary information about each question in a quiz, compared to the whole quiz. More...
Public Member Functions | |
calculate_questions_stats_for_question_bank (int $quizid, bool $calculateifrequired=true, bool $performanalysis=true,) | |
Load question stats for a quiz. | |
clear_cached_data ($qubaids) | |
Clear the cached data for a particular report configuration. | |
display ($quiz, $cm, $course) | |
Display the report. | |
get_all_stats_and_analysis ( $quiz, $whichattempts, $whichtries, core\dml\sql_join $groupstudentsjoins, $questions, $progress=null, bool $calculateifrequired=true, bool $performanalysis=true) | |
Get the quiz and question statistics, either by loading the cached results, or by recomputing them. | |
get_current_group ($cm, $course, $context) | |
Get the current group for the user user looking at the 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. | |
print_header_and_tabs ($cm, $course, $quiz, $reportmode='overview') | |
Initialise some parts of $PAGE and start output. | |
Public Attributes | |
int const | NO_GROUPS_ALLOWED = -2 |
special value used in place of groupid, to mean the use cannot access any groups. | |
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. | |
analyse_responses_for_questions ($questions, $qubaids, $whichtries, $progress=null, $done=[]) | |
Analyse responses for an array of questions or sub questions. | |
download_quiz_info_table ($quizinfo) | |
Download the table of overall quiz statistics. | |
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. | |
get_progress_trace_instance () | |
Appropriate instance depending if we want html output for the user or not. | |
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. | |
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. | |
output_individual_question_data ($quiz, $questionstat) | |
Display the statistical and introductory information about a question. | |
output_individual_question_response_analysis ($question, $variantno, $s, $reporturl, $qubaids, $whichtries=question_attempt::LAST_TRY) | |
Display the response analysis for a question. | |
output_quiz_info_table ($quizinfo) | |
Return HTML for table of overall quiz statistics. | |
output_quiz_structure_analysis_table ($questionstats) | |
Output the table that lists all the questions in the quiz with their statistics. | |
output_statistics_graph ($quiz, $qubaids) | |
Output the HTML needed to show the statistics graph. | |
render_question_text ($question) | |
Output question text in a box with urls appropriate for a preview of the question. | |
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.
stdClass[] | $questions | as returned by self\load_and_initialise_questions_for_calculations |
stdClass[] | $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.
stdClass[] | $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. |
quiz_statistics_report::calculate_questions_stats_for_question_bank | ( | int | $quizid, |
bool | $calculateifrequired = true, | ||
bool | $performanalysis = true ) |
Load question stats for a quiz.
int | $quizid | question usage |
bool | $calculateifrequired | if true (the default) the stats will be calculated if not already stored. If false, null will be returned if the stats are not already available. |
bool | $performanalysis | if true (the default) and there are calculated stats, analysis will be performed for each question. |
?all_calculated_for_qubaid_condition | question stats |
quiz_statistics_report::clear_cached_data | ( | $qubaids | ) |
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 mod_quiz\local\reports\report_base.
|
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, | |||
bool | $calculateifrequired = true, | ||
bool | $performanalysis = true ) |
Get the quiz and question statistics, either by loading the cached results, or by recomputing them.
stdClass | $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 | |
bool | $calculateifrequired | if true (the default) the stats will be calculated if not already stored. If false, [null, null] will be returned if the stats are not already available. |
bool | $performanalysis | if true (the default) and there are calculated stats, analysis will be performed for each question. |
array | with 2 elements: - $quizstats The statistics for overall attempt scores.
|
|
inherited |
Get the current group for the user user looking at the report.
stdClass | $cm | the course_module information. |
stdClass | $course | 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.
stdClass | $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. |
core\dml\sql_join | $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.
stdClass | $quiz | the quiz settings. |
core_question\statistics\questions\calculated | $questionstat | the question to report on. |
|
protected |
Display the response analysis for a question.
stdClass | $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.
stdClass | $quiz | the quiz. |
qubaid_condition | $qubaids | the question usages whose responses to analyse. |
|
inherited |
Initialise some parts of $PAGE and start output.
stdClass | $cm | the course_module information. |
stdClass | $course | the course settings. |
stdClass | $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.
stdClass | $question | question data. |
string | HTML of question text, ready for display. |