Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Plan to Improve Flexibility of Question Category Sharing and Permissions

From MoodleDocs

Status of this Plan

Working on the plan now and it is still under discussion. Please post comments here : forum discussion starting here with new heading 'Plan to Improve Flexibility of Question Category Sharing and Permissions'

Background

Commenting

I plan along the way before making changes to the question bank code to add plenty of commenting in the approved Moodle style and in line with this info on Quiz_developer_docs#Code_documentation. Will add ??? where I'm not sure of something and generally add as many inline and phpdoc comments to the code as seem useful. I think Moodle guideline suggest that there are never to many comments in code, I'll try to keep the comments succinct. This I hope along the way will be a good way for me to learn about how the code works myself and cement the concepts in my own mind.

Rest of Tasks in Plan Are In The Order I Intend to Tackle Them

Commenting will be something I'll do throughout my work as I delve into the code and add new code. The rest of tasks in my plan below are in roughly the order in which I intend to tackle them.

Before Branch Changes to HEAD

I propose to make these changes before I branch the question bank code to work on a development branch.

Convert the Current edit categories table to a UL

Will convert the current edit categories table to an UL. This will be one step towards the new interface with several headings and lists of categories below each context heading. I won't add the context headings at this stage just change the current table to a UL.

Remove the Question Bank Reliance on SESSION

Will work on removing the use of SESSION to keep track of what category should be displayed and pass category and other params from page to page as url params or as hidden fields for buttons.

After Branching

Make DB changes

Remove 'publish' field from question_categories table 'course' field will become 'context' and will be of INT type pointing to the 'context' table.

Calculate equivalent context

Contents of the new context table will depend on the old contents of 'publish' and 'course' if publish is 1 then we make the context the site context. If it is 0 then we make the context the context for the course indicated in the 'course' field.

Change in How Categories Are Shared

Previously you could share a category anywhere in your Course's question bank category hierarchy at the site level. Now we have decided that we'll seperate hierarchies for categories at each context level. So we need code on db upgrade to check that all parent categories referred to in the question_categories 'parent' field are in the same context. If they are not then this category becomes a new top level category.

Edit Categories Page

Add Headings to Edit Categories Page for Each Context Level

Will add headings to edit categories page and below each heading there will be a list of categories in that context. Edit Categories page will then have the structure as shown here

Add Up / Down Action Buttons

These will work as discussed here - I like the first option and not the alternative I discuss.