Quiz Summary Page Hiding: Difference between revisions
Line 66: | Line 66: | ||
[[File:8.PNG]] | [[File:8.PNG]] | ||
''Edit quiz name with a spetial invisible symbol'' | |||
This way is a temporary solution and it doesn`t need any addings to database. If we need to add flag we can add to a quiz name or intro any invisible symbol and then check it as a flag. | This way is a temporary solution and it doesn`t need any addings to database. If we need to add flag we can add to a quiz name or intro any invisible symbol and then check it as a flag. |
Revision as of 08:55, 24 September 2015
Summary page in Moodle quiz
At the end of every quiz user sees a summary page asking to confirm quiz finishing.
Pushing the "Submit all and finish" user gets another submit request.
Only after this user can finish and go to review page.
Finishing quiz without summary page
As a way not see the summary page is to ask the confirmation on the last quiz page.
Pushing next user finishes his attempt and goes to review page.
Turning off the summary page
We should have an additional option to omit the summary page.
There are some variants to place this option:
Quiz administration -> Edit settings:
Add yes/no trigger to Layout menu of quiz.
Quiz administration -> Edit quiz:
Add a new special summary page with a checkbox.
Add a new special summary page with a add-option on the page. And spedial close-button for disabling.
Storing the flag in the database
The main problem of this task we need save anywhere the flag about the summary page showing. I`ve got some ideas how to save this information:
Change table structure by adding a new column to mdl_quiz table
The most obvious way to add a new column to the quiz information table mdl_quiz.This table was created for storing options and it`s common to add such things. But this table has already many columns and we need to take into account our new column in backup and restore procedures.
Add row to mdl_quiz_slots table
If we don`t want to add a new column we may add a new row to a table quiz_slots. This table contains the information about quiz pages configuration. May be it`s a reason to add a new additional slot for summary page. Some columns fill by negative numbers to mark it as not a question. This way allow not to change structure but confuses different objects in one table. It can cause more additional conditions in php code to filter what is question and what is not and which page to show in quiz and which not.
Edit quiz name with a spetial invisible symbol
This way is a temporary solution and it doesn`t need any addings to database. If we need to add flag we can add to a quiz name or intro any invisible symbol and then check it as a flag.
The problem that user can delete it by name/intro edition.
Implementation
The last page of the quiz redirects us to the summary page. Now it should be checked if summery page should be shawn.
We can create this fork next way:
next button sends a form with different properties of current and next page (look moodle\mod\quiz\renderer.php - attempt_form function). Inside this function we can check the hide-flag from database and send additional value by form. Another script (moodle\mod\quiz\process_attempt.php) catches this form and checks different given properties. The properties are:
// Get submitted parameters. $attemptid = required_param('attempt', PARAM_INT); $thispage = optional_param('thispage', 0, PARAM_INT); $nextpage = optional_param('nextpage', 0, PARAM_INT); $next = optional_param('next', false, PARAM_BOOL); $finishattempt = optional_param('finishattempt', false, PARAM_BOOL); $timeup = optional_param('timeup', 0, PARAM_BOOL); // True if form was submitted by timer. $scrollpos = optional_param('scrollpos', null , PARAM_RAW); // Here we can catch our hide-flag
And then in the place:
if ($page == -1) { $nexturl = $attemptobj->summary_url(); }
we can add checking hide-flag and if we need hide the summary page set the $finishattempt variable as true.
If we need show the confirm window before redirecting to preview page we can use
$button->add_action(new confirm_action(get_string('confirmclose', 'quiz'), null, get_string('submitallandfinish', 'quiz')));
for the "next" button on the last attempt page.