MDL-72438 question: Final deprecations
This commit is contained in:
@@ -2092,262 +2092,3 @@ function is_latest(string $version, string $questionbankentryid): bool {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Deprecated functions from Moodle 4.0.
|
||||
|
||||
/**
|
||||
* Generate the URL for starting a new preview of a given question with the given options.
|
||||
* @param integer $questionid the question to preview.
|
||||
* @param string $preferredbehaviour the behaviour to use for the preview.
|
||||
* @param float $maxmark the maximum to mark the question out of.
|
||||
* @param question_display_options $displayoptions the display options to use.
|
||||
* @param int $variant the variant of the question to preview. If null, one will
|
||||
* be picked randomly.
|
||||
* @param object $context context to run the preview in (affects things like
|
||||
* filter settings, theme, lang, etc.) Defaults to $PAGE->context.
|
||||
* @return moodle_url the URL.
|
||||
* @deprecated since Moodle 4.0
|
||||
* @see qbank_previewquestion\helper::question_preview_url()
|
||||
* @todo Final deprecation on Moodle 4.4 MDL-72438
|
||||
*/
|
||||
function question_preview_url($questionid, $preferredbehaviour = null,
|
||||
$maxmark = null, $displayoptions = null, $variant = null, $context = null) {
|
||||
debugging('Function question_preview_url() has been deprecated and moved to qbank_previewquestion plugin,
|
||||
Please use qbank_previewquestion\previewquestion_helper::question_preview_url() instead.', DEBUG_DEVELOPER);
|
||||
|
||||
return \qbank_previewquestion\helper::question_preview_url($questionid, $preferredbehaviour,
|
||||
$maxmark, $displayoptions, $variant, $context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Popup params for the question preview.
|
||||
*
|
||||
* @return array that can be passed as $params to the {@see popup_action()} constructor.
|
||||
* @deprecated since Moodle 4.0
|
||||
* @see qbank_previewquestion\previewquestion_helper::question_preview_popup_params()
|
||||
* @todo Final deprecation on Moodle 4.4 MDL-72438
|
||||
*/
|
||||
function question_preview_popup_params() {
|
||||
debugging('Function question_preview_popup_params() has been deprecated and moved to qbank_previewquestion plugin,
|
||||
Please use qbank_previewquestion\previewquestion_helper::question_preview_popup_params() instead.', DEBUG_DEVELOPER);
|
||||
|
||||
return \qbank_previewquestion\helper::question_preview_popup_params();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a stamp that uniquely identifies this version of the question
|
||||
*
|
||||
* In future we want this to use a hash of the question data to guarantee that
|
||||
* identical versions have the same version stamp.
|
||||
*
|
||||
* @param object $question
|
||||
* @return string A unique version stamp
|
||||
* @deprecated since Moodle 4.0
|
||||
* @todo Final deprecation on Moodle 4.4 MDL-72438
|
||||
*/
|
||||
function question_hash($question) {
|
||||
debugging('Function question_hash() has been deprecated without replacement.', DEBUG_DEVELOPER);
|
||||
return make_unique_id_code();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create url for question export.
|
||||
*
|
||||
* @param int $contextid
|
||||
* @param int $categoryid
|
||||
* @param string $format
|
||||
* @param string $withcategories
|
||||
* @param string $withcontexts
|
||||
* @param string $filename
|
||||
* @return moodle_url export file url
|
||||
* @deprecated since Moodle 4.0 MDL-71573
|
||||
* @see qbank_exportquestions\exportquestions_helper
|
||||
* @todo Final deprecation on Moodle 4.4 MDL-72438
|
||||
*/
|
||||
function question_make_export_url($contextid, $categoryid, $format, $withcategories,
|
||||
$withcontexts, $filename) {
|
||||
debugging('Function question_make_export_url() has been deprecated and moved to qbank_exportquestions plugin,
|
||||
Please use qbank_exportquestions\exportquestions_helper::question_make_export_url() instead.', DEBUG_DEVELOPER);
|
||||
|
||||
return \qbank_exportquestions\exportquestions_helper::question_make_export_url($contextid, $categoryid, $format,
|
||||
$withcategories, $withcontexts, $filename);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the URL to export a single question (exportone.php).
|
||||
*
|
||||
* @param stdClass|question_definition $question the question definition as obtained from
|
||||
* question_bank::load_question_data() or question_bank::make_question().
|
||||
* (Only ->id and ->contextid are used.)
|
||||
* @return moodle_url the requested URL.
|
||||
* @deprecated since Moodle 4.0
|
||||
* @see \qbank_exporttoxml\helper::question_get_export_single_question_url()
|
||||
* @todo Final deprecation on Moodle 4.4 MDL-72438
|
||||
*/
|
||||
function question_get_export_single_question_url($question) {
|
||||
debugging('Function question_get_export_single_question_url() has been deprecated and moved to qbank_exporttoxml plugin,
|
||||
please use qbank_exporttoxml\helper::question_get_export_single_question_url() instead.', DEBUG_DEVELOPER);
|
||||
qbank_exporttoxml\helper::question_get_export_single_question_url($question);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove stale questions from a category.
|
||||
*
|
||||
* While questions should not be left behind when they are not used any more,
|
||||
* it does happen, maybe via restore, or old logic, or uncovered scenarios. When
|
||||
* this happens, the users are unable to delete the question category unless
|
||||
* they move those stale questions to another one category, but to them the
|
||||
* category is empty as it does not contain anything. The purpose of this function
|
||||
* is to detect the questions that may have gone stale and remove them.
|
||||
*
|
||||
* You will typically use this prior to checking if the category contains questions.
|
||||
*
|
||||
* The stale questions (unused and hidden to the user) handled are:
|
||||
* - hidden questions
|
||||
* - random questions
|
||||
*
|
||||
* @param int $categoryid The category ID.
|
||||
* @deprecated since Moodle 4.0 MDL-71585
|
||||
* @see qbank_managecategories\helper
|
||||
* @todo Final deprecation on Moodle 4.4 MDL-72438
|
||||
*/
|
||||
function question_remove_stale_questions_from_category($categoryid) {
|
||||
debugging('Function question_remove_stale_questions_from_category()
|
||||
has been deprecated and moved to qbank_managecategories plugin,
|
||||
Please use qbank_managecategories\helper::question_remove_stale_questions_from_category() instead.',
|
||||
DEBUG_DEVELOPER);
|
||||
\qbank_managecategories\helper::question_remove_stale_questions_from_category($categoryid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Private method, only for the use of add_indented_names().
|
||||
*
|
||||
* Recursively adds an indentedname field to each category, starting with the category
|
||||
* with id $id, and dealing with that category and all its children, and
|
||||
* return a new array, with those categories in the right order.
|
||||
*
|
||||
* @param array $categories an array of categories which has had childids
|
||||
* fields added by flatten_category_tree(). Passed by reference for
|
||||
* performance only. It is not modfied.
|
||||
* @param int $id the category to start the indenting process from.
|
||||
* @param int $depth the indent depth. Used in recursive calls.
|
||||
* @param int $nochildrenof
|
||||
* @return array a new array of categories, in the right order for the tree.
|
||||
* @deprecated since Moodle 4.0 MDL-71585
|
||||
* @see qbank_managecategories\helper
|
||||
* @todo Final deprecation on Moodle 4.4 MDL-72438
|
||||
*/
|
||||
function flatten_category_tree(&$categories, $id, $depth = 0, $nochildrenof = -1) {
|
||||
debugging('Function flatten_category_tree() has been deprecated and moved to qbank_managecategories plugin,
|
||||
Please use qbank_managecategories\helper::flatten_category_tree() instead.', DEBUG_DEVELOPER);
|
||||
return \qbank_managecategories\helper::flatten_category_tree($categories, $id, $depth, $nochildrenof);
|
||||
}
|
||||
|
||||
/**
|
||||
* Format categories into an indented list reflecting the tree structure.
|
||||
*
|
||||
* @param array $categories An array of category objects, for example from the.
|
||||
* @param int $nochildrenof
|
||||
* @return array The formatted list of categories.
|
||||
* @deprecated since Moodle 4.0 MDL-71585
|
||||
* @see qbank_managecategories\helper
|
||||
* @todo Final deprecation on Moodle 4.4 MDL-72438
|
||||
*/
|
||||
function add_indented_names($categories, $nochildrenof = -1) {
|
||||
debugging('Function add_indented_names() has been deprecated and moved to qbank_managecategories plugin,
|
||||
Please use qbank_managecategories\helper::add_indented_names() instead.', DEBUG_DEVELOPER);
|
||||
return \qbank_managecategories\helper::add_indented_names($categories, $nochildrenof);
|
||||
}
|
||||
|
||||
/**
|
||||
* Output a select menu of question categories.
|
||||
* Categories from this course and (optionally) published categories from other courses
|
||||
* are included. Optionally, only categories the current user may edit can be included.
|
||||
*
|
||||
* @param array $contexts
|
||||
* @param bool $top
|
||||
* @param int $currentcat
|
||||
* @param integer $selected optionally, the id of a category to be selected by
|
||||
* default in the dropdown.
|
||||
* @param int $nochildrenof
|
||||
* @deprecated since Moodle 4.0 MDL-71585
|
||||
* @see qbank_managecategories\helper
|
||||
* @todo Final deprecation on Moodle 4.4 MDL-72438
|
||||
*/
|
||||
function question_category_select_menu($contexts, $top = false, $currentcat = 0,
|
||||
$selected = "", $nochildrenof = -1) {
|
||||
debugging('Function question_category_select_menu() has been deprecated and moved to qbank_managecategories plugin,
|
||||
Please use qbank_managecategories\helper::question_category_select_menu() instead.', DEBUG_DEVELOPER);
|
||||
\qbank_managecategories\helper::question_category_select_menu($contexts, $top, $currentcat, $selected, $nochildrenof);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the category objects, including a count of the number of questions in that category,
|
||||
* for all the categories in the lists $contexts.
|
||||
*
|
||||
* @param mixed $contexts either a single contextid, or a comma-separated list of context ids.
|
||||
* @param string $sortorder used as the ORDER BY clause in the select statement.
|
||||
* @param bool $top Whether to return the top categories or not.
|
||||
* @return array of category objects.
|
||||
* @deprecated since Moodle 4.0 MDL-71585
|
||||
* @see qbank_managecategories\helper
|
||||
* @todo Final deprecation on Moodle 4.4 MDL-72438
|
||||
*/
|
||||
function get_categories_for_contexts($contexts, $sortorder = 'parent, sortorder, name ASC', $top = false) {
|
||||
debugging('Function get_categories_for_contexts() has been deprecated and moved to qbank_managecategories plugin,
|
||||
Please use qbank_managecategories\helper::get_categories_for_contexts() instead.', DEBUG_DEVELOPER);
|
||||
return \qbank_managecategories\helper::get_categories_for_contexts($contexts, $sortorder, $top);
|
||||
}
|
||||
|
||||
/**
|
||||
* Output an array of question categories.
|
||||
*
|
||||
* @param array $contexts The list of contexts.
|
||||
* @param bool $top Whether to return the top categories or not.
|
||||
* @param int $currentcat
|
||||
* @param bool $popupform
|
||||
* @param int $nochildrenof
|
||||
* @param boolean $escapecontextnames Whether the returned name of the thing is to be HTML escaped or not.
|
||||
* @return array
|
||||
* @deprecated since Moodle 4.0 MDL-71585
|
||||
* @see qbank_managecategories\helper
|
||||
* @todo Final deprecation on Moodle 4.4 MDL-72438
|
||||
*/
|
||||
function question_category_options($contexts, $top = false, $currentcat = 0,
|
||||
$popupform = false, $nochildrenof = -1, $escapecontextnames = true) {
|
||||
debugging('Function question_category_options() has been deprecated and moved to qbank_managecategories plugin,
|
||||
Please use qbank_managecategories\helper::question_category_options() instead.', DEBUG_DEVELOPER);
|
||||
return \qbank_managecategories\helper::question_category_options($contexts, $top, $currentcat,
|
||||
$popupform, $nochildrenof, $escapecontextnames);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add context in categories key.
|
||||
*
|
||||
* @param array $categories The list of categories.
|
||||
* @return array
|
||||
* @deprecated since Moodle 4.0 MDL-71585
|
||||
* @see qbank_managecategories\helper
|
||||
* @todo Final deprecation on Moodle 4.4 MDL-72438
|
||||
*/
|
||||
function question_add_context_in_key($categories) {
|
||||
debugging('Function question_add_context_in_key() has been deprecated and moved to qbank_managecategories plugin,
|
||||
Please use qbank_managecategories\helper::question_add_context_in_key() instead.', DEBUG_DEVELOPER);
|
||||
return \qbank_managecategories\helper::question_add_context_in_key($categories);
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds top categories in the given categories hierarchy and replace their name with a proper localised string.
|
||||
*
|
||||
* @param array $categories An array of question categories.
|
||||
* @param boolean $escape Whether the returned name of the thing is to be HTML escaped or not.
|
||||
* @return array The same question category list given to the function, with the top category names being translated.
|
||||
* @deprecated since Moodle 4.0 MDL-71585
|
||||
* @see qbank_managecategories\helper
|
||||
* @todo Final deprecation on Moodle 4.4 MDL-72438
|
||||
*/
|
||||
function question_fix_top_names($categories, $escape = true) {
|
||||
debugging('Function question_fix_top_names() has been deprecated and moved to qbank_managecategories plugin,
|
||||
Please use qbank_managecategories\helper::question_fix_top_names() instead.', DEBUG_DEVELOPER);
|
||||
return \qbank_managecategories\helper::question_fix_top_names($categories, $escape);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user