[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/mod/quiz/ -> attemptlib.php (summary)

Back-end code for handling data about quizzes and the current user's attempt. There are classes for loading all the information about a quiz and attempts, and for displaying the navigation panel.

Copyright: 2008 onwards Tim Hunt
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 2554 lines (97 kb)
Included or required:0 times
Referenced: 2 times
Includes or requires: 0 files

Defines 7 classes

moodle_quiz_exception:: (1 method):
  __construct()

quiz:: (35 methods):
  __construct()
  create()
  create_attempt_object()
  preload_questions()
  load_questions()
  get_structure()
  get_courseid()
  get_course()
  get_quizid()
  get_quiz()
  get_quiz_name()
  get_navigation_method()
  get_num_attempts_allowed()
  get_cmid()
  get_cm()
  get_context()
  is_preview_user()
  has_questions()
  get_question()
  get_questions()
  get_sections()
  get_access_manager()
  has_capability()
  require_capability()
  view_url()
  edit_url()
  attempt_url()
  start_attempt_url()
  review_url()
  summary_url()
  confirm_start_attempt_message()
  cannot_review_message()
  navigation()
  ensure_question_loaded()
  get_all_question_types_used()

quiz_attempt:: (105 methods):
  __construct()
  create_helper()
  create()
  create_from_usage_id()
  state_name()
  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()
  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()
  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_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_url()
  summary_url()
  processattempt_url()
  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()
  process_going_overdue()
  process_abandon()
  fire_state_transition_event()
  page_and_question_url()
  process_attempt()
  check_page_access()
  set_currentpage()
  fire_attempt_viewed_event()
  fire_attempt_summary_viewed_event()
  fire_attempt_reviewed_event()

quiz_nav_section_heading:: (1 method):
  __construct()

quiz_nav_question_button:: (7 methods):
  __construct()
  get_question_buttons()
  get_state_string()
  render_before_button_bits()
  render_restart_preview_link()
  user_picture()
  get_button_container_class()

quiz_attempt_nav_panel:: (3 methods):
  get_question_url()
  render_before_button_bits()
  render_end_bits()

quiz_review_nav_panel:: (2 methods):
  get_question_url()
  render_end_bits()


Class: moodle_quiz_exception  - X-Ref

Class for quiz exceptions. Just saves a couple of arguments on the
constructor for a moodle_exception.

__construct($quizobj, $errorcode, $a = null, $link = '', $debuginfo = null)   X-Ref
No description

Class: quiz  - X-Ref

A class encapsulating a quiz and the questions it contains, and making the
information available to scripts like view.php.

Initially, it only loads a minimal amout of information about each question - loading
extra information only when necessary or when asked. The class tracks which questions
are loaded.

__construct($quiz, $cm, $course, $getcontext = true)   X-Ref
Constructor, assuming we already have the necessary data loaded.

param: object $quiz the row from the quiz table.
param: object $cm the course_module object for this quiz.
param: object $course the row from the course table for the course we belong to.
param: bool $getcontext intended for testing - stops the constructor getting the context.

create($quizid, $userid = null)   X-Ref
Static function to create a new quiz object for a specific user.

param: int $quizid the the quiz id.
param: int $userid the the userid.
return: quiz the new quiz object

create_attempt_object($attemptdata)   X-Ref
Create a {@link quiz_attempt} for an attempt at this quiz.

param: object $attemptdata row from the quiz_attempts table.
return: quiz_attempt the new quiz_attempt object.

preload_questions()   X-Ref
Load just basic information about all the questions in this quiz.


load_questions($questionids = null)   X-Ref
Fully load some or all of the questions for this quiz. You must call
{@link preload_questions()} first.

param: array $questionids question ids of the questions to load. null for all.

get_structure()   X-Ref
Get an instance of the {@link \mod_quiz\structure} class for this quiz.

return: \mod_quiz\structure describes the questions in the quiz.

get_courseid()   X-Ref
No description

get_course()   X-Ref
No description

get_quizid()   X-Ref
No description

get_quiz()   X-Ref
No description

get_quiz_name()   X-Ref
No description

get_navigation_method()   X-Ref
No description

get_num_attempts_allowed()   X-Ref
No description

get_cmid()   X-Ref
No description

get_cm()   X-Ref
No description

get_context()   X-Ref
No description

is_preview_user()   X-Ref

return: bool wether the current user is someone who previews the quiz,

has_questions()   X-Ref

return: whether any questions have been added to this quiz.

get_question($id)   X-Ref

param: int $id the question id.
return: object the question object with that id.

get_questions($questionids = null)   X-Ref

param: array $questionids question ids of the questions to load. null for all.

get_sections()   X-Ref
Get all the sections in this quiz.

return: array 0, 1, 2, ... => quiz_sections row from the database.

get_access_manager($timenow)   X-Ref
Return quiz_access_manager and instance of the quiz_access_manager class
for this quiz at this time.

param: int $timenow the current time as a unix timestamp.
return: quiz_access_manager and instance of the quiz_access_manager class

has_capability($capability, $userid = null, $doanything = true)   X-Ref
Wrapper round the has_capability funciton that automatically passes in the quiz context.


require_capability($capability, $userid = null, $doanything = true)   X-Ref
Wrapper round the require_capability funciton that automatically passes in the quiz context.


view_url()   X-Ref

return: string the URL of this quiz's view page.

edit_url()   X-Ref

return: string the URL of this quiz's edit page.

attempt_url($attemptid, $page = 0)   X-Ref

param: int $attemptid the id of an attempt.
param: int $page optional page number to go to in the attempt.
return: string the URL of that attempt.

start_attempt_url($page = 0)   X-Ref

return: string the URL of this quiz's edit page. Needs to be POSTed to with a cmid parameter.

review_url($attemptid)   X-Ref

param: int $attemptid the id of an attempt.
return: string the URL of the review of that attempt.

summary_url($attemptid)   X-Ref

param: int $attemptid the id of an attempt.
return: string the URL of the review of that attempt.

confirm_start_attempt_message($notused)   X-Ref

param: bool $notused not used.
return: string an empty string.

cannot_review_message($when, $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: int $when One of the mod_quiz_display_options::DURING,
param: bool $short if true, return a shorter string.
return: string an appropraite message.

navigation($title)   X-Ref

param: string $title the name of this particular quiz page.
return: array the data that needs to be sent to print_header_simple as the $navigation

ensure_question_loaded($id)   X-Ref
Check that the definition of a particular question is loaded, and if not throw an exception.

param: $id a questionid.

get_all_question_types_used($includepotential = false)   X-Ref
Return all the question types used in this quiz.

param: boolean $includepotential if the quiz include random questions, setting this flag to true will make the function to
return: array a sorted array including the different question types

Class: quiz_attempt  - X-Ref

This class extends the quiz class to hold data about the state of a particular attempt,
in addition to the data about the quiz.

__construct($attempt, $quiz, $cm, $course, $loadquestions = true)   X-Ref
Constructor assuming we already have the necessary data loaded.

param: object $attempt the row of the quiz_attempts table.
param: object $quiz the quiz object for this attempt and user.
param: object $cm the course_module object for this quiz.
param: object $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).

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

param: string $state one of the state constants like IN_PROGRESS.
return: string the human-readable state name.

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 the 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, chnage it to be within range).

