| [ Index ] |
PHP Cross Reference of Unnamed Project |
[Source view] [Print] [Project Stats]
More object oriented wrappers around parts of the Moodle question bank. In due course, I expect that the question bank will be converted to a fully object oriented structure, at which point this file can be a starting point.
| Copyright: | 2009 The Open University |
| License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
| File Size: | 597 lines (22 kb) |
| Included or required: | 1 time |
| Referenced: | 2 times |
| Includes or requires: | 1 file question/type/questiontypebase.php |
question_finder:: (9 methods):
get_instance()
get_instance_for_cache()
get_data_cache()
uncache_question()
load_question_data()
get_questions_from_categories()
get_questions_from_categories_with_usage_counts()
load_for_cache()
load_many_for_cache()
Class: question_finder - X-Ref
Class for loading questions according to various criteria.| get_instance() X-Ref |
return: question_finder a question finder. |
| get_instance_for_cache(cache_definition $definition) X-Ref |
| No description |
| get_data_cache() X-Ref |
return: get the question definition cache we are using. |
| uncache_question($questionid) X-Ref |
| This method needs to be called whenever a question is edited. |
| load_question_data($questionid) X-Ref |
| Load a question definition data from the database. The data will be returned as a plain stdClass object. param: int $questionid the id of the question to load. return: object question definition loaded from the database. |
| get_questions_from_categories($categoryids, $extraconditions,$extraparams = array() X-Ref |
| Get the ids of all the questions in a list of categories. param: array $categoryids either a categoryid, or a comma-separated list param: string $extraconditions extra conditions to AND with the rest of param: array $extraparams any parameters used by $extraconditions. return: array questionid => questionid. |
| get_questions_from_categories_with_usage_counts($categoryids,qubaid_condition $qubaids, $extraconditions = '', $extraparams = array() X-Ref |
| 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). param: array $categoryids an array question_category ids. param: qubaid_condition $qubaids which question_usages to count previous uses from. param: string $extraconditions extra conditions to AND with the rest of param: array $extraparams any parameters used by $extraconditions. return: array questionid => count of number of previous uses. |
| load_for_cache($questionid) X-Ref |
| No description |
| load_many_for_cache(array $questionids) X-Ref |
| No description |
| is_qtype_installed($qtypename) X-Ref |
param: string $qtypename a question type name, e.g. 'multichoice'. return: bool whether that question type is installed in this Moodle. |
| get_qtype($qtypename, $mustexist = true) X-Ref |
| Get the question type class for a particular question type. param: string $qtypename the question type name. For example 'multichoice' or 'shortanswer'. param: bool $mustexist if false, the missing question type is returned when return: question_type the corresponding question type class. |
| get_config() X-Ref |
| Load the question configuration data from config_plugins. return: object get_config('question') with caching. |
| qtype_enabled($qtypename) X-Ref |
param: string $qtypename the internal name of a question type. For example multichoice. return: bool whether users are allowed to create questions of this type. |
| qtype_exists($qtypename) X-Ref |
param: string $qtypename the internal name of a question type. For example multichoice. return: bool whether this question type exists. |
| get_qtype_name($qtypename) X-Ref |
param: $qtypename the internal name of a question type, for example multichoice. return: string the human_readable name of this question type, from the language pack. |
| get_all_qtypes() X-Ref |
return: array all the installed question types. |
| sort_qtype_array($qtypes, $config = null) X-Ref |
| Sort an array of question types according to the order the admin set up, and then alphabetically for the rest. param: array qtype->name() => qtype->local_name(). return: array sorted array. |
| get_creatable_qtypes() X-Ref |
return: array all the question types that users are allowed to create, |
| load_question_definition_classes($qtypename) X-Ref |
| 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. param: string $qtypename the question type name. For example 'multichoice' or 'shortanswer'. |
| notify_question_edited($questionid) X-Ref |
| This method needs to be called whenever a question is edited. |
| load_question_data($questionid) X-Ref |
| Load a question definition data from the database. The data will be returned as a plain stdClass object. param: int $questionid the id of the question to load. return: object question definition loaded from the database. |
| load_question($questionid, $allowshuffle = true) X-Ref |
| Load a question definition from the database. The object returned will actually be of an appropriate {@link question_definition} subclass. param: int $questionid the id of the question to load. param: bool $allowshuffle if false, then any shuffle option on the selected return: question_definition loaded from the database. |
| make_question($questiondata) X-Ref |
| Convert the question information loaded with {@link get_question_options()} to a question_definintion object. param: object $questiondata raw data loaded from the database. return: question_definition loaded from the database. |
| get_finder() X-Ref |
return: question_finder a question finder. |
| start_unit_test() X-Ref |
| Only to be called from unit tests. Allows {@link load_test_data()} to be used. |
| end_unit_test() X-Ref |
| Only to be called from unit tests. Allows {@link load_test_data()} to be used. |
| return_test_question_data($questionid) X-Ref |
| No description |
| load_test_question_data(question_definition $question) X-Ref |
| To be used for unit testing only. Will throw an exception if {@link start_unit_test()} has not been called first. param: object $questiondata a question data object to put in the test data store. |
| ensure_fraction_options_initialised() X-Ref |
| No description |
| fraction_options() X-Ref |
return: array string => string The standard set of grade options (fractions) |
| fraction_options_full() X-Ref |
| No description |
| cron() X-Ref |
| Perform scheduled maintenance tasks relating to the question bank. |
| get_all_question_types_in_categories($categories) X-Ref |
| Return a list of the different question types present in the given categories. param: array $categories a list of category ids return: array the list of question types in the categories |
| Generated: Thu Aug 11 10:00:09 2016 | Cross-referenced by PHPXref 0.7.1 |