Moodle  2.2.1
http://www.collinsharper.com
qtype_multichoice_base Class Reference
Inheritance diagram for qtype_multichoice_base:
Collaboration diagram for qtype_multichoice_base:

Public Member Functions

 start_attempt (question_attempt_step $step, $variant)
 apply_attempt_state (question_attempt_step $step)
 get_question_summary ()
 get_order (question_attempt $qa)
 get_response (question_attempt $qa)
 is_choice_selected ($response, $value)
 check_file_access ($qa, $options, $component, $filearea, $args, $forcedownload)
 make_html_inline ($html)

Data Fields

const LAYOUT_DROPDOWN = 0
const LAYOUT_VERTICAL = 1
const LAYOUT_HORIZONTAL = 2
 $answers
 $shuffleanswers
 $answernumbering
 $layout = self::LAYOUT_VERTICAL
 $correctfeedback
 $correctfeedbackformat
 $partiallycorrectfeedback
 $partiallycorrectfeedbackformat
 $incorrectfeedback
 $incorrectfeedbackformat

Protected Member Functions

 init_order (question_attempt $qa)

Protected Attributes

 $order = null

Detailed Description

Base class for multiple choice questions. The parts that are common to single select and multiple select.

Definition at line 37 of file question.php.


Member Function Documentation

When an in-progress question_attempt is re-loaded from the database, this method is called so that the question can re-initialise its internal state as needed by this attempt.

For example, the multiple choice question type needs to set the order of the choices to the order that was set up when start_attempt was called originally. All the information required to do this should be in the $step object, which is the first step of the question_attempt being loaded.

Parameters:
question_attempt_stepThe first step of the question_attempt being loaded.

Reimplemented from question_definition.

Reimplemented in qtype_calculatedmulti_multi_question, and qtype_calculatedmulti_single_question.

Definition at line 65 of file question.php.

Here is the call graph for this function:

check_file_access ( qa,
options,
component,
filearea,
args,
forcedownload 
)

Checks whether the users is allow to be served a particular file.

Parameters:
question_attempt$qathe question attempt being displayed.
question_display_options$optionsthe options that control display of the question.
string$componentthe name of the component we are serving files for.
string$fileareathe name of the file area.
array$argsthe remaining bits of the file path.
bool$forcedownloadwhether the user must be forced to download the file.
Returns:
bool true if the user can access this file.

Reimplemented from question_definition.

Definition at line 94 of file question.php.

Here is the call graph for this function:

Definition at line 79 of file question.php.

Here is the call graph for this function:

Generate a brief, plain-text, summary of this question. This is used by various reports. This should show the particular variant of the question as presented to students. For example, the calculated quetsion type would fill in the particular numbers that were presented to the student. This method will return null if such a summary is not possible, or inappropriate.

Returns:
string|null a plain text summary of this question.

Reimplemented from question_definition.

Definition at line 69 of file question.php.

Here is the call graph for this function:

get_response ( question_attempt qa) [abstract]

Reimplemented in qtype_multichoice_multi_question, and qtype_multichoice_single_question.

Here is the caller graph for this function:

init_order ( question_attempt qa) [protected]

Definition at line 84 of file question.php.

Here is the call graph for this function:

Here is the caller graph for this function:

is_choice_selected ( response,
value 
) [abstract]

Reimplemented in qtype_multichoice_multi_question, and qtype_multichoice_single_question.

Here is the caller graph for this function:

make_html_inline ( html)

Definition at line 128 of file question.php.

start_attempt ( question_attempt_step step,
variant 
)

Start a new attempt at this question, storing any information that will be needed later in the step.

This is where the question can do any initialisation required on a per-attempt basis. For example, this is where the multiple choice question type randomly shuffles the choices (if that option is set).

Any information about how the question has been set up for this attempt should be stored in the $step, by calling $step->set_qt_var(...).

Parameters:
question_attempt_stepThe first step of the question_attempt being started. Can be used to store state.
int$varantwhich variant of this question to start. Will be between 1 and get_num_variants() inclusive.

Reimplemented from question_definition.

Reimplemented in qtype_calculatedmulti_multi_question, and qtype_calculatedmulti_single_question.

Definition at line 57 of file question.php.

Here is the call graph for this function:


Field Documentation

$answernumbering

Definition at line 45 of file question.php.

$answers

Definition at line 42 of file question.php.

$correctfeedback

Definition at line 48 of file question.php.

$correctfeedbackformat

Definition at line 49 of file question.php.

$incorrectfeedback

Definition at line 52 of file question.php.

$incorrectfeedbackformat

Definition at line 53 of file question.php.

$layout = self::LAYOUT_VERTICAL

Definition at line 46 of file question.php.

$order = null [protected]

Definition at line 55 of file question.php.

$partiallycorrectfeedback

Definition at line 50 of file question.php.

$partiallycorrectfeedbackformat

Definition at line 51 of file question.php.

$shuffleanswers

Definition at line 44 of file question.php.

const LAYOUT_DROPDOWN = 0

Definition at line 38 of file question.php.

const LAYOUT_HORIZONTAL = 2

Definition at line 40 of file question.php.

const LAYOUT_VERTICAL = 1

Definition at line 39 of file question.php.


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Enumerations