param: int $page the requested page number.
return: int a safe page number to use.

get_quiz()   X-Ref
No description

get_quizobj()   X-Ref
No description

get_courseid()   X-Ref
No description

get_course()   X-Ref
No description

get_quizid()   X-Ref
No description

get_quiz_name()   X-Ref
No description

get_navigation_method()   X-Ref
No description

get_cm()   X-Ref
No description

get_cmid()   X-Ref
No description

is_preview_user()   X-Ref

return: bool wether the current user is someone who previews the quiz,

get_num_attempts_allowed()   X-Ref
No description

get_num_pages()   X-Ref
No description

get_access_manager($timenow)   X-Ref

param: int $timenow the current time as a unix timestamp.
return: quiz_access_manager and instance of the quiz_access_manager class

get_attemptid()   X-Ref
No description

get_uniqueid()   X-Ref
No description

get_attempt()   X-Ref
No description

get_attempt_number()   X-Ref
No description

get_state()   X-Ref
No description

get_userid()   X-Ref
No description

get_currentpage()   X-Ref
No description

get_sum_marks()   X-Ref
No description

is_finished()   X-Ref

return: bool whether this attempt has been finished (true) or is still

is_preview()   X-Ref
No description

is_own_attempt()   X-Ref
Is this someone dealing with their own attempt or preview?

return: bool true => own attempt/preview. false => reviewing someone elses.

is_own_preview()   X-Ref

return: bool whether this attempt is a preview belonging to the current user.

