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. More...
|
|
| 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. More...
|
|
| 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. More...
|
|
| load_for_cache ($questionid) |
| Loads the data for the key provided ready formatted for caching. More...
|
|
| load_many_for_cache (array $questionids) |
| Loads several keys for the cache. More...
|
|
| load_question_data ($questionid) |
| Load a question definition data from the database. More...
|
|
| uncache_question ($questionid) |
| This method needs to be called whenever a question is edited.
|
|
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 |
- Return values
-
get | the question definition cache we are using. |
◆ 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 categoryid, or a comma-separated list 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. |
◆ 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. |
◆ 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: