Commit Graph

316 Commits

Author SHA1 Message Date
Mihail Geshoski e807bf8d35 Merge branch 'MDL-86297-MOODLE_500_STABLE' of https://github.com/PhMemmel/moodle into MOODLE_500_STABLE 2025-09-24 11:49:39 +08:00
Mihail Geshoski e74db295a9 Merge branch 'MDL-85551_500_STABLE' of https://github.com/marxjohnson/moodle into MOODLE_500_STABLE 2025-09-02 09:23:05 +08:00
Philipp Memmel 6b9b6ea399 MDL-86297 core_question: Fix limit when retrieving qbank instances 2025-09-01 08:43:46 +02:00
Luca Bösch 140ec8196d MDL-86362 questions: Fix question bank table styles 2025-08-30 14:59:58 +02:00
Mark Johnson ed6e1c2db9 MDL-85551 questions: Creating a default category with a questions mod
When a new module that publishes questions is created, it does not have
a default question category created until it is viewed. This means that
other parts of the system that want to use the bank while its empty
(such as bulk moving questions) cannot see it.

This adds a step to the common edit_module_post_actions() function so
that any module supporting the FEATURE_PUBLISHES_QUESTIONS feature will
have its default category created with the module instance.

This can be overridden by setting skipdefaultcategory to true
in the $moduleinfo argument to edit_post_module_actions().
2025-08-12 14:04:04 +01:00
Mihail Geshoski 3f7b1ab5b5 Merge branch 'MDL-79540_500_STABLE' of https://github.com/marxjohnson/moodle into MOODLE_500_STABLE 2025-08-07 10:19:42 +08:00
Andrew Nicols bf18273a08 MDL-85897 core: Move all deprecations to emit_deprecation 2025-07-30 13:53:27 +08:00
Mihail Geshoski eac831f04f Merge branch 'MDL-84466_500_STABLE' of https://github.com/marxjohnson/moodle into MOODLE_500_STABLE 2025-07-16 13:16:21 +08:00
Mark Johnson 7b45a898b0 MDL-84466 question/qbank: Update pending transfer notification
This updates the logic and text of the notification that is shown while
the question transfer task is still pending, to include instances of the
new transfer_questions task. It also ensures the notification is shown
if a user tries to access the question editing screen from outside the
question bank.
2025-07-15 12:03:25 +01:00
Mihail Geshoski ca2bbff2b3 Merge branch 'MDL-85754_500_STABLE' of https://github.com/marxjohnson/moodle into MOODLE_500_STABLE 2025-07-15 10:31:41 +08:00
Mark Johnson 57553a1b19 MDL-79540 qbank_managecategories: Don't allow own child as parent
When we build the options for a question category selector, the
"nochildrenof" option isn't correctly compared to the category ID. This
means we can select a category's own children as its new parent.
2025-07-11 10:08:33 +01:00
Mihail Geshoski 6e4e00b0fe Merge branch 'MDL-85069_500_STABLE' of https://github.com/marxjohnson/moodle into MOODLE_500_STABLE 2025-07-08 22:28:36 +08:00
Mihail Geshoski 9416ffd303 Merge branch 'MDL-84695-500' of https://github.com/lucaboesch/moodle into MOODLE_500_STABLE 2025-07-08 22:21:25 +08:00
Mark Johnson 563280c99a MDL-85754 question: Don't show banks where user has no permission
The Switch Banks UI was listing all question banks on the course where
the use had the managecategory permission, plus the other banks they had
used recently.

This conflicted with the check when it tried to load a selected bank,
which checked the useall/usemine permissions. This could lead to errors
if this permission had been removed.

This applies consistent checks to both lists with the useall/usermine
permissions instead.
2025-07-08 12:01:43 +01:00
Mark Johnson 84d7c6ce6d MDL-85754 question: Only use current context in question_edit_contexts
Due to the changes in question sharing, it no longer makes sense to look
at parent contexts when establishing permissions in the question bank.

Questions now belong to a single activity module, and we should be able
to inherit and override permisions at that level like we do with any
other.

