Moodle APIs 4.3
Moodle 4.3.6 (Build: 20240812)
|
Functions | |
build_required_parameters_for_custom_view (array $params, array $extraparams) | |
Build required parameters for question bank custom view. | |
mod_quiz_calculate_question_stats (context $context) | |
Implement the calculate_question_stats callback. | |
mod_quiz_cm_info_dynamic (cm_info $cm) | |
Sets dynamic information about a course module. | |
mod_quiz_core_calendar_event_timestart_updated (\calendar_event $event, stdClass $quiz) | |
This function will update the quiz module according to the event that has been modified. | |
mod_quiz_core_calendar_get_event_action_string (string $eventtype) | |
Callback to fetch the activity event type lang string. | |
mod_quiz_core_calendar_get_valid_event_timestart_range (\calendar_event $event, stdClass $quiz) | |
Returns the min and max values for the timestart property of a quiz activity event. | |
mod_quiz_core_calendar_provide_event_action (calendar_event $event, core_calendar\action_factory $factory, int $userid=0) | |
This function receives a calendar event and returns the action associated with it, or null if there is none. | |
mod_quiz_get_completion_active_rule_descriptions ($cm) | |
Callback which returns human-readable strings describing the active completion custom rules for the module instance. | |
mod_quiz_get_fontawesome_icon_map () | |
Get icon mapping for font-awesome. | |
mod_quiz_inplace_editable (string $itemtype, int $itemid, string $newvalue) | |
In place editable callback for slot displaynumber. | |
mod_quiz_output_fragment_add_random_question_form ($args) | |
Generates the add random question in a fragment output. | |
mod_quiz_output_fragment_question_data (array $args) | |
Question data fragment to get the question html via ajax call. | |
mod_quiz_output_fragment_quiz_question_bank ($args) | |
Generates the question bank in a fragment output. | |
mod_quiz_user_preferences () | |
Return a list of all the user preferences used by mod_quiz. | |
quiz_add_instance ($quiz) | |
Given an object containing all the necessary data, (defined by the form in mod_form.php) this function will create a new instance and return the id number of the new instance. | |
quiz_after_add_or_update ($quiz) | |
This function is called at the end of quiz_add_instance and quiz_update_instance, to do the common processing. | |
quiz_allows_multiple_tries ($quiz) | |
Does this quiz allow multiple tries? | |
quiz_attempt_summary_link_to_reports ($quiz, $cm, $context, $returnzero=false, $currentgroup=0) | |
Returns the same as quiz_num_attempt_summary() but wrapped in a link to the quiz reports. | |
quiz_check_updates_since (cm_info $cm, $from, $filter=[]) | |
Check if the module has any update that affects the current user since a given time. | |
quiz_delete_all_attempts ($quiz) | |
Delete all the attempts belonging to a quiz. | |
quiz_delete_all_overrides ($quiz, $log=true) | |
Deletes all quiz overrides from the database and clears any corresponding calendar events. | |
quiz_delete_instance ($id) | |
Given an ID of an instance of this module, this function will permanently delete the instance and any data that depends on it. | |
quiz_delete_override ($quiz, $overrideid, $log=true) | |
Deletes a quiz override from the database and clears any corresponding calendar events. | |
quiz_delete_references ($quizid) | |
Delete all question references for a quiz. | |
quiz_delete_user_attempts ($quiz, $user) | |
Delete all the attempts belonging to a user in a particular quiz. | |
quiz_extend_settings_navigation (settings_navigation $settings, navigation_node $quiznode) | |
This function extends the settings navigation block for the site. | |
quiz_format_grade ($quiz, $grade) | |
Round a grade to the correct number of decimal places, and format it for display. | |
quiz_format_question_grade ($quiz, $grade) | |
Round a grade to the correct number of decimal places, and format it for display. | |
quiz_get_best_grade ($quiz, $userid) | |
Get the best current grade for a particular user in a quiz. | |
quiz_get_coursemodule_info ($coursemodule) | |
Add a get_coursemodule_info function in case any quiz type wants to add 'extra' information for the course (see resource). | |
quiz_get_extra_capabilities () | |
quiz_get_grade_format ($quiz) | |
Determine the correct number of decimal places required to format a grade. | |
quiz_get_group_override_priorities ($quizid) | |
Calculates the priorities of timeopen and timeclose values for group overrides for a quiz. | |
quiz_get_navigation_options () | |
quiz_get_post_actions () | |
List the actions that correspond to a post of this module. | |
quiz_get_recent_mod_activity (&$activities, &$index, $timestart, $courseid, $cmid, $userid=0, $groupid=0) | |
Returns all quiz graded users since a given time for specified quiz. | |
quiz_get_user_attempts ($quizids, $userid, $status='finished', $includepreviews=false) | |
quiz_get_user_grades ($quiz, $userid=0) | |
Return grade for given user or all users. | |
quiz_get_view_actions () | |
List the actions that correspond to a view of this module. | |
quiz_grade_item_delete ($quiz) | |
Delete grade item for given quiz. | |
quiz_grade_item_update ($quiz, $grades=null) | |
Create or update the grade item for given quiz. | |
quiz_has_grades ($quiz) | |
Is this a graded quiz? If this method returns true, you can assume that $quiz->grade and $quiz->sumgrades are non-zero (for example, if you want to divide by them). | |
quiz_num_attempt_summary ($quiz, $cm, $returnzero=false, $currentgroup=0) | |
Return a textual summary of the number of attempts that have been made at a particular quiz, returns '' if no attempts have been made yet, unless $returnzero is passed as true. | |
quiz_page_type_list ($pagetype, $parentcontext, $currentcontext) | |
Return a list of page types. | |
quiz_pluginfile ($course, $cm, $context, $filearea, $args, $forcedownload, array $options=[]) | |
Serves the quiz files. | |
quiz_print_recent_mod_activity ($activity, $courseid, $detail, $modnames) | |
quiz_process_options ($quiz) | |
Pre-process the quiz options form data, making any necessary adjustments. | |
quiz_question_pluginfile ($course, $context, $component, $filearea, $qubaid, $slot, $args, $forcedownload, array $options=[]) | |
Called via pluginfile.php -> question_pluginfile to serve files belonging to a question in a question_attempt when that attempt is a quiz attempt. | |
quiz_questions_in_use ($questionids) | |
Standard callback used by questions_in_use. | |
quiz_refresh_events ($courseid=0, $instance=null, $cm=null) | |
This standard function will check all instances of this module and make sure there are up-to-date events created for each of them. | |
quiz_reset_course_form_defaults ($course) | |
Course reset form defaults. | |
quiz_reset_course_form_definition ($mform) | |
Implementation of the function for printing the form elements that control whether the course reset functionality affects the quiz. | |
quiz_reset_gradebook ($courseid, $type='') | |
Removes all grades from gradebook. | |
quiz_reset_userdata ($data) | |
Actual implementation of the reset course functionality, delete all the quiz attempts for course $data->courseid, if $data->reset_quiz_attempts is set and true. | |
quiz_review_option_form_to_db ($fromform, $field) | |
Helper function for quiz_process_options(). | |
quiz_supports ($feature) | |
quiz_update_effective_access ($quiz, $userid) | |
Updates a quiz object with override information for a user. | |
quiz_update_events ($quiz, $override=null) | |
This function updates the events associated to the quiz. | |
quiz_update_grades ($quiz, $userid=0, $nullifnone=true) | |
Update grades in central gradebook. | |
quiz_update_instance ($quiz, $mform) | |
Given an object containing all the necessary data, (defined by the form in mod_form.php) this function will update an existing instance with new data. | |
quiz_user_complete ($course, $user, $mod, $quiz) | |
Print a detailed representation of what a user has done with a given particular instance of this module, for user activity reports. | |
quiz_user_outline ($course, $user, $mod, $quiz) | |
Return a small object with summary information about what a user has done with a given particular instance of this module Used for user activity reports. | |
Variables | |
const | QUIZ_ATTEMPTFIRST '3' |
const | QUIZ_ATTEMPTLAST '4' |
const | QUIZ_EVENT_TYPE_CLOSE 'close' |
const | QUIZ_EVENT_TYPE_OPEN 'open' |
#- | |
const | QUIZ_GRADEAVERAGE '2' |
const | QUIZ_GRADEHIGHEST '1' |
#- | |
const | QUIZ_MAX_ATTEMPT_OPTION 10 |
#+ Option controlling what options are offered on the quiz settings form. | |
const | QUIZ_MAX_DECIMAL_OPTION 5 |
const | QUIZ_MAX_EVENT_LENGTH 5*24*60*60 |
#- | |
const | QUIZ_MAX_Q_DECIMAL_OPTION 7 |
const | QUIZ_MAX_QPP_OPTION 50 |
const | QUIZ_NAVMETHOD_FREE 'free' |
#+ Options for navigation method within quizzes. | |
const | QUIZ_NAVMETHOD_SEQ 'sequential' |
build_required_parameters_for_custom_view | ( | array | $params, |
array | $extraparams ) |
Build required parameters for question bank custom view.
array | $params | the page parameters |
array | $extraparams | additional parameters |
array |
mod_quiz_calculate_question_stats | ( | context | $context | ) |
Implement the calculate_question_stats callback.
This enables quiz statistics to be shown in statistics columns in the database.
context | $context | return the statistics related to this context (which will be a quiz context). |
all_calculated_for_qubaid_condition|null | The statistics for this quiz, if available, else null. |
mod_quiz_cm_info_dynamic | ( | cm_info | $cm | ) |
mod_quiz_core_calendar_event_timestart_updated | ( | \calendar_event | $event, |
stdClass | $quiz ) |
This function will update the quiz module according to the event that has been modified.
It will set the timeopen or timeclose value of the quiz instance according to the type of event provided.
moodle_exception |
calendar_event | $event | A quiz activity calendar event |
stdClass | $quiz | A quiz activity instance |
mod_quiz_core_calendar_get_event_action_string | ( | string | $eventtype | ) |
Callback to fetch the activity event type lang string.
string | $eventtype | The event type. |
lang_string | The event type lang string. |
mod_quiz_core_calendar_get_valid_event_timestart_range | ( | \calendar_event | $event, |
stdClass | $quiz ) |
Returns the min and max values for the timestart property of a quiz activity event.
The min and max values will be the timeopen and timeclose properties of the quiz, respectively, if they are set.
If either value isn't set then null will be returned instead to indicate that there is no cutoff for that value.
If the vent has no valid timestart range then [false, false] will be returned. This is the case for overriden events.
A minimum and maximum cutoff return value will look like: [ [1505704373, 'The date must be after this date'], [1506741172, 'The date must be before this date'] ]
moodle_exception |
calendar_event | $event | The calendar event to get the time range for |
stdClass | $quiz | The module instance to get the range from |
array |
mod_quiz_core_calendar_provide_event_action | ( | calendar_event | $event, |
core_calendar\action_factory | $factory, | ||
int | $userid = 0 ) |
This function receives a calendar event and returns the action associated with it, or null if there is none.
This is used by block_myoverview in order to display the event appropriately. If null is returned then the event is not displayed on the block.
calendar_event | $event | |
core_calendar\action_factory | $factory | |
int | $userid | User id to use for all capability checks, etc. Set to 0 for current user (default). |
core_calendar\local\event\entities\action_interface|null |
mod_quiz_get_completion_active_rule_descriptions | ( | $cm | ) |
Callback which returns human-readable strings describing the active completion custom rules for the module instance.
cm_info | stdClass | $cm | object with fields ->completion and ->customdata['customcompletionrules'] |
array\$descriptions | the array of descriptions for the custom rules. |
mod_quiz_inplace_editable | ( | string | $itemtype, |
int | $itemid, | ||
string | $newvalue ) |
In place editable callback for slot displaynumber.
string | $itemtype | slotdisplarnumber |
int | $itemid | the id of the slot in the quiz_slots table |
string | $newvalue | the new value for displaynumber field for a given slot in the quiz_slots table |
core\output\inplace_editable|void |
mod_quiz_output_fragment_add_random_question_form | ( | $args | ) |
Generates the add random question in a fragment output.
This allows the form to be rendered in javascript, for example inside a modal.
The required arguments as keys in the $args array are: cat {string} The category and category context ids comma separated. addonpage {int} The page id to add this question to. returnurl {string} URL to return to after form submission. cmid {int} The course module id the questions are being added to.
array | $args | The fragment arguments. |
string | The rendered mform fragment. |
mod_quiz_output_fragment_question_data | ( | array | $args | ) |
Question data fragment to get the question html via ajax call.
array | $args |
string |
mod_quiz_output_fragment_quiz_question_bank | ( | $args | ) |
Generates the question bank in a fragment output.
This allows the question bank to be displayed in a modal.
The only expected argument provided in the $args array is 'querystring'. The value should be the list of parameters URL encoded and used to build the question bank page.
The individual list of parameters expected can be found in question_build_edit_resources.
array | $args | The fragment arguments. |
string | The rendered mform fragment. |
mod_quiz_user_preferences | ( | ) |
Return a list of all the user preferences used by mod_quiz.
@uses core_user\is_current_user
array[] |
quiz_add_instance | ( | $quiz | ) |
Given an object containing all the necessary data, (defined by the form in mod_form.php) this function will create a new instance and return the id number of the new instance.
stdClass | $quiz | the data that came from the form. |
mixed | the id of the new instance on success, false or a string error message on failure. |
quiz_after_add_or_update | ( | $quiz | ) |
This function is called at the end of quiz_add_instance and quiz_update_instance, to do the common processing.
stdClass | $quiz | the quiz object. |
quiz_allows_multiple_tries | ( | $quiz | ) |
Does this quiz allow multiple tries?
bool |
quiz_attempt_summary_link_to_reports | ( | $quiz, | |
$cm, | |||
$context, | |||
$returnzero = false, | |||
$currentgroup = 0 ) |
Returns the same as quiz_num_attempt_summary() but wrapped in a link to the quiz reports.
stdClass | $quiz | the quiz object. Only $quiz->id is used at the moment. |
stdClass | $cm | the cm object. Only $cm->course, $cm->groupmode and $cm->groupingid fields are used at the moment. |
stdClass | $context | the quiz context. |
bool | $returnzero | if false (default), when no attempts have been made '' is returned instead of 'Attempts: 0'. |
int | $currentgroup | if there is a concept of current group where this method is being called (e.g. a report) pass it in here. Default 0 which means no current group. |
string | HTML fragment for the link. |
quiz_check_updates_since | ( | cm_info | $cm, |
$from, | |||
$filter = [] ) |
Check if the module has any update that affects the current user since a given time.
cm_info | $cm | course module data |
int | $from | the time to check updates from |
array | $filter | if we need to check only specific updates |
stdClass | an object with the different type of areas indicating if they were updated or not |
quiz_delete_all_attempts | ( | $quiz | ) |
Delete all the attempts belonging to a quiz.
stdClass | $quiz | The quiz object. |
quiz_delete_all_overrides | ( | $quiz, | |
$log = true ) |
Deletes all quiz overrides from the database and clears any corresponding calendar events.
stdClass | $quiz | The quiz object. |
bool | $log | Whether to trigger logs. |
quiz_delete_instance | ( | $id | ) |
Given an ID of an instance of this module, this function will permanently delete the instance and any data that depends on it.
int | $id | the id of the quiz to delete. |
bool | success or failure. |
quiz_delete_override | ( | $quiz, | |
$overrideid, | |||
$log = true ) |
Deletes a quiz override from the database and clears any corresponding calendar events.
stdClass | $quiz | The quiz object. |
int | $overrideid | The id of the override being deleted |
bool | $log | Whether to trigger logs. |
bool | true on success |
quiz_delete_references | ( | $quizid | ) |
Delete all question references for a quiz.
int | $quizid | The id of quiz. |
quiz_delete_user_attempts | ( | $quiz, | |
$user ) |
Delete all the attempts belonging to a user in a particular quiz.
mod_quiz\quiz_settings | $quiz | The quiz object. |
stdClass | $user | The user object. |
quiz_extend_settings_navigation | ( | settings_navigation | $settings, |
navigation_node | $quiznode ) |
This function extends the settings navigation block for the site.
It is safe to rely on PAGE here as we will only ever be within the module context when this is called
settings_navigation | $settings | |
navigation_node | $quiznode |
void |
quiz_format_grade | ( | $quiz, | |
$grade ) |
Round a grade to the correct number of decimal places, and format it for display.
stdClass | $quiz | The quiz table row, only $quiz->decimalpoints is used. |
float | $grade | The grade to round. |
string |
quiz_format_question_grade | ( | $quiz, | |
$grade ) |
Round a grade to the correct number of decimal places, and format it for display.
stdClass | $quiz | The quiz table row, only $quiz->decimalpoints is used. |
float | $grade | The grade to round. |
string |
quiz_get_best_grade | ( | $quiz, | |
$userid ) |
Get the best current grade for a particular user in a quiz.
stdClass | $quiz | the quiz settings. |
int | $userid | the id of the user. |
float | the user's current grade for this quiz, or null if this user does not have a grade on this quiz. |
quiz_get_coursemodule_info | ( | $coursemodule | ) |
Add a get_coursemodule_info function in case any quiz type wants to add 'extra' information for the course (see resource).
Given a course_module object, this function returns any "extra" information that may be needed when printing this activity in a course listing. See get_array_of_activities() in course/lib.php.
stdClass | $coursemodule | The coursemodule object (record). |
cached_cm_info|false | An object on information that the courses will know about (most noticeably, an icon). |
quiz_get_extra_capabilities | ( | ) |
array | all other caps used in module |
quiz_get_grade_format | ( | $quiz | ) |
Determine the correct number of decimal places required to format a grade.
stdClass | $quiz | The quiz table row, only $quiz->decimalpoints and ->questiondecimalpoints are used. |
integer |
quiz_get_group_override_priorities | ( | $quizid | ) |
Calculates the priorities of timeopen and timeclose values for group overrides for a quiz.
int | $quizid | The quiz ID. |
array|null | Array of group override priorities for open and close times. Null if there are no group overrides. |
quiz_get_navigation_options | ( | ) |
the | options for quiz navigation. |
quiz_get_post_actions | ( | ) |
List the actions that correspond to a post of this module.
This is used by the participation report.
Note: This is not used by new logging system. Event with crud = ('c' || 'u' || 'd') and edulevel = LEVEL_PARTICIPATING will be considered as post action.
array |
quiz_get_user_attempts | ( | $quizids, | |
$userid, | |||
$status = 'finished', | |||
$includepreviews = false ) |
int | array | $quizids | A quiz ID, or an array of quiz IDs. |
int | $userid | the userid. |
string | $status | 'all', 'finished' or 'unfinished' to control |
bool | $includepreviews |
array | of all the user's attempts at this quiz. Returns an empty array if there are none. |
quiz_get_user_grades | ( | $quiz, | |
$userid = 0 ) |
Return grade for given user or all users.
int | $quizid | id of quiz |
int | $userid | optional user id, 0 means all users |
array | array of grades, false if none. These are raw grades. They should be processed with quiz_format_grade for display. |
quiz_get_view_actions | ( | ) |
List the actions that correspond to a view of this module.
This is used by the participation report.
Note: This is not used by new logging system. Event with crud = 'r' and edulevel = LEVEL_PARTICIPATING will be considered as view action.
array |
quiz_grade_item_delete | ( | $quiz | ) |
Delete grade item for given quiz.
stdClass | $quiz | object |
int |
quiz_grade_item_update | ( | $quiz, | |
$grades = null ) |
Create or update the grade item for given quiz.
stdClass | $quiz | object with extra cmidnumber |
mixed | $grades | optional array/object of grade(s); 'reset' means reset grades in gradebook |
int | 0 if ok, error code otherwise |
quiz_has_grades | ( | $quiz | ) |
Is this a graded quiz? If this method returns true, you can assume that $quiz->grade and $quiz->sumgrades are non-zero (for example, if you want to divide by them).
stdClass | $quiz | a row from the quiz table. |
bool | whether this is a graded quiz. |
quiz_num_attempt_summary | ( | $quiz, | |
$cm, | |||
$returnzero = false, | |||
$currentgroup = 0 ) |
Return a textual summary of the number of attempts that have been made at a particular quiz, returns '' if no attempts have been made yet, unless $returnzero is passed as true.
stdClass | $quiz | the quiz object. Only $quiz->id is used at the moment. |
stdClass | $cm | the cm object. Only $cm->course, $cm->groupmode and $cm->groupingid fields are used at the moment. |
bool | $returnzero | if false (default), when no attempts have been made '' is returned instead of 'Attempts: 0'. |
int | $currentgroup | if there is a concept of current group where this method is being called (e.g. a report) pass it in here. Default 0 which means no current group. |
string | a string like "Attempts: 123", "Attemtps 123 (45 from your groups)" or "Attemtps 123 (45 from this group)". |
quiz_page_type_list | ( | $pagetype, | |
$parentcontext, | |||
$currentcontext ) |
Return a list of page types.
string | $pagetype | current page type |
stdClass | $parentcontext | Block's parent context |
stdClass | $currentcontext | Current context of block |
quiz_pluginfile | ( | $course, | |
$cm, | |||
$context, | |||
$filearea, | |||
$args, | |||
$forcedownload, | |||
array | $options = [] ) |
Serves the quiz files.
stdClass | $course | course object |
stdClass | $cm | course module object |
stdClass | $context | context object |
string | $filearea | file area |
array | $args | extra arguments |
bool | $forcedownload | whether or not force download |
array | $options | additional options affecting the file serving |
bool | false if file not found, does not return if found - justsend the file |
quiz_process_options | ( | $quiz | ) |
Pre-process the quiz options form data, making any necessary adjustments.
Called by add/update instance in this file.
stdClass | $quiz | The variables set on the form. |
quiz_question_pluginfile | ( | $course, | |
$context, | |||
$component, | |||
$filearea, | |||
$qubaid, | |||
$slot, | |||
$args, | |||
$forcedownload, | |||
array | $options = [] ) |
Called via pluginfile.php -> question_pluginfile to serve files belonging to a question in a question_attempt when that attempt is a quiz attempt.
stdClass | $course | course settings object |
stdClass | $context | context object |
string | $component | the name of the component we are serving files for. |
string | $filearea | the name of the file area. |
int | $qubaid | the attempt usage id. |
int | $slot | the id of a question in this quiz attempt. |
array | $args | the remaining bits of the file path. |
bool | $forcedownload | whether the user must be forced to download the file. |
array | $options | additional options affecting the file serving |
bool | false if file not found, does not return if found - justsend the file |
quiz_questions_in_use | ( | $questionids | ) |
Standard callback used by questions_in_use.
array | $questionids | of question ids. |
bool | whether any of these questions are used by any instance of this module. |
quiz_refresh_events | ( | $courseid = 0, | |
$instance = null, | |||
$cm = null ) |
This standard function will check all instances of this module and make sure there are up-to-date events created for each of them.
If courseid = 0, then every quiz event in the site is checked, else only quiz events belonging to the course specified are checked. This function is used, in its new format, by restore_refresh_events()
int | $courseid | |
int | stdClass | $instance | Quiz module instance or ID. |
int | stdClass | $cm | Course module object or ID (not used in this module). |
bool |
quiz_reset_course_form_defaults | ( | $course | ) |
Course reset form defaults.
array | the defaults. |
quiz_reset_course_form_definition | ( | $mform | ) |
Implementation of the function for printing the form elements that control whether the course reset functionality affects the quiz.
MoodleQuickForm | $mform | the course reset form that is being built. |
quiz_reset_gradebook | ( | $courseid, | |
$type = '' ) |
Removes all grades from gradebook.
int | $courseid | |
string | optional type |
quiz_reset_userdata | ( | $data | ) |
Actual implementation of the reset course functionality, delete all the quiz attempts for course $data->courseid, if $data->reset_quiz_attempts is set and true.
Also, move the quiz open and close dates, if the course start date is changing.
stdClass | $data | the data submitted from the reset course. |
array | status array |
quiz_review_option_form_to_db | ( | $fromform, | |
$field ) |
Helper function for quiz_process_options().
stdClass | $fromform | the sumbitted form date. |
string | $field | one of the review option field names. |
quiz_supports | ( | $feature | ) |
string | $feature | FEATURE_xx constant for requested feature |
mixed | True if module supports feature, false if not, null if doesn't know or string for the module purpose. |
quiz_update_effective_access | ( | $quiz, | |
$userid ) |
Updates a quiz object with override information for a user.
Algorithm: For each quiz setting, if there is a matching user-specific override, then use that otherwise, if there are group-specific overrides, return the most lenient combination of them. If neither applies, leave the quiz setting unchanged.
Special case: if there is more than one password that applies to the user, then quiz->extrapasswords will contain an array of strings giving the remaining passwords.
stdClass | $quiz | The quiz object. |
int | $userid | The userid. |
stdClass\$quiz | The updated quiz object. |
quiz_update_events | ( | $quiz, | |
$override = null ) |
This function updates the events associated to the quiz.
If $override is non-zero, then it updates only the events associated with the specified override.
stdClass | $quiz | the quiz object. |
stdClass | null | $override | limit to a specific override |
quiz_update_grades | ( | $quiz, | |
$userid = 0, | |||
$nullifnone = true ) |
Update grades in central gradebook.
stdClass | $quiz | the quiz settings. |
int | $userid | specific user only, 0 means all users. |
bool | $nullifnone | If a single user is specified and $nullifnone is true a grade item with a null rawgrade will be inserted |
quiz_update_instance | ( | $quiz, | |
$mform ) |
Given an object containing all the necessary data, (defined by the form in mod_form.php) this function will update an existing instance with new data.
stdClass | $quiz | the data that came from the form. |
stdClass | $mform | no longer used. |
mixed | true on success, false or a string error message on failure. |
quiz_user_complete | ( | $course, | |
$user, | |||
$mod, | |||
$quiz ) |
Print a detailed representation of what a user has done with a given particular instance of this module, for user activity reports.
stdClass | $course | |
stdClass | $user | |
stdClass | $mod | |
stdClass | $quiz |
bool |
quiz_user_outline | ( | $course, | |
$user, | |||
$mod, | |||
$quiz ) |
Return a small object with summary information about what a user has done with a given particular instance of this module Used for user activity reports.
$return->time = the time they did it $return->info = a short text description
stdClass | $course | |
stdClass | $user | |
stdClass | $mod | |
stdClass | $quiz |
stdClass|null |
const QUIZ_EVENT_TYPE_OPEN 'open' |
#-
Event types.
const QUIZ_GRADEHIGHEST '1' |
#-
#+ Options determining how the grades from individual attempts are combined to give the overall grade for a user
const QUIZ_MAX_EVENT_LENGTH 5*24*60*60 |
#-
If start and end date for the quiz are more than this many seconds apart they will be represented by two separate events in the calendar