How the quiz navigation should work in Moodle 2.0
|Warning: This page is no longer in use. The information contained on the page should NOT be seen as relevant or reliable.|
this was implemented more-or-less as described.
This page summarises the how we want the Moodle 2.0 navigation to work for the quiz module.
It follows discussion between Sam Hemelryk, me (Tim Hunt) and Martin Dougiamas. The plan is that Sam will do the implementation.
Note that the diagram on Quiz_user_interface_overview is reasonably up-to-date, but no longer entirely accurate.
New API method to control whether blocks are displayed
$PAGE->blocks->show_only_fake_blocks($trueorfalse = true); for controlling blocks on pages.
If this method is not called, the blocks are shown, as now. If this method is called with true (which is the default value of the argument) then basically, the blocks_manager::load blocks method will not be called, so only fake blocks are shown.
New quiz setting for whether to call that API
On the quiz settings from, in the Display section. Add a new setting:
Show blocks during the quiz attempt: Yes / No (Default no)
If set to No, then the pages attempt.php, summary.php and review.php call the $PAGE->blocks->show_only_fake_blocks() method. Actually, it is not quite that simple. review.php has two modes. 1. A student reviewing their own attempt (or a teacher reviewing a preview that they did), and 2. a teacher reviewing a student's attempt. The blocks should not be hidden when a teacher is reviewing a student's attempt.
Note that there is a page Admin -> plugins -> modules -> quiz, where the admin can define defaults for all the quiz settings, and decide whether each setting counts as advanced. This setting also needs to be added there.
I am tempted to say that by default, it should be an advanced setting.
All these links already exist in the existing quiz tabs, so you can get the URLs from there. The is the structure we want within the quiz:
- Manual grading
Note that the quiz reports are plugins, so the list is dynamic, and different reports may require different capabilities, but all that logic is encapsulated in the quiz_report_list() function. The quiz Info link should be visible to anyone who can see the quiz.
Question bank UI is defined by the scripts edit.php, category.php, import.php and export.php. There is also the script question.php which shows the editing form for a particular question, and preview.php for previewing a particular question in a pop-up. There is also a tabs.php file, which mostly just uses the questionbank_navigation_tabs() function from lib/questionlib.php, but that should go.
There is a part of the question bank for the following contexts:
- the system context (currently, the closes we have to a link for this is the 'Front page questions' link in the admin tree.
- the context for any course category.
- each course context
- each quiz context.
In the future, there may be sections of the question bank for each lesson, and possibly other types of activity.
One would therefore expect that the various scripts that comprise the question bank would take a contextid parameter. Unfortunately, that is not the case. For historical reasons they take either a courseid or a cmid paramter, and there is a function question_edit_setup() in question/editlib.php that tries to sort it out.
Anyway, there are a a sub-tree of settings links that are required wherever the question bank appears. Basically, to the four main question bank scripts
- Question bank
As you can see from the questionbank_navigation_tabs function, these each require a capability check.
We need a simple function, like questionbank_navigation_tabs, so that it is easy to add this sub-tree to the settings navigation whenever we want it.
Links in the settings block
Again, all these links are in tabs.php. There are some standard links that appear for every module. These are shown in italics.
The is the structure we want:
- Settings overrides
- Edit (On the edit screen, we use tabs to distinguish the edit questions and order and paging views, with a user-preference so that it remembers which mode you used last.)
- Question bank
- Locally assigned roles
- Check permissions
I think there is currently code there so that clicking on 'Edit' takes you to whichever of Edit questions or Order and paging you were using most recently (it does that via a user pref). Please can we keep that functionality.
Clean up the quiz edit page
Get rid of the link 'Question Bank management' that appear at the top right of mod/quiz/edit.php (since the link is now in the settings block).
We must have navigation on the quiz edit page, (mod/quiz/edit.php) even though that will not be great on small screens. I tried to start a discussion about that page at http://moodle.org/mod/forum/discuss.php?d=149375#p653549, but without much success.
Remove the old tabs.php
In both the quiz and the question bank.
Review all the pages, and ensure that the breadcrumbs cleanly match this navigation structure.