mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 21:49:15 +01:00
Merge branch 'MDL-72438' of https://github.com/Chocolate-lightning/moodle
This commit is contained in:
commit
08fce52dd3
@ -1706,13 +1706,6 @@ $functions = array(
|
||||
'capabilities' => 'moodle/question:flag',
|
||||
'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE),
|
||||
),
|
||||
'core_question_submit_tags_form' => array(
|
||||
'classname' => 'core_question_external',
|
||||
'methodname' => 'submit_tags_form',
|
||||
'description' => 'Update the question tags.',
|
||||
'type' => 'write',
|
||||
'ajax' => true,
|
||||
),
|
||||
'core_question_get_random_question_summaries' => array(
|
||||
'classname' => 'core_question_external',
|
||||
'methodname' => 'get_random_question_summaries',
|
||||
|
@ -3125,3 +3125,94 @@ function random_bytes_emulate($length) {
|
||||
);
|
||||
return random_bytes($length);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since Moodle 4.0
|
||||
*/
|
||||
function question_preview_url() {
|
||||
throw new coding_exception(__FUNCTION__ . '() has been removed.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since Moodle 4.0
|
||||
*/
|
||||
function question_preview_popup_params() {
|
||||
throw new coding_exception(__FUNCTION__ . '() has been removed.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since Moodle 4.0
|
||||
*/
|
||||
function question_hash() {
|
||||
throw new coding_exception(__FUNCTION__ . '() has been removed.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since Moodle 4.0 MDL-71573
|
||||
*/
|
||||
function question_make_export_url() {
|
||||
throw new coding_exception(__FUNCTION__ . '() has been removed.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since Moodle 4.0
|
||||
*/
|
||||
function question_get_export_single_question_url() {
|
||||
throw new coding_exception(__FUNCTION__ . '() has been removed.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since Moodle 4.0 MDL-71585
|
||||
*/
|
||||
function question_remove_stale_questions_from_category() {
|
||||
throw new coding_exception(__FUNCTION__ . '() has been removed.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since Moodle 4.0 MDL-71585
|
||||
*/
|
||||
function flatten_category_tree() {
|
||||
throw new coding_exception(__FUNCTION__ . '() has been removed.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since Moodle 4.0 MDL-71585
|
||||
*/
|
||||
function add_indented_names() {
|
||||
throw new coding_exception(__FUNCTION__ . '() has been removed.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since Moodle 4.0 MDL-71585
|
||||
*/
|
||||
function question_category_select_menu() {
|
||||
throw new coding_exception(__FUNCTION__ . '() has been removed.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since Moodle 4.0 MDL-71585
|
||||
*/
|
||||
function get_categories_for_contexts() {
|
||||
throw new coding_exception(__FUNCTION__ . '() has been removed.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since Moodle 4.0 MDL-71585
|
||||
*/
|
||||
function question_category_options() {
|
||||
throw new coding_exception(__FUNCTION__ . '() has been removed.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since Moodle 4.0 MDL-71585
|
||||
*/
|
||||
function question_add_context_in_key() {
|
||||
throw new coding_exception(__FUNCTION__ . '() has been removed.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since Moodle 4.0 MDL-71585
|
||||
*/
|
||||
function question_fix_top_names() {
|
||||
throw new coding_exception(__FUNCTION__ . '() has been removed.');
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -76,6 +76,20 @@ information provided here is intended especially for developers.
|
||||
as an alternative to implementing the \core\hook\described_hook interface.
|
||||
* The hook API now supports the use of the new \core\attribute\hook\replaces_callbacks() attribute
|
||||
as an alternative to implementing the \core\hook\deprecated_callback_replacement interface.
|
||||
* The following previously deprecated methods have been removed and can no longer be used:
|
||||
- `question_preview_url`
|
||||
- `question_preview_popup_params`
|
||||
- `question_hash`
|
||||
- `question_make_export_url`
|
||||
- `question_get_export_single_question_url`
|
||||
- `question_remove_stale_questions_from_category`
|
||||
- `flatten_category_tree`
|
||||
- `add_indented_names`
|
||||
- `question_category_select_menu`
|
||||
- `get_categories_for_contexts`
|
||||
- `question_category_options`
|
||||
- `question_add_context_in_key`
|
||||
- `question_fix_top_names`
|
||||
|
||||
=== 4.3 ===
|
||||
|
||||
|
@ -1375,19 +1375,10 @@ class structure {
|
||||
|
||||
|
||||
/**
|
||||
* Retrieve the list of slot tags for the given slot id.
|
||||
*
|
||||
* @param int $slotid The id for the slot
|
||||
* @return stdClass[] The list of slot tag records
|
||||
* @deprecated since Moodle 4.0 MDL-71573
|
||||
* @todo Final deprecation on Moodle 4.4 MDL-72438
|
||||
*/
|
||||
public function get_slot_tags_for_slot_id($slotid) {
|
||||
debugging('Function get_slot_tags_for_slot_id() has been deprecated and the structure
|
||||
for this method have been moved to filtercondition in question_set_reference table, please
|
||||
use the new structure instead.', DEBUG_DEVELOPER);
|
||||
// All the associated code for this method have been removed to get rid of accidental call or errors.
|
||||
return [];
|
||||
public function get_slot_tags_for_slot_id() {
|
||||
throw new \coding_exception(__FUNCTION__ . '() has been removed.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -35,80 +35,10 @@ function quiz_get_completion_state() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves tag information for the given list of quiz slot ids.
|
||||
* Currently the only slots that have tags are random question slots.
|
||||
*
|
||||
* Example:
|
||||
* If we have 3 slots with id 1, 2, and 3. The first slot has two tags, the second
|
||||
* has one tag, and the third has zero tags. The return structure will look like:
|
||||
* [
|
||||
* 1 => [
|
||||
* quiz_slot_tags.id => { ...tag data... },
|
||||
* quiz_slot_tags.id => { ...tag data... },
|
||||
* ],
|
||||
* 2 => [
|
||||
* quiz_slot_tags.id => { ...tag data... },
|
||||
* ],
|
||||
* 3 => [],
|
||||
* ]
|
||||
*
|
||||
* @param int[] $slotids The list of id for the quiz slots.
|
||||
* @return array[] List of quiz_slot_tags records indexed by slot id.
|
||||
* @deprecated since Moodle 4.0
|
||||
* @todo Final deprecation on Moodle 4.4 MDL-72438
|
||||
*/
|
||||
function quiz_retrieve_tags_for_slot_ids($slotids) {
|
||||
debugging('Method quiz_retrieve_tags_for_slot_ids() is deprecated, ' .
|
||||
'see filtercondition->tags from the question_set_reference table.', DEBUG_DEVELOPER);
|
||||
global $DB;
|
||||
if (empty($slotids)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$slottags = $DB->get_records_list('quiz_slot_tags', 'slotid', $slotids);
|
||||
$tagsbyid = core_tag_tag::get_bulk(array_filter(array_column($slottags, 'tagid')), 'id, name');
|
||||
$tagsbyname = false; // It will be loaded later if required.
|
||||
$emptytagids = array_reduce($slotids, function($carry, $slotid) {
|
||||
$carry[$slotid] = [];
|
||||
return $carry;
|
||||
}, []);
|
||||
|
||||
return array_reduce(
|
||||
$slottags,
|
||||
function($carry, $slottag) use ($slottags, $tagsbyid, $tagsbyname) {
|
||||
if (isset($tagsbyid[$slottag->tagid])) {
|
||||
// Make sure that we're returning the most updated tag name.
|
||||
$slottag->tagname = $tagsbyid[$slottag->tagid]->name;
|
||||
} else {
|
||||
if ($tagsbyname === false) {
|
||||
// We were hoping that this query could be avoided, but life
|
||||
// showed its other side to us!
|
||||
$tagcollid = core_tag_area::get_collection('core', 'question');
|
||||
$tagsbyname = core_tag_tag::get_by_name_bulk(
|
||||
$tagcollid,
|
||||
array_column($slottags, 'tagname'),
|
||||
'id, name'
|
||||
);
|
||||
}
|
||||
if (isset($tagsbyname[$slottag->tagname])) {
|
||||
// Make sure that we're returning the current tag id that matches
|
||||
// the given tag name.
|
||||
$slottag->tagid = $tagsbyname[$slottag->tagname]->id;
|
||||
} else {
|
||||
// The tag does not exist anymore (neither the tag id nor the tag name
|
||||
// matches an existing tag).
|
||||
// We still need to include this row in the result as some callers might
|
||||
// be interested in these rows. An example is the editing forms that still
|
||||
// need to display tag names even if they don't exist anymore.
|
||||
$slottag->tagid = null;
|
||||
}
|
||||
}
|
||||
|
||||
$carry[$slottag->slotid][$slottag->id] = $slottag;
|
||||
return $carry;
|
||||
},
|
||||
$emptytagids
|
||||
);
|
||||
function quiz_retrieve_tags_for_slot_ids() {
|
||||
throw new coding_exception(__FUNCTION__ . '() has been removed.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -19,6 +19,9 @@ This file describes API changes in the quiz code.
|
||||
* There is a new function qbank_helper::get_version_information_for_questions_in_attempt to efficiently
|
||||
check whether each question in an attempt is using the latest versions. This is used by re-grading,
|
||||
replacing some old code there, and to update teacher previews automatically.
|
||||
* The following previously deprecated methods have been removed and can no longer be used:
|
||||
- `get_slot_tags_for_slot_id`
|
||||
- `quiz_retrieve_tags_for_slot_ids`
|
||||
|
||||
=== 4.3 ===
|
||||
|
||||
|
12
question/amd/build/edit_tags.min.js
vendored
12
question/amd/build/edit_tags.min.js
vendored
@ -1,12 +0,0 @@
|
||||
/**
|
||||
* A javascript module to handle question tags editing.
|
||||
*
|
||||
* @deprecated since Moodle 4.0
|
||||
* @todo Final deprecation on Moodle 4.4 MDL-72438
|
||||
* @module core_question/edit_tags
|
||||
* @copyright 2018 Simey Lameze <simey@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define("core_question/edit_tags",["jquery","core/fragment","core/str","core/modal_events","core/modal_save_cancel","core/notification","core/custom_interaction_events","core_question/repository","core_question/selectors"],(function($,Fragment,Str,ModalEvents,ModalSaveCancel,Notification,CustomEvents,Repository,QuestionSelectors){var enableSaveButton=function(root){root.find(QuestionSelectors.actions.save).prop("disabled",!1)},disableSaveButton=function(root){root.find(QuestionSelectors.actions.save).prop("disabled",!0)},startLoading=function(root){root.find(QuestionSelectors.containers.loadingIcon).removeClass("hidden")},stopLoading=function(root){root.find(QuestionSelectors.containers.loadingIcon).addClass("hidden")},save=function(modal,root){disableSaveButton(root),startLoading(root);var formData=function(modal){return modal.getBody().find("form").serialize()}(modal),questionId=function(modal){return modal.getBody().data("questionid")}(modal),contextId=function(modal){return modal.getBody().data("contextid")}(modal);return Repository.submitTagCreateUpdateForm(questionId,contextId,formData).always((function(){stopLoading(root),enableSaveButton(root)})).catch(Notification.exception)};return{init:function(root){window.console.warn("warn: The core_question/repository has been deprecated.Please use qbank_tagquestion/repository instead."),function(root){var modalPromise=ModalSaveCancel.create({large:!1}).then((function(modal){return Str.get_string("questiontags","question").then((function(string){return modal.setTitle(string),string})).catch(Notification.exception),modal.getRoot().on(ModalEvents.save,(function(e){modal.getBody().find("form").submit(),e.preventDefault()})),modal.getRoot().on("submit","form",(function(e){save(modal,root).then((function(){modal.hide(),location.reload()})).catch(Notification.exception),e.preventDefault(),e.stopPropagation()})),modal}));root.on("click",QuestionSelectors.actions.edittags,(function(e){e.preventDefault(),modalPromise.then((modal=>modal.show()))})),root.on(CustomEvents.events.activate,QuestionSelectors.actions.edittags,(function(e){var currentTarget=$(e.currentTarget),questionId=currentTarget.data("questionid"),canTag=!!currentTarget.data("cantag"),contextId=currentTarget.data("contextid");modalPromise.then((function(modal){disableSaveButton(root),startLoading(root);var args={id:questionId},tagsFragment=Fragment.loadFragment("question","tags_form",contextId,args);return modal.setBody(tagsFragment),tagsFragment.then((function(){enableSaveButton(root)})).always((function(){stopLoading(root)})).catch(Notification.exception),canTag?modal.getRoot().find(QuestionSelectors.actions.save).show():modal.getRoot().find(QuestionSelectors.actions.save).hide(),function(modal,questionId){modal.getBody().attr("data-questionid",questionId)}(modal,questionId),function(modal,contextId){modal.getBody().attr("data-contextid",contextId)}(modal,contextId),modal})).catch(Notification.exception),e.preventDefault()}))}(root=$(root))}}}));
|
||||
|
||||
//# sourceMappingURL=edit_tags.min.js.map
|
File diff suppressed because one or more lines are too long
12
question/amd/build/repository.min.js
vendored
12
question/amd/build/repository.min.js
vendored
@ -1,12 +0,0 @@
|
||||
/**
|
||||
* A javascript module to handle question ajax actions.
|
||||
*
|
||||
* @deprecated since Moodle 4.0
|
||||
* @todo Final deprecation on Moodle 4.4 MDL-72438
|
||||
* @module core_question/repository
|
||||
* @copyright 2017 Simey Lameze <lameze@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define("core_question/repository",["jquery","core/ajax"],(function($,Ajax){return{submitTagCreateUpdateForm:function(questionId,contextId,formdata){window.console.warn("warn: The core_question/repository has been deprecated.Please use qbank_tagquestion/repository instead.");var request={methodname:"core_question_submit_tags_form",args:{questionid:questionId,contextid:contextId,formdata:formdata}};return Ajax.call([request])[0]}}}));
|
||||
|
||||
//# sourceMappingURL=repository.min.js.map
|
@ -1 +0,0 @@
|
||||
{"version":3,"file":"repository.min.js","sources":["../src/repository.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * A javascript module to handle question ajax actions.\n *\n * @deprecated since Moodle 4.0\n * @todo Final deprecation on Moodle 4.4 MDL-72438\n * @module core_question/repository\n * @copyright 2017 Simey Lameze <lameze@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['jquery', 'core/ajax'], function($, Ajax) {\n\n /**\n * Submit the form data for the question tags form.\n *\n * @method submitTagCreateUpdateForm\n * @param {number} questionId\n * @param {number} contextId\n * @param {string} formdata The URL encoded values from the form\n * @returns {promise}\n */\n var submitTagCreateUpdateForm = function(questionId, contextId, formdata) {\n window.console.warn('warn: The core_question/repository has been deprecated.' +\n 'Please use qbank_tagquestion/repository instead.');\n var request = {\n methodname: 'core_question_submit_tags_form',\n args: {\n questionid: questionId,\n contextid: contextId,\n formdata: formdata\n }\n };\n\n return Ajax.call([request])[0];\n };\n\n return {\n submitTagCreateUpdateForm: submitTagCreateUpdateForm\n };\n});\n"],"names":["define","$","Ajax","submitTagCreateUpdateForm","questionId","contextId","formdata","window","console","warn","request","methodname","args","questionid","contextid","call"],"mappings":";;;;;;;;;AAwBAA,kCAAO,CAAC,SAAU,cAAc,SAASC,EAAGC,YA0BjC,CACHC,0BAhB4B,SAASC,WAAYC,UAAWC,UAC5DC,OAAOC,QAAQC,KAAK,+GAEhBC,QAAU,CACVC,WAAY,iCACZC,KAAM,CACFC,WAAYT,WACZU,UAAWT,UACXC,SAAUA,kBAIXJ,KAAKa,KAAK,CAACL,UAAU"}
|
12
question/amd/build/selectors.min.js
vendored
12
question/amd/build/selectors.min.js
vendored
@ -1,12 +0,0 @@
|
||||
/**
|
||||
* The purpose of this module is to centralize selectors related to question.
|
||||
*
|
||||
* @deprecated since Moodle 4.0
|
||||
* @todo Final deprecation on Moodle 4.4 MDL-72438
|
||||
* @module core_question/selectors
|
||||
* @copyright 2018 Simey Lameze <lameze@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define("core_question/selectors",[],(function(){return window.console.warn("warn: The core_question/selectors has been deprecated. Please use qbank_tagquestion/selectors instead."),{actions:{save:'[data-action="save"]',edittags:'[data-action="edittags"]'},containers:{loadingIcon:'[data-region="overlay-icon-container"]'}}}));
|
||||
|
||||
//# sourceMappingURL=selectors.min.js.map
|
@ -1 +0,0 @@
|
||||
{"version":3,"file":"selectors.min.js","sources":["../src/selectors.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * The purpose of this module is to centralize selectors related to question.\n *\n * @deprecated since Moodle 4.0\n * @todo Final deprecation on Moodle 4.4 MDL-72438\n * @module core_question/selectors\n * @copyright 2018 Simey Lameze <lameze@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine([], function() {\n window.console.warn('warn: The core_question/selectors has been deprecated. Please use qbank_tagquestion/selectors instead.');\n return {\n actions: {\n save: '[data-action=\"save\"]',\n edittags: '[data-action=\"edittags\"]',\n },\n containers: {\n loadingIcon: '[data-region=\"overlay-icon-container\"]',\n },\n };\n});\n"],"names":["define","window","console","warn","actions","save","edittags","containers","loadingIcon"],"mappings":";;;;;;;;;AAwBAA,iCAAO,IAAI,kBACPC,OAAOC,QAAQC,KAAK,0GACb,CACHC,QAAS,CACLC,KAAM,uBACNC,SAAU,4BAEdC,WAAY,CACRC,YAAa"}
|
@ -1,282 +0,0 @@
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* A javascript module to handle question tags editing.
|
||||
*
|
||||
* @deprecated since Moodle 4.0
|
||||
* @todo Final deprecation on Moodle 4.4 MDL-72438
|
||||
* @module core_question/edit_tags
|
||||
* @copyright 2018 Simey Lameze <simey@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define([
|
||||
'jquery',
|
||||
'core/fragment',
|
||||
'core/str',
|
||||
'core/modal_events',
|
||||
'core/modal_save_cancel',
|
||||
'core/notification',
|
||||
'core/custom_interaction_events',
|
||||
'core_question/repository',
|
||||
'core_question/selectors',
|
||||
],
|
||||
function(
|
||||
$,
|
||||
Fragment,
|
||||
Str,
|
||||
ModalEvents,
|
||||
ModalSaveCancel,
|
||||
Notification,
|
||||
CustomEvents,
|
||||
Repository,
|
||||
QuestionSelectors
|
||||
) {
|
||||
|
||||
/**
|
||||
* Enable the save button in the footer.
|
||||
*
|
||||
* @param {object} root The container element.
|
||||
* @method enableSaveButton
|
||||
*/
|
||||
var enableSaveButton = function(root) {
|
||||
root.find(QuestionSelectors.actions.save).prop('disabled', false);
|
||||
};
|
||||
|
||||
/**
|
||||
* Disable the save button in the footer.
|
||||
*
|
||||
* @param {object} root The container element.
|
||||
* @method disableSaveButton
|
||||
*/
|
||||
var disableSaveButton = function(root) {
|
||||
root.find(QuestionSelectors.actions.save).prop('disabled', true);
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the serialised form data.
|
||||
*
|
||||
* @method getFormData
|
||||
* @param {object} modal The modal object.
|
||||
* @return {string} serialised form data
|
||||
*/
|
||||
var getFormData = function(modal) {
|
||||
return modal.getBody().find('form').serialize();
|
||||
};
|
||||
|
||||
/**
|
||||
* Set the element state to loading.
|
||||
*
|
||||
* @param {object} root The container element
|
||||
* @method startLoading
|
||||
*/
|
||||
var startLoading = function(root) {
|
||||
var loadingIconContainer = root.find(QuestionSelectors.containers.loadingIcon);
|
||||
|
||||
loadingIconContainer.removeClass('hidden');
|
||||
};
|
||||
|
||||
/**
|
||||
* Remove the loading state from the element.
|
||||
*
|
||||
* @param {object} root The container element
|
||||
* @method stopLoading
|
||||
*/
|
||||
var stopLoading = function(root) {
|
||||
var loadingIconContainer = root.find(QuestionSelectors.containers.loadingIcon);
|
||||
|
||||
loadingIconContainer.addClass('hidden');
|
||||
};
|
||||
|
||||
/**
|
||||
* Set the context Id data attribute on the modal.
|
||||
*
|
||||
* @param {Promise} modal The modal promise.
|
||||
* @param {int} contextId The context id.
|
||||
*/
|
||||
var setContextId = function(modal, contextId) {
|
||||
modal.getBody().attr('data-contextid', contextId);
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the context Id data attribute value from the modal body.
|
||||
*
|
||||
* @param {Promise} modal The modal promise.
|
||||
* @return {int} The context id.
|
||||
*/
|
||||
var getContextId = function(modal) {
|
||||
return modal.getBody().data('contextid');
|
||||
};
|
||||
|
||||
/**
|
||||
* Set the question Id data attribute on the modal.
|
||||
*
|
||||
* @param {Promise} modal The modal promise.
|
||||
* @param {int} questionId The question Id.
|
||||
*/
|
||||
var setQuestionId = function(modal, questionId) {
|
||||
modal.getBody().attr('data-questionid', questionId);
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the question Id data attribute value from the modal body.
|
||||
*
|
||||
* @param {Promise} modal The modal promise.
|
||||
* @return {int} The question Id.
|
||||
*/
|
||||
var getQuestionId = function(modal) {
|
||||
return modal.getBody().data('questionid');
|
||||
};
|
||||
|
||||
/**
|
||||
* Register event listeners for the module.
|
||||
*
|
||||
* @param {object} root The calendar root element
|
||||
*/
|
||||
var registerEventListeners = function(root) {
|
||||
|
||||
var modalPromise = ModalSaveCancel.create({
|
||||
large: false,
|
||||
}).then(function(modal) {
|
||||
// All of this code only executes once, when the modal is
|
||||
// first created. This allows us to add any code that should
|
||||
// only be run once, such as adding event handlers to the modal.
|
||||
Str.get_string('questiontags', 'question')
|
||||
.then(function(string) {
|
||||
modal.setTitle(string);
|
||||
return string;
|
||||
})
|
||||
.catch(Notification.exception);
|
||||
|
||||
modal.getRoot().on(ModalEvents.save, function(e) {
|
||||
var form = modal.getBody().find('form');
|
||||
form.submit();
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
modal.getRoot().on('submit', 'form', function(e) {
|
||||
save(modal, root).then(function() {
|
||||
modal.hide();
|
||||
location.reload();
|
||||
return;
|
||||
}).catch(Notification.exception);
|
||||
|
||||
// Stop the form from actually submitting and prevent it's
|
||||
// propagation because we have already handled the event.
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
});
|
||||
|
||||
return modal;
|
||||
});
|
||||
|
||||
root.on('click', QuestionSelectors.actions.edittags, function(e) {
|
||||
e.preventDefault();
|
||||
// eslint-disable-next-line promise/catch-or-return
|
||||
modalPromise.then((modal) => modal.show());
|
||||
});
|
||||
|
||||
// We need to add an event handler to the tags link because there are
|
||||
// multiple links on the page and without adding a listener we don't know
|
||||
// which one the user clicked on the show the modal.
|
||||
root.on(CustomEvents.events.activate, QuestionSelectors.actions.edittags, function(e) {
|
||||
var currentTarget = $(e.currentTarget);
|
||||
|
||||
var questionId = currentTarget.data('questionid'),
|
||||
canTag = !!currentTarget.data('cantag'),
|
||||
contextId = currentTarget.data('contextid');
|
||||
|
||||
// This code gets called each time the user clicks the tag link
|
||||
// so we can use it to reload the contents of the tag modal.
|
||||
modalPromise.then(function(modal) {
|
||||
// Display spinner and disable save button.
|
||||
disableSaveButton(root);
|
||||
startLoading(root);
|
||||
|
||||
var args = {
|
||||
id: questionId
|
||||
};
|
||||
|
||||
var tagsFragment = Fragment.loadFragment('question', 'tags_form', contextId, args);
|
||||
modal.setBody(tagsFragment);
|
||||
|
||||
tagsFragment.then(function() {
|
||||
enableSaveButton(root);
|
||||
return;
|
||||
})
|
||||
.always(function() {
|
||||
// Always hide the loading spinner when the request
|
||||
// has completed.
|
||||
stopLoading(root);
|
||||
return;
|
||||
})
|
||||
.catch(Notification.exception);
|
||||
|
||||
// Show or hide the save button depending on whether the user
|
||||
// has the capability to edit the tags.
|
||||
if (canTag) {
|
||||
modal.getRoot().find(QuestionSelectors.actions.save).show();
|
||||
} else {
|
||||
modal.getRoot().find(QuestionSelectors.actions.save).hide();
|
||||
}
|
||||
|
||||
setQuestionId(modal, questionId);
|
||||
setContextId(modal, contextId);
|
||||
|
||||
return modal;
|
||||
}).catch(Notification.exception);
|
||||
|
||||
e.preventDefault();
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Send the form data to the server to save question tags.
|
||||
*
|
||||
* @method save
|
||||
* @param {object} modal The modal object.
|
||||
* @param {object} root The container element.
|
||||
* @return {object} A promise
|
||||
*/
|
||||
var save = function(modal, root) {
|
||||
// Display spinner and disable save button.
|
||||
disableSaveButton(root);
|
||||
startLoading(root);
|
||||
|
||||
var formData = getFormData(modal);
|
||||
var questionId = getQuestionId(modal);
|
||||
var contextId = getContextId(modal);
|
||||
|
||||
// Send the form data to the server for processing.
|
||||
return Repository.submitTagCreateUpdateForm(questionId, contextId, formData)
|
||||
.always(function() {
|
||||
// Regardless of success or error we should always stop
|
||||
// the loading icon and re-enable the buttons.
|
||||
stopLoading(root);
|
||||
enableSaveButton(root);
|
||||
return;
|
||||
})
|
||||
.catch(Notification.exception);
|
||||
};
|
||||
|
||||
return {
|
||||
init: function(root) {
|
||||
window.console.warn('warn: The core_question/repository has been deprecated.' +
|
||||
'Please use qbank_tagquestion/repository instead.');
|
||||
root = $(root);
|
||||
registerEventListeners(root);
|
||||
}
|
||||
};
|
||||
});
|
@ -1,54 +0,0 @@
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* A javascript module to handle question ajax actions.
|
||||
*
|
||||
* @deprecated since Moodle 4.0
|
||||
* @todo Final deprecation on Moodle 4.4 MDL-72438
|
||||
* @module core_question/repository
|
||||
* @copyright 2017 Simey Lameze <lameze@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define(['jquery', 'core/ajax'], function($, Ajax) {
|
||||
|
||||
/**
|
||||
* Submit the form data for the question tags form.
|
||||
*
|
||||
* @method submitTagCreateUpdateForm
|
||||
* @param {number} questionId
|
||||
* @param {number} contextId
|
||||
* @param {string} formdata The URL encoded values from the form
|
||||
* @returns {promise}
|
||||
*/
|
||||
var submitTagCreateUpdateForm = function(questionId, contextId, formdata) {
|
||||
window.console.warn('warn: The core_question/repository has been deprecated.' +
|
||||
'Please use qbank_tagquestion/repository instead.');
|
||||
var request = {
|
||||
methodname: 'core_question_submit_tags_form',
|
||||
args: {
|
||||
questionid: questionId,
|
||||
contextid: contextId,
|
||||
formdata: formdata
|
||||
}
|
||||
};
|
||||
|
||||
return Ajax.call([request])[0];
|
||||
};
|
||||
|
||||
return {
|
||||
submitTagCreateUpdateForm: submitTagCreateUpdateForm
|
||||
};
|
||||
});
|
@ -1,36 +0,0 @@
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* The purpose of this module is to centralize selectors related to question.
|
||||
*
|
||||
* @deprecated since Moodle 4.0
|
||||
* @todo Final deprecation on Moodle 4.4 MDL-72438
|
||||
* @module core_question/selectors
|
||||
* @copyright 2018 Simey Lameze <lameze@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define([], function() {
|
||||
window.console.warn('warn: The core_question/selectors has been deprecated. Please use qbank_tagquestion/selectors instead.');
|
||||
return {
|
||||
actions: {
|
||||
save: '[data-action="save"]',
|
||||
edittags: '[data-action="edittags"]',
|
||||
},
|
||||
containers: {
|
||||
loadingIcon: '[data-region="overlay-icon-container"]',
|
||||
},
|
||||
};
|
||||
});
|
@ -1,29 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* A class for representing question categories.
|
||||
*
|
||||
* @package moodlecore
|
||||
* @subpackage questionbank
|
||||
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @deprecated since Moodle 4.0 MDL-71585
|
||||
* @see \qbank_managecategories\question_category_list
|
||||
* @see \qbank_managecategories\question_category_list_item
|
||||
* @see \qbank_managecategories\question_category_object
|
||||
* @todo Final deprecation on Moodle 4.4 MDL-72438
|
||||
*/
|
@ -1,27 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Defines the form for editing question categories.
|
||||
*
|
||||
* @package moodlecore
|
||||
* @subpackage questionbank
|
||||
* @copyright 2007 Jamie Pratt me@jamiep.org
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @deprecated since Moodle 4.0 MDL-71585
|
||||
* @see qbank_managecategories\form\category_form
|
||||
* @todo Final deprecation on Moodle 4.4 MDL-72438
|
||||
*/
|
@ -124,121 +124,6 @@ class core_question_external extends external_api {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns description of method parameters.
|
||||
*
|
||||
* @return external_function_parameters.
|
||||
* @deprecated since Moodle 4.0
|
||||
* @see \qbank_tagquestion\external\qbank_tagquestion_external
|
||||
* @todo Final deprecation on Moodle 4.4 MDL-72438
|
||||
*/
|
||||
public static function submit_tags_form_parameters() {
|
||||
return new external_function_parameters([
|
||||
'questionid' => new external_value(PARAM_INT, 'The question id'),
|
||||
'contextid' => new external_value(PARAM_INT, 'The editing context id'),
|
||||
'formdata' => new external_value(PARAM_RAW, 'The data from the tag form'),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the tags form submission.
|
||||
*
|
||||
* @param int $questionid The question id.
|
||||
* @param int $contextid The editing context id.
|
||||
* @param string $formdata The question tag form data in a URI encoded param string
|
||||
* @return array The created or modified question tag
|
||||
* @deprecated since Moodle 4.0
|
||||
* @see \qbank_tagquestion\external\qbank_tagquestion_external
|
||||
* @todo Final deprecation on Moodle 4.4 MDL-72438
|
||||
*/
|
||||
public static function submit_tags_form($questionid, $contextid, $formdata) {
|
||||
global $DB, $CFG;
|
||||
|
||||
$data = [];
|
||||
$result = ['status' => false];
|
||||
|
||||
// Parameter validation.
|
||||
$params = self::validate_parameters(self::submit_tags_form_parameters(), [
|
||||
'questionid' => $questionid,
|
||||
'contextid' => $contextid,
|
||||
'formdata' => $formdata
|
||||
]);
|
||||
|
||||
$editingcontext = \context::instance_by_id($contextid);
|
||||
self::validate_context($editingcontext);
|
||||
parse_str($params['formdata'], $data);
|
||||
|
||||
if (!$question = $DB->get_record_sql('
|
||||
SELECT q.*, qc.contextid
|
||||
FROM {question} q
|
||||
JOIN {question_categories} qc ON qc.id = q.category
|
||||
WHERE q.id = ?', [$questionid])) {
|
||||
throw new \moodle_exception('questiondoesnotexist', 'question');
|
||||
}
|
||||
|
||||
require_once($CFG->libdir . '/questionlib.php');
|
||||
|
||||
$cantag = question_has_capability_on($question, 'tag');
|
||||
$questioncontext = \context::instance_by_id($question->contextid);
|
||||
$contexts = new \core_question\local\bank\question_edit_contexts($editingcontext);
|
||||
|
||||
$formoptions = [
|
||||
'editingcontext' => $editingcontext,
|
||||
'questioncontext' => $questioncontext,
|
||||
'contexts' => $contexts->all()
|
||||
];
|
||||
|
||||
$mform = new \qbank_tagquestion\form\tags_form(null, $formoptions, 'post', '', null, $cantag, $data);
|
||||
|
||||
if ($validateddata = $mform->get_data()) {
|
||||
if ($cantag) {
|
||||
if (isset($validateddata->tags)) {
|
||||
// Due to a mform bug, if there's no tags set on the tag element, it submits the name as the value.
|
||||
// The only way to discover is checking if the tag element is an array.
|
||||
$tags = is_array($validateddata->tags) ? $validateddata->tags : [];
|
||||
|
||||
core_tag_tag::set_item_tags('core_question', 'question', $validateddata->id,
|
||||
$questioncontext, $tags);
|
||||
|
||||
$result['status'] = true;
|
||||
}
|
||||
|
||||
if (isset($validateddata->coursetags)) {
|
||||
$coursetags = is_array($validateddata->coursetags) ? $validateddata->coursetags : [];
|
||||
core_tag_tag::set_item_tags('core_question', 'question', $validateddata->id,
|
||||
$editingcontext->get_course_context(false), $coursetags);
|
||||
|
||||
$result['status'] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns description of method result value.
|
||||
*
|
||||
* @deprecated since Moodle 4.0
|
||||
* @see \qbank_tagquestion\external\qbank_tagquestion_external
|
||||
* @todo Final deprecation on Moodle 4.4 MDL-72438
|
||||
*/
|
||||
public static function submit_tags_form_returns() {
|
||||
return new external_single_structure([
|
||||
'status' => new external_value(PARAM_BOOL, 'status: true if success')
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Marking the method as deprecated.
|
||||
*
|
||||
* @return bool
|
||||
* @todo Final deprecation on Moodle 4.4 MDL-72438
|
||||
*/
|
||||
public static function submit_tags_form_is_deprecated() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns description of method parameters.
|
||||
*
|
||||
|
@ -70,17 +70,9 @@ abstract class bulk_action_base {
|
||||
}
|
||||
|
||||
/**
|
||||
* A unique key for the bulk action, this will be used in the api to identify the action data.
|
||||
* Every bulk must have a unique key to perform the action as a part of the form post in the base view.
|
||||
* When questions are selected, it will post according to the key its selected from the dropdown.
|
||||
*
|
||||
* @return string
|
||||
* @deprecated since Moodle 4.1
|
||||
* @see get_key()
|
||||
* @todo Final deprecation on Moodle 4.5 MDL-72438
|
||||
* @deprecated since Moodle 4.0
|
||||
*/
|
||||
public function get_bulk_action_key() {
|
||||
debugging(__FUNCTION__ . " is deprecated and should no longer be used. Please use get_key() instead.", DEBUG_DEVELOPER);
|
||||
return $this->get_key();
|
||||
throw new \coding_exception(__FUNCTION__ . '() has been removed.');
|
||||
}
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
require_once($CFG->dirroot . '/question/editlib.php');
|
||||
|
||||
use coding_exception;
|
||||
use core\plugininfo\qbank;
|
||||
use core\output\datafilter;
|
||||
use core_plugin_manager;
|
||||
@ -850,21 +851,10 @@ class view {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the URL to preview a question.
|
||||
* @param \stdClass $questiondata the data defining the question.
|
||||
* @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
|
||||
*/
|
||||
public function preview_question_url($questiondata) {
|
||||
debugging(
|
||||
'Function preview_question_url() has been deprecated and moved to qbank_previewquestion plugin, ' .
|
||||
'please use qbank_previewquestion\helper::question_preview_url() instead.',
|
||||
DEBUG_DEVELOPER
|
||||
);
|
||||
return question_preview_url($questiondata->id, null, null, null, null,
|
||||
$this->get_most_specific_context());
|
||||
public function preview_question_url() {
|
||||
throw new coding_exception(__FUNCTION__ . '() has been removed.');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1510,29 +1500,17 @@ class view {
|
||||
}
|
||||
|
||||
/**
|
||||
* Process actions for the selected action.
|
||||
* @deprecated since Moodle 4.0
|
||||
* @todo Final deprecation on Moodle 4.4 MDL-72438
|
||||
*/
|
||||
public function process_actions(): void {
|
||||
debugging('Function process_actions() is deprecated and its code has been completely deleted.
|
||||
Please, remove the call from your code and check core_question\local\bank\bulk_action_base
|
||||
to learn more about bulk actions in qbank.', DEBUG_DEVELOPER);
|
||||
// Associated code is deleted to make sure any incorrect call doesnt not cause any data loss.
|
||||
throw new coding_exception(__FUNCTION__ . '() has been removed.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Process actions with ui.
|
||||
* @return bool
|
||||
* @deprecated since Moodle 4.0
|
||||
* @todo Final deprecation on Moodle 4.4 MDL-72438
|
||||
*/
|
||||
public function process_actions_needing_ui(): bool {
|
||||
debugging('Function process_actions_needing_ui() is deprecated and its code has been completely deleted.
|
||||
Please, remove the call from your code and check core_question\local\bank\bulk_action_base
|
||||
to learn more about bulk actions in qbank.', DEBUG_DEVELOPER);
|
||||
// Associated code is deleted to make sure any incorrect call doesnt not cause any data loss.
|
||||
return false;
|
||||
public function process_actions_needing_ui() {
|
||||
throw new coding_exception(__FUNCTION__ . '() has been removed.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
93
question/deprecatedlib.php
Normal file
93
question/deprecatedlib.php
Normal file
@ -0,0 +1,93 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* List of deprecated question functions.
|
||||
*
|
||||
* @package core_question
|
||||
* @copyright 2024 Mathew May <mathew.solutions>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
/**
|
||||
* @deprecated since Moodle 4.0 MDL-71585
|
||||
*/
|
||||
function question_is_only_child_of_top_category_in_context() {
|
||||
throw new coding_exception(__FUNCTION__ . '() has been removed.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since Moodle 4.0 MDL-71585
|
||||
*/
|
||||
function question_is_top_category() {
|
||||
throw new coding_exception(__FUNCTION__ . '() has been removed.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since Moodle 4.0 MDL-71585
|
||||
*/
|
||||
function question_can_delete_cat() {
|
||||
throw new coding_exception(__FUNCTION__ . '() has been removed.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since Moodle 4.0
|
||||
*/
|
||||
function print_choose_qtype_to_add_form() {
|
||||
throw new coding_exception(__FUNCTION__ . '() has been removed.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since Moodle 4.0
|
||||
*/
|
||||
function create_new_question_button() {
|
||||
throw new coding_exception(__FUNCTION__ . '() has been removed.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since Moodle 4.0
|
||||
*/
|
||||
function core_question_output_fragment_tags_form() {
|
||||
throw new coding_exception(__FUNCTION__ . '() has been removed.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since Moodle 4.0
|
||||
*/
|
||||
function question_preview_question_pluginfile() {
|
||||
throw new coding_exception(__FUNCTION__ . '() has been removed.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since Moodle 4.0
|
||||
*/
|
||||
function question_preview_action_url() {
|
||||
throw new coding_exception(__FUNCTION__ . '() has been removed.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since Moodle 4.0
|
||||
*/
|
||||
function question_preview_form_url() {
|
||||
throw new coding_exception(__FUNCTION__ . '() has been removed.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since Moodle 4.0
|
||||
*/
|
||||
function restart_preview() {
|
||||
throw new coding_exception(__FUNCTION__ . '() has been removed.');
|
||||
}
|
@ -113,52 +113,6 @@ function get_questions_category(object $category, bool $noparent, bool $recurse
|
||||
return $qresults;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether this is the only child of a top category in a context.
|
||||
*
|
||||
* @param int $categoryid a category id.
|
||||
* @return bool
|
||||
* @deprecated since Moodle 4.0 MDL-71585
|
||||
* @see qbank_managecategories\helper
|
||||
* @todo Final deprecation on Moodle 4.4 MDL-72438
|
||||
*/
|
||||
function question_is_only_child_of_top_category_in_context($categoryid) {
|
||||
debugging('Function question_is_only_child_of_top_category_in_context()
|
||||
has been deprecated and moved to qbank_managecategories plugin,
|
||||
Please use qbank_managecategories\helper::question_is_only_child_of_top_category_in_context() instead.',
|
||||
DEBUG_DEVELOPER);
|
||||
return \qbank_managecategories\helper::question_is_only_child_of_top_category_in_context($categoryid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the category is a "Top" category (with no parent).
|
||||
*
|
||||
* @param int $categoryid a category id.
|
||||
* @return bool
|
||||
* @deprecated since Moodle 4.0 MDL-71585
|
||||
* @see qbank_managecategories\helper
|
||||
* @todo Final deprecation on Moodle 4.4 MDL-72438
|
||||
*/
|
||||
function question_is_top_category($categoryid) {
|
||||
debugging('Function question_is_top_category() has been deprecated and moved to qbank_managecategories plugin,
|
||||
Please use qbank_managecategories\helper::question_is_top_category() instead.', DEBUG_DEVELOPER);
|
||||
return \qbank_managecategories\helper::question_is_top_category($categoryid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures that this user is allowed to delete this category.
|
||||
*
|
||||
* @param int $todelete a category id.
|
||||
* @deprecated since Moodle 4.0 MDL-71585
|
||||
* @see qbank_managecategories\helper
|
||||
* @todo Final deprecation on Moodle 4.4 MDL-72438
|
||||
*/
|
||||
function question_can_delete_cat($todelete) {
|
||||
debugging('Function question_can_delete_cat() has been deprecated and moved to qbank_managecategories plugin,
|
||||
Please use qbank_managecategories\helper::question_can_delete_cat() instead.', DEBUG_DEVELOPER);
|
||||
\qbank_managecategories\helper::question_can_delete_cat($todelete);
|
||||
}
|
||||
|
||||
/**
|
||||
* Common setup for all pages for editing questions.
|
||||
* @param string $baseurl the name of the script calling this funciton. For examle 'qusetion/edit.php'.
|
||||
@ -485,57 +439,3 @@ function require_login_in_context($contextorid = null){
|
||||
require_login();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Print a form to let the user choose which question type to add.
|
||||
* When the form is submitted, it goes to the question.php script.
|
||||
* @param $hiddenparams hidden parameters to add to the form, in addition to
|
||||
* the qtype radio buttons.
|
||||
* @param $allowedqtypes optional list of qtypes that are allowed. If given, only
|
||||
* those qtypes will be shown. Example value array('description', 'multichoice').
|
||||
* @deprecated since Moodle 4.0
|
||||
* @see \qbank_editquestion\editquestion_helper::print_choose_qtype_to_add_form()
|
||||
* @todo Final deprecation of this class in moodle 4.4 MDL-72438
|
||||
*/
|
||||
function print_choose_qtype_to_add_form($hiddenparams, array $allowedqtypes = null, $enablejs = true) {
|
||||
debugging('Function print_choose_qtype_to_add_form() is deprecated,
|
||||
please use \qbank_editquestion\editquestion_helper::print_choose_qtype_to_add_form() instead.', DEBUG_DEVELOPER);
|
||||
global $CFG, $PAGE, $OUTPUT;
|
||||
|
||||
$chooser = \qbank_editquestion\qbank_chooser::get($PAGE->course, $hiddenparams, $allowedqtypes);
|
||||
$renderer = $PAGE->get_renderer('question', 'bank');
|
||||
|
||||
return $renderer->render($chooser);
|
||||
}
|
||||
|
||||
/**
|
||||
* Print a button for creating a new question. This will open question/addquestion.php,
|
||||
* which in turn goes to question/question.php before getting back to $params['returnurl']
|
||||
* (by default the question bank screen).
|
||||
*
|
||||
* @param int $categoryid The id of the category that the new question should be added to.
|
||||
* @param array $params Other paramters to add to the URL. You need either $params['cmid'] or
|
||||
* $params['courseid'], and you should probably set $params['returnurl']
|
||||
* @param string $caption the text to display on the button.
|
||||
* @param string $tooltip a tooltip to add to the button (optional).
|
||||
* @param bool $disabled if true, the button will be disabled.
|
||||
* @deprecated since Moodle 4.0
|
||||
* @see \qbank_editquestion\editquestion_helper::create_new_question_button()
|
||||
* @todo Final deprecation of this class in moodle 4.4 MDL-72438
|
||||
*/
|
||||
function create_new_question_button($categoryid, $params, $caption, $tooltip = '', $disabled = false) {
|
||||
debugging('Function create_new_question_button() has been deprecated and moved to bank/editquestion,
|
||||
please use qbank_editquestion\editquestion_helper::create_new_question_button() instead.', DEBUG_DEVELOPER);
|
||||
global $CFG, $PAGE, $OUTPUT;
|
||||
static $choiceformprinted = false;
|
||||
$params['category'] = $categoryid;
|
||||
$url = new moodle_url('/question/bank/editquestion/addquestion.php', $params);
|
||||
echo $OUTPUT->single_button($url, $caption, 'get', array('disabled'=>$disabled, 'title'=>$tooltip));
|
||||
|
||||
if (!$choiceformprinted) {
|
||||
echo '<div id="qtypechoicecontainer">';
|
||||
echo print_choose_qtype_to_add_form(array());
|
||||
echo "</div>\n";
|
||||
$choiceformprinted = true;
|
||||
}
|
||||
}
|
||||
|
@ -42,24 +42,10 @@ class core_question_renderer extends plugin_renderer_base {
|
||||
}
|
||||
|
||||
/**
|
||||
* Render an icon, optionally with the word 'Preview' beside it, to preview
|
||||
* a given question.
|
||||
* @param int $questionid the id of the question to be previewed.
|
||||
* @param context $context the context in which the preview is happening.
|
||||
* Must be a course or category context.
|
||||
* @param bool $showlabel if true, show the word 'Preview' after the icon.
|
||||
* If false, just show the icon.
|
||||
* @deprecated since Moodle 4.0
|
||||
* @see qbank_previewquestion\output\renderer
|
||||
* @todo Final deprecation on Moodle 4.4 MDL-72438
|
||||
*/
|
||||
public function question_preview_link($questionid, context $context, $showlabel) {
|
||||
debugging('Function question_preview_link() has been deprecated and moved to qbank_previewquestion plugin,
|
||||
Please use qbank_previewquestion renderer.', DEBUG_DEVELOPER);
|
||||
|
||||
return $this->page->get_renderer('qbank_previewquestion')->question_preview_link(
|
||||
$questionid, $context, $showlabel
|
||||
);
|
||||
public function question_preview_link() {
|
||||
throw new coding_exception(__FUNCTION__ . '() has been removed.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,27 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Defines the export questions form.
|
||||
*
|
||||
* @package moodlecore
|
||||
* @subpackage questionbank
|
||||
* @copyright 2007 Jamie Pratt me@jamiep.org
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @deprecated since Moodle 4.0 MDL-71573
|
||||
* @see qbank_exportquestions\form\export_form
|
||||
* @todo Final deprecation on Moodle 4.4 MDL-72438
|
||||
*/
|
@ -1,27 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Defines the import questions form.
|
||||
*
|
||||
* @package moodlecore
|
||||
* @subpackage questionbank
|
||||
* @copyright 2007 Jamie Pratt me@jamiep.org
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @deprecated since Moodle 4.0 MDL-71585
|
||||
* @see \qbank_importquestions\form\question_import_form
|
||||
* @todo Final deprecation on Moodle 4.4 MDL-72438
|
||||
*/
|
@ -30,78 +30,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
require_once($CFG->dirroot . '/question/editlib.php');
|
||||
|
||||
/**
|
||||
* Question tags fragment callback.
|
||||
*
|
||||
* @param array $args Arguments to the form.
|
||||
* @return null|string The rendered form.
|
||||
* @deprecated since Moodle 4.0
|
||||
* @see /question/bank/qbank_tagquestion/lib.php
|
||||
* @todo Final deprecation on Moodle 4.4 MDL-72438
|
||||
*/
|
||||
function core_question_output_fragment_tags_form($args) {
|
||||
debugging('Function core_question_output_fragment_tags_form() is deprecated,
|
||||
please use core_question_output_fragment_tags_form() from qbank_tagquestion instead.', DEBUG_DEVELOPER);
|
||||
|
||||
if (!empty($args['id'])) {
|
||||
global $CFG, $DB;
|
||||
require_once($CFG->libdir . '/questionlib.php');
|
||||
$id = clean_param($args['id'], PARAM_INT);
|
||||
$editingcontext = $args['context'];
|
||||
|
||||
// Load the question and some related information.
|
||||
$question = $DB->get_record('question', ['id' => $id]);
|
||||
|
||||
if ($coursecontext = $editingcontext->get_course_context(false)) {
|
||||
$course = $DB->get_record('course', ['id' => $coursecontext->instanceid]);
|
||||
$filtercourses = [$course];
|
||||
} else {
|
||||
$filtercourses = null;
|
||||
}
|
||||
|
||||
$sql = "SELECT qc.*
|
||||
FROM {question} q
|
||||
JOIN {question_versions} qv ON qv.questionid = q.id
|
||||
JOIN {question_bank_entries} qbe ON qbe.id = qv.questionbankentryid
|
||||
JOIN {question_categories} qc ON qc.id = qbe.questioncategoryid
|
||||
WHERE q.id = :id";
|
||||
$category = $DB->get_record_sql($sql, ['id' => $question->id]);
|
||||
$questioncontext = \context::instance_by_id($category->contextid);
|
||||
$contexts = new \core_question\local\bank\question_edit_contexts($editingcontext);
|
||||
|
||||
// Load the question tags and filter the course tags by the current course.
|
||||
if (core_tag_tag::is_enabled('core_question', 'question')) {
|
||||
$tagobjectsbyquestion = core_tag_tag::get_items_tags('core_question', 'question', [$question->id]);
|
||||
if (!empty($tagobjectsbyquestion[$question->id])) {
|
||||
$tagobjects = $tagobjectsbyquestion[$question->id];
|
||||
$sortedtagobjects = question_sort_tags($tagobjects,
|
||||
context::instance_by_id($category->contextid), $filtercourses);
|
||||
}
|
||||
}
|
||||
$formoptions = [
|
||||
'editingcontext' => $editingcontext,
|
||||
'questioncontext' => $questioncontext,
|
||||
'contexts' => $contexts->all()
|
||||
];
|
||||
$data = [
|
||||
'id' => $question->id,
|
||||
'questioncategory' => $category->name,
|
||||
'questionname' => $question->name,
|
||||
'categoryid' => $category->id,
|
||||
'contextid' => $category->contextid,
|
||||
'context' => $questioncontext->get_context_name(),
|
||||
'tags' => $sortedtagobjects->tags ?? [],
|
||||
'coursetags' => $sortedtagobjects->coursetags ?? [],
|
||||
];
|
||||
|
||||
$cantag = question_has_capability_on($question, 'tag');
|
||||
$mform = new \qbank_tagquestion\form\tags_form(null, $formoptions, 'post', '', null, $cantag, $data);
|
||||
$mform->set_data($data);
|
||||
|
||||
return $mform->render();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Question data fragment to get the question html via ajax call.
|
||||
*
|
||||
|
@ -1,27 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Form for moving questions between categories.
|
||||
*
|
||||
* @package moodlecore
|
||||
* @subpackage questionbank
|
||||
* @copyright 2008 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @deprecated since Moodle 4.0 MDL-71585
|
||||
* @see qbank_managecategories\form\question_move_form
|
||||
* @todo Final deprecation on Moodle 4.4 MDL-72438
|
||||
*/
|
@ -1,105 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Library functions used by question/preview.php.
|
||||
*
|
||||
* @package core_question
|
||||
* @subpackage questionengine
|
||||
* @copyright 2010 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @deprecated since Moodle 4.0
|
||||
* @see qbank_previewquestion\form\preview_options_form
|
||||
* @see qbank_previewquestion\output\question_preview_options
|
||||
*/
|
||||
|
||||
use qbank_previewquestion\question_preview_options;
|
||||
|
||||
/**
|
||||
* Called via pluginfile.php -> question_pluginfile to serve files belonging to
|
||||
* a question in a question_attempt when that attempt is a preview.
|
||||
*
|
||||
* @package core_question
|
||||
* @category files
|
||||
* @param stdClass $course course settings object
|
||||
* @param stdClass $context context object
|
||||
* @param string $component the name of the component we are serving files for.
|
||||
* @param string $filearea the name of the file area.
|
||||
* @param int $qubaid the question_usage this image belongs to.
|
||||
* @param int $slot the relevant slot within the usage.
|
||||
* @param array $args the remaining bits of the file path.
|
||||
* @param bool $forcedownload whether the user must be forced to download the file.
|
||||
* @param array $fileoptions
|
||||
* @return void false if file not found, does not return if found - justsend the file
|
||||
* @deprecated since Moodle 4.0
|
||||
* @see qbank_previewquestion\helper::question_preview_question_pluginfile()
|
||||
* @todo Final deprecation on Moodle 4.4 MDL-72438
|
||||
*/
|
||||
function question_preview_question_pluginfile($course, $context, $component,
|
||||
$filearea, $qubaid, $slot, $args, $forcedownload, $fileoptions) {
|
||||
debugging('Function question_preview_question_pluginfile() has been deprecated and moved to qbank_previewquestion plugin,
|
||||
please use qbank_previewquestion\helper::question_preview_question_pluginfile() instead.', DEBUG_DEVELOPER);
|
||||
qbank_previewquestion\helper::question_preview_question_pluginfile($course, $context,
|
||||
$component, $filearea, $qubaid, $slot, $args, $forcedownload, $fileoptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* The the URL to use for actions relating to this preview.
|
||||
* @param int $questionid the question being previewed.
|
||||
* @param int $qubaid the id of the question usage for this preview.
|
||||
* @param question_preview_options $options the options in use.
|
||||
* @param context $context
|
||||
* @deprecated since Moodle 4.0
|
||||
* @see qbank_previewquestion\helper::question_preview_action_url()
|
||||
* @todo Final deprecation on Moodle 4.4 MDL-72438
|
||||
*/
|
||||
function question_preview_action_url($questionid, $qubaid,
|
||||
question_preview_options $options, $context) {
|
||||
debugging('Function question_preview_action_url() has been deprecated and moved to qbank_previewquestion plugin,
|
||||
please use qbank_previewquestion\helper::question_preview_action_url() instead.', DEBUG_DEVELOPER);
|
||||
qbank_previewquestion\helper::question_preview_action_url($questionid, $qubaid, $options, $context);
|
||||
}
|
||||
|
||||
/**
|
||||
* The the URL to use for actions relating to this preview.
|
||||
* @param int $questionid the question being previewed.
|
||||
* @param context $context the current moodle context.
|
||||
* @param int $previewid optional previewid to sign post saved previewed answers.
|
||||
* @deprecated since Moodle 4.0
|
||||
* @see qbank_previewquestion\helper::question_preview_form_url()
|
||||
* @todo Final deprecation on Moodle 4.4 MDL-72438
|
||||
*/
|
||||
function question_preview_form_url($questionid, $context, $previewid = null) {
|
||||
debugging('Function question_preview_form_url() has been deprecated and moved to qbank_previewquestion plugin,
|
||||
please use qbank_previewquestion\helper::question_preview_form_url() instead.', DEBUG_DEVELOPER);
|
||||
qbank_previewquestion\helper::question_preview_form_url($questionid, $context, $previewid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the current preview, if any, and redirect to start a new preview.
|
||||
* @param int $previewid
|
||||
* @param int $questionid
|
||||
* @param object $displayoptions
|
||||
* @param object $context
|
||||
* @deprecated since Moodle 4.0
|
||||
* @see qbank_previewquestion\helper::restart_preview()
|
||||
* @todo Final deprecation on Moodle 4.4 MDL-72438
|
||||
*/
|
||||
function restart_preview($previewid, $questionid, $displayoptions, $context) {
|
||||
debugging('Function restart_preview() has been deprecated and moved to qbank_previewquestion plugin,
|
||||
please use qbank_previewquestion\helper::restart_preview() instead.', DEBUG_DEVELOPER);
|
||||
qbank_previewquestion\helper::restart_preview($previewid, $questionid, $displayoptions, $context);
|
||||
}
|
@ -88,26 +88,11 @@ if (!M.core_scroll_manager.save_scroll_pos) {
|
||||
Y.log("The scroll_to_saved_pos function has been deprecated. " +
|
||||
"Please use initLinksScrollPos in core/scroll_manager instead.", 'moodle-core-notification', 'warn');
|
||||
};
|
||||
|
||||
/**
|
||||
* If there is a parameter like scrollpos=123 in the URL, scroll to that saved position.
|
||||
* @deprecated since Moodle 4.0
|
||||
* @see core/scroll_manager
|
||||
* @todo Final deprecation on Moodle 4.4 MDL-72438
|
||||
*/
|
||||
M.core_scroll_manager.scroll_to_saved_pos = function(Y) {
|
||||
callPromisedFunction(M.core_scroll_manager.scroll_to_saved_pos, Y);
|
||||
};
|
||||
}
|
||||
/* eslint-enable */
|
||||
|
||||
M.core_question_engine = M.core_question_engine || {};
|
||||
|
||||
/**
|
||||
* Flag used by M.core_question_engine.prevent_repeat_submission.
|
||||
*/
|
||||
M.core_question_engine.questionformalreadysubmitted = false;
|
||||
|
||||
/**
|
||||
* Initialise a question submit button. This saves the scroll position and
|
||||
* sets the fragment on the form submit URL so the page reloads in the right place.
|
||||
@ -133,62 +118,3 @@ M.core_question_engine.init_submit_button = function(Y, button) {
|
||||
}
|
||||
}, buttonel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise a form that contains questions printed using print_question.
|
||||
* This has the effect of:
|
||||
* 1. Turning off browser autocomlete.
|
||||
* 2. Stopping enter from submitting the form (or toggling the next flag) unless
|
||||
* keyboard focus is on the submit button or the flag.
|
||||
* 3. Removes any '.questionflagsavebutton's, since we have JavaScript to toggle
|
||||
* the flags using ajax.
|
||||
* 4. Scroll to the position indicated by scrollpos= in the URL, if it is there.
|
||||
* 5. Prevent the user from repeatedly submitting the form.
|
||||
* @param Y the Yahoo object. Needs to have the DOM and Event modules loaded.
|
||||
* @param form something that can be passed to Y.one, to find the form element.
|
||||
* @deprecated since Moodle 4.0
|
||||
* @see core_question/question_engine
|
||||
* @todo Final deprecation on Moodle 4.4 MDL-72438
|
||||
*/
|
||||
M.core_question_engine.init_form = function(Y, form) {
|
||||
Y.log("The core_question_engine.init_form function has been deprecated. " +
|
||||
"Please use init_form in core_question/question_engine instead.", 'moodle-core-notification', 'warn');
|
||||
|
||||
Y.one(form).setAttribute('autocomplete', 'off');
|
||||
|
||||
Y.on('submit', M.core_question_engine.prevent_repeat_submission, form, form, Y);
|
||||
|
||||
Y.on('key', function (e) {
|
||||
if (!e.target.test('a') && !e.target.test('input[type=submit]') &&
|
||||
!e.target.test('input[type=img]') && !e.target.test('textarea') && !e.target.test('[contenteditable=true]')) {
|
||||
e.preventDefault();
|
||||
}
|
||||
}, form, 'press:13');
|
||||
|
||||
Y.one(form).all('.questionflagsavebutton').remove();
|
||||
|
||||
M.core_scroll_manager.scroll_to_saved_pos(Y);
|
||||
}
|
||||
|
||||
/**
|
||||
* Event handler to stop a question form being submitted more than once.
|
||||
* @param e the form submit event.
|
||||
* @param form the form element.
|
||||
* @deprecated since Moodle 4.0
|
||||
* @see core_question/question_engine
|
||||
* @todo Final deprecation on Moodle 4.4 MDL-72438
|
||||
*/
|
||||
M.core_question_engine.prevent_repeat_submission = function(e, Y) {
|
||||
Y.log("The prevent_repeat_submission function has been deprecated. " +
|
||||
"Please use preventRepeatSubmission in core_question/question_engine instead.", 'moodle-core-notification', 'warn');
|
||||
|
||||
if (M.core_question_engine.questionformalreadysubmitted) {
|
||||
e.halt();
|
||||
return;
|
||||
}
|
||||
|
||||
setTimeout(function() {
|
||||
Y.all('input[type=submit]').set('disabled', true);
|
||||
}, 0);
|
||||
M.core_question_engine.questionformalreadysubmitted = true;
|
||||
}
|
||||
|
@ -92,18 +92,10 @@ class core_question_bank_renderer extends plugin_renderer_base {
|
||||
}
|
||||
|
||||
/**
|
||||
* Render a qbank_chooser.
|
||||
*
|
||||
* @param renderable $qbankchooser The chooser.
|
||||
* @return string
|
||||
* @deprecated since Moodle 4.0
|
||||
* @see \qbank_editquestion\output\renderer
|
||||
* @todo Final deprecation on Moodle 4.4 MDL-72438
|
||||
*/
|
||||
public function render_qbank_chooser(renderable $qbankchooser) {
|
||||
debugging('Function render_qbank_chooser is deprecated,
|
||||
please use qbank_editquestion renderer instead.', DEBUG_DEVELOPER);
|
||||
return $this->render_from_template('core_question/qbank_chooser', $qbankchooser->export_for_template($this));
|
||||
public function render_qbank_chooser() {
|
||||
throw new coding_exception(__FUNCTION__ . '() has been removed.');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -192,61 +184,31 @@ class core_question_bank_renderer extends plugin_renderer_base {
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the HTML for the question chooser javascript popup.
|
||||
*
|
||||
* @param array $real A set of real question types
|
||||
* @param array $fake A set of fake question types
|
||||
* @param object $course The course that will be displayed
|
||||
* @param array $hiddenparams Any hidden parameters to add to the form
|
||||
* @return string The composed HTML for the questionbank chooser
|
||||
* @todo Final deprecation on Moodle 4.4 MDL-72438
|
||||
* @deprecated since Moodle 4.0
|
||||
*/
|
||||
public function qbank_chooser($real, $fake, $course, $hiddenparams) {
|
||||
debugging('Method core_question_bank_renderer::qbank_chooser() is deprecated, ' .
|
||||
'see core_question_bank_renderer::render_qbank_chooser().', DEBUG_DEVELOPER);
|
||||
return '';
|
||||
public function qbank_chooser() {
|
||||
throw new coding_exception(__FUNCTION__ . '() has been removed.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the HTML for a specified set of question types.
|
||||
*
|
||||
* @param array $types A set of question types as used by the qbank_chooser_module function
|
||||
* @return string The composed HTML for the module
|
||||
* @todo Final deprecation on Moodle 4.4 MDL-72438
|
||||
* @deprecated since Moodle 4.0
|
||||
*/
|
||||
protected function qbank_chooser_types($types) {
|
||||
debugging('Method core_question_bank_renderer::qbank_chooser_types() is deprecated, ' .
|
||||
'see core_question_bank_renderer::render_qbank_chooser().', DEBUG_DEVELOPER);
|
||||
return '';
|
||||
protected function qbank_chooser_types() {
|
||||
throw new coding_exception(__FUNCTION__ . '() has been removed.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the HTML for the specified question type, adding any required classes.
|
||||
*
|
||||
* @param object $qtype An object containing the title, and link. An icon, and help text may optionally be specified.
|
||||
* If the module contains subtypes in the types option, then these will also be displayed.
|
||||
* @param array $classes Additional classes to add to the encompassing div element
|
||||
* @return string The composed HTML for the question type
|
||||
* @todo Final deprecation on Moodle 4.4 MDL-72438
|
||||
* @deprecated since Moodle 4.0
|
||||
*/
|
||||
protected function qbank_chooser_qtype($qtype, $classes = array()) {
|
||||
debugging('Method core_question_bank_renderer::qbank_chooser_qtype() is deprecated, ' .
|
||||
'see core_question_bank_renderer::render_qbank_chooser().', DEBUG_DEVELOPER);
|
||||
return '';
|
||||
protected function qbank_chooser_qtype() {
|
||||
throw new coding_exception(__FUNCTION__ . '() has been removed.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the title for the question bank chooser.
|
||||
*
|
||||
* @param string $title The language string identifier
|
||||
* @param string $identifier The component identifier
|
||||
* @return string The composed HTML for the title
|
||||
* @todo Final deprecation on Moodle 4.4 MDL-72438
|
||||
* @deprecated since Moodle 4.0
|
||||
*/
|
||||
protected function qbank_chooser_title($title, $identifier = null) {
|
||||
debugging('Method core_question_bank_renderer::qbank_chooser_title() is deprecated, ' .
|
||||
'see core_question_bank_renderer::render_qbank_chooser().', DEBUG_DEVELOPER);
|
||||
return '';
|
||||
protected function qbank_chooser_title() {
|
||||
throw new coding_exception(__FUNCTION__ . '() has been removed.');
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,42 @@
|
||||
This files describes API changes for code that uses the question API.
|
||||
|
||||
=== 4.4 ===
|
||||
* The following previously deprecated methods have been removed and can no longer be used:
|
||||
- `submit_tags_form`
|
||||
- `get_bulk_action_key`
|
||||
- `preview_question_url`
|
||||
- `process_actions`
|
||||
- `process_actions_needing_ui`
|
||||
- `question_is_only_child_of_top_category_in_context`
|
||||
- `question_is_top_category`
|
||||
- `question_can_delete_cat`
|
||||
- `print_choose_qtype_to_add_form`
|
||||
- `create_new_question_button`
|
||||
- `question_preview_link`
|
||||
- `core_question_output_fragment_tags_form`
|
||||
- `render_qbank_chooser`
|
||||
- `qbank_chooser`
|
||||
- `qbank_chooser_types`
|
||||
- `qbank_chooser_qtype`
|
||||
- `qbank_chooser_title`
|
||||
|
||||
* The following previously deprecated files have been removed and can no longer be used:
|
||||
- `question/amd/src/edit_tags.js`
|
||||
- `question/amd/src/repository.js`
|
||||
- `question/amd/src/selectors.js`
|
||||
- `question/category_class.php`
|
||||
- `question/category_form.php`
|
||||
- `question/export_form.php`
|
||||
- `question/import_form.php`
|
||||
- `question/move_form.php`
|
||||
- `question/previewlib.php`
|
||||
- `question/yui/src/preview/js/preview.js`
|
||||
|
||||
* The following previously deprecated JS functions have been removed and can no longer be used:
|
||||
- `M.core_scroll_manager.scroll_to_saved_pos`
|
||||
- `M.core_question_engine.init_form`
|
||||
- `M.core_question_engine.prevent_repeat_submission`
|
||||
|
||||
=== 4.3 ===
|
||||
|
||||
1) The core_question_generator::update_question has been changed so that it no longer modifies the $question
|
||||
|
@ -1,57 +0,0 @@
|
||||
YUI.add('moodle-question-preview', function (Y, NAME) {
|
||||
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/*
|
||||
* @copyright 2014 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
/**
|
||||
* JavaScript required by the question preview pop-up.
|
||||
*
|
||||
* @deprecated since Moodle 4.0
|
||||
* @todo Final deprecation on Moodle 4.4 MDL-72438
|
||||
* @module moodle-question-preview
|
||||
*/
|
||||
|
||||
Y.log("The moodle-question-preview module has been deprecated. " +
|
||||
"Please use moodle-qbank_previewquestion-preview instead.", 'moodle-core-notification', 'warn');
|
||||
|
||||
M.question = M.question || {};
|
||||
M.question.preview = M.question.preview || {};
|
||||
|
||||
/*
|
||||
* Initialise JavaScript-specific parts of the question preview popup.
|
||||
*/
|
||||
M.question.preview.init = function() {
|
||||
M.core_question_engine.init_form(Y, '#responseform');
|
||||
|
||||
// Add a close button to the window.
|
||||
var closebutton = Y.Node.create('<input type="button" class="btn btn-secondary mb-1"/>')
|
||||
.set('value', M.util.get_string('closepreview', 'question'));
|
||||
|
||||
closebutton.on('click', function() {
|
||||
window.close();
|
||||
});
|
||||
Y.one('#previewcontrols').append(closebutton);
|
||||
|
||||
// Stop a question form being submitted more than once.
|
||||
Y.on('submit', M.core_question_engine.prevent_repeat_submission, '#mform1', null, Y);
|
||||
};
|
||||
|
||||
|
||||
}, '@VERSION@', {"requires": ["base", "dom", "event-delegate", "event-key", "core_question_engine"]});
|
@ -1 +0,0 @@
|
||||
YUI.add("moodle-question-preview",function(n,e){M.question=M.question||{},M.question.preview=M.question.preview||{},M.question.preview.init=function(){M.core_question_engine.init_form(n,"#responseform");var e=n.Node.create('<input type="button" class="btn btn-secondary mb-1"/>').set("value",M.util.get_string("closepreview","question"));e.on("click",function(){window.close()}),n.one("#previewcontrols").append(e),n.on("submit",M.core_question_engine.prevent_repeat_submission,"#mform1",null,n)}},"@VERSION@",{requires:["base","dom","event-delegate","event-key","core_question_engine"]});
|
@ -1,55 +0,0 @@
|
||||
YUI.add('moodle-question-preview', function (Y, NAME) {
|
||||
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/*
|
||||
* @copyright 2014 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
/**
|
||||
* JavaScript required by the question preview pop-up.
|
||||
*
|
||||
* @deprecated since Moodle 4.0
|
||||
* @todo Final deprecation on Moodle 4.4 MDL-72438
|
||||
* @module moodle-question-preview
|
||||
*/
|
||||
|
||||
|
||||
M.question = M.question || {};
|
||||
M.question.preview = M.question.preview || {};
|
||||
|
||||
/*
|
||||
* Initialise JavaScript-specific parts of the question preview popup.
|
||||
*/
|
||||
M.question.preview.init = function() {
|
||||
M.core_question_engine.init_form(Y, '#responseform');
|
||||
|
||||
// Add a close button to the window.
|
||||
var closebutton = Y.Node.create('<input type="button" class="btn btn-secondary mb-1"/>')
|
||||
.set('value', M.util.get_string('closepreview', 'question'));
|
||||
|
||||
closebutton.on('click', function() {
|
||||
window.close();
|
||||
});
|
||||
Y.one('#previewcontrols').append(closebutton);
|
||||
|
||||
// Stop a question form being submitted more than once.
|
||||
Y.on('submit', M.core_question_engine.prevent_repeat_submission, '#mform1', null, Y);
|
||||
};
|
||||
|
||||
|
||||
}, '@VERSION@', {"requires": ["base", "dom", "event-delegate", "event-key", "core_question_engine"]});
|
@ -1,10 +0,0 @@
|
||||
{
|
||||
"name": "moodle-question-preview",
|
||||
"builds": {
|
||||
"moodle-question-preview": {
|
||||
"jsfiles": [
|
||||
"preview.js"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
52
question/yui/src/preview/js/preview.js
vendored
52
question/yui/src/preview/js/preview.js
vendored
@ -1,52 +0,0 @@
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/*
|
||||
* @copyright 2014 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
/**
|
||||
* JavaScript required by the question preview pop-up.
|
||||
*
|
||||
* @deprecated since Moodle 4.0
|
||||
* @todo Final deprecation on Moodle 4.4 MDL-72438
|
||||
* @module moodle-question-preview
|
||||
*/
|
||||
|
||||
Y.log("The moodle-question-preview module has been deprecated. " +
|
||||
"Please use moodle-qbank_previewquestion-preview instead.", 'moodle-core-notification', 'warn');
|
||||
|
||||
M.question = M.question || {};
|
||||
M.question.preview = M.question.preview || {};
|
||||
|
||||
/*
|
||||
* Initialise JavaScript-specific parts of the question preview popup.
|
||||
*/
|
||||
M.question.preview.init = function() {
|
||||
M.core_question_engine.init_form(Y, '#responseform');
|
||||
|
||||
// Add a close button to the window.
|
||||
var closebutton = Y.Node.create('<input type="button" class="btn btn-secondary mb-1"/>')
|
||||
.set('value', M.util.get_string('closepreview', 'question'));
|
||||
|
||||
closebutton.on('click', function() {
|
||||
window.close();
|
||||
});
|
||||
Y.one('#previewcontrols').append(closebutton);
|
||||
|
||||
// Stop a question form being submitted more than once.
|
||||
Y.on('submit', M.core_question_engine.prevent_repeat_submission, '#mform1', null, Y);
|
||||
};
|
@ -1,11 +0,0 @@
|
||||
{
|
||||
"moodle-question-preview": {
|
||||
"requires": [
|
||||
"base",
|
||||
"dom",
|
||||
"event-delegate",
|
||||
"event-key",
|
||||
"core_question_engine"
|
||||
]
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user