Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
|
This static class provides access to the other question engine classes. More...
Static Public Member Functions | |
static | can_questions_finish_during_the_attempt ($behaviour) |
With this behaviour, is it possible that a question might finish as the student interacts with it, without a call to the question_attempt::finish() method? More... | |
static | delete_questions_usage_by_activities (qubaid_condition $qubaids) |
Delete from the database. More... | |
static | delete_questions_usage_by_activity ($qubaid) |
Delete a question_usage_by_activity from the database, based on its id. More... | |
static | get_all_response_file_areas () |
static | get_archetypal_behaviours () |
Return an array where the keys are the internal names of the archetypal behaviours, and the values are a human-readable name. More... | |
static | get_behaviour_name ($behaviour) |
Get the translated name of a behaviour, for display in the UI. More... | |
static | get_behaviour_options ($currentbehaviour) |
Return an array where the keys are the internal names of the behaviours in preferred order and the values are a human-readable name. More... | |
static | get_behaviour_type ($behaviour) |
Create a behaviour for a particular type. More... | |
static | get_behaviour_unused_display_options ($behaviour) |
static | get_dp_options () |
Returns the valid choices for the number of decimal places for showing question marks. More... | |
static | initialise_js () |
Initialise the JavaScript required on pages where questions will be displayed. More... | |
static | is_behaviour_archetypal ($behaviour) |
static | is_manual_grade_in_range ($qubaid, $slot) |
Validate that the manual grade submitted for a particular question is in range. More... | |
static | load_behaviour_class ($behaviour) |
Load the behaviour class(es) belonging to a particular model. More... | |
static | load_questions_usage_by_activity ($qubaid, moodle_database $db=null) |
Load a question_usage_by_activity from the database, based on its id. More... | |
static | load_used_variants (array $questionids, qubaid_condition $qubaids) |
Get the number of times each variant has been used for each question in a list in a set of usages. More... | |
static | make_archetypal_behaviour ($preferredbehaviour, question_attempt $qa) |
Create an archetypal behaviour for a particular question attempt. More... | |
static | make_behaviour ($behaviour, question_attempt $qa, $preferredbehaviour) |
Create a behaviour for a particular type. More... | |
static | make_questions_usage_by_activity ($component, $context) |
Create a new question_usage_by_activity. More... | |
static | questions_in_use (array $questionids, qubaid_condition $qubaids=null) |
static | save_questions_usage_by_activity (question_usage_by_activity $quba, moodle_database $db=null) |
Save a question_usage_by_activity to the database. More... | |
static | set_max_mark_in_attempts (qubaid_condition $qubaids, $slot, $newmaxmark) |
Change the maxmark for the question_attempt with number in usage $slot for all the specified question_attempts. More... | |
static | sort_behaviours ($archetypes, $orderlist, $disabledlist, $current=null) |
Return an array where the keys are the internal names of the behaviours in preferred order and the values are a human-readable name. More... | |
Static Protected Member Functions | |
static | load_behaviour_type_class ($behaviour) |
Load the behaviour type class for a particular behaviour. More... | |
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 , which is the main class that is used by other code that wants to use questions. 2009 The Open University License http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
static |
With this behaviour, is it possible that a question might finish as the student interacts with it, without a call to the question_attempt::finish() method?
string | $behaviour | the name of a behaviour. E.g. 'deferredfeedback'. |
bool | whether with this behaviour, questions may finish naturally. |
|
static |
Delete from the database.
qubaid_condition | $qubaids | identifies which questions usages to delete. |
|
static |
Delete a question_usage_by_activity from the database, based on its id.
int | $qubaid | the id of the usage to delete. |
|
static |
array | all the file area names that may contain response files. |
|
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().
array | model name => lang string for this behaviour name. |
|
static |
Get the translated name of a behaviour, for display in the UI.
string | $behaviour | the internal name of the model. |
string | name from the current language pack. |
|
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.
string | $currentbehaviour |
array | model name => lang string for this behaviour name. |
|
static |
Create a 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().
string | $behaviour | the type of model to create. |
question_attempt | $qa | the question attempt the model will process. |
string | $preferredbehaviour | the preferred behaviour for the containing usage. |
question_behaviour_type | an instance of appropriate behaviour class. |
|
static |
string | $behaviour | the name of a behaviour. |
array | of question_display_options field names, that are not relevant to this behaviour before a 'finish' action. |
|
static |
Returns the valid choices for the number of decimal places for showing question marks.
For use in the user interface.
array | suitable for passing to html_writer::select() or similar. |
|
static |
Initialise the JavaScript required on pages where questions will be displayed.
string |
|
static |
string | $behaviour | the name of a behaviour. E.g. 'deferredfeedback'. |
bool | whether this is an archetypal behaviour. |
|
static |
Validate that the manual grade submitted for a particular question is in range.
int | $qubaid | the question_usage id. |
int | $slot | the slot number within the usage. |
bool | whether the submitted data is in range. |
|
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.
string | $qtypename | the question type name. For example 'multichoice' or 'shortanswer'. |
|
staticprotected |
Load the behaviour type class for a particular behaviour.
That is, include_once('/question/behaviour/' . $behaviour . '/behaviourtype.php').
string | $behaviour | the behaviour name. For example 'interactive' or 'deferredfeedback'. |
|
static |
Load a question_usage_by_activity from the database, based on its id.
int | $qubaid | the id of the usage to load. |
moodle_database | $db | a database connectoin. Defaults to global $DB. |
question_usage_by_activity | loaded from the database. |
|
static |
Get the number of times each variant has been used for each question in a list in a set of usages.
array | $questionids | of question ids. |
qubaid_condition | $qubaids | ids of the usages to consider. |
array | questionid => variant number => num uses. |
|
static |
Create an archetypal behaviour for a particular question attempt.
Used by question_definition::make_behaviour().
string | $preferredbehaviour | the type of model required. |
question_attempt | $qa | the question attempt the model will process. |
question_behaviour | an instance of appropriate behaviour class. |
|
static |
Create a 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().
string | $behaviour | the type of model to create. |
question_attempt | $qa | the question attempt the model will process. |
string | $preferredbehaviour | the preferred behaviour for the containing usage. |
question_behaviour | an instance of appropriate behaviour class. |
|
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().
string | $component | the plugin creating this attempt. For example mod_quiz. |
object | $context | the context this usage belongs to. |
question_usage_by_activity | the newly created object. |
|
static |
array | $questionids | of question ids. |
qubaid_condition | $qubaids | ids of the usages to consider. |
boolean | whether any of these questions are being used by any of those usages. |
|
static |
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()
question_usage_by_activity | the usage to save. | |
moodle_database | $db | a database connectoin. Defaults to global $DB. |
|
static |
Change the maxmark for the question_attempt with number in usage $slot for all the specified question_attempts.
qubaid_condition | $qubaids | Selects which usages are updated. |
int | $slot | the number is usage to affect. |
number | $newmaxmark | the new max mark to set. |
|
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.
array | $archetypes,array | of behaviours |
string | $orderlist,a | comma separated list of behaviour names |
string | $disabledlist,a | comma separated list of behaviour names |
string | $current,current | behaviour name |
array | model name => lang string for this behaviour name. |