Note: This documentation is for Moodle 2.7. For up-to-date documentation see How the quiz navigation should work in Moodle 2.0.

Development:How the quiz navigation should work in Moodle 2.0: Difference between revisions

From MoodleDocs
(New page: 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 tha...)
 
No edit summary
Line 2: Line 2:


It follows discussion between Sam Hemelryk, me (Tim Hunt) and Martin Dougiamas. The plan is that Sam will do the implementation.
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 [[Development:Quiz_user_interface_overview]] is reasonably up-to-date, but no longer entirely accurate.


==New API method to control whether blocks are displayed==
==New API method to control whether blocks are displayed==


$PAGE->blocks->show_only_fake_blocks($trueorfalse = false); for controlling blocks on pages. If the page does not want blocks, then it can call this method, passing false, and basically, the blocks_manager::load blocks method will not be called.
$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==
==New quiz setting for whether to call that API==


TODO
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.




==Links in the navigation block==
==Links in the navigation block==


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:
* Quiz
** Info
** Results
*** Grades
*** Responses
*** Statistics
*** 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 settings links==
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
** Questions
** Categories
** Import
** Export
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 subtree to the settings navigation whenever we want it.




==Links in the settings block==
==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:
* Quiz
** ''Setting''
** Group and user settings (currently the tab is called Overrides but I prefer this name)
** Edit
*** Edit qustions
*** Order and paging.
** Preview
** Question bank
*** Questions
*** Categories
*** Import
*** Export
** ''Locally assigned roles''
** ''Permissions''
** ''Check permissions''
** ''Logs''
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.
TODO
==Remove the old tabs.php==
In both the quiz and the question bank.
==Get rid of the old link to the question bank==
That is, get rid of the link 'Question Bank management' that appear at the top right of mod/quiz/edit.php.
==Breadcrumbs==
Review all the pages, and ensure that the breadcrumbs cleanly match this navigation structure.




Line 24: Line 114:


* MDL-20276 the main bug for implementing this
* MDL-20276 the main bug for implementing this
* MDL-20724, MDL-22333related bug reports.
* MDL-20724, MDL-22333 related bug reports.

Revision as of 14:44, 10 May 2010

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 Development: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.


Links in the navigation block

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:

  • Quiz
    • Info
    • Results
      • Grades
      • Responses
      • Statistics
      • 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 settings links

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:

  1. the system context (currently, the closes we have to a link for this is the 'Front page questions' link in the admin tree.
  2. the context for any course category.
  3. each course context
  4. 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
    • Questions
    • Categories
    • Import
    • Export

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 subtree 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:

  • Quiz
    • Setting
    • Group and user settings (currently the tab is called Overrides but I prefer this name)
    • Edit
      • Edit qustions
      • Order and paging.
    • Preview
    • Question bank
      • Questions
      • Categories
      • Import
      • Export
    • Locally assigned roles
    • Permissions
    • Check permissions
    • Logs

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.

TODO


Remove the old tabs.php

In both the quiz and the question bank.


Get rid of the old link to the question bank

That is, get rid of the link 'Question Bank management' that appear at the top right of mod/quiz/edit.php.


Breadcrumbs

Review all the pages, and ensure that the breadcrumbs cleanly match this navigation structure.


See also