Differences Between: [Versions 402 and 403]
(no description)
File Size: | 2336 lines (88 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
quiz_attempt:: (121 methods):
__construct()
create_helper()
create()
create_from_usage_id()
state_name()
load_questions()
preload_all_attempt_step_users()
link_sections_and_slots()
determine_layout()
number_questions()
force_page_number_into_range()
get_quiz()
get_quizobj()
get_courseid()
get_course()
get_quizid()
get_quiz_name()
get_navigation_method()
get_cm()
get_cmid()
get_context()
is_preview_user()
get_num_attempts_allowed()
get_num_pages()
get_access_manager()
get_attemptid()
get_uniqueid()
get_attempt()
get_attempt_number()
get_state()
get_userid()
get_currentpage()
get_sum_marks()
is_finished()
is_preview()
is_own_attempt()
is_own_preview()
is_review_allowed()
has_response_to_at_least_one_graded_question()
requires_manual_grading()
get_additional_summary_data()
get_overall_feedback()
has_capability()
require_capability()
check_review_capability()
can_navigate_to()
get_attempt_state()
get_display_options()
get_display_options_with_edit_link()
is_last_page()
get_slots()
get_active_slots()
get_question_usage()
get_question_attempt()
all_question_attempts_originally_in_slot()
is_real_question()
is_question_flagged()
is_blocked_by_previous_question()
can_question_be_redone_now()
get_original_slot()
get_question_number()
get_heading_before_slot()
get_question_page()
get_question_name()
get_question_state()
get_question_status()
get_question_state_class()
get_question_mark()
get_question_action_time()
get_question_type_name()
get_time_left_display()
get_submitted_date()
get_due_date()
view_url()
start_attempt_url()
attempt_page_title()
attempt_url()
summary_page_title()
summary_url()
processattempt_url()
review_page_title()
review_url()
get_default_show_all()
cannot_review_message()
get_html_head_contributions()
get_question_html_head_contributions()
restart_preview_button()
render_question()
render_question_helper()
make_blocked_question_placeholder()
render_question_at_step()
render_question_for_commenting()
check_file_access()
get_navigation_panel()
links_to_other_attempts()
links_to_other_redos()
handle_if_time_expired()
process_submitted_actions()
process_redo_question()
process_auto_save()
save_question_flags()
process_finish()
update_timecheckstate()
recompute_final_grade()
process_going_overdue()
process_abandon()
process_reopen_abandoned()
fire_state_transition_event()
page_and_question_url()
process_attempt()
check_page_access()
set_currentpage()
fire_attempt_viewed_event()
fire_attempt_updated_event()
fire_attempt_autosaved_event()
fire_attempt_question_restarted_event()
fire_attempt_summary_viewed_event()
fire_attempt_reviewed_event()
fire_attempt_manual_grading_completed_event()
set_offline_modified_time()
get_number_of_unanswered_questions()
Class: quiz_attempt - X-Ref
This class represents one user's attempt at a particular quiz.__construct($attempt, $quiz, $cm, $course, $loadquestions = true) X-Ref |
Constructor assuming we already have the necessary data loaded. param: stdClass $attempt the row of the quiz_attempts table. param: stdClass $quiz the quiz object for this attempt and user. param: stdClass|cm_info $cm the course_module object for this quiz. param: stdClass $course the row from the course table for the course we belong to. param: bool $loadquestions (optional) if true, the default, load all the details |
create_helper($conditions) X-Ref |
Used by {create()} and {create_from_usage_id()}. param: array $conditions passed to $DB->get_record('quiz_attempts', $conditions). return: quiz_attempt the desired instance of this class. |
create($attemptid) X-Ref |
Static function to create a new quiz_attempt object given an attemptid. param: int $attemptid the attempt id. return: quiz_attempt the new quiz_attempt object |
create_from_usage_id($usageid) X-Ref |
Static function to create a new quiz_attempt object given a usage id. param: int $usageid the attempt usage id. return: quiz_attempt the new quiz_attempt object |
state_name($state) X-Ref |
Get a human-readable name for one of the quiz attempt states. param: string $state one of the state constants like IN_PROGRESS. return: string the human-readable state name. |
load_questions() X-Ref |
This method can be called later if the object was constructed with $loadquestions = false. |
preload_all_attempt_step_users() X-Ref |
Preload all attempt step users to show in Response history. |
link_sections_and_slots() X-Ref |
Let each slot know which section it is part of. |
determine_layout() X-Ref |
Parse attempt->layout to populate the other arrays that represent the layout. |
number_questions() X-Ref |
Work out the number to display for each question/slot. |
force_page_number_into_range($page) X-Ref |
If the given page number is out of range (before the first page, or after the last page, change it to be within range). param: int $page the requested page number. return: int a safe page number to use. |
get_quiz() X-Ref |
Get the raw quiz settings object. return: stdClass |
get_quizobj() X-Ref |
Get the {@see seb_quiz_settings} object for this quiz. return: quiz_settings |
get_courseid() X-Ref |
Git the id of the course this quiz belongs to. return: int the course id. |
get_course() X-Ref |
Get the course settings object. return: stdClass the course settings object. |
get_quizid() X-Ref |
Get the quiz id. return: int the quiz id. |
get_quiz_name() X-Ref |
Get the name of this quiz. return: string Quiz name, directly from the database (format_string must be called before output). |
get_navigation_method() X-Ref |
Get the quiz navigation method. return: int QUIZ_NAVMETHOD_FREE or QUIZ_NAVMETHOD_SEQ. |
get_cm() X-Ref |
Get the course_module for this quiz. return: stdClass|cm_info the course_module object. |
get_cmid() X-Ref |
Get the course-module id. return: int the course_module id. |
get_context() X-Ref |
Get the quiz context. return: context_module the context of the quiz this attempt belongs to. |
is_preview_user() X-Ref |
Is the current user is someone who previews the quiz, rather than attempting it? return: bool true user is a preview user. False, if they can do real attempts. |
get_num_attempts_allowed() X-Ref |
Get the number of attempts the user is allowed at this quiz. return: int the number of attempts allowed at this quiz (0 = infinite). |
get_num_pages() X-Ref |
Get the number of quizzes in the quiz attempt. return: int number pages. |
get_access_manager($timenow) X-Ref |
Get the access_manager for this quiz attempt. param: int $timenow the current time as a unix timestamp. return: access_manager and instance of the access_manager class |
get_attemptid() X-Ref |
Get the id of this attempt. return: int the attempt id. |
get_uniqueid() X-Ref |
Get the question-usage id corresponding to this quiz attempt. return: int the attempt unique id. |
get_attempt() X-Ref |
Get the raw quiz attempt object. return: stdClass the row from the quiz_attempts table. |
get_attempt_number() X-Ref |
Get the attempt number. return: int the number of this attempt (is it this user's first, second, ... attempt). |
get_state() X-Ref |
Get the state of this attempt. return: string {@see IN_PROGRESS}, {@see FINISHED}, {@see OVERDUE} or {@see ABANDONED}. |
get_userid() X-Ref |
Get the id of the user this attempt belongs to. return: int user id. |
get_currentpage() X-Ref |
Get the current page of the attempt return: int page number. |
get_sum_marks() X-Ref |
Get the total number of marks that the user had scored on all the questions. return: float |
is_finished() X-Ref |
Has this attempt been finished? States {@see FINISHED} and {@see ABANDONED} are both considered finished in this state. Other states are not. return: bool |
is_preview() X-Ref |
Is this attempt a preview? return: bool true if it is. |
is_own_attempt() X-Ref |
Does this attempt belong to the current user? return: bool true => own attempt/preview. false => reviewing someone else's. |
is_own_preview() X-Ref |
Is this attempt is a preview belonging to the current user. return: bool true if it is. |
is_review_allowed() X-Ref |
Is the current user allowed to review this attempt. This applies when {@see is_own_attempt()} returns false. return: bool whether the review should be allowed. |
has_response_to_at_least_one_graded_question() X-Ref |
Has the student, in this attempt, engaged with the quiz in a non-trivial way? That is, is there any question worth a non-zero number of marks, where the student has made some response that we have saved? return: bool true if we have saved a response for at least one graded question. |
requires_manual_grading() X-Ref |
Do any questions in this attempt need to be graded manually? return: bool True if we have at least one question still needs manual grading. |
get_additional_summary_data(question_display_options $options) X-Ref |
Get extra summary information about this attempt. Some behaviours may be able to provide interesting summary information about the attempt as a whole, and this method provides access to that data. To see how this works, try setting a quiz to one of the CBM behaviours, and then look at the extra information displayed at the top of the quiz review page once you have submitted an attempt. In the return value, the array keys are identifiers of the form qbehaviour_behaviourname_meaningfullkey. For qbehaviour_deferredcbm_highsummary. The values are arrays with two items, title and content. Each of these will be either a string, or a renderable. param: question_display_options $options the display options for this quiz attempt at this time. return: array as described above. |
get_overall_feedback($grade) X-Ref |
Get the overall feedback corresponding to a particular mark. param: number $grade a particular grade. return: string the feedback. |
has_capability($capability, $userid = null, $doanything = true) X-Ref |
Wrapper round the has_capability function that automatically passes in the quiz context. param: string $capability the name of the capability to check. For example mod/forum:view. param: int|null $userid A user id. If null checks the permissions of the current user. param: bool $doanything If false, ignore effect of admin role assignment. return: boolean true if the user has this capability, otherwise false. |
require_capability($capability, $userid = null, $doanything = true) X-Ref |
Wrapper round the require_capability function that automatically passes in the quiz context. param: string $capability the name of the capability to check. For example mod/forum:view. param: int|null $userid A user id. If null checks the permissions of the current user. param: bool $doanything If false, ignore effect of admin role assignment. |
check_review_capability() X-Ref |
Check the appropriate capability to see whether this user may review their own attempt. If not, prints an error. |
can_navigate_to($slot) X-Ref |
Checks whether a user may navigate to a particular slot. param: int $slot the target slot (currently does not affect the answer). return: bool true if the navigation should be allowed. |
get_attempt_state() X-Ref |
Get where we are time-wise in relation to this attempt and the quiz settings. return: int one of {@see display_options::DURING}, {@see display_options::IMMEDIATELY_AFTER}, |
get_display_options($reviewing) X-Ref |
Wrapper that the correct display_options for this quiz at the moment. param: bool $reviewing true for options when reviewing, false for when attempting. return: question_display_options the render options for this user on this attempt. |
get_display_options_with_edit_link($reviewing, $slot, $thispageurl) X-Ref |
Wrapper that the correct display_options for this quiz at the moment. param: bool $reviewing true for review page, else attempt page. param: int $slot which question is being displayed. param: moodle_url $thispageurl to return to after the editing form is return: question_display_options the render options for this user on this |
is_last_page($page) X-Ref |
Is a particular page the last one in the quiz? param: int $page a page number return: bool true if that is the last page of the quiz. |
get_slots($page = 'all') X-Ref |
Return the list of slot numbers for either a given page of the quiz, or for the whole quiz. param: mixed $page string 'all' or integer page number. return: array the requested list of slot numbers. |
get_active_slots($page = 'all') X-Ref |
Return the list of slot numbers for either a given page of the quiz, or for the whole quiz. param: mixed $page string 'all' or integer page number. return: array the requested list of slot numbers. |
get_question_usage() X-Ref |
Helper method for unit tests. Get the underlying question usage object. return: question_usage_by_activity the usage. |
get_question_attempt($slot) X-Ref |
Get the question_attempt object for a particular question in this attempt. param: int $slot the number used to identify this question within this attempt. return: question_attempt the requested question_attempt. |
all_question_attempts_originally_in_slot($slot) X-Ref |
Get all the question_attempt objects that have ever appeared in a given slot. This relates to the 'Try another question like this one' feature. param: int $slot the number used to identify this question within this attempt. return: question_attempt[] the attempts. |
is_real_question($slot) X-Ref |
Is a particular question in this attempt a real question, or something like a description. param: int $slot the number used to identify this question within this attempt. return: int whether that question is a real question. Actually returns the |
is_question_flagged($slot) X-Ref |
Is a particular question in this attempt a real question, or something like a description. param: int $slot the number used to identify this question within this attempt. return: bool whether that question is a real question. |
is_blocked_by_previous_question($slot) X-Ref |
Checks whether the question in this slot requires the previous question to have been completed. param: int $slot the number used to identify this question within this attempt. return: bool whether the previous question must have been completed before |
can_question_be_redone_now($slot) X-Ref |
Is it possible for this question to be re-started within this attempt? param: int $slot the number used to identify this question within this attempt. return: bool whether the student should be given the option to restart this question now. |
get_original_slot($slot) X-Ref |
Given a slot in this attempt, which may or not be a redone question, return the original slot. param: int $slot identifies a particular question in this attempt. return: int the slot where this question was originally. |
get_question_number($slot) X-Ref |
Get the displayed question number for a slot. param: int $slot the number used to identify this question within this attempt. return: string the displayed question number for the question in this slot. |
get_heading_before_slot($slot) X-Ref |
If the section heading, if any, that should come just before this slot. param: int $slot identifies a particular question in this attempt. return: string|null the required heading, or null if there is not one here. |
get_question_page($slot) X-Ref |
Return the page of the quiz where this question appears. param: int $slot the number used to identify this question within this attempt. return: int the page of the quiz this question appears on. |
get_question_name($slot) X-Ref |
Return the grade obtained on a particular question, if the user is permitted to see it. You must previously have called load_question_states to load the state data about this question. param: int $slot the number used to identify this question within this attempt. return: string the formatted grade, to the number of decimal places specified |
get_question_state($slot) X-Ref |
Return the {@see question_state} that this question is in. param: int $slot the number used to identify this question within this attempt. return: question_state the state this question is in. |
get_question_status($slot, $showcorrectness) X-Ref |
Return the grade obtained on a particular question, if the user is permitted to see it. You must previously have called load_question_states to load the state data about this question. param: int $slot the number used to identify this question within this attempt. param: bool $showcorrectness Whether right/partial/wrong states should return: string the formatted grade, to the number of decimal places specified |
get_question_state_class($slot, $showcorrectness) X-Ref |
Return the grade obtained on a particular question, if the user is permitted to see it. You must previously have called load_question_states to load the state data about this question. param: int $slot the number used to identify this question within this attempt. param: bool $showcorrectness Whether right/partial/wrong states should return: string class name for this state. |
get_question_mark($slot) X-Ref |
Return the grade obtained on a particular question. You must previously have called load_question_states to load the state data about this question. param: int $slot the number used to identify this question within this attempt. return: string the formatted grade, to the number of decimal places specified by the quiz. |
get_question_action_time($slot) X-Ref |
Get the time of the most recent action performed on a question. param: int $slot the number used to identify this question within this usage. return: int timestamp. |
get_question_type_name($slot) X-Ref |
Return the question type name for a given slot within the current attempt. param: int $slot the number used to identify this question within this attempt. return: string the question type name. |
get_time_left_display($timenow) X-Ref |
Get the time remaining for an in-progress attempt, if the time is short enough that it would be worth showing a timer. param: int $timenow the time to consider as 'now'. return: int|false the number of seconds remaining for this attempt. |
get_submitted_date() X-Ref |
Get the time when this attempt was submitted. return: int timestamp, or 0 if it has not been submitted yet. |
get_due_date() X-Ref |
If the attempt is in an applicable state, work out the time by which the student should next do something. return: int timestamp by which the student needs to do something. |
view_url() X-Ref |
Get the URL of this quiz's view.php page. return: moodle_url quiz view url. |
start_attempt_url($slot = null, $page = -1) X-Ref |
Get the URL to start or continue an attempt. param: int|null $slot which question in the attempt to go to after starting (optional). param: int $page which page in the attempt to go to after starting. return: moodle_url the URL of this quiz's edit page. Needs to be POSTed to with a cmid parameter. |
attempt_page_title(int $page) X-Ref |
Generates the title of the attempt page. param: int $page the page number (starting with 0) in the attempt. return: string attempt page title. |
attempt_url($slot = null, $page = -1, $thispage = -1) X-Ref |
Get the URL of a particular page within this attempt. param: int|null $slot if specified, the slot number of a specific question to link to. param: int $page if specified, a particular page to link to. If not given deduced param: int $thispage if not -1, the current page. Will cause links to other things on return: moodle_url the URL to continue this attempt. |
summary_page_title() X-Ref |
Generates the title of the summary page. return: string summary page title. |
summary_url() X-Ref |
Get the URL of the summary page of this attempt. return: moodle_url the URL of this quiz's summary page. |
processattempt_url() X-Ref |
Get the URL to which the attempt data should be submitted. return: moodle_url the URL of this quiz's summary page. |
review_page_title(int $page, bool $showall = false) X-Ref |
Generates the title of the review page. param: int $page the page number (starting with 0) in the attempt. param: bool $showall whether the review page contains the entire attempt on one page. return: string title of the review page. |
review_url($slot = null, $page = -1, $showall = null, $thispage = -1) X-Ref |
Get the URL of a particular page in the review of this attempt. param: int|null $slot indicates which question to link to. param: int $page if specified, the URL of this particular page of the attempt, otherwise param: bool|null $showall if true, the URL will be to review the entire attempt on one page, param: int $thispage if not -1, the current page. Will cause links to other things on return: moodle_url the URL to review this attempt. |
get_default_show_all($script) X-Ref |
By default, should this script show all questions on one page for this attempt? param: string $script the script name, e.g. 'attempt', 'summary', 'review'. return: bool whether show all on one page should be on by default. |
cannot_review_message($short = false) X-Ref |
If $reviewoptions->attempt is false, meaning that students can't review this attempt at the moment, return an appropriate string explaining why. param: bool $short if true, return a shorter string. return: string an appropriate message. |
get_html_head_contributions($page = 'all', $showall = false) X-Ref |
Initialise the JS etc. required all the questions on a page. param: int|string $page a page number, or 'all'. param: bool $showall if true, forces page number to all. return: string HTML to output - mostly obsolete, will probably be an empty string. |
get_question_html_head_contributions($slot) X-Ref |
Initialise the JS etc. required by one question. param: int $slot the question slot number. return: string HTML to output - but this is mostly obsolete. Will probably be an empty string. |
restart_preview_button() X-Ref |
Print the HTML for the start new preview button, if the current user is allowed to see one. return: string HTML for the button. |
render_question($slot, $reviewing, renderer $renderer, $thispageurl = null) X-Ref |
Generate the HTML that displays the question in its current state, with the appropriate display options. param: int $slot identifies the question in the attempt. param: bool $reviewing is the being printed on an attempt or a review page. param: renderer $renderer the quiz renderer. param: moodle_url $thispageurl the URL of the page this question is being printed on. return: string HTML for the question in its current state. |
render_question_helper($slot, $reviewing, $thispageurl,renderer $renderer, $seq) X-Ref |
Helper used by {@see render_question()} and {@see render_question_at_step()}. param: int $slot identifies the question in the attempt. param: bool $reviewing is the being printed on an attempt or a review page. param: moodle_url $thispageurl the URL of the page this question is being printed on. param: renderer $renderer the quiz renderer. param: int|null $seq the seq number of the past state to display. return: string HTML fragment. |
make_blocked_question_placeholder($slot) X-Ref |
Create a fake question to be displayed in place of a question that is blocked until the previous question has been answered. param: int $slot int slot number of the question to replace. return: question_attempt the placeholder question attempt. |
render_question_at_step($slot, $seq, $reviewing,renderer $renderer, $thispageurl = null) X-Ref |
Like {@see render_question()} but displays the question at the past step indicated by $seq, rather than showing the latest step. param: int $slot the slot number of a question in this quiz attempt. param: int $seq the seq number of the past state to display. param: bool $reviewing is the being printed on an attempt or a review page. param: renderer $renderer the quiz renderer. param: moodle_url $thispageurl the URL of the page this question is being printed on. return: string HTML for the question in its current state. |
render_question_for_commenting($slot) X-Ref |
Wrapper round print_question from lib/questionlib.php. param: int $slot the id of a question in this quiz attempt. return: string HTML of the question. |
check_file_access($slot, $reviewing, $contextid, $component,$filearea, $args, $forcedownload) X-Ref |
Check whether access should be allowed to a particular file. param: int $slot the slot of a question in this quiz attempt. param: bool $reviewing is the being printed on an attempt or a review page. param: int $contextid the file context id from the request. param: string $component the file component from the request. param: string $filearea the file area from the request. param: array $args extra part components from the request. param: bool $forcedownload whether to force download. return: bool true if the file can be accessed. |
get_navigation_panel(renderer $output,$panelclass, $page, $showall = false) X-Ref |
Get the navigation panel object for this attempt. param: renderer $output the quiz renderer to use to output things. param: string $panelclass The type of panel, navigation_panel_attempt::class or navigation_panel_review::class param: int $page the current page number. param: bool $showall whether we are showing the whole quiz on one page. (Used by review.php.) return: block_contents the requested object. |
links_to_other_attempts(moodle_url $url) X-Ref |
Return an array of variant URLs to other attempts at this quiz. The $url passed in must contain an attempt parameter. The {@see links_to_other_attempts} object returned contains an array with keys that are the attempt number, 1, 2, 3. The array values are either a {@see moodle_url} with the attempt parameter updated to point to the attempt id of the other attempt, or null corresponding to the current attempt number. param: moodle_url $url a URL. return: links_to_other_attempts|bool containing array int => null|moodle_url. |
links_to_other_redos($slot, moodle_url $baseurl) X-Ref |
Return an array of variant URLs to other redos of the question in a particular slot. The $url passed in must contain a slot parameter. The {@see links_to_other_attempts} object returned contains an array with keys that are the redo number, 1, 2, 3. The array values are either a {@see moodle_url} with the slot parameter updated to point to the slot that has that redo of this question; or null corresponding to the redo identified by $slot. param: int $slot identifies a question in this attempt. param: moodle_url $baseurl the base URL to modify to generate each link. return: links_to_other_attempts|null containing array int => null|moodle_url, |
handle_if_time_expired($timestamp, $studentisonline) X-Ref |
Check this attempt, to see if there are any state transitions that should happen automatically. This function will update the attempt checkstatetime. param: int $timestamp the timestamp that should be stored as the modified param: bool $studentisonline is the student currently interacting with Moodle? |
process_submitted_actions($timestamp, $becomingoverdue = false, $simulatedresponses = null) X-Ref |
Process all the actions that were submitted as part of the current request. param: int $timestamp the timestamp that should be stored as the modified. param: bool $becomingoverdue param: array|null $simulatedresponses If not null, then we are testing, and this is an array of simulated data. |
process_redo_question($slot, $timestamp) X-Ref |
Replace a question in an attempt with a new attempt at the same question. Well, for randomised questions, it won't be the same question, it will be a different randomly selected pick from the available question. param: int $slot the question to restart. param: int $timestamp the timestamp to record for this action. |
process_auto_save($timestamp) X-Ref |
Process all the autosaved data that was part of the current request. param: int $timestamp the timestamp that should be stored as the modified. |
save_question_flags() X-Ref |
Update the flagged state for all question_attempts in this usage, if their flagged state was changed in the request. |
process_finish($timestamp, $processsubmitted, $timefinish = null, $studentisonline = false) X-Ref |
Submit the attempt. The separate $timefinish argument should be used when the quiz attempt is being processed asynchronously (for example when cron is submitting attempts where the time has expired). param: int $timestamp the time to record as last modified time. param: bool $processsubmitted if true, and question responses in the current param: ?int $timefinish if set, use this as the finish time for the attempt. param: bool $studentisonline is the student currently interacting with Moodle? |
update_timecheckstate($time) X-Ref |
Update this attempt timecheckstate if necessary. param: int|null $time the timestamp to set. |
recompute_final_grade() X-Ref |
Needs to be called after this attempt's grade is changed, to update the overall quiz grade. |
process_going_overdue($timestamp, $studentisonline) X-Ref |
Mark this attempt as now overdue. param: int $timestamp the time to deem as now. param: bool $studentisonline is the student currently interacting with Moodle? |
process_abandon($timestamp, $studentisonline) X-Ref |
Mark this attempt as abandoned. param: int $timestamp the time to deem as now. param: bool $studentisonline is the student currently interacting with Moodle? |
process_reopen_abandoned($timestamp) X-Ref |
This method takes an attempt in the 'Never submitted' state, and reopens it. If, for this student, time has not expired (perhaps, because an override has been added, then the attempt is left open. Otherwise, it is immediately submitted for grading. param: int $timestamp the time to deem as now. |
fire_state_transition_event($eventclass, $timestamp, $studentisonline) X-Ref |
Fire a state transition event. param: string $eventclass the event class name. param: int $timestamp the timestamp to include in the event. param: bool $studentisonline is the student currently interacting with Moodle? |
page_and_question_url($script, $slot, $page, $showall, $thispage) X-Ref |
Get a URL for a particular question on a particular page of the quiz. Used by {@see attempt_url()} and {@see review_url()}. param: string $script e.g. 'attempt' or 'review'. Used in the URL like /mod/quiz/$script.php. param: int $slot identifies the specific question on the page to jump to. param: int $page -1 to look up the page number from the slot, otherwise param: bool|null $showall if true, return a URL with showall=1, and not page number. param: int $thispage the page we are currently on. Links to questions on this return: moodle_url The requested URL. |
process_attempt($timenow, $finishattempt, $timeup, $thispage) X-Ref |
Process responses during an attempt at a quiz. param: int $timenow time when the processing started. param: bool $finishattempt whether to finish the attempt or not. param: bool $timeup true if form was submitted by timer. param: int $thispage current page number. return: string the attempt state once the data has been processed. |
check_page_access(int $page, bool $allownext = true) X-Ref |
Check a page read access to see if is an out of sequence access. If allownext is set then we also check whether access to the page after the current one should be permitted. param: int $page page number. param: bool $allownext in case of a sequential navigation, can we go to next page ? return: boolean false is an out of sequence access, true otherwise. |
set_currentpage($page) X-Ref |
Update attempt page. param: int $page page number. return: boolean true if everything was ok, false otherwise (out of sequence access). |
fire_attempt_viewed_event() X-Ref |
Trigger the attempt_viewed event. |
fire_attempt_updated_event() X-Ref |
Trigger the attempt_updated event. return: void |
fire_attempt_autosaved_event() X-Ref |
Trigger the attempt_autosaved event. return: void |
fire_attempt_question_restarted_event(int $slot, int $newquestionid) X-Ref |
Trigger the attempt_question_restarted event. param: int $slot Slot number param: int $newquestionid New question id. return: void |
fire_attempt_summary_viewed_event() X-Ref |
Trigger the attempt_summary_viewed event. |
fire_attempt_reviewed_event() X-Ref |
Trigger the attempt_reviewed event. |
fire_attempt_manual_grading_completed_event() X-Ref |
Trigger the attempt manual grading completed event. |
set_offline_modified_time($time) X-Ref |
Update the timemodifiedoffline attempt field. This function should be used only when web services are being used. param: int $time time stamp. return: boolean false if the field is not updated because web services aren't being used. |
get_number_of_unanswered_questions() X-Ref |
Get the total number of unanswered questions in the attempt. return: int |