Class for loading questions according to various criteria.
More...
|
| get_questions_from_categories ($categoryids, $extraconditions, $extraparams=array()) |
| Get the ids of all the questions in a list of categories.
|
|
| get_questions_from_categories_and_tags_with_usage_counts ($categoryids, qubaid_condition $qubaids, $extraconditions='', $extraparams=array(), $tagids=array()) |
| Get the ids of all the questions in a list of categories that have ALL the provided tags, with the number of times they have already been used in a given set of usages.
|
|
| get_questions_from_categories_with_usage_counts ($categoryids, qubaid_condition $qubaids, $extraconditions='', $extraparams=array()) |
| Get the ids of all the questions in a list of categories, with the number of times they have already been used in a given set of usages.
|
|
| load_for_cache ($questionid) |
| Loads the data for the key provided ready formatted for caching.
|
|
| load_many_for_cache (array $questionids) |
| Loads several keys for the cache.
|
|
| load_question_data ($questionid) |
| Load a question definition data from the database.
|
|
| uncache_question ($questionid) |
| This method needs to be called whenever a question is edited.
|
|
|
static question_finder | $questionfinder = null |
| the singleton instance of this class.
|
|
Class for loading questions according to various criteria.
- Copyright
- 2009 The Open University
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
◆ get_data_cache()
question_finder::get_data_cache |
( |
| ) |
|
|
protected |
◆ get_instance()
static question_finder::get_instance |
( |
| ) |
|
|
static |
◆ get_instance_for_cache()
Returns an instance of the data source class that the cache can use for loading data using the other methods specified by this interface.
- Parameters
-
- Return values
-
Implements cache_data_source.
◆ get_questions_from_categories()
question_finder::get_questions_from_categories |
( |
| $categoryids, |
|
|
| $extraconditions, |
|
|
| $extraparams = array() ) |
Get the ids of all the questions in a list of categories.
- Parameters
-
array | $categoryids | either a category id, or a comma-separated list of category ids, or an array of them. |
string | $extraconditions | extra conditions to AND with the rest of the where clause. Must use named parameters. |
array | $extraparams | any parameters used by $extraconditions. |
- Return values
-
array | questionid => questionid. |
◆ get_questions_from_categories_and_tags_with_usage_counts()
question_finder::get_questions_from_categories_and_tags_with_usage_counts |
( |
| $categoryids, |
|
|
qubaid_condition | $qubaids, |
|
|
| $extraconditions = '', |
|
|
| $extraparams = array(), |
|
|
| $tagids = array() ) |
Get the ids of all the questions in a list of categories that have ALL the provided tags, with the number of times they have already been used in a given set of usages.
The result array is returned in order of increasing (count previous uses).
- Parameters
-
array | $categoryids | an array of question_category ids. |
qubaid_condition | $qubaids | which question_usages to count previous uses from. |
string | $extraconditions | extra conditions to AND with the rest of the where clause. Must use named parameters. |
array | $extraparams | any parameters used by $extraconditions. |
array | $tagids | an array of tag ids |
- Return values
-
array | questionid => count of number of previous uses. |
- Deprecated
- since Moodle 4.3
- Todo
- Final deprecation on Moodle 4.7 MDL-78091
◆ get_questions_from_categories_with_usage_counts()
question_finder::get_questions_from_categories_with_usage_counts |
( |
| $categoryids, |
|
|
qubaid_condition | $qubaids, |
|
|
| $extraconditions = '', |
|
|
| $extraparams = array() ) |
Get the ids of all the questions in a list of categories, with the number of times they have already been used in a given set of usages.
The result array is returned in order of increasing (count previous uses).
- Parameters
-
array | $categoryids | an array question_category ids. |
qubaid_condition | $qubaids | which question_usages to count previous uses from. |
string | $extraconditions | extra conditions to AND with the rest of the where clause. Must use named parameters. |
array | $extraparams | any parameters used by $extraconditions. |
- Return values
-
array | questionid => count of number of previous uses. |
- Deprecated
- since Moodle 4.3
- Todo
- Final deprecation on Moodle 4.7 MDL-78091
◆ load_for_cache()
question_finder::load_for_cache |
( |
| $key | ) |
|
Loads the data for the key provided ready formatted for caching.
- Parameters
-
string | int | $key | The key to load. |
- Return values
-
mixed | What ever data should be returned, or false if it can't be loaded. |
Implements cache_data_source.
◆ load_many_for_cache()
question_finder::load_many_for_cache |
( |
array | $keys | ) |
|
Loads several keys for the cache.
- Parameters
-
array | $keys | An array of keys each of which will be string|int. |
- Return values
-
array | An array of matching data items. |
Implements cache_data_source.
◆ load_question_data()
question_finder::load_question_data |
( |
| $questionid | ) |
|
Load a question definition data from the database.
The data will be returned as a plain stdClass object.
- Parameters
-
int | $questionid | the id of the question to load. |
- Return values
-
object | question definition loaded from the database. |
The documentation for this class was generated from the following file: