Moodle APIs 4.3
Moodle 4.3.6 (Build: 20240812)
|
Functions | |
_tidy_question ($question, $category, array $tagobjects=null, array $filtercourses=null) | |
Private function to factor common code out of get_question_options(). | |
add_indented_names ($categories, $nochildrenof=-1) | |
Format categories into an indented list reflecting the tree structure. | |
core_question_find_next_unused_idnumber (?string $oldidnumber, int $categoryid) | |
If $oldidnumber ends in some digits then return the next available idnumber of the same form. | |
core_question_question_preview_pluginfile ($previewcontext, $questionid, $filecontext, $filecomponent, $filearea, $args, $forcedownload, $options=[]) | |
Serve questiontext files in the question text when they are displayed in this report. | |
delete_question_bank_entry ($entryid) | |
Check if there is more versions left for the entry. | |
flatten_category_tree (&$categories, $id, $depth=0, $nochildrenof=-1) | |
Private method, only for the use of add_indented_names(). | |
get_categories_for_contexts ($contexts, $sortorder='parent, sortorder, name ASC', $top=false) | |
Get all the category objects, including a count of the number of questions in that category, for all the categories in the lists $contexts. | |
get_import_export_formats ($type) | |
Get list of available import or export formats. | |
get_next_version (int $questionbankentryid) | |
Get the next version number to create base on a Question bank entry id. | |
get_question_bank_entry (int $questionid) | |
Get the question_bank_entry object given a question id. | |
get_question_options (&$questions, $loadtags=false, $filtercourses=null) | |
Updates the question objects with question type specific information by calling {. | |
get_question_version ($questionid) | |
Get the question versions given a question id in a descending sort . | |
idnumber_exist_in_question_category ($questionidnumber, $categoryid, $limitfrom=0, $limitnum=1) | |
Check if an idnumber exist in the category. | |
is_latest (string $version, string $questionbankentryid) | |
Checks if question is the latest version. | |
match_grade_options ($gradeoptionsfull, $grade, $matchgrades='error') | |
Check whether a given grade is one of a list of allowed options. | |
move_question_set_references (int $oldcategoryid, int $newcatgoryid, int $oldcontextid, int $newcontextid, bool $delete=false) | |
Update the questioncontextid field for all question_set_references records given a new context id. | |
print_question_icon ($question) | |
Print the icon for the question type. | |
question_add_context_in_key ($categories) | |
Add context in categories key. | |
question_category_delete_safe ($category) | |
Category is about to be deleted, 1/ All questions are deleted for this question category. | |
question_category_in_use ($categoryid, $recursive=false) | |
Tests whether any question in a category is used by any part of Moodle. | |
question_category_options ($contexts, $top=false, $currentcat=0, $popupform=false, $nochildrenof=-1, $escapecontextnames=true) | |
Output an array of question categories. | |
question_category_select_menu ($contexts, $top=false, $currentcat=0, $selected="", $nochildrenof=-1) | |
Output a select menu of question categories. | |
question_categorylist ($categoryid) | |
Get the list of categories. | |
question_categorylist_parents (int $categoryid) | |
Get all parent categories of a given question category in descending order. | |
question_context_has_any_questions ($context) | |
Determine whether there are any questions belonging to this context, that is whether any of its question categories contain any questions. | |
question_default_export_filename ($course, $category) | |
Create a reasonable default file name for exporting questions from a particular category. | |
question_delete_activity ($cm, $notused=false) | |
All question categories and their questions are deleted for this activity. | |
question_delete_context ($contextid) | |
All question categories and their questions are deleted for this context id. | |
question_delete_course ($course, $notused=false) | |
All question categories and their questions are deleted for this course. | |
question_delete_course_category ($category, $newcategory, $notused=false) | |
Category is about to be deleted, 1/ All question categories and their questions are deleted for this course category. | |
question_delete_question ($questionid) | |
Deletes question and all associated data from the database. | |
question_edit_url ($context) | |
Gets the question edit url. | |
question_extend_settings_navigation (navigation_node $navigationnode, $context, $baseurl='/question/edit.php') | |
Adds question bank setting links to the given navigation node if caps are met and loads the navigation from the plugins. | |
question_fix_top_names ($categories, $escape=true) | |
Finds top categories in the given categories hierarchy and replace their name with a proper localised string. | |
question_get_all_capabilities () | |
Get the question bank caps. | |
question_get_default_category ($contextid) | |
Get the default category for the context. | |
question_get_export_single_question_url ($question) | |
Get the URL to export a single question (exportone.php). | |
question_get_question_capabilities () | |
Get the array of capabilities for question. | |
question_get_top_categories_for_contexts ($contextids) | |
Gets the list of top categories in the given contexts in the array("categoryid,categorycontextid") format. | |
question_get_top_category ($contextid, $create=false) | |
Gets the top category in the given context. | |
question_has_capability_on ($questionorid, $cap, $notused=-1) | |
Check capability on category. | |
question_hash ($question) | |
Creates a stamp that uniquely identifies this version of the question. | |
question_load_questions ($questionids, $extrafields='', $join='') | |
Load a set of questions, given a list of ids. | |
question_make_default_categories ($contexts) | |
Gets the default category in the most specific context. | |
question_make_export_url ($contextid, $categoryid, $format, $withcategories, $withcontexts, $filename) | |
Create url for question export. | |
question_module_uses_questions ($modname) | |
Does an activity module use the question bank? | |
question_move_category_to_context ($categoryid, $oldcontextid, $newcontextid) | |
This function helps move a question cateogry to a new context by moving all the files belonging to all the questions to the new context. | |
question_move_question_tags_to_new_context (array $questions, context $newcontext) | |
This function will handle moving all tag instances to a new context for a given list of questions. | |
question_move_questions_to_category ($questionids, $newcategoryid) | |
This function should be considered private to the question bank, it is called from question/editlib.php question/contextmoveq.php and a few similar places to to the work of actually moving questions and associated data. | |
question_page_type_list ($pagetype, $parentcontext, $currentcontext) | |
Return a list of page types. | |
question_pluginfile ($course, $context, $component, $filearea, $args, $forcedownload, $options=[]) | |
Called by pluginfile.php to serve files related to the 'question' core component and for files belonging to qtypes. | |
question_preload_questions ($questionids=null, $extrafields='', $join='', $extraparams=[], $orderby='') | |
Given a list of ids, load the basic information about a set of questions from the questions table. | |
question_preview_popup_params () | |
Popup params for the question preview. | |
question_preview_url ($questionid, $preferredbehaviour=null, $maxmark=null, $displayoptions=null, $variant=null, $context=null) | |
Generate the URL for starting a new preview of a given question with the given options. | |
question_remove_stale_questions_from_category ($categoryid) | |
Remove stale questions from a category. | |
question_reorder_qtypes ($sortedqtypes, $tomove, $direction) | |
Move one question type in a list of question types. | |
question_require_capability_on ($question, $cap) | |
Require capability on question. | |
question_rewrite_question_preview_urls ($text, $questionid, $filecontextid, $filecomponent, $filearea, $itemid, $previewcontextid, $previewcomponent, $options=null) | |
Rewrite the PLUGINFILE urls in part of the content of a question, for use when viewing the question outside an attempt (for example, in the question bank listing or in the quiz statistics report). | |
question_rewrite_question_urls ($text, $file, $contextid, $component, $filearea, array $ids, $itemid, array $options=null) | |
Helps call file_rewrite_pluginfile_urls with the right parameters. | |
question_save_from_deletion ($questionids, $newcontextid, $oldplace, $newcategory=null) | |
Creates a new category to save the questions in use. | |
question_save_qtype_order ($neworder, $config=null) | |
Save a new question type order to the config_plugins table. | |
question_sort_tags ($tagobjects, $categorycontext, $filtercourses=null) | |
Sort question tags by course or normal tags. | |
questions_in_use ($questionids) | |
Check if the question is used. | |
sort_categories_by_tree (&$categories, $id=0, $level=1) | |
Returns the categories with their names ordered following parent-child relationships. | |