Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Flagging questions during a quiz attempt: Difference between revisions

From MoodleDocs
(New page: This is We want students to be able to mark certain questions as they are doing them for whatever purpose, for example: * because they want to go back and check their answer before submi...)
 
No edit summary
Line 1: Line 1:
This is  
This is MDL-16263.


We want students to be able to mark certain questions as they are doing them for whatever purpose, for example:
We want students to be able to mark certain questions as they are doing them for whatever purpose, for example:
Line 8: Line 8:
==Code organisation==
==Code organisation==


Flagging of questions actually be implemented as a feature of the question engine, because it is potentially useful shared functionality. However
Flagging of questions actually be implemented as a feature of the question engine, because it is potentially useful shared functionality. However any user of the question engine will have control over whether the flagging interface appears using the $cmoptions parameter to the print_question function.


==Interface==
In addition, some other parts of the quiz interface will be enhanced to show the flagged state of questions.


The flags will be displayed to the left of the questions, under the question number/marks etc.
We will just store the current state of the flag for each attempt at a question (per question session), so there will not be any history kept.


If JavaScript is on, the flag state will be toggled using an ajax interface when it is clicked on. If JS is off, there will be a check-box to show the state, which will be saved when that page of the quiz is submitted.
==Interface within questions==


The flags will be shown
The flags will be displayed to the left of the questions, under the question number and marks, if the $cmoptions->flags is set in the call to print_question. There are three modes: QUESTION_FLAGSHIDDEN, QUESTION_FLAGSSHOWN and QUESTION_FLAGSEDITABLE. QUESTION_FLAGSSHOWN means display the current state of the flag, but don't let it be changed. QUESTION_FLAGSEDITABLE means show the flag with UI to change it.
 
If JavaScript is on, the flag state will be toggled using an Ajax interface when it is clicked on. If JavaScript is off, there will be a check-box to show the state, which will be saved when that page of the quiz is submitted. Even with Ajax on, there will be a checkbox, and the flag image will be in its <label>, but the checkbox will be hidden.
 
==Configuration options within the quiz==
 
There will be a new capability moodle/question:flag, which can be overridden in the quiz context to control whether a particular quiz uses flagging.
 
==Interface within the quiz==
 
If flags are on, the quiz will use QUESTION_FLAGSEDITABLE in attempt.php, and on the review.php and reviewquestion.php page when a user is reviewing their own attempt. It will use QUESTION_FLAGSSHOWN on the two review pages when you are reviewing someone else's attempt.
 
In addition, if flags are in use
* they will be shown on summary.php.
* they may also be shown in the navigation block. (I will try it, is see if it looks good or if it is just confusing.)
 
==Database changes==
 
There will be a new column
flagged INT(2) NOT NULL DEFAULT 0
in the question_sessions table.
 
This will be accessed and updated through a few functions in questionlib.php.
 
==Recording state changes==
 
If JavaScript is on, there will be a new script question/toggleflag.php to receive the Ajax state update requests.
 
Also, in the standard response processing (question_process_responses) there will be additional code to get the state of the flag checkbox and store it.
 
==Security of the Ajax interface==
 
To be written.

Revision as of 02:42, 29 August 2008

This is MDL-16263.

We want students to be able to mark certain questions as they are doing them for whatever purpose, for example:

  • because they want to go back and check their answer before submitting the quiz.
  • because the results will only be released later, and they particularly want to remember to check whether they got this question right.
  • because they want to ask their friend or teacher something relating to that question later.

Code organisation

Flagging of questions actually be implemented as a feature of the question engine, because it is potentially useful shared functionality. However any user of the question engine will have control over whether the flagging interface appears using the $cmoptions parameter to the print_question function.

In addition, some other parts of the quiz interface will be enhanced to show the flagged state of questions.

We will just store the current state of the flag for each attempt at a question (per question session), so there will not be any history kept.

Interface within questions

The flags will be displayed to the left of the questions, under the question number and marks, if the $cmoptions->flags is set in the call to print_question. There are three modes: QUESTION_FLAGSHIDDEN, QUESTION_FLAGSSHOWN and QUESTION_FLAGSEDITABLE. QUESTION_FLAGSSHOWN means display the current state of the flag, but don't let it be changed. QUESTION_FLAGSEDITABLE means show the flag with UI to change it.

If JavaScript is on, the flag state will be toggled using an Ajax interface when it is clicked on. If JavaScript is off, there will be a check-box to show the state, which will be saved when that page of the quiz is submitted. Even with Ajax on, there will be a checkbox, and the flag image will be in its <label>, but the checkbox will be hidden.

Configuration options within the quiz

There will be a new capability moodle/question:flag, which can be overridden in the quiz context to control whether a particular quiz uses flagging.

Interface within the quiz

If flags are on, the quiz will use QUESTION_FLAGSEDITABLE in attempt.php, and on the review.php and reviewquestion.php page when a user is reviewing their own attempt. It will use QUESTION_FLAGSSHOWN on the two review pages when you are reviewing someone else's attempt.

In addition, if flags are in use

  • they will be shown on summary.php.
  • they may also be shown in the navigation block. (I will try it, is see if it looks good or if it is just confusing.)

Database changes

There will be a new column

flagged INT(2) NOT NULL DEFAULT 0

in the question_sessions table.

This will be accessed and updated through a few functions in questionlib.php.

Recording state changes

If JavaScript is on, there will be a new script question/toggleflag.php to receive the Ajax state update requests.

Also, in the standard response processing (question_process_responses) there will be additional code to get the state of the flag checkbox and store it.

Security of the Ajax interface

To be written.