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

Public Member Functions

 __toString ()
 is_active ()
 is_finished ()
 is_graded ()
 is_correct ()
 is_partially_correct ()
 is_incorrect ()
 is_gave_up ()
 is_commented ()
 get_summary_state ()
 corresponding_commented_state ($fraction)
 get_feedback_class ()
 get_state_class ($showcorrectness)
 default_string ($showcorrectness)

Static Public Member Functions

static init ()
static get_all ()
static get_all_for_summary_state ($summarystate)
static get ($name)
static graded_state_for_fraction ($fraction)
static manually_graded_state_for_fraction ($fraction)

Static Public Attributes

static $notstarted
static $unprocessed
static $todo
static $invalid
static $complete
static $needsgrading
static $finished
static $gaveup
static $gradedwrong
static $gradedpartial
static $gradedright
static $manfinished
static $mangaveup
static $mangrwrong
static $mangrpartial
static $mangrright

Protected Member Functions

 __construct ()

Detailed Description

An enumeration representing the states a question can be in after a question_attempt_step.

There are also some useful methods for testing and manipulating states.

Definition at line 39 of file states.php.


Constructor & Destructor Documentation

__construct ( ) [protected]

#@+-

Definition at line 61 of file states.php.


Member Function Documentation

Returns:
string convert this state to a string.

Definition at line 108 of file states.php.

Compute an appropriate state to move to after a manual comment has been added to this state.

Parameters:
number$fractionthe manual grade (if any) on the fraction scale.
Returns:
int the new state.

Reimplemented in question_state_graded, question_state_gaveup, question_state_finished, and question_state_needsgrading.

Definition at line 247 of file states.php.

default_string ( showcorrectness)

The result of doing get_string on the result of get_state_class().

Parameters:
bool$showcorrectnessWhether right/partial/wrong states should be distinguised.
Returns:
string a string from the lang pack that can be used in the UI.

Definition at line 280 of file states.php.

Here is the call graph for this function:

static get ( name) [static]
Parameters:
string$namea state name.
Returns:
question_state the state with that name.

Definition at line 116 of file states.php.

Here is the caller graph for this function:

static get_all ( ) [static]

Get all the states in an array.

Returns:
of question_state objects.

Definition at line 77 of file states.php.

Here is the caller graph for this function:

static get_all_for_summary_state ( summarystate) [static]

Get all the states in an array.

Parameters:
string$summarystateone of the four summary states inprogress, needsgrading, manuallygraded or autograded.
Returns:
arrau of the corresponding states.

Definition at line 92 of file states.php.

Here is the caller graph for this function:

Return an appropriate CSS class name ''/'correct'/'partiallycorrect'/'incorrect', for a state.

Returns:
string

Reimplemented in question_state_mangrright, question_state_mangrpartial, question_state_mangrwrong, question_state_gradedright, question_state_gradedpartial, question_state_gradedwrong, and question_state_gaveup.

Definition at line 256 of file states.php.

Here is the caller graph for this function:

get_state_class ( showcorrectness) [abstract]

Return the name of an appropriate string to look up in the question language pack for a state. This is used, for example, by question_behaviour::get_state_string(). However, behaviours sometimes change this default string for soemthing more specific.

Parameters:
bool$showcorrectnessWhether right/partial/wrong states should be distinguised, or just treated as 'complete'.
Returns:
string the name of a string that can be looked up in the 'question' lang pack, or used as a CSS class name, etc.

Reimplemented in question_state_graded, question_state_gaveup, question_state_finished, question_state_needsgrading, question_state_complete, question_state_invalid, question_state_todo, question_state_unprocessed, and question_state_notstarted.

Here is the caller graph for this function:

Each state can be categorised into one of four categories: inprogress, needsgrading, manuallygraded or autograded.

Returns:
string which category this state falls into.

Definition at line 191 of file states.php.

Here is the call graph for this function:

static graded_state_for_fraction ( fraction) [static]

Return the appropriate graded state based on a fraction. That is 0 or less is $graded_incorrect, 1 is $graded_correct, otherwise it is $graded_partcorrect. Appropriate allowance is made for rounding float values.

Parameters:
number$fractionthe grade, on the fraction scale.
Returns:
int one of the state constants.

Definition at line 211 of file states.php.

Here is the caller graph for this function:

static init ( ) [static]

Definition at line 64 of file states.php.

is_active ( )

Is this state one of the ones that mean the question attempt is in progress? That is, started, but no finished.

Returns:
bool

Reimplemented in question_state_complete, question_state_invalid, and question_state_todo.

Definition at line 125 of file states.php.

Is this state one of the ones that mean the question attempt has had a manual comment added?

Returns:
bool

Reimplemented in question_state_manuallygraded, question_state_mangaveup, and question_state_manfinished.

Definition at line 182 of file states.php.

Here is the caller graph for this function:

Is this state one of the ones that mean the question attempt has been graded?

Returns:
bool

Reimplemented in question_state_mangrright, and question_state_gradedright.

Definition at line 150 of file states.php.

Is this state one of the ones that mean the question attempt is finished? That is, no further interaction possible, apart from manual grading.

Returns:
bool

Reimplemented in question_state_complete, question_state_invalid, question_state_todo, question_state_unprocessed, and question_state_notstarted.

Definition at line 134 of file states.php.

Here is the caller graph for this function:

Is this state one of the ones that mean the question attempt has been graded?

Returns:
bool

Reimplemented in question_state_gaveup.

Definition at line 174 of file states.php.

is_graded ( )

Is this state one of the ones that mean the question attempt has been graded?

Returns:
bool

Reimplemented in question_state_gradedright, question_state_gradedpartial, and question_state_graded.

Definition at line 142 of file states.php.

Is this state one of the ones that mean the question attempt has been graded?

Returns:
bool

Reimplemented in question_state_mangrwrong, and question_state_gradedwrong.

Definition at line 166 of file states.php.

Is this state one of the ones that mean the question attempt has been graded?

Returns:
bool

Reimplemented in question_state_mangrpartial, and question_state_gradedpartial.

Definition at line 158 of file states.php.

static manually_graded_state_for_fraction ( fraction) [static]

Return the appropriate manually graded state based on a fraction. That is 0 or less is $manually_graded_incorrect, 1 is $manually_graded_correct, otherwise it is $manually_graded_partcorrect. Appropriate allowance is made for rounding float values.

Parameters:
number$fractionthe grade, on the fraction scale.
Returns:
int one of the state constants.

Definition at line 229 of file states.php.

Here is the caller graph for this function:


Field Documentation

$complete [static]

Definition at line 47 of file states.php.

$finished [static]

Definition at line 49 of file states.php.

$gaveup [static]

Definition at line 50 of file states.php.

$gradedpartial [static]

Definition at line 52 of file states.php.

$gradedright [static]

Definition at line 53 of file states.php.

$gradedwrong [static]

Definition at line 51 of file states.php.

$invalid [static]

Definition at line 46 of file states.php.

$manfinished [static]

Definition at line 54 of file states.php.

$mangaveup [static]

Definition at line 55 of file states.php.

$mangrpartial [static]

Definition at line 57 of file states.php.

$mangrright [static]

Definition at line 58 of file states.php.

$mangrwrong [static]

Definition at line 56 of file states.php.

$needsgrading [static]

Definition at line 48 of file states.php.

$notstarted [static]

#@+ Specific question_state instances.

Definition at line 43 of file states.php.

$todo [static]

Definition at line 45 of file states.php.

$unprocessed [static]

Definition at line 44 of file states.php.


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