Moodle  2.2.1
http://www.collinsharper.com
question_bank Class Reference

Static Public Member Functions

static is_qtype_installed ($qtypename)
static get_qtype ($qtypename, $mustexist=true)
static get_config ()
static qtype_enabled ($qtypename)
static qtype_exists ($qtypename)
static get_qtype_name ($qtypename)
static get_all_qtypes ()
static sort_qtype_array ($qtypes, $config=null)
static get_creatable_qtypes ()
static load_question_definition_classes ($qtypename)
static load_question ($questionid, $allowshuffle=true)
static make_question ($questiondata)
static get_finder ()
static start_unit_test ()
static end_unit_test ()
static load_test_question_data (question_definition $question)
static fraction_options ()
static fraction_options_full ()

Data Fields

const MAX_SUMMARY_LENGTH = 32000

Protected Member Functions

 ensure_fraction_options_initialised ()

Static Protected Attributes

static $questionfinder = null

Detailed Description

This static class provides access to the other question bank.

It provides functions for managing question types and question definitions.

Definition at line 44 of file bank.php.


Member Function Documentation

static end_unit_test ( ) [static]

Only to be called from unit tests. Allows load_test_data() to be used.

Definition at line 301 of file bank.php.

Here is the caller graph for this function:

Definition at line 327 of file bank.php.

Here is the caller graph for this function:

static fraction_options ( ) [static]
Returns:
array string => string The standard set of grade options (fractions) to use when editing questions, in the range 0 to 1 inclusive. Array keys are string becuase: a) we want grades to exactly 7 d.p., and b. you can't have float array keys in PHP. Initialised by ensure_grade_options_initialised().

Definition at line 391 of file bank.php.

Here is the call graph for this function:

Here is the caller graph for this function:

static fraction_options_full ( ) [static]
Returns:
array string => string The full standard set of (fractions) -1 to 1 inclusive.

Definition at line 397 of file bank.php.

Here is the call graph for this function:

Here is the caller graph for this function:

static get_all_qtypes ( ) [static]
Returns:
array all the installed question types.

Definition at line 152 of file bank.php.

Here is the call graph for this function:

Here is the caller graph for this function:

static get_config ( ) [static]

Load the question configuration data from config_plugins.

Returns:
object get_config('question') with caching.

Definition at line 115 of file bank.php.

Here is the caller graph for this function:

static get_creatable_qtypes ( ) [static]
Returns:
array all the question types that users are allowed to create, sorted into the preferred order set on the admin screen.

Definition at line 204 of file bank.php.

Here is the call graph for this function:

Here is the caller graph for this function:

static get_finder ( ) [static]
Returns:
question_finder a question finder.

Definition at line 284 of file bank.php.

Here is the caller graph for this function:

static get_qtype ( qtypename,
mustexist = true 
) [static]

Get the question type class for a particular question type.

Parameters:
string$qtypenamethe question type name. For example 'multichoice' or 'shortanswer'.
bool$mustexistif false, the missing question type is returned when the requested question type is not installed.
Returns:
question_type the corresponding question type class.

Definition at line 89 of file bank.php.

Here is the call graph for this function:

static get_qtype_name ( qtypename) [static]
Parameters:
$qtypenamethe internal name of a question type, for example multichoice.
Returns:
string the human_readable name of this question type, from the language pack.

Definition at line 145 of file bank.php.

Here is the call graph for this function:

Here is the caller graph for this function:

static is_qtype_installed ( qtypename) [static]
Parameters:
string$qtypenamea question type name, e.g. 'multichoice'.
Returns:
bool whether that question type is installed in this Moodle.

Definition at line 77 of file bank.php.

Here is the call graph for this function:

Here is the caller graph for this function:

static load_question ( questionid,
allowshuffle = true 
) [static]

Load a question definition from the database. The object returned will actually be of an appropriate question_definition subclass.

Parameters:
int$questionidthe id of the question to load.
bool$allowshuffleif false, then any shuffle option on the selected quetsion is disabled.
Returns:
question_definition loaded from the database.

Definition at line 251 of file bank.php.

Here is the call graph for this function:

Here is the caller graph for this function:

static load_question_definition_classes ( qtypename) [static]

Load the question definition class(es) belonging to a question type. That is, include_once('/question/type/' . $qtypename . '/question.php'), with a bit of checking.

Parameters:
string$qtypenamethe question type name. For example 'multichoice' or 'shortanswer'.

Definition at line 230 of file bank.php.

Here is the caller graph for this function:

static load_test_question_data ( question_definition question) [static]

To be used for unit testing only. Will throw an exception if start_unit_test() has not been called first.

Parameters:
object$questiondataa question data object to put in the test data store.

Definition at line 319 of file bank.php.

Here is the caller graph for this function:

static make_question ( questiondata) [static]

Convert the question information loaded with get_question_options() to a question_definintion object.

Parameters:
object$questiondataraw data loaded from the database.
Returns:
question_definition loaded from the database.

Definition at line 277 of file bank.php.

Here is the call graph for this function:

Here is the caller graph for this function:

static qtype_enabled ( qtypename) [static]
Parameters:
string$qtypenamethe internal name of a question type. For example multichoice.
Returns:
bool whether users are allowed to create questions of this type.

Definition at line 126 of file bank.php.

Here is the call graph for this function:

static qtype_exists ( qtypename) [static]
Parameters:
string$qtypenamethe internal name of a question type. For example multichoice.
Returns:
bool whether this question type exists.

Definition at line 137 of file bank.php.

Here is the call graph for this function:

Here is the caller graph for this function:

static sort_qtype_array ( qtypes,
config = null 
) [static]

Sort an array of question types according to the order the admin set up, and then alphabetically for the rest.

Parameters:
arrayqtype->name() => qtype->local_name().
Returns:
array sorted array.

Definition at line 171 of file bank.php.

Here is the call graph for this function:

Here is the caller graph for this function:

static start_unit_test ( ) [static]

Only to be called from unit tests. Allows load_test_data() to be used.

Definition at line 294 of file bank.php.

Here is the caller graph for this function:


Field Documentation

$questionfinder = null [static, protected]

Definition at line 54 of file bank.php.

const MAX_SUMMARY_LENGTH = 32000

Definition at line 46 of file bank.php.


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