project: Moodle
summary: Quiz and Question bank in Moodle 4.3
description: This follows on from . , . Continuing the work to implement the plan originally set out here: (those are links into key posts in a long quiz forum thread). We dont know exactly what will make it into 4.3, but this is our aspiriation at the current time. Current planned development: Question bank column reordering, show/hide and resizing (in integration) Implement question bank filtering (in development) Add additional question bank filters Make question bank columns pinnable Hopefully more will happen, but that is still under discussion.

1.summary: Better searching/filtering in the question bank, so more flexible randomisation in quizzes
description: introduced a new filter UI for the participants page which was refactored into a reusable core API in . This issue continues that work by converting the question banks filters to the use new API, with each condition implemented in the appropriate qbank plugin. This then allows any plugin to define its own filter conditions. The scope of this issue covers just the conversion of the current filters, adding additional filters based on other question bank columns is out of scope, but these will be added in follow-up tracker issues (). In particular, we will have the following filter conditions: Question bank category (optionally including subcategories) Show hidden questions Tags Show question text in question list "Show question text in question list" is not technically a filter, since it controls which which fields of each record are displayed, rather than which record. However, this was included in the existing question bank filter UI, so for simplicity we will just convert it to the new filter UI within this issue. Once is resolved we will hopefully have a method to show and hide fields, so will have a more logical place for this option to live, and can convert it in a subsequent issue (). "Show hidden questions" and "Show question text in question list" are a simple yes/no choice. Rather than using an autocomplete with just these choices, we have implemented an additional datafilter class for a binary filter. This allows us to use a Yes/No select instead for these filters. "Question bank category" requires an additional checkbox to indicate whether or not the results should include questions from subcategories of the selected category well. To support this, datafilters now support an additional "filteroptions" parameter, to allow filters to add custom options to modify the filters behaviour. Currently, all filters used on the Participants page have the option to match on the join types "All", "Any" or "None". These options do not make sense for most of the filters use in the question bank (all except Tags). Datafilters can now define the list of jointypes they support, and if only one is available the option will be hidden in the UI. In the question bank, we must always have a category filter, and the "Show hidden questions" filter should always be shown to make it clear which state it is in. To support this, datafilters can now be defined as "required", in which case the "remove" button will be hidden and they will not be removed by the "Clear filters" button. Aside from the main question bank UI, these changes also impact how questions are added to the quiz. The "Add from the question bank" and "Add a random question" modals now use the new filter UI to allow filtering of questions by categories and tags. For random questions, these filters are saved to the question set reference. This can be extended in the future to support more filters. None of these changes should impact on the existing filters on the Participants page.
2.summary: Implement question bank sharing
description: Implement the sharing of question bank between the users. Currently, the question bank is visible if a user has the capability under that context, so if another user from a different context wants to see a bank, the user will need to have permission for that context. Sharing of question bank will bridge that gap.
3.summary: Fix qbank_action_menu - regressions and api issues
description: The new class qbank_action_menu which was added to provide links for tertiary navigation is done in a very wrong way that everything is hardcoded including the URL, navigation key, etc. This has created a regression from qbank plugins as the initial implementation was to support navigation from third-party and core plugins, having this class removed ability and it wont be possible for any plugin using the question bank using their own navigation which was added extensively from the quiz4.0 project. This tracker will investigate the mess and implement a proper fix with a proof of concept using .
4.summary: Add actions as a feature in qbank plugin base class
description: Question bank plugins currently implement actions as a subclass of columns. They are returned by plugin_feature::get_question_columns then separated from the actual columns to be used in the action list on each row. This is due to the way they were historically displayed as a separate column for each icon, but makes no sense with the changes since 4.0. This issue will re-factor the question bank actions API so that actions are their own class, separate from columns. Shared code will be inherited from a common base class to avoid duplication.
5.summary: Anywhere a teacher views questions, display version information
description: I think that, whenever a user with appropriate cababilities (e.g. moodle/question:edit|use|view), then somewhere in the display of the question, there should be a little badge which makes it clear which version you are looking at. For example: !Rough UI mock-up.png! I am not quite sure about the exact visual styling, and there are various cases to consider about what needs to be displayed (e.g. in a quiz there is the expected version of the question, based on how the quiz is build, compared to the acutal version that was used when this student started this attempt, or when the attempt was last regraded), so those details need to be worked out, but otherwise I think this is a nice usability win.
6.summary: Give teachers more flexibility to customise their own view of the question bank
description: The agreed scope of this issue for 4.3 is as follows: Column sort order admin screen: Add controls to set the default width of each column Add action menu with an option to hide a column to hide the column by default Add an "Add columns" menu to add back any hidden columns Add a preview to show an example of the question bank table with the configured defaults Question bank teacher view: Add an action menu to each column header with options to hide, move or resize the column, providing keyboard-accessible interfaces. Add draggable move and resize icons to each column header that appear on hover. Add an "Add columns" menu to add back any hidden columns. Adding overflow scrolling to the table, so it scrolls within the available page width. Out of scope for this issue, but will be addressed later through separate issues: Combining the checkbox, type and question name into a single column. Hiding some columns by default on new installs, to provide a cleaner interface for the most common use cases. Fixing any inconsistencies with table styling in other areas of Moodle. Add column pinning/freezing Change the bulk edit UI to use the sticky footer widget, following the bulk edit on the course page. The UI mockups (including all of the above) can be seen here: Admin screen| Question bank|
7.summary: Question bank: qbank_action_menu hard-codes a list of plugins, instead of using the plugin_feature::get_navigation_node callback
description: Recently I tried to add a new question bank plugin () and I found myself stuck because I wanted to add a new menu option in the question bank menu (next to import, export and managecategories). Basically there are two location where the menus and their access is hardcoded: In the question/classes/local/bank/question_edit_contexts.php: we have to add an entry here so the menu appears for the user who has access right| If not the menu will not ever appear. question/classes/output/qbank_action_menu.php: we have to add the url to the new question bank page| to make it appear in the menu. I feel we are pretty close to have a plug and play type of behaviour but not close enough not to need core modification to be able to add new question bank action via plugin for now.
8.summary: Move question deletion code for plugins to event handlers
description: Currently, question_delete_question() in questionlib.php contains code for deleting data held by the qbank_customfields, qbank_tagquestion and qbank_comments plugins. The function already triggers an event when the question is deleted, so this code should be moved to event handlers in the respective plugins.
9.summary: Implement qbank plugin enabled/disabled events
description: Currently, admin/qbankplugins.php calls qbank_columnsortorder\column_manager directly to enable and disable columns as qbank plugins are enabled and disabled. Rather than calling plugin code directly, we should trigger an event when a qbank plugin is enabled or disabled, so any plugin an observe these events and perform any necessary actions.

