Note:

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

Administration page for question types

From MoodleDocs

Moodle 2.0


We need an administration page for question types, like admin/modules.php, admin/blocks.php or admin/filter.php. This is MDL-6751.

Requirements

See which question types are installed, and which version each one is.

See how many instances of each type there are and get a list of those instances and which context they belong to.

Provide a way for the administrator to control which question types can be created. (It may be necessary to leave a question type installed, so that old quiz results can be reviewed, but the administrator may wish to prevent the creation of new questions of that type, so it can be phased out.)

If there are no questions of a particular type in the database, provide a delete option.

Allow each question types to have its own settings page.

Some question types require others to be installed (e.g. for example calculated depends on numerical, which in turn depends on short answer). Show these dependencies, and don't allow deletion of question types when others depend on them.

(Technical) move qtype_xxx_version config variables to the config_plugins table.

Design

The main "Manage question types" page page will use a table like the other Manage XXX pages. The table will have columns "Question type", "No. questions", "Version", "Requires", "Available to?", "Delete" and "Settings".

The number in the "No. questions" column will be a link to a report that lists all the question categories that contain questions of this type. It will be a table with columns "Context", "Question category", "Questions" and "Hidden questions". The context will be a link to that context, if the user has access. The question category will be a link to the question bank screen for that category.

To control the ability to create questions of a particular type, we will replace the single moodle/question:add capability with a set of capabilities qtype/shortanswer:add. The "Available to?" column will then list all those roles that have that capability in the system context (or "No roles"). Each role name will be a link to the corresponding edit role page, so that the permission can easily be changed. In addition, if this capability is overridden in any context, then "with exceptions" will be appended to the value in this column. Those words will be a link to a new report, the "Capability check" report MDL-16343. (Those links will only be links for people with the appropriate capabilites.)

The new capabilites will require changes to the question bank code. (Note that to really prevent creation of questions of a certain type, administrators will have to use "Prohibit" it teachers are allowed to override roles. I mention this here while I remember it, because it needs to be documented.)

The delete link will be like the delete link for modules and blocks, except that you will only be able to delete questions if there are no instances, and if no other question types depend on them. Question types need a way of saying which other question types they depend on, and upgrade_plugins should, ideally, check this.

If a question type wants its own settings page, it should put a settings.php file in its plugin folder. Any question type with such a settings file will have a "Settings" link added in the "Settings" column. These will also be listed in the admin tree, as for modules and blocks.

Moving the config variables will be done in the main lib/db/upgrade.php script. This will also require changes to the install/upgrade_plugins code in adminlib.php.

See also