Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
quiz_statistics

Namespaces

namespace  quiz_statistics
  
 
namespace  quiz_statistics\event\observer
  
 
namespace  quiz_statistics\privacy
  
 
namespace  quiz_statistics\task
  
 
namespace  quiz_statistics\tests
  
 

Classes

class  quiz_statistics\calculated
 
class  quiz_statistics\calculator
 
class  quiz_statistics\event\observer\attempt_submitted
 
class  quiz_statistics\hook_callbacks
 
class  quiz_statistics\privacy\provider
 Privacy Subsystem for quiz_statistics implementing null_provider. More...
 
class  quiz_statistics\quiz_attempt_deleted
 
class  quiz_statistics\task\recalculate
 
class  quiz_statistics\tests\statistics_helper
 
class  quiz_statistics_question_table
 This table shows statistics about a particular question. More...
 
class  quiz_statistics_report
 The quiz statistics report provides summary information about each question in a quiz, compared to the whole quiz. More...
 
class  quiz_statistics_settings_form
 This is the settings form for the quiz statistics report. More...
 
class  quiz_statistics_table
 This table has one row for each question in the quiz, with sub-rows when random questions and variants appear. More...
 

Functions

 quiz_statistics_attempts_sql ($quizid, core\dml\sql_join $groupstudentsjoins, $whichattempts=QUIZ_GRADEAVERAGE, $includeungraded=false)
 SQL to fetch relevant 'quiz_attempts' records.
 
 quiz_statistics_qubaids_condition ($quizid, core\dml\sql_join $groupstudentsjoins, $whichattempts=QUIZ_GRADEAVERAGE, $includeungraded=false)
 Return a qubaid_condition from the values returned by quiz_statistics_attempts_sql.
 
 quiz_statistics_question_preview_pluginfile ($previewcontext, $questionid, $filecontext, $filecomponent, $filearea, $args, $forcedownload, $options=[])
 Serve questiontext files in the question text when they are displayed in this report.
 
 xmldb_quiz_statistics_install ()
 Post-install script.
 
 xmldb_quiz_statistics_upgrade ($oldversion)
 Quiz statistics report upgrade code.
 

Variables

 $callbacks
 
 $capabilities
 
 $plugin = 2024041600
 
$plugin component = 'quiz_statistics'
 
$plugin version = 2024042200
 

Detailed Description

Function Documentation

◆ quiz_statistics_attempts_sql()

quiz_statistics_attempts_sql ( $quizid,
core\dml\sql_join $groupstudentsjoins,
$whichattempts = QUIZ_GRADEAVERAGE,
$includeungraded = false )

SQL to fetch relevant 'quiz_attempts' records.

Parameters
int$quizidquiz id to get attempts for
core\dml\sql_join$groupstudentsjoinsContains joins, wheres, params, empty if not using groups
string$whichattemptswhich 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.
bool$includeungradedwhether to fetch ungraded attempts too
Return values
arrayFROM and WHERE sql fragments and sql params

◆ quiz_statistics_qubaids_condition()

quiz_statistics_qubaids_condition ( $quizid,
core\dml\sql_join $groupstudentsjoins,
$whichattempts = QUIZ_GRADEAVERAGE,
$includeungraded = false )

Return a qubaid_condition from the values returned by quiz_statistics_attempts_sql.

Parameters
int$quizid
core\dml\sql_join$groupstudentsjoinsContains joins, wheres, params
string$whichattemptswhich 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.
bool$includeungraded
Return values
qubaid_join

◆ quiz_statistics_question_preview_pluginfile()

quiz_statistics_question_preview_pluginfile ( $previewcontext,
$questionid,
$filecontext,
$filecomponent,
$filearea,
$args,
$forcedownload,
$options = [] )

Serve questiontext files in the question text when they are displayed in this report.

Parameters
context$previewcontextthe quiz context
int$questionidthe question id.
context$filecontextthe file (question) context
string$filecomponentthe component the file belongs to.
string$fileareathe file area.
array$argsremaining file args.
bool$forcedownload,.
array$optionsadditional options affecting the file serving.

Variable Documentation

◆ $callbacks

$callbacks
Initial value:
= [
[
'hook' => mod_quiz\hook\structure_modified::class,
'callback' => quiz_statistics\hook_callbacks::class . '::quiz_structure_modified',
'priority' => 500,
],
[
'hook' => mod_quiz\hook\attempt_state_changed::class,
'callback' => quiz_statistics\hook_callbacks::class . '::quiz_attempt_submitted_or_deleted',
'priority' => 500,
],
]

◆ $capabilities

$capabilities
Initial value:
= [
'quiz/statistics:view' => [
'captype' => 'read',
'contextlevel' => CONTEXT_MODULE,
'archetypes' => [
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'manager' => CAP_ALLOW
],
'clonepermissionsfrom' => 'mod/quiz:viewreports'
]
]
const CAP_ALLOW
Allow permission, overrides CAP_PREVENT defined in parent contexts.
Definition accesslib.php:115
const CONTEXT_MODULE
Course module context level - one instance for each course module.
Definition accesslib.php:130