Below is an instruction that describes a task, paired with an input that provides an epic with this format: 
"project": "Name of the project" 
"summary": "Summary of the epic user story" 
"description": "Description of the epic user story". Write a response that appropriately completes the request.### Instruction:
Break this epic user story into smaller tasks to help the developers understand the epic better, you can divide this epic into as much as you want depending on the complexity of the epic.
### Input:
project: Moodle
summary: Quiz and Question bank in Moodle 4.3
description: This follows on from . , . Continuing the work to implement the plan originally set out here: (those are links into key posts in a long quiz forum thread). We dont know exactly what will make it into 4.3, but this is our aspiriation at the current time. Current planned development: Question bank column reordering, show/hide and resizing (in integration) Implement question bank filtering (in development) Add additional question bank filters Make question bank columns pinnable Hopefully more will happen, but that is still under discussion.

### Response:
1.summary: Better searching/filtering in the question bank, so more flexible randomisation in quizzes
description: introduced a new filter UI for the participants page which was refactored into a reusable core API in . This issue continues that work by converting the question banks filters to the use new API, with each condition implemented in the appropriate qbank plugin. This then allows any plugin to define its own filter conditions. The scope of this issue covers just the conversion of the current filters, adding additional filters based on other question bank columns is out of scope, but these will be added in follow-up tracker issues (). In particular, we will have the following filter conditions: Question bank category (optionally including subcategories) Show hidden questions Tags Show question text in question list "Show question text in question list" is not technically a filter, since it controls which which fields of each record are displayed, rather than which record. However, this was included in the existing question bank filter UI, so for simplicity we will just convert it to the new filter UI within this issue. Once is resolved we will hopefully have a method to show and hide fields, so will have a more logical place for this option to live, and can convert it in a subsequent issue (). "Show hidden questions" and "Show question text in question list" are a simple yes/no choice. Rather than using an autocomplete with just these choices, we have implemented an additional datafilter class for a binary filter. This allows us to use a Yes/No select instead for these filters. "Question bank category" requires an additional checkbox to indicate whether or not the results should include questions from subcategories of the selected category well. To support this, datafilters now support an additional "filteroptions" parameter, to allow filters to add custom options to modify the filters behaviour. Currently, all filters used on the Participants page have the option to match on the join types "All", "Any" or "None". These options do not make sense for most of the filters use in the question bank (all except Tags). Datafilters can now define the list of jointypes they support, and if only one is available the option will be hidden in the UI. In the question bank, we must always have a category filter, and the "Show hidden questions" filter should always be shown to make it clear which state it is in. To support this, datafilters can now be defined as "required", in which case the "remove" button will be hidden and they will not be removed by the "Clear filters" button. Aside from the main question bank UI, these changes also impact how questions are added to the quiz. The "Add from the question bank" and "Add a random question" modals now use the new filter UI to allow filtering of questions by categories and tags. For random questions, these filters are saved to the question set reference. This can be extended in the future to support more filters. None of these changes should impact on the existing filters on the Participants page.
2.summary: Implement question bank sharing
description: Implement the sharing of question bank between the users. Currently, the question bank is visible if a user has the capability under that context, so if another user from a different context wants to see a bank, the user will need to have permission for that context. Sharing of question bank will bridge that gap.
3.summary: Fix qbank_action_menu - regressions and api issues
description: The new class qbank_action_menu which was added to provide links for tertiary navigation is done in a very wrong way that everything is hardcoded including the URL, navigation key, etc. This has created a regression from qbank plugins as the initial implementation was to support navigation from third-party and core plugins, having this class removed ability and it wont be possible for any plugin using the question bank using their own navigation which was added extensively from the quiz4.0 project. This tracker will investigate the mess and implement a proper fix with a proof of concept using .
4.summary: Add actions as a feature in qbank plugin base class
description: Question bank plugins currently implement actions as a subclass of columns. They are returned by plugin_feature::get_question_columns then separated from the actual columns to be used in the action list on each row. This is due to the way they were historically displayed as a separate column for each icon, but makes no sense with the changes since 4.0. This issue will re-factor the question bank actions API so that actions are their own class, separate from columns. Shared code will be inherited from a common base class to avoid duplication.
5.summary: Anywhere a teacher views questions, display version information
description: I think that, whenever a user with appropriate cababilities (e.g. moodle/question:edit|use|view), then somewhere in the display of the question, there should be a little badge which makes it clear which version you are looking at. For example: !Rough UI mock-up.png! I am not quite sure about the exact visual styling, and there are various cases to consider about what needs to be displayed (e.g. in a quiz there is the expected version of the question, based on how the quiz is build, compared to the acutal version that was used when this student started this attempt, or when the attempt was last regraded), so those details need to be worked out, but otherwise I think this is a nice usability win.
6.summary: Give teachers more flexibility to customise their own view of the question bank
description: The agreed scope of this issue for 4.3 is as follows: Column sort order admin screen: Add controls to set the default width of each column Add action menu with an option to hide a column to hide the column by default Add an "Add columns" menu to add back any hidden columns Add a preview to show an example of the question bank table with the configured defaults Question bank teacher view: Add an action menu to each column header with options to hide, move or resize the column, providing keyboard-accessible interfaces. Add draggable move and resize icons to each column header that appear on hover. Add an "Add columns" menu to add back any hidden columns. Adding overflow scrolling to the table, so it scrolls within the available page width. Out of scope for this issue, but will be addressed later through separate issues: Combining the checkbox, type and question name into a single column. Hiding some columns by default on new installs, to provide a cleaner interface for the most common use cases. Fixing any inconsistencies with table styling in other areas of Moodle. Add column pinning/freezing Change the bulk edit UI to use the sticky footer widget, following the bulk edit on the course page. The UI mockups (including all of the above) can be seen here: Admin screen| Question bank|
7.summary: Question bank: qbank_action_menu hard-codes a list of plugins, instead of using the plugin_feature::get_navigation_node callback
description: Recently I tried to add a new question bank plugin () and I found myself stuck because I wanted to add a new menu option in the question bank menu (next to import, export and managecategories). Basically there are two location where the menus and their access is hardcoded: In the question/classes/local/bank/question_edit_contexts.php: we have to add an entry here so the menu appears for the user who has access right| If not the menu will not ever appear. question/classes/output/qbank_action_menu.php: we have to add the url to the new question bank page| to make it appear in the menu. I feel we are pretty close to have a plug and play type of behaviour but not close enough not to need core modification to be able to add new question bank action via plugin for now.
8.summary: Move question deletion code for plugins to event handlers
description: Currently, question_delete_question() in questionlib.php contains code for deleting data held by the qbank_customfields, qbank_tagquestion and qbank_comments plugins. The function already triggers an event when the question is deleted, so this code should be moved to event handlers in the respective plugins.
9.summary: Implement qbank plugin enabled/disabled events
description: Currently, admin/qbankplugins.php calls qbank_columnsortorder\column_manager directly to enable and disable columns as qbank plugins are enabled and disabled. Rather than calling plugin code directly, we should trigger an event when a qbank plugin is enabled or disabled, so any plugin an observe these events and perform any necessary actions.
