Extension:Quiz

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manual
Crystal Clear action run.png
Quiz

Release status: stable

Quiz extension.png
Implementation Tag, Hook
Description Quiz tool for MediaWiki
Author(s) Lrbabetalk
Latest version 1.0.2 (2010-10-12)
MediaWiki 1.12
License GNU General Public License
Download
Example and format documentation: v:Help:Quiz
Hooks used
ParserFirstCallInit

Translate the Quiz extension if it is available at translatewiki.net

Check usage and version matrix; code metrics
Bugs: list open list all report

Quiz is the quiz building tool adopted on the Wikiversity. This extension aims at being :

  • Simple in its syntax and its use; powerful in its possibilities.
  • Open to suggestions and improvements (by facilitating the addition of new types of questions).

Help / Hilfe / Aide[edit | edit source]

Currently, the help pages are hosted on the wikiversities in order to allow working examples.

Installation instructions[edit | edit source]

  1. Create a new directory named "Quiz" in the "extensions" directory of your wiki.
  2. Copy the downloaded files into the new directory.
  3. Add this line at the end of the LocalSettings.php :
require_once("$IP/extensions/Quiz/Quiz.php");

Alternatively, if you have shell access, you can checkout the extension directly from SVN.

  1. cd to the "extensions" directory of your wiki.
  2. svn export http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/Quiz
    
  3. Modify LocalSettings.php same as above.

Contributing[edit | edit source]

Adding a new question type[edit | edit source]

Quiz was conceived to facilitate the addition of new question types. If the basic types (multiple choice with single/multiple responses) are not enough for you, you have the possibility of easily creating and integrating the type of questions which you need. For that you must have some knowledge of PHP.

If you are not able yourself to create your new type of question, contact me and I'll see what I can do.

  1. The first thing that you must do is choose a syntax (the simplest possible) for your question type. The restrictions are:
    • The syntax of the question's header is fixed. The question has to be placed between curly brackets - i.e. { and } .
    • For consistency, it is recommended to use || to mark the beginning of the feedback section ("correction").
  2. Choose a new code name for your question type (example: "questionTypeName") as well as a symbol (currently the symbol "()" is used for single response multiple choice because it looks like a radio button, and the symbol "[]" is used for multiple response multiple choice because it looks like a checkbox).
  3. Add a "case" at the beginning of the parseParameters's "switch", as follows :
    case 'symbol':
    	$this->mType = "questionTypeName";
    	break;
    
  4. Add a parser function to Quiz.php
    This function must convert a question object from quiz syntax to HTML and set a state to the question (right, wrong, error, NA or unmarked), according to syntax errors and eventually posted answers. Name the function "questionTypeNameParseObject" and implement as follows :
    /**
     * Convert a basic type object from quiz syntax to HTML.
     * 
     * @param  $input				A question object in quiz syntax
     * 
     * @return $output				A question object in HTML.
     */
    function questionTypeNameParseObject($input) {
    	// your code here.
    	$this->setState(""); // Set the state if needed.
    	return $output;
    }
    
  5. Write down your syntax specifications which will be added to the help. Please read first the existing help.
  6. Once this is all done, contact me to include officially your question type inside the extension.

Reporting a bug[edit | edit source]

The bugs reported for pre 1.0 versions have been archived.

  • Subst doesn't work inside the quiz.
  • The quiz is vanishing if you use the Submit button while editing it.
  • The shuffle feature allows to shuffle a quiz with a single question.

Add found bugs here.

Headings[edit | edit source]

Could you explain what is the problem ? Lrbabe 13:50, 20 May 2007 (UTC)
When I use heading like = Title = or == Subtitle == then they are correctly rendered but not listed in Contents.
It seams, that every question get its own content overview.
I mean, thats not an important problem. One solution is simply to disable headings in quizes because its very unusual to need headings in quiz. That also prevent problem with shuffling of the questions.
-- MichaelFrey 18:01, 20 May 2007 (UTC)

Background colour[edit | edit source]

  • There seems to bee a problem in the java script for correction. If you define a feedback for a question the bckground collor of the feedback text ist defined as grey. If you have a for example a table with defined background collor the feedback text looks ugly.

broken Wiki[edit | edit source]

  • If I add "require_once" line to my Localsettings.php file, my Wiki disappears!

first answer disappears[edit | edit source]

  • I already reported this over at v:Help talk:Quiz-Simple after a second look on the examples on v:Help:Quiz, which turned out to be some of the same ones along with others of the same type that exhibit the same bug, it seems a bit screwier than I described over there. I said that when you hit the submit button the answers you place in the answer boxes shift such that your first answer disappears, the rest move up to the previous question boxes and the last question box is empty. Turns out I've also had it so that all of the answers disappear except for one, 'Plato,' which ends up in the first question box. That answer comes up a couple of times within the set so I can't tell if it's the second answer "Plato" that's remaining or the last answer "Plato," but I'd venture to guess it's the last one. The write-ins with only one question box to write in invariably go blank as I hit the submit button and tell me I didn't answer the question. -LambaJan 08:42, 19 February 2008 (UTC)

everythings wrong when nothing selected[edit | edit source]

  • All the correct anwsers are highlighted with red colour if the submit button is clicked directly without selecting any of the anwsers. Vignesh -India

Tabular response and piped links[edit | edit source]

  • In tabular response type of questions, syntax error is caused by piped links (including a | character) inside the column headings.

Example:

{Question

|type="[]"}
| Option A | [[Article name|Option B]] | Option C
++- Question 1
(Clue: A and B are correct).
-++ Question 2 (
Clue: B and C are correct).
--+ Question 3
(Clue: C is correct).

Mange01 08:14, 17 November 2008 (UTC)

does not work with[edit | edit source]

  • v 1.0.1, on Mediawiki 1.15.1, isn't working the tags return unparsed, does anyone have it working on MW 1.15.x?

Robling 18:41, 11 September 2009 (UTC)

Zero not possible as answer[edit | edit source]

  • The application seems not to take zero for an answer. I tried hideous solutions like { 0.01 110% } or { -0.1-0.1 } so that zero could be evaluated as a good answer but it does not work either. Has anyone found a other way to get rid of this problem yet than asking the user enter an O instead of a 0 ? Xzapro4 06:52, 4 October 2009 (UTC)

Try accepting zero as a string, not a numeric in the quiz answer.

Temporary solution: you can ask for user to type "00" instead of only "0", it works fine.

more than one quiz on a page[edit | edit source]

  • If more than one quiz is on a page, the correction is mixed up.

Example: http://de.wikiversity.org/w/index.php?title=Benutzer:MichaelFrey/Spielwiese&oldid=221352

<quiz shuffle="none">
{ AnyQuestion}
+ Right
- Wrong
</quiz>

<quiz shuffle="none">
{ Any other Question}
- Wrong
+ Right
</quiz>
And also the section link is mixed up: v:Help:Quiz
The section links goes to the first quiz and not to the one I've submited.
-- MichaelFrey 21:31, 23 May 2010 (UTC)

To do[edit | edit source]

All suggestions on the extension and its future possibilities are welcome: Extension_talk:Quiz.

Changelog[edit | edit source]

  • 1.0
    • New features :
      • display, points and shuffle parameters added to the quiz tag.
      • New question type : Textfield.
    • Improvements :
      • Possibility to use comma as a decimal separator.
      • Advanced shuffle filtering.
    • Syntax :
      • Questions with no question text are now allowed.
    • Bugs fixed :
      • Fixed bug when the list of choice is only "|".
      • Fixed a bug allowing to set a negative coef to a question.
  • 0.7b
    • Improvements :
      • Possibility of shuffling the whole quiz (ECMAscript)
    • Syntax :
      • Questions can be separated by only one blank line.
    • Bugs fixed :
      • It is now possible to write a correction inside question's headings.
      • Removed an XSS vulnerability alowing to add unsafe HTML markup and script after the last question.
    • Other :
      • It is no more possible to write text betweens questions !
  • 0.5b
    Thanks to Tim Starling code's reviews, several bugs have been cleaned up, the XSS holes removed and the extension is ready to be installed on the wikiversity.
    • Improvements :
      • New question type : "categorical question".
      • Possibility to write text betweens questions.
      • Creation of a standard internationalisation file.
      • Possibilty of "unchecking" radio button on double-click.
    • Syntax :
      • For technical resons, questions must b separated by at least 2 blank lines.
  • 0.1b
    First release !

Thanks[edit | edit source]

Thanks to those who helped me for their invaluable councils, especially

External links[edit | edit source]

See also[edit | edit source]