Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
question_state_invalid Class Reference
Inheritance diagram for question_state_invalid:
question_state

Public Member Functions

 __toString ()
 
 corresponding_commented_state ($fraction)
 Compute an appropriate state to move to after a manual comment has been added to this state.
 
 default_string ($showcorrectness)
 The result of doing get_string on the result of get_state_class().
 
 get_feedback_class ()
 Return an appropriate CSS class name ''/'correct'/'partiallycorrect'/'incorrect', for a state.
 
 get_state_class ($showcorrectness)
 Return the name of an appropriate string to look up in the question language pack for a state.
 
 get_summary_state ()
 Each state can be categorised into one of four categories: inprogress, needsgrading, manuallygraded or autograded.
 
 is_active ()
 Is this state one of the ones that mean the question attempt is in progress? That is, started, but no finished.
 
 is_commented ()
 Is this state one of the ones that mean the question attempt has had a manual comment added?
 
 is_correct ()
 Is this state one of the ones that mean the question attempt has been graded?
 
 is_finished ()
 Is this state one of the ones that mean the question attempt is finished? That is, no further interaction possible, apart from manual grading.
 
 is_gave_up ()
 Is this state one of the ones that mean the question attempt has been graded?
 
 is_graded ()
 Is this state one of the ones that mean the question attempt has been graded?
 
 is_incorrect ()
 Is this state one of the ones that mean the question attempt has been graded?
 
 is_partially_correct ()
 Is this state one of the ones that mean the question attempt has been graded?
 

Static Public Member Functions

static get (string $name)
 Get the instance of this class for a given state name.
 
static get_all ()
 Get all the states in an array.
 
static get_all_for_summary_state ($summarystate)
 Get all the states in an array.
 
static graded_state_for_fraction ($fraction)
 Return the appropriate graded state based on a fraction.
 
static init ()
 
static manually_graded_state_for_fraction ($fraction)
 Return the appropriate manually graded state based on a fraction.
 

Static Public Attributes

static $complete
 
static $finished
 
static $gaveup
 
static $gradedpartial
 
static $gradedright
 
static $gradedwrong
 
static $invalid
 
static $manfinished
 
static $mangaveup
 
static $mangrpartial
 
static $mangrright
 
static $mangrwrong
 
static $needsgrading
 
static $notstarted
 #+ Specific question_state instances.
 
static $todo
 
static $unprocessed
 

Member Function Documentation

◆ __toString()

question_state::__toString ( )
inherited
Return values
stringconvert this state to a string.

◆ corresponding_commented_state()

question_state::corresponding_commented_state ( $fraction)
inherited

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.
Return values
intthe new state.

Reimplemented in question_state_finished, question_state_gaveup, question_state_graded, and question_state_needsgrading.

◆ default_string()

question_state::default_string ( $showcorrectness)
inherited

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

Parameters
bool$showcorrectnessWhether right/partial/wrong states should be distinguised.
Return values
stringa string from the lang pack that can be used in the UI.

◆ get()

static question_state::get ( string $name)
staticinherited

Get the instance of this class for a given state name.

Parameters
string$namea state name.
Return values
question_state|nullthe state with that name. (Null only in an exceptional case.)

◆ get_all()

static question_state::get_all ( )
staticinherited

Get all the states in an array.

Return values
question_state[]of question_state objects.

◆ get_all_for_summary_state()

static question_state::get_all_for_summary_state ( $summarystate)
staticinherited

Get all the states in an array.

Parameters
string$summarystateone of the four summary states inprogress, needsgrading, manuallygraded or autograded.
Return values
arrayof the corresponding states.

◆ get_feedback_class()

question_state::get_feedback_class ( )
inherited

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

Return values
string

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

◆ get_state_class()

question_state_invalid::get_state_class ( $showcorrectness)

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'.
Return values
stringthe name of a string that can be looked up in the 'question' lang pack, or used as a CSS class name, etc.

Reimplemented from question_state.

◆ get_summary_state()

question_state::get_summary_state ( )
inherited

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

Return values
stringwhich category this state falls into.

◆ graded_state_for_fraction()

static question_state::graded_state_for_fraction ( $fraction)
staticinherited

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.
Return values
question_stateone of the state constants.

◆ is_active()

question_state_invalid::is_active ( )

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

Return values
bool

Reimplemented from question_state.

◆ is_commented()

question_state::is_commented ( )
inherited

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

Return values
bool

Reimplemented in question_state_manfinished, question_state_mangaveup, and question_state_manuallygraded.

◆ is_correct()

question_state::is_correct ( )
inherited

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

Return values
bool

Reimplemented in question_state_gradedright, and question_state_mangrright.

◆ is_finished()

question_state_invalid::is_finished ( )

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

Return values
bool

Reimplemented from question_state.

◆ is_gave_up()

question_state::is_gave_up ( )
inherited

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

Return values
bool

Reimplemented in question_state_gaveup.

◆ is_graded()

question_state::is_graded ( )
inherited

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

Return values
bool

Reimplemented in question_state_graded, question_state_gradedpartial, and question_state_gradedright.

◆ is_incorrect()

question_state::is_incorrect ( )
inherited

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

Return values
bool

Reimplemented in question_state_gradedwrong, and question_state_mangrwrong.

◆ is_partially_correct()

question_state::is_partially_correct ( )
inherited

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

Return values
bool

Reimplemented in question_state_gradedpartial, and question_state_mangrpartial.

◆ manually_graded_state_for_fraction()

static question_state::manually_graded_state_for_fraction ( $fraction)
staticinherited

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.
Return values
intone of the state constants.

The documentation for this class was generated from the following file: