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

Static Public Member Functions

static make_questions_usage_by_activity ($component, $context)
static load_questions_usage_by_activity ($qubaid)
static save_questions_usage_by_activity (question_usage_by_activity $quba)
static delete_questions_usage_by_activity ($qubaid)
static delete_questions_usage_by_activities (qubaid_condition $qubaids)
static set_max_mark_in_attempts (qubaid_condition $qubaids, $slot, $newmaxmark)
static questions_in_use (array $questionids, qubaid_condition $qubaids=null)
static make_archetypal_behaviour ($preferredbehaviour, question_attempt $qa)
static get_behaviour_unused_display_options ($behaviour)
static make_behaviour ($behaviour, question_attempt $qa, $preferredbehaviour)
static load_behaviour_class ($behaviour)
static get_archetypal_behaviours ()
static is_behaviour_archetypal ($behaviour)
static sort_behaviours ($archetypes, $orderlist, $disabledlist, $current=null)
static get_behaviour_options ($currentbehaviour)
static get_behaviour_name ($behaviour)
static get_all_response_file_areas ()
static get_dp_options ()
static initialise_js ()

Detailed Description

This static class provides access to the other question engine classes.

It provides functions for managing question behaviours), and for creating, loading, saving and deleting question_usage_by_activitys, which is the main class that is used by other code that wants to use questions.

Definition at line 54 of file lib.php.


Member Function Documentation

Delete question_usage_by_activitys from the database.

Parameters:
qubaid_condition$qubaidsidentifies which questions usages to delete.

Definition at line 109 of file lib.php.

Here is the caller graph for this function:

static delete_questions_usage_by_activity ( qubaid) [static]

Delete a question_usage_by_activity from the database, based on its id.

Parameters:
int$qubaidthe id of the usage to delete.

Definition at line 101 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

static get_all_response_file_areas ( ) [static]
Returns:
array all the file area names that may contain response files.

Definition at line 334 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

static get_archetypal_behaviours ( ) [static]

Return an array where the keys are the internal names of the archetypal behaviours, and the values are a human-readable name. An archetypal behaviour is one that is suitable to pass the name of to question_usage_by_activity::set_preferred_behaviour().

Returns:
array model name => lang string for this behaviour name.

Definition at line 224 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

static get_behaviour_name ( behaviour) [static]

Get the translated name of an behaviour, for display in the UI.

Parameters:
string$behaviourthe internal name of the model.
Returns:
string name from the current language pack.

Definition at line 327 of file lib.php.

Here is the caller graph for this function:

static get_behaviour_options ( currentbehaviour) [static]

Return an array where the keys are the internal names of the behaviours in preferred order and the values are a human-readable name.

Parameters:
string$currentbehaviour
Returns:
array model name => lang string for this behaviour name.

Definition at line 299 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

static get_behaviour_unused_display_options ( behaviour) [static]
Parameters:
string$behaviourthe name of a behaviour.
Returns:
array of question_display_options field names, that are not relevant to this behaviour before a 'finish' action.

Definition at line 164 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

static get_dp_options ( ) [static]

Returns the valid choices for the number of decimal places for showing question marks. For use in the user interface.

Returns:
array suitable for passing to choose_from_menu() or similar.

Definition at line 352 of file lib.php.

Here is the caller graph for this function:

static initialise_js ( ) [static]

Initialise the JavaScript required on pages where questions will be displayed.

Definition at line 359 of file lib.php.

Here is the caller graph for this function:

static is_behaviour_archetypal ( behaviour) [static]
Parameters:
string$behaviourthe name of a behaviour. E.g. 'deferredfeedback'.
Returns:
bool whether this is an archetypal behaviour.

Definition at line 240 of file lib.php.

Here is the call graph for this function:

static load_behaviour_class ( behaviour) [static]

Load the behaviour class(es) belonging to a particular model. That is, include_once('/question/behaviour/' . $behaviour . '/behaviour.php'), with a bit of checking.

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

Definition at line 203 of file lib.php.

Here is the caller graph for this function:

static load_questions_usage_by_activity ( qubaid) [static]

Load a question_usage_by_activity from the database, based on its id.

Parameters:
int$qubaidthe id of the usage to load.
Returns:
question_usage_by_activity loaded from the database.

Definition at line 76 of file lib.php.

Here is the caller graph for this function:

static make_archetypal_behaviour ( preferredbehaviour,
question_attempt qa 
) [static]

Create an archetypal behaviour for a particular question attempt. Used by question_definition::make_behaviour().

Parameters:
string$preferredbehaviourthe type of model required.
question_attempt$qathe question attempt the model will process.
Returns:
question_behaviour an instance of appropriate behaviour class.

Definition at line 149 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

static make_behaviour ( behaviour,
question_attempt qa,
preferredbehaviour 
) [static]

Create an behaviour for a particular type. If that type cannot be found, return an instance of qbehaviour_missing.

Normally you should use make_archetypal_behaviour(), or call the constructor of a particular model class directly. This method is only intended for use by question_attempt::load_from_records().

Parameters:
string$behaviourthe type of model to create.
question_attempt$qathe question attempt the model will process.
string$preferredbehaviourthe preferred behaviour for the containing usage.
Returns:
question_behaviour an instance of appropriate behaviour class.

Definition at line 186 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

static make_questions_usage_by_activity ( component,
context 
) [static]

Create a new question_usage_by_activity. The usage is created in memory. If you want it to persist, you will need to call save_questions_usage_by_activity().

Parameters:
string$componentthe plugin creating this attempt. For example mod_quiz.
object$contextthe context this usage belongs to.
Returns:
question_usage_by_activity the newly created object.

Definition at line 67 of file lib.php.

Here is the caller graph for this function:

static questions_in_use ( array questionids,
qubaid_condition qubaids = null 
) [static]
Parameters:
array$questionidsof question ids.
qubaid_condition$qubaidsids of the usages to consider.
Returns:
boolean whether any of these questions are being used by any of those usages.

Definition at line 133 of file lib.php.

Here is the caller graph for this function:

Save a question_usage_by_activity to the database. This works either if the usage was newly created by make_questions_usage_by_activity() or loaded from the database using load_questions_usage_by_activity()

Parameters:
question_usage_by_activitythe usage to save.

Definition at line 87 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

static set_max_mark_in_attempts ( qubaid_condition qubaids,
slot,
newmaxmark 
) [static]

Change the maxmark for the question_attempt with number in usage $slot for all the specified question_attempts.

Parameters:
qubaid_condition$qubaidsSelects which usages are updated.
int$slotthe number is usage to affect.
number$newmaxmarkthe new max mark to set.

Definition at line 121 of file lib.php.

Here is the caller graph for this function:

static sort_behaviours ( archetypes,
orderlist,
disabledlist,
current = null 
) [static]

Return an array where the keys are the internal names of the behaviours in preferred order and the values are a human-readable name.

Parameters:
array$archetypes,arrayof behaviours
string$orderlist,acomma separated list of behaviour names
string$disabledlist,acomma separated list of behaviour names
string$current,currentbehaviour name
Returns:
array model name => lang string for this behaviour name.

Definition at line 256 of file lib.php.

Here is the caller graph for this function:


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