In the longer term, we probably want to replace question_edit_contexts
with something simpler, but for the time being this should apply the
correct permission checks where it's used without requiring a big
refactor of existing code.
2025-07-08 12:01:42 +01:00
Luca Bösch e2e5de61da MDL-84695 mod_qbank: More precise get_qbank_ids_of_type_in_course query. 2025-07-06 12:14:37 +02:00
Mark Johnson b9b69a5e3e MDL-85069 question: Services for question bank and category search
This updates the core_question_search_shared_banks external function
with additional parameters to make it applicable outside of the "Switch
bank" dialogue in the quiz, with the corresponding changes to the
question_banks_datasource Javascript module, and unit test coverage.

It also adds a new \core_question\output\question_category_selector
class for rendering a select list of question categories, migrating
the logic used in qbank_managecategories to a core namespace. There
is a fragment callback for rendering this via AJAX.
2025-07-02 10:59:04 +01:00
Mark Johnson 3f4478a7b7 MDL-85069 question: Fix return URL parameters after moving questions
When calling the core_question_move_questions external function, the
returned $returnurl paramater kept the original `cat`, `category` and
`lastchanged` parameters.

If the question was moved to another question bank, this meant the user
would be redirected to that bank, but the URL would still refer to the
category in the original bank. Opening the bulk move dialogue again
would then show the original bank and category selected by default, not
the current one.

This change ensures the cat parameter is updated to match the new
category, unsets the `category` parameter as it is redundant. If a single
question is moved, "lastchanged" is updated to that question, otherwise
it is unset.
2025-06-30 15:27:36 +01:00
Mark Johnson 22bfb8f591 MDL-85881 questions: Handle multi-byte names during migration
We were using strlen() instead of core_text::strlen() when checking the
length of a question bank name created during the migration. This meant
that multibyte strings were counted as being too long, even though they
were within the character limit.
2025-06-30 11:09:47 +01:00
Artem Garanin 8fa9939614 MDL-85369 question: fix tag collection ID in legacy‑filter upgrade.
Use the actual tag collection for the 'question' tag area instead of
the default collection.
2025-05-29 14:08:42 -04:00
Tim Hunt e76afc9907 MDL-84303 qbanks: fix permission checks accessing shared banks 2025-04-08 10:06:39 +01:00
Tim Hunt 019e480c35 MDL-84303 qbank: fix recently viewed question tracking
This revealed some Unit tests with incorrect setup (trying to view
a qestion bank in course context) so I fixed those.
2025-04-08 10:06:39 +01:00
Huong Nguyen ac92443315 Merge branch 'MDL-84900_main' of https://github.com/marxjohnson/moodle 2025-04-04 10:20:03 +07:00
Stephan Robotta e13a5b3f9d MDL-85070 qbank: Dialogue question move into category with comma 2025-04-02 08:50:58 +02:00
Mark Johnson a8342dd5f5 MDL-84900 questions: Limit list of shared question banks
The "Switch question bank" modal was attempting to load every question
bank in the system the user has access to. For a highly privileged user,
this could mean loading the coursemodinfo cache for every course in the
system, resulting in memory exhaustion.

