|
Moodle
2.2.1
http://www.collinsharper.com
|
This class extends the quiz class to hold data about the state of a particular attempt, in addition to the data about the quiz.
Definition at line 408 of file attemptlib.php.
| __construct | ( | $ | attempt, |
| $ | quiz, | ||
| $ | cm, | ||
| $ | course, | ||
| $ | loadquestions = true |
||
| ) |
Constructor assuming we already have the necessary data loaded.
| object | $attempt | the row of the quiz_attempts table. |
| object | $quiz | the quiz object for this attempt and user. |
| object | $cm | the course_module object for this quiz. |
| object | $course | the row from the course table for the course we belong to. |
| bool | $loadquestions | (optional) if true, the default, load all the details of the state of each question. Else just set up the basic details of the attempt. |
Definition at line 429 of file attemptlib.php.

| attempt_url | ( | $ | slot = null, |
| $ | page = -1, |
||
| $ | thispage = -1 |
||
| ) |
| int | $slot | if speified, the slot number of a specific question to link to. |
| int | $page | if specified, a particular page to link to. If not givem deduced from $slot, or goes to the first page. |
| int | $questionid | a question id. If set, will add a fragment to the URL to jump to a particuar question on the page. |
| int | $thispage | if not -1, the current page. Will cause links to other things on this page to be output as only a fragment. |
Definition at line 930 of file attemptlib.php.

| cannot_review_message | ( | $ | short = false | ) |
If $reviewoptions->attempt is false, meaning that students can't review this attempt at the moment, return an appropriate string explaining why.
| bool | $short | if true, return a shorter string. |
Definition at line 971 of file attemptlib.php.

| check_file_access | ( | $ | slot, |
| $ | reviewing, | ||
| $ | contextid, | ||
| $ | component, | ||
| $ | filearea, | ||
| $ | args, | ||
| $ | forcedownload | ||
| ) |
Check wheter access should be allowed to a particular file.
| int | $id | the id of a question in this quiz attempt. |
| bool | $reviewing | is the being printed on an attempt or a review page. |
| string | $thispageurl | the URL of the page this question is being printed on. |
Definition at line 1068 of file attemptlib.php.

Check the appropriate capability to see whether this user may review their own attempt. If not, prints an error.
Definition at line 696 of file attemptlib.php.

| static create | ( | $ | attemptid | ) | [static] |
Static function to create a new quiz_attempt object given an attemptid.
| int | $attemptid | the attempt id. |
Definition at line 466 of file attemptlib.php.


| static create_from_usage_id | ( | $ | usageid | ) | [static] |
Static function to create a new quiz_attempt object given a usage id.
| int | $usageid | the attempt usage id. |
Definition at line 476 of file attemptlib.php.


| static create_helper | ( | $ | conditions | ) | [static, protected] |
Used by {create()} and {create_from_usage_id()}.
| array | $conditions | passed to $DB->get_record('quiz_attempts', $conditions). |
Definition at line 446 of file attemptlib.php.


| finish_attempt | ( | $ | timestamp | ) |
| get_access_manager | ( | $ | timenow | ) |
| int | $timenow | the current time as a unix timestamp. |
Definition at line 581 of file attemptlib.php.

| get_attempt | ( | ) |
Definition at line 596 of file attemptlib.php.
Definition at line 601 of file attemptlib.php.

Definition at line 710 of file attemptlib.php.


| get_attemptid | ( | ) |
Definition at line 586 of file attemptlib.php.
| get_cm | ( | ) |
Definition at line 549 of file attemptlib.php.

| get_cmid | ( | ) |
Definition at line 554 of file attemptlib.php.

| get_course | ( | ) |
Definition at line 534 of file attemptlib.php.
| get_courseid | ( | ) |
Definition at line 529 of file attemptlib.php.

| get_display_options | ( | $ | reviewing | ) |
Wrapper that the correct mod_quiz_display_options for this quiz at the moment.
Definition at line 720 of file attemptlib.php.


| get_display_options_with_edit_link | ( | $ | reviewing, |
| $ | slot, | ||
| $ | thispageurl | ||
| ) |
Wrapper that the correct mod_quiz_display_options for this quiz at the moment.
| bool | $reviewing | true for review page, else attempt page. |
| int | $slot | which question is being displayed. |
| moodle_url | $thispageurl | to return to after the editing form is submitted or cancelled. If null, no edit link will be generated. |
Definition at line 748 of file attemptlib.php.


| get_html_head_contributions | ( | $ | page = 'all', |
| $ | showall = false |
||
| ) |
Initialise the JS etc. required all the questions on a page..
| mixed | $page | a page number, or 'all'. |
Definition at line 980 of file attemptlib.php.

