Search and install the plugin using the Extension Manager. Refer to Plugins on how to install plugins manually. If you do install manually the directory must be named quiz
.
Use this plugin to add a quiz to a wiki page. The syntax looks like this:
{{quiz>quiz_page¶m1¶m2&...¶mN}}
where paramX can be one or more from follow list and quiz_page is the ID of a wiki page (like this) that contain the quiz:
learning | show correct answers at the end of quiz | optional |
---|---|---|
showintro | show quiz intro on every question | optional |
rndquest | shuffle random of question's order | optional |
rndchoice | shuffle random of choice's order on every question | optional |
highscores | show a button to view the 10 best scores | optional |
To make a quiz, create a page, with a syntax looks like follow.
You can define a title (using Headline Level 1 ====== Title ======) and a intro for whole quiz
====== Title of quiz ====== Quiz intro text. Quiz intro text. Quiz intro text. Quiz intro text. Quiz intro text. Quiz intro text. Quiz intro text. Quiz intro text. Quiz intro text. Quiz intro text
For every quiz, You can define one or more questions (using bullet *):
* Test of question
For every question, one or more optional choices (using bullet -). If no choices is defined, the question will be a free answer (text) type
- choice 1 - .... - choice N
one or more correct answers (using second level bullet and brackets, delimited with | * [a1|a2|...|aN]). If two or more correct answers is defined, the question will be multi-answers (checkbox) type. If only one is defined, the question will be single answer (radio) type.
* [1|2]
a optional score (using second level bullet and parenthesis * (N))
* (5)
and a optional explanation
* explanation
For every quiz, you can define one or more scores explanation (using Headline Level 2 ===== minN-maxN =====), for total score in the range [minN,maxN]. If defined, will be displayed at the end of the test, along with correct answers.
===== 1-20 ===== Explanation for score in the range [1,10]
For intro, questions, choices, explanation and scores explanation it's possibile to use wiki syntax.
====== Quiz title ====== Quiz intro text. Quiz intro text. Quiz intro text. Quiz intro text. Quiz intro text. Quiz intro text. Quiz intro text. Quiz intro text. Quiz intro text. Quiz intro text. Quiz intro text. Quiz intro text. Quiz intro text. Quiz intro text. Quiz intro text. Quiz intro text. Quiz intro text. Quiz intro text. Quiz intro text. Quiz intro text. * Question 1 description (multi answers - checkbox) - choice 1 <-- choice 1 - .... - choice N <-- choice N * [1|2] <-- right answers (one or more, | delimited) * (10) <-- score * explanation <-- optional * Question 2 description (single answer - radio) - choice 1 <-- choice 1 - .... - choice M <-- choice M * [2] <-- right answer (from 1 to M) * (5) <-- score * explanation <-- optional * Question 3 description (single answer - text) * [Pippo] <-- right answer * (20) <-- score * explanation <-- optional ===== min1-max1 ===== <-- optional Explanation for score in the range [min1,max1] ===== min2-max2 ===== <-- optional Explanation for score in the rangen [min2,max2] .... ===== minN-maxN ===== <-- optional Explanation for score in the range [minN,maxN]
The quiz plugin makes use of background AJAX, so you don't have to reload the whole page each time on every question.
The quiz title is converted to a md5sum. This is used as the filename in data/meta to store the highscores: md5sum.quiz - so all quiz in the whole wiki must be unique. As a result you can move your quiz around and the quiz data is accessible. If you remove the quiz you must remove the quiz data with “rm”.
There's always room for improvement. If you're able to add any contributions to make this plugin better, please let me know or discuss your thoughts right here (please use ===== Level 3 Headlines =====
to open a new “thread”/issue and ----
(four dashes, horizontal rule) to structure it when needed).
When I create quiz in playground (based on provided sample quiz), answers sometimes appears and then rapidly disappears (being replaced with blank “start quiz” or “continue” button, I don't remember exacly) while answering. Tested on IE8/Chrome8, sometimes this bug appears, sometimes not.
Instead of resulttext (“you anwered correctly … of … questions”) this kind of error message appears. Total score is displayed, though. Error message: “Warning: sprintf() [function.sprintf]: Too few arguments in C:\xampplite\xampplite\htdocs\dokuwiki\lib\plugins\quiz\class_quiz.php on line 194”.
Fix by replacing line 13 of lang/en/lang.php:
$lang['quiz_resulttext'] = "You answered %d out of %d questions correctly (%d %)";
with:
$lang['quiz_resulttext'] = "You answered %d out of %d questions correctly (%d %%)";
fixed with new version — mluigi 2010/12/07 09:30
When quiz command is linking on the same page where it was called from, Dokuwiki halts. Perhaps you should add internal check to avoid it.
When not defining optional scores explanation ( using Headline Level 2 ===== minN-maxN ===== ), this kind of error message appears. Total score is displayed, though. Error message: “Warning: Invalid argument supplied for foreach() in C:\wamp\www\dokuwiki\lib\plugins\quiz\class_quiz.php on line 200”.
Fix by replacing line 200 from class_quiz.php:
foreach ($data['scores'] as $scores) {
with:
if ($data['scores']) foreach ($data['scores'] as $scores) {
fixed with new version — mluigi 2010/12/07 09:30
Using learning parameter when adding a quiz to a wiki page does not work (correct answers are not shown at the and of quiz).
Fix by replacing the following lines:
$param['quizmode'] = $_POST['quiz_mode'];
to
$param['learning'] = $_POST['quiz_learning'];
$html .= '<input type="hidden" name="quiz_mode" value="' . $this->mode. '">' . "\n";
to
$html .= '<input type="hidden" name="quiz_learning" value="' . $this->mode. '">' . "\n";
$this->mode = $param['quizmode'];
to
$this->mode = $param['learning'];
fixed with new version — mluigi 2010/12/07 09:30
If inserting {{quiz>...}}
in its own dokuwiki section, clicking “edit” for that section will start the quiz.
Fix by replacing lines 114,115 from class_quiz.php:
$html .= '</div>'; $html .= '</div>';
with:
$html .= '</div>'; $html .= '</form>'; $html .= '</div>';
fixed with new version — mluigi 2010/12/07 09:30
I can't figure out how to link a quiz command (quiz> …) to a quiz wiki page - like stated here
The “quiz_page” reference is a wiki namespace path? How would this command look like if I want to add a quiz from here (this page), to this example quiz page
Somenthing like this? plugin:quiz:example
I wanted some way to add more detail to questions and explanations. Questions can have additional bullet points added by adding a list item called “Detail” and sub-bullets will be added to the question. They must not extend additional levels. Second, the explanation is similarly extended by defining sub-bullets on the normal explanation line. My test page: http://www.siliconpr0n.org/wiki/doku.php?id=quiz:metal_gate_cmos
Example usage:
Source diff against quiz-07.12.2010.zip:
428c428,442 < --- > # Like explanation except with a special key > } elseif (strtoupper(substr($lines[$k], 0, 12)) == " * DETAIL") { > $tmp = ''; > while($k < $nr - 1) { > $l = $lines[$k + 1]; > > if (substr($l, 0, 8) == " * ") { > # Keep it as a list, just shift it > $tmp .= $hRender->render(str_replace(" * "," * ",$l)) . "\n"; > $k += 1; > } else { > break; > } > } > $quizz['questions'][$nquest]['question'] .= $tmp; 436a451 > # Doesn't the above subst take care of this? 440c455,470 < $quizz['questions'][$nquest]['explanation'] = $tmp; --- > $exp = $tmp; > > $tmp = ''; > # Extended explanation? Peek to see if there is continuation > while($k < $nr - 1) { > $l = $lines[$k + 1]; > > if (substr($l, 0, 8) == " * ") { > # Keep it as a list, just shift it > $tmp .= $hRender->render(str_replace(" * "," * ",$l)) . "\n"; > $k += 1; > } else { > break; > } > } > $quizz['questions'][$nquest]['explanation'] = $exp . $tmp;
— JohnDMcMaster 2012/05/24 10:08
Thanks for a simple quiz plugin! One question, even if I don't set a title for my quiz, the pagename will show up as the title. I wonder if it is possible to “fix” this, as I would like to have only one title per quiz page, and that should be the master page's title. It is important as I use page titles for navigation, although I can work around by using the meta plugin to set a title for the master page. I hope this makes sense. Thanks for clarification in advance! —Eivind
I have tried this plugin and notice that with “rndquest” and “rndchoice” shuffle the order of questions and choice first time and then on every reload of the page it remain the same. Is there any option that on every reload it suffle the questions and choices or may be I am missing something.
The plugin is really useful to make Dokuwiki a useful tool for learning. I would appreciate someone can make this work again for new release of Dokuwiki.
Attempting to view the example page for this plugin takes you to a site that attempts to install malware!
If this was true, it should be put to the very top of the page, not at the end. But I just tried the Demo link, and it simply went to one of those holding pages when a domain expired, and I didn't experience any malicious attempt to install anything. — Anika Henke 2014/03/23 11:50I've just removed the link to the Demo as it was broken since over a year anyway. — Anika Henke 2014/03/23 12:53
Not Found
The requested URL /getform.php was not found on this server.
it is not directing to right link .
Please help to resolve the issue