This change updates the API for getting shared question banks so it can
be searched by name and limited to a number of results. There is a new
external service that uses this functionality, and a Javascript data
provider for calling the service. The autocomplete in the "Switch
question bank" modal will now use this data provider for the "Other
question bank" autocomplete, rather than loading all banks up front.
2025-04-01 13:31:41 +01:00
Mark Johnson d3584833ea MDL-84900 questions: Allow get_formatted_bank to force filter context 2025-04-01 13:30:33 +01:00
Andrew Nicols e587896573 MDL-78090 core_question: Update deprecated method sigs per new deprecation rules 2025-03-21 08:31:28 +08:00
Andrew Nicols 08ad641c7d Merge branch 'MDL-78090_core_question-final-deprecations' of https://github.com/ziegenberg/moodle 2025-03-21 08:19:36 +08:00
Andrew Nicols 2c121ab509 Merge branch 'MDL-84674_trim-old-deprecations' of https://github.com/ziegenberg/moodle 2025-03-21 08:15:12 +08:00
Conn Warwicker 2d6df85dea MDL-84302 mod_quiz: Improvements with invalid questions.
- Improve visuals of invalid questions by highlighting and
labelling.
- Removes links to actions which will not work for invalid
questions
- Doesn't allow a preview/attempt of a quiz if it has invalid
questions. This is an improvement over it throwing an exception.
- Don't allow the adding of questions to a quiz if they have
an invalid type.
2025-03-19 18:42:50 +00:00
Daniel Ziegenberg 15579eb07f MDL-84674 core: Remove long-deprecated methods
Signed-off-by: Daniel Ziegenberg <daniel@ziegenberg.at>
2025-03-18 10:36:53 +01:00
Tim Hunt ece18d3d22 MDL-84247 questions: rename is_valid_question -> is_qtype_usable
and move it next to is_qtype_installed. This makes the API of the
question_bank class more consistent
2025-03-17 17:12:50 +00:00
Conn Warwicker 77777a0726 MDL-84247 core_question: Improvements to handling invalid questions.
- Highlight the row and adds a badge to indicate that a question
is invalid, to make it much clearer.
- Remove the bulk action checkbox
- Fixes usage count and comments links for missingtype questions.
- Add new behat tests and fix up some existing ones to work
with new logic.
2025-03-17 16:37:27 +00:00
Daniel Ziegenberg 1d97e47040 MDL-78090 core_question: final deprecations
Signed-off-by: Daniel Ziegenberg <daniel@ziegenberg.at>
2025-03-16 19:27:56 +01:00
Conn Warwicker 01d4095926 MDL-80386 core_question: Add "show all" button to filters.
This adds the "Show All" button to the question bank filters
to allow users to select all questions easily.

It also adds new behat tests to test the functionality.
2025-03-12 15:43:08 +00:00
Andrew Nicols 2455005096 Merge branch 'MDL-84558' of https://github.com/timhunt/moodle 2025-03-06 11:56:36 +08:00
Sara Arjona 46619157f2 Merge branch 'MDL-83784' of https://github.com/cwarwicker/moodle 2025-02-19 11:58:21 +01:00
Conn Warwicker 2499276c65 MDL-83784 mod_quiz: Fix quiz unusable if question category missing.
Random questions set to question categories which no longer exist
was throwing an error making it impossible to use or edit the quiz
to fix it. This will now allow the user to view the questions and
edit the quiz in order to fix the problem of the missing category.
2025-02-19 09:21:43 +00:00
Tim Hunt 5d6fe4a279 MDL-84558 question bank: fix the PHPdocs for default_sort 2025-02-18 15:44:48 +00:00
Huong Nguyen a3e4e4565e Merge branch 'MDL-79265-master' of https://github.com/NashTechOpenUniversity/moodle 2025-02-13 09:15:20 +07:00
Hieu Nguyen Dang be4d569ad0 MDL-79265 question bank: fix which questions are listed with hidden
This fixes the bug where if the latest version of the question is hidden,
the question disappears, even if older versions exist that are still visible.
2025-02-06 14:48:33 +07:00
Mark Johnson c968ab77be MDL-84146 question: Improve handling of JS parameters 2025-02-04 02:34:28 +00:00
Jun Pataleta 8008466be8 Merge branch 'MDL-82542-master' of https://github.com/NashTechOpenUniversity/moodle 2025-02-01 00:20:36 +08:00
Huong Nguyen a3d72aa941 Merge branch 'MDL-83862_main' of https://github.com/marxjohnson/moodle 2025-01-30 09:35:02 +07:00
Mark Johnson bc57ced4f2 MDL-83862 question: Improve documentation of $qbank parameters 2025-01-27 11:24:54 +00:00
ferran d91b897549 MDL-82767 mod_qbank: fix delete action url 2025-01-22 10:35:23 +01:00
Sara Arjona 1627aa8e71 Merge branch 'MDL-83527-main-v02' of https://github.com/ferranrecio/moodle 2025-01-14 09:38:54 +01:00
ferran 3474d4a241 MDL-83527 mod_qbank: migrate cm action menu to output class 2025-01-13 14:49:46 +01:00
Luca Bösch e5b1650013 MDL-84141 mod_qbank: filter name and qbank on recently viewed. 2025-01-09 17:23:48 +01:00
hieuvu a6e4638752 MDL-82542 qbank_managecategories: Add new user preferences
Keep the checkbox to show questions from subcategories as a user preference.
2025-01-09 09:21:19 +07:00