| get_navigation_panel | ( | mod_quiz_renderer $ | output, |
| $ | panelclass, | ||
| $ | page, | ||
| $ | showall = false |
||
| ) |
Get the navigation panel object for this attempt.
| $panelclass | The type of panel, quiz_attempt_nav_panel or quiz_review_nav_panel |
| $page | the current page number. |
| $showall | whether we are showing the whole quiz on one page. (Used by review.php) |
Definition at line 1082 of file attemptlib.php.

Definition at line 567 of file attemptlib.php.
| get_num_pages | ( | ) |
Definition at line 572 of file attemptlib.php.
| get_overall_feedback | ( | $ | grade | ) |
Get the overall feedback corresponding to a particular mark.
| $grade | a particular grade. |
Definition at line 673 of file attemptlib.php.

| get_question_action_time | ( | $ | slot | ) |
Get the time of the most recent action performed on a question.
| int | $slot | the number used to identify this question within this usage. |
Definition at line 896 of file attemptlib.php.
| get_question_attempt | ( | $ | slot | ) |
Get the question_attempt object for a particular question in this attempt.
| int | $slot | the number used to identify this question within this attempt. |
Definition at line 802 of file attemptlib.php.
| get_question_html_head_contributions | ( | $ | slot | ) |
Initialise the JS etc. required by one question.
| int | $questionid | the question id. |
Definition at line 996 of file attemptlib.php.

| get_question_mark | ( | $ | slot | ) |
Return the grade obtained on a particular question. You must previously have called load_question_states to load the state data about this question.
| int | $slot | the number used to identify this question within this attempt. |
Definition at line 887 of file attemptlib.php.

| get_question_name | ( | $ | slot | ) |
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.
| int | $slot | the number used to identify this question within this attempt. |
Definition at line 846 of file attemptlib.php.
| get_question_number | ( | $ | slot | ) |
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.
| int | $slot | the number used to identify this question within this attempt. |
Definition at line 833 of file attemptlib.php.
| get_question_state_class | ( | $ | slot, |
| $ | showcorrectness | ||
| ) |
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.
| int | $slot | the number used to identify this question within this attempt. |
| bool | $showcorrectness | Whether right/partial/wrong states should be distinguised. |
Definition at line 875 of file attemptlib.php.
| get_question_status | ( | $ | slot, |
| $ | showcorrectness | ||
| ) |
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.
| int | $slot | the number used to identify this question within this attempt. |
| bool | $showcorrectness | Whether right/partial/wrong states should be distinguised. |
Definition at line 861 of file attemptlib.php.
| get_quiz | ( | ) |
| get_quiz_name | ( | ) |
Definition at line 544 of file attemptlib.php.
| get_quizid | ( | ) |
Definition at line 539 of file attemptlib.php.

| get_quizobj | ( | ) |
Definition at line 524 of file attemptlib.php.
| get_slots | ( | $ | page = 'all' | ) |
Return the list of question ids for either a given page of the quiz, or for the whole quiz.
| mixed | $page | string 'all' or integer page number. |
Definition at line 785 of file attemptlib.php.

| get_uniqueid | ( | ) |
Definition at line 591 of file attemptlib.php.
| get_userid | ( | ) |
Definition at line 606 of file attemptlib.php.

| has_capability | ( | $ | capability, |
| $ | userid = null, |
||
| $ | doanything = true |
||
| ) |
Wrapper round the has_capability funciton that automatically passes in the quiz context.
Definition at line 681 of file attemptlib.php.

| is_finished | ( | ) |
Definition at line 614 of file attemptlib.php.
| is_last_page | ( | $ | page | ) |
| int | $page | page number |
Definition at line 774 of file attemptlib.php.
| is_own_attempt | ( | ) |
Is this a student dealing with their own attempt/teacher previewing, or someone with 'mod/quiz:viewreports' reviewing someone elses attempt.
Definition at line 630 of file attemptlib.php.

| is_own_preview | ( | ) |
Definition at line 639 of file attemptlib.php.

| is_preview | ( | ) |
Definition at line 619 of file attemptlib.php.

| is_preview_user | ( | ) |
Definition at line 562 of file attemptlib.php.

| is_question_flagged | ( | $ | slot | ) |
Is a particular question in this attempt a real question, or something like a description.
| int | $slot | the number used to identify this question within this attempt. |
Definition at line 820 of file attemptlib.php.
| is_real_question | ( | $ | slot | ) |
Is a particular question in this attempt a real question, or something like a description.
| int | $slot | the number used to identify this question within this attempt. |
Definition at line 811 of file attemptlib.php.
Is the current user allowed to review this attempt. This applies when is_own_attempt() returns false.
Definition at line 650 of file attemptlib.php.

