Moodle PHP Documentation 4.3
Moodle 4.3.5 (Build: 20240610) (7dcfaa79f78)
|
Quiz external functions. More...
Static Public Member Functions | |
static | get_attempt_access_information ($quizid, $attemptid=0) |
Return access information for a given attempt in a quiz. | |
static | get_attempt_access_information_parameters () |
Describes the parameters for get_attempt_access_information. | |
static | get_attempt_access_information_returns () |
Describes the get_attempt_access_information return value. | |
static | get_attempt_data ($attemptid, $page, $preflightdata=[]) |
Returns information for the given attempt page for a quiz attempt in progress. | |
static | get_attempt_data_parameters () |
Describes the parameters for get_attempt_data. | |
static | get_attempt_data_returns () |
Describes the get_attempt_data return value. | |
static | get_attempt_review ($attemptid, $page=-1) |
Returns review information for the given finished attempt, can be used by users or teachers. | |
static | get_attempt_review_parameters () |
Describes the parameters for get_attempt_review. | |
static | get_attempt_review_returns () |
Describes the get_attempt_review return value. | |
static | get_attempt_summary ($attemptid, $preflightdata=[]) |
Returns a summary of a quiz attempt before it is submitted. | |
static | get_attempt_summary_parameters () |
Describes the parameters for get_attempt_summary. | |
static | get_attempt_summary_returns () |
Describes the get_attempt_summary return value. | |
static | get_combined_review_options ($quizid, $userid=0) |
Combines the review options from a number of different quiz attempts. | |
static | get_combined_review_options_parameters () |
Describes the parameters for get_combined_review_options. | |
static | get_combined_review_options_returns () |
Describes the get_combined_review_options return value. | |
static | get_quiz_access_information ($quizid) |
Return access information for a given quiz. | |
static | get_quiz_access_information_parameters () |
Describes the parameters for get_quiz_access_information. | |
static | get_quiz_access_information_returns () |
Describes the get_quiz_access_information return value. | |
static | get_quiz_feedback_for_grade ($quizid, $grade) |
Get the feedback text that should be show to a student who got the given grade in the given quiz. | |
static | get_quiz_feedback_for_grade_parameters () |
Describes the parameters for view_quiz. | |
static | get_quiz_feedback_for_grade_returns () |
Describes the get_quiz_feedback_for_grade return value. | |
static | get_quiz_required_qtypes ($quizid) |
Return the potential question types that would be required for a given quiz. | |
static | get_quiz_required_qtypes_parameters () |
Describes the parameters for get_quiz_required_qtypes. | |
static | get_quiz_required_qtypes_returns () |
Describes the get_quiz_required_qtypes return value. | |
static | get_quizzes_by_courses ($courseids=[]) |
Returns a list of quizzes in a provided list of courses, if no list is provided all quizzes that the user can view will be returned. | |
static | get_quizzes_by_courses_parameters () |
Describes the parameters for get_quizzes_by_courses. | |
static | get_quizzes_by_courses_returns () |
Describes the get_quizzes_by_courses return value. | |
static | get_user_attempts ($quizid, $userid=0, $status='finished', $includepreviews=false) |
Return a list of attempts for the given quiz and user. | |
static | get_user_attempts_parameters () |
Describes the parameters for get_user_attempts. | |
static | get_user_attempts_returns () |
Describes the get_user_attempts return value. | |
static | get_user_best_grade ($quizid, $userid=0) |
Get the best current grade for the given user on a quiz. | |
static | get_user_best_grade_parameters () |
Describes the parameters for get_user_best_grade. | |
static | get_user_best_grade_returns () |
Describes the get_user_best_grade return value. | |
static | process_attempt ($attemptid, $data, $finishattempt=false, $timeup=false, $preflightdata=[]) |
Process responses during an attempt at a quiz and also deals with attempts finishing. | |
static | process_attempt_parameters () |
Describes the parameters for process_attempt. | |
static | process_attempt_returns () |
Describes the process_attempt return value. | |
static | save_attempt ($attemptid, $data, $preflightdata=[]) |
Processes save requests during the quiz. | |
static | save_attempt_parameters () |
Describes the parameters for save_attempt. | |
static | save_attempt_returns () |
Describes the save_attempt return value. | |
static | start_attempt ($quizid, $preflightdata=[], $forcenew=false) |
Starts a new attempt at a quiz. | |
static | start_attempt_parameters () |
Describes the parameters for start_attempt. | |
static | start_attempt_returns () |
Describes the start_attempt return value. | |
static | view_attempt ($attemptid, $page, $preflightdata=[]) |
Trigger the attempt viewed event. | |
static | view_attempt_parameters () |
Describes the parameters for view_attempt. | |
static | view_attempt_returns () |
Describes the view_attempt return value. | |
static | view_attempt_review ($attemptid) |
Trigger the attempt reviewed event. | |
static | view_attempt_review_parameters () |
Describes the parameters for view_attempt_review. | |
static | view_attempt_review_returns () |
Describes the view_attempt_review return value. | |
static | view_attempt_summary ($attemptid, $preflightdata=[]) |
Trigger the attempt summary viewed event. | |
static | view_attempt_summary_parameters () |
Describes the parameters for view_attempt_summary. | |
static | view_attempt_summary_returns () |
Describes the view_attempt_summary return value. | |
static | view_quiz ($quizid) |
Trigger the course module viewed event and update the module completion status. | |
static | view_quiz_parameters () |
Describes the parameters for view_quiz. | |
static | view_quiz_returns () |
Describes the view_quiz return value. | |
Static Protected Member Functions | |
static | validate_attempt ($params, $checkaccessrules=true, $failifoverdue=true) |
Utility function for validating a given attempt. | |
static | validate_attempt_review ($params) |
Validate an attempt finished for review. | |
static | validate_quiz ($quizid) |
Utility function for validating a quiz. | |
Quiz external functions.
|
static |
Return access information for a given attempt in a quiz.
int | $quizid | quiz instance id |
int | $attemptid | attempt id, 0 for the user last attempt if exists |
array | of warnings and the access information |
|
static |
Describes the parameters for get_attempt_access_information.
external_function_parameters |
|
static |
Describes the get_attempt_access_information return value.
external_single_structure |
|
static |
Returns information for the given attempt page for a quiz attempt in progress.
int | $attemptid | attempt id |
int | $page | page number |
array | $preflightdata | preflight required data (like passwords) |
array | of warnings and the attempt data, next page, message and questions |
|
static |
Describes the parameters for get_attempt_data.
external_function_parameters |
|
static |
Describes the get_attempt_data return value.
external_single_structure |
|
static |
Returns review information for the given finished attempt, can be used by users or teachers.
int | $attemptid | attempt id |
int | $page | page number, empty for all the questions in all the pages |
array | of warnings and the attempt data, feedback and questions |
|
static |
Describes the parameters for get_attempt_review.
external_function_parameters |
|
static |
Describes the get_attempt_review return value.
external_single_structure |
|
static |
Returns a summary of a quiz attempt before it is submitted.
int | $attemptid | attempt id |
int | $preflightdata | preflight required data (like passwords) |
array | of warnings and the attempt summary data for each question |
|
static |
Describes the parameters for get_attempt_summary.
external_function_parameters |
|
static |
Describes the get_attempt_summary return value.
external_single_structure |
|
static |
Combines the review options from a number of different quiz attempts.
int | $quizid | quiz instance id |
int | $userid | user id (empty for current user) |
array | of warnings and the review options |
|
static |
Describes the parameters for get_combined_review_options.
external_function_parameters |
|
static |
Describes the get_combined_review_options return value.
external_single_structure |
|
static |
Return access information for a given quiz.
int | $quizid | quiz instance id |
array | of warnings and the access information |
|
static |
Describes the parameters for get_quiz_access_information.
external_function_parameters |
|
static |
Describes the get_quiz_access_information return value.
external_single_structure |
|
static |
Get the feedback text that should be show to a student who got the given grade in the given quiz.
int | $quizid | quiz instance id |
float | $grade | the grade to check |
array | of warnings and status result |
|
static |
|
static |
Describes the get_quiz_feedback_for_grade return value.
external_single_structure |
|
static |
Return the potential question types that would be required for a given quiz.
Please note that for random question types we return the potential question types in the category choosen.
int | $quizid | quiz instance id |
array | of warnings and the access information |
|
static |
Describes the parameters for get_quiz_required_qtypes.
external_function_parameters |
|
static |
Describes the get_quiz_required_qtypes return value.
external_single_structure |
|
static |
Returns a list of quizzes in a provided list of courses, if no list is provided all quizzes that the user can view will be returned.
array | $courseids | Array of course ids |
array | of quizzes details |
|
static |
Describes the parameters for get_quizzes_by_courses.
external_function_parameters |
|
static |
Describes the get_quizzes_by_courses return value.
external_single_structure |
|
static |
Return a list of attempts for the given quiz and user.
int | $quizid | quiz instance id |
int | $userid | user id |
string | $status | quiz status: all, finished or unfinished |
bool | $includepreviews | whether to include previews or not |
array | of warnings and the list of attempts |
|
static |
Describes the parameters for get_user_attempts.
external_function_parameters |
|
static |
Describes the get_user_attempts return value.
external_single_structure |
|
static |
Get the best current grade for the given user on a quiz.
int | $quizid | quiz instance id |
int | $userid | user id |
array | of warnings and the grade information |
|
static |
Describes the parameters for get_user_best_grade.
external_function_parameters |
|
static |
Describes the get_user_best_grade return value.
external_single_structure |
|
static |
Process responses during an attempt at a quiz and also deals with attempts finishing.
int | $attemptid | attempt id |
array | $data | the data to be saved |
bool | $finishattempt | whether to finish or not the attempt |
bool | $timeup | whether the WS was called by a timer when the time is up |
array | $preflightdata | preflight required data (like passwords) |
array | of warnings and the attempt state after the processing |
|
static |
Describes the parameters for process_attempt.
external_function_parameters |
|
static |
|
static |
Processes save requests during the quiz.
This function is intended for the quiz auto-save feature.
int | $attemptid | attempt id |
array | $data | the data to be saved |
array | $preflightdata | preflight required data (like passwords) |
array | of warnings and execution result |
|
static |
Describes the parameters for save_attempt.
external_function_parameters |
|
static |
|
static |
Starts a new attempt at a quiz.
int | $quizid | quiz instance id |
array | $preflightdata | preflight required data (like passwords) |
bool | $forcenew | Whether to force a new attempt or not. |
array | of warnings and the attempt basic data |
|
static |
Describes the parameters for start_attempt.
external_function_parameters |
|
static |
|
staticprotected |
Utility function for validating a given attempt.
array | $params | array of parameters including the attemptid and preflight data |
bool | $checkaccessrules | whether to check the quiz access rules or not |
bool | $failifoverdue | whether to return error if the attempt is overdue |
array | containing the attempt object and access messages |
|
staticprotected |
Validate an attempt finished for review.
The attempt would be reviewed by a user or a teacher.
array | $params | Array of parameters including the attemptid |
array | containing the attempt object and display options |
|
staticprotected |
Utility function for validating a quiz.
int | $quizid | quiz instance id |
array | array containing the quiz, course, context and course module objects |
|
static |
Trigger the attempt viewed event.
int | $attemptid | attempt id |
int | $page | page number |
array | $preflightdata | preflight required data (like passwords) |
array | of warnings and status result |
|
static |
Describes the parameters for view_attempt.
external_function_parameters |
|
static |
|
static |
Trigger the attempt reviewed event.
int | $attemptid | attempt id |
array | of warnings and status result |
|
static |
Describes the parameters for view_attempt_review.
external_function_parameters |
|
static |
Describes the view_attempt_review return value.
external_single_structure |
|
static |
Trigger the attempt summary viewed event.
int | $attemptid | attempt id |
array | $preflightdata | preflight required data (like passwords) |
array | of warnings and status result |
|
static |
Describes the parameters for view_attempt_summary.
external_function_parameters |
|
static |
Describes the view_attempt_summary return value.
external_single_structure |
|
static |
Trigger the course module viewed event and update the module completion status.
int | $quizid | quiz instance id |
array | of warnings and status result |
|
static |
|
static |