is_review_allowed()   X-Ref
Is the current user allowed to review this attempt. This applies when
{@link 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.

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 sumitted 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: $grade a particular grade.

has_capability($capability, $userid = null, $doanything = true)   X-Ref
Wrapper round the has_capability funciton that automatically passes in the quiz context.


require_capability($capability, $userid = null, $doanything = true)   X-Ref
Wrapper round the require_capability funciton that automatically passes in the quiz context.


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


get_attempt_state()   X-Ref

return: int one of the mod_quiz_display_options::DURING,

get_display_options($reviewing)   X-Ref
Wrapper that the correct mod_quiz_display_options for this quiz at the
moment.

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 mod_quiz_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

param: int $page page number
return: bool true if this 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_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

all_question_attempts_originally_in_slot($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

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 this one can be seen.

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: 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 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 {@link 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
enought 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

return: int the time when this attempt was submitted. 0 if it has not been

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

return: string quiz view url.

start_attempt_url($slot = null, $page = -1)   X-Ref

return: string the URL of this quiz's edit page. Needs to be POSTed to with a cmid parameter.

attempt_url($slot = null, $page = -1, $thispage = -1)   X-Ref

param: int $slot if speified, the slot number of a specific question to link to.
param: int $page if specified, a particular page to link to. If not givem deduced
param: int $questionid a question id. If set, will add a fragment to the URL
param: int $thispage if not -1, the current page. Will cause links to other things on
return: string the URL to continue this attempt.

summary_url()   X-Ref

return: string the URL of this quiz's summary page.

processattempt_url()   X-Ref

return: string the URL of this quiz's summary page.

review_url($slot = null, $page = -1, $showall = null, $thispage = -1)   X-Ref

param: int $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: string 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: 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 appropraite message.

get_html_head_contributions($page = 'all', $showall = false)   X-Ref
Initialise the JS etc. required all the questions on a page.

param: mixed $page a page number, or 'all'.

get_question_html_head_contributions($slot)   X-Ref
Initialise the JS etc. required by one question.

param: int $questionid the question id.

restart_preview_button()   X-Ref
Print the HTML for the start new preview button, if the current user
is allowed to see one.


render_question($slot, $reviewing, mod_quiz_renderer $renderer, $thispageurl = null)   X-Ref
Generate the HTML that displayes 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: mod_quiz_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, mod_quiz_renderer $renderer, $seq)   X-Ref
Helper used by {@link render_question()} and {@link 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: mod_quiz_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_definition the placeholde question.

render_question_at_step($slot, $seq, $reviewing, mod_quiz_renderer $renderer, $thispageurl = '')   X-Ref
Like {@link render_question()} but displays the question at the past step
indicated by $seq, rather than showing the latest step.

param: int $id the id 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: mod_quiz_renderer $renderer the quiz renderer.
param: string $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 $id the id of a question in this quiz attempt.

check_file_access($slot, $reviewing, $contextid, $component,$filearea, $args, $forcedownload)   X-Ref
Check wheter access should be allowed to a particular file.

param: int $id the id of a question in this quiz attempt.
param: bool $reviewing is the being printed on an attempt or a review page.
param: string $thispageurl the URL of the page this question is being printed on.
return: string HTML for the question in its current state.

get_navigation_panel(mod_quiz_renderer $output,$panelclass, $page, $showall = false)   X-Ref
Get the navigation panel object for this attempt.

param: $panelclass The type of panel, quiz_attempt_nav_panel or quiz_review_nav_panel
param: $page the current page number.
param: $showall whether we are showing the whole quiz on one page. (Used by review.php)
return: quiz_nav_panel_base 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 {@link mod_quiz_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 {@link moodle_url} with the attmept 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: mod_quiz_links_to_other_attempts 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 {@link mod_quiz_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 {@link 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: mod_quiz_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 modifed
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 modifed
param: bool $becomingoverdue
param: array|null $simulatedresponses If not null, then we are testing, and this is an array of simulated data, keys are slot

process_redo_question($slot, $timestamp)   X-Ref
Replace a question in an attempt with a new attempt at the same qestion.

param: int $slot the questoin 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 modifed

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)   X-Ref
No description

update_timecheckstate($time)   X-Ref
Update this attempt timecheckstate if necessary.

param: int|null the timecheckstate

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?

fire_state_transition_event($eventclass, $timestamp)   X-Ref
Fire a state transition event.
the same event information.

param: string $eventclass the event class name.
param: int $timestamp the timestamp to include in the event.
return: void

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 {@link attempt_url()} and {@link review_url()}.

param: string $script. 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: 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($page)   X-Ref
Check a page access to see if is an out of sequence access.

param: int $page page number
return: boolean false is 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_summary_viewed_event()   X-Ref
Trigger the attempt_summary_viewed event.


fire_attempt_reviewed_event()   X-Ref
Trigger the attempt_reviewed event.


Class: quiz_nav_section_heading  - X-Ref

Represents a heading in the navigation panel.

__construct($heading)   X-Ref
Constructor.

param: string $heading the heading text

Class: quiz_nav_question_button  - X-Ref

Represents a single link in the navigation panel.

__construct(quiz_attempt $attemptobj,question_display_options $options, $page, $showall)   X-Ref
No description

get_question_buttons()   X-Ref
Get the buttons and section headings to go in the quiz navigation block.

return: renderable[] the buttons, possibly interleaved with section headings.

get_state_string(question_attempt $qa, $showcorrectness)   X-Ref
No description

render_before_button_bits(mod_quiz_renderer $output)   X-Ref
No description

render_restart_preview_link($output)   X-Ref
No description

user_picture()   X-Ref
No description

get_button_container_class()   X-Ref
Return 'allquestionsononepage' as CSS class name when $showall is set,
otherwise, return 'multipages' as CSS class name.

return: string, CSS class name

Class: quiz_attempt_nav_panel  - X-Ref

Specialisation of {@link quiz_nav_panel_base} for the attempt quiz page.

get_question_url($slot)   X-Ref
No description

render_before_button_bits(mod_quiz_renderer $output)   X-Ref
No description

render_end_bits(mod_quiz_renderer $output)   X-Ref
No description

Class: quiz_review_nav_panel  - X-Ref

Specialisation of {@link quiz_nav_panel_base} for the review quiz page.

get_question_url($slot)   X-Ref
No description

render_end_bits(mod_quiz_renderer $output)   X-Ref
No description



Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1