| links_to_other_attempts | ( | moodle_url $ | url | ) |
Given a URL containing attempt={this attempt id}, return an array of variant URLs
| moodle_url | $url | a URL. |
Definition at line 1100 of file attemptlib.php.

| page_and_question_url | ( | $ | script, |
| $ | slot, | ||
| $ | page, | ||
| $ | showall, | ||
| $ | thispage | ||
| ) | [protected] |
Get a URL for a particular question on a particular page of the quiz. Used by attempt_url() and review_url().
| string | $script,. | Used in the URL like /mod/quiz/$script.php |
| int | $slot | identifies the specific question on the page to jump to. 0 to just use the $page parameter. |
| int | $page | -1 to look up the page number from the slot, otherwise the page number to go to. |
| bool | $showall | if true, return a URL with showall=1, and not page number |
| int | $thispage | the page we are currently on. Links to questions on this page will just be a fragment #q123. -1 to disable this. |
Definition at line 1215 of file attemptlib.php.

| process_all_actions | ( | $ | timestamp | ) |
Process all the actions that were submitted as part of the current request.
| int | $timestamp | the timestamp that should be stored as the modifed time in the database for these actions. If null, will use the current time. |
Definition at line 1125 of file attemptlib.php.

Definition at line 944 of file attemptlib.php.
| question_print_comment_fields | ( | $ | slot, |
| $ | prefix | ||
| ) |
Print the fields of the comment form for questions in this attempt.
| $slot | which question to output the fields for. |
| $prefix | Prefix to add to all field names. |
Definition at line 1187 of file attemptlib.php.

| render_question | ( | $ | slot, |
| $ | reviewing, | ||
| $ | thispageurl = null |
||
| ) |
Generate the HTML that displayes the question in its current state, with the appropriate display options.
| int | $id | the id of a question in this quiz attempt. |
| bool | $reviewing | is the being printed on an attempt or a review page. |
| moodle_url | $thispageurl | the URL of the page this question is being printed on. |
Definition at line 1025 of file attemptlib.php.


| render_question_at_step | ( | $ | slot, |
| $ | seq, | ||
| $ | reviewing, | ||
| $ | thispageurl = '' |
||
| ) |
Like render_question() but displays the question at the past step indicated by $seq, rather than showing the latest step.
| int | $id | the id of a question in this quiz attempt. |
| int | $seq | the seq number of the past state to display. |
| bool | $reviewing | is the being printed on an attempt or a review page. |
| string | $thispageurl | the URL of the page this question is being printed on. |
Definition at line 1041 of file attemptlib.php.


| render_question_for_commenting | ( | $ | slot | ) |
Wrapper round print_question from lib/questionlib.php.
| int | $id | the id of a question in this quiz attempt. |
Definition at line 1052 of file attemptlib.php.

| require_capability | ( | $ | capability, |
| $ | userid = null, |
||
| $ | doanything = true |
||
| ) |
Wrapper round the require_capability funciton that automatically passes in the quiz context.
Definition at line 688 of file attemptlib.php.

Print the HTML for the start new preview button, if the current user is allowed to see one.
Definition at line 1005 of file attemptlib.php.

| review_url | ( | $ | slot = null, |
| $ | page = -1, |
||
| $ | showall = false, |
||
| $ | thispage = -1 |
||
| ) |
| int | $slot | indicates which question to link to. |
| int | $page | if specified, the URL of this particular page of the attempt, otherwise the URL will go to the first page. If -1, deduce $page from $slot. |
| bool | $showall | if true, the URL will be to review the entire attempt on one page, and $page will be ignored. |
| int | $thispage | if not -1, the current page. Will cause links to other things on this page to be output as only a fragment. |
Definition at line 958 of file attemptlib.php.


Update the flagged state for all question_attempts in this usage, if their flagged state was changed in the request.
Definition at line 1145 of file attemptlib.php.

| start_attempt_url | ( | $ | slot = null, |
| $ | page = -1 |
||
| ) |
Definition at line 911 of file attemptlib.php.

| summary_url | ( | ) |
Definition at line 937 of file attemptlib.php.
| view_url | ( | ) |
Definition at line 904 of file attemptlib.php.

$attempt [protected] |
Definition at line 411 of file attemptlib.php.
$pagelayout [protected] |
Definition at line 415 of file attemptlib.php.
$quba [protected] |
Definition at line 412 of file attemptlib.php.
$quizobj [protected] |
Definition at line 410 of file attemptlib.php.
$reviewoptions = null [protected] |
Definition at line 416 of file attemptlib.php.