Quiz Preview

Quiz Preview

de Frederic Triquet -
Number of replies: 5
Hi,

you will find attached a zip-file containing 3 files:
- mod/quiz/edit.php (this file was modified)
I just added a button that opens the preview window (popup)
- mod/quiz/preview.php (this file was created)
- quizpreview_edit_patch.txt
this is the result of a 'diff' command, it should be used with the unix command 'patch'.

You may want to 'patch' _your_ mod/quiz/edit.php if you already made some modifications to it and don't want to lose them.
On the other hand if you are using an original version of edit.php (version 1.1.1), you can overwrite it with _my_ mod/quiz/edit.php

(I would say that "normal" user just have to put the two php files in moodle_dir/mod/quiz/ and don't care about all the patch stuff)

I hope my explanations are clear enough.

Please fell free to send me comments about my quiz-preview.

Fred
Promeyo de puntuacions: -
In reply to Frederic Triquet

Re: Quiz Preview

de Przemyslaw Stencel -
Hi Fred,

Very useful hack!

My comments:

1/ I get some errors - they are displayed just before the questions. These errors do not appear when I attempt the quiz.
Warning: Invalid argument supplied for foreach() in /home/users/stencel/www/moodle/mod/quiz/lib.php on line 1675
Warning: Division by zero in /home/users/stencel/www/moodle/mod/quiz/lib.php on line 1692


2/ I think that since it opens in a popup window, the header (course name & breadcrumbs) and footer (loggedinas) are not necessary.

3/ A "Grade" button would be very useful. The teacher would then be able not only to see the quiz, but to try it out, too. This "Grade" button should check the answers and return the page with feedback, but it should not record the answers into the database as an attempt.

Cheers,
Przemek
In reply to Przemyslaw Stencel

Re: Quiz Preview

de Frederic Triquet -
Thanks for your comments Przemek

1) ouch ! I looked into mod/quiz/lib.php and couldn't find why you got these problems (maybe we don't have the same version of this file ?)
in my file there is no "foreach" at line 1675 and no division at line 1692...
Could you give me more informations about this ?
Does it happen for all your questions ? Which types of questions are these ?

2) you're right, i'm gonna remove it

3) hmmm... I'm not sure it is so easy to make but I will have a look, it would be an interseting feature

Thanks again

Fred
In reply to Frederic Triquet

Re: Quiz Preview

de Przemyslaw Stencel -
About #1:

Sorry, this could be my fault. I installed your hack on Moodle 1.2 dev, without 'patching' (I don't know how to do it). You did warn against it riseta

I do have a 1.1.1 installation, but this is a live, production installation, so I'd rather not test new code there. However, if I find some time to do it, I might backup the original edit.php and try your hack there. I'll let you know what happens.
In reply to Frederic Triquet

Re: Quiz Preview

de Siegwart Mayr -

Hi, Fred,

Thanks for sharing that code.  This is already a big improvement in functionality on the current 1.1.1 version of the Quiz module.  The Quiz Preview button makes it a lot simpler to preview it.

The only drawback right now, as you mentioned in another discussion (http://moodle.org/mod/forum/discuss.php?d=4013#18483) is the fact that the current quiz needs to be saved before it can be previewed.   It needs that "Save Quiz" button to only save the questions (and not exit quiz editing), as well as a "Save & Exit" button.

It's also true about Przemyslaw's comment of allowing the users to actually complete the quiz and posted to receive the actual feedback, so that the quiz feedback functionality can be "previewed" as well.