Extension:Quiz

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

Release status:Extension status stable

Quiz extension.png
ImplementationTemplate:Extension#type Tag, Hook
DescriptionTemplate:Extension#description Quiz tool for MediaWiki
Author(s)Template:Extension#username Lrbabetalk
Latest versionTemplate:Extension#version 1.2.0 (2013-08-13)
MediaWikiTemplate:Extension#mediawiki 1.23
LicenseTemplate:Extension#license GNU General Public License 2.0 or later
Download
ExampleTemplate:Extension#example and format documentation: v:Help:Quiz
Hooks usedTemplate:Extension#hook
ParserFirstCallInitManual:Hooks/ParserFirstCallInit

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

Check usage and version matrix.

IssuesPhabricator

Open tasks · Report a bug

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]

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

Installation instructions[edit]

  • Download and place the file(s) in a directory called Quiz in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
    require_once "$IP/extensions/Quiz/Quiz.php";
    
  • YesY Done - Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

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

  1. cd to the "extensions" directory of your wiki.
  2. git clone https://phabricator.wikimedia.org/diffusion/EQUI/extension-quiz.git
    
  3. Modify LocalSettings.php same as above.

Contributing[edit]

Adding a new question type[edit]

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]

Report new bugs to the phabricator board.

The bugs reported for pre 1.0 versions have been archived.

does not work with[edit]

  • 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)

To do[edit]

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

  • 1.1
    • Do not display the (i) to users into case insensitive textfields.
    • Use the template {{plural}} in some messages.
  • 1.2?
    • Basic GIFT import and export to existing format
  • 2.0
  • 3.0

Changelog[edit]

  • 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]

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

External links[edit]

See also[edit]