Open main menu

Extension:QuizTabulate

MediaWiki extensions manual
OOjs UI icon advanced.svg
QuizTabulate
Release status: beta
Implementation Parser function , Database , Hook
Description Tabulates user input for the quiz extension
Author(s) Ike Hecht (tosfostalk)
Latest version 1.2.0.1 (July 2014)
Compatibility policy release branches
PHP 5.3+
Database changes Yes
License GNU General Public License 2.0 or later
Download
  • $wgQuizNamespace
viewquiztabulate
Translate the QuizTabulate extension if it is available at translatewiki.net
Check usage and version matrix.

The QuizTabulate extension tabulates user input for the quiz extension. It allows transclusion of a quiz from the Quiz namespace. It then displays the tabulated results of that quiz on the quiz's page. In other words, it records and displays the number of times that quiz's answers were chosen.

This extension has been tested to work well. However, it is experimental because it currently only works with the quiz extension's "Multiple choice" question type.

InstallationEdit

The Quiz extension must first be installed properly and working!
  • Download and place the file(s) in a directory called QuizTabulate in your extensions/ folder.

Hook installationEdit

If you are using an older version of the quiz extension, you must add one line of code to it for tabulation to work. In the file named Quiz.class.php, make the following change to the parseQuestion function (around line 290):

	...
	function parseQuestion( $matches ) {
		$question = new Question(
			$this->mBeingCorrected,
			$this->mCaseSensitive,
			$this->mQuestionId,
			$this->mParser
		);
		wfRunHooks( 'QuizQuestionCreated', array( $this, &$question ) ); //*** INSERT THIS LINE! ***
		$buffer = $question->parseHeader( $matches[1] );
		...

The latest master branch of the Quiz extension already has this code inserted and does not require modification.

Configuration parametersEdit

$wgQuizNamespace
The extension creates a custom namespace called "Quiz". By default, quiz results are only displayed on pages in this namespace. You can change the special Quiz namespace to any namespace you'd like. For example:
$wgQuizNamespace = NS_MY_NAMESPACE; //Where NS_MY_NAMESPACE is a constant equal to, for example: 140

User rightsEdit

viewquiztabulate
Which users are allowed to see the tabulated results? By default this is:
$wgGroupPermissions['*'            ]['viewquiztabulate'] = false;
$wgGroupPermissions['user'         ]['viewquiztabulate'] = false;
$wgGroupPermissions['autoconfirmed']['viewquiztabulate'] = false;
$wgGroupPermissions['bot'          ]['viewquiztabulate'] = true; // registered bots
$wgGroupPermissions['sysop'        ]['viewquiztabulate'] = true;

UsageEdit

  1. Create a quiz in the Quiz namespace.
  2. Transclude that quiz on some other page by using the #quiztabulate parser function. (optional)
  3. Submit some answers.
  4. View your answers on the quiz's page in the Quiz namespace.

ExampleEdit

  1. Create a page called Quiz:Test with the following contents:
    <quiz>
    {Bulgaria and Rumania joined the 
    European Union in 2007.
    |type="()"}
    + TRUE.
    - FALSE.
    </quiz>
    
  2. Create a page called Project:Sandbox with the following contents:
    {{#quiztabulate:Test}}
    
  3. Submit some answers.
  4. Navigate to Quiz:Test. Assuming you have the appropriate User rights, you will see the Quiz's results.

Resetting a quizEdit

Important: If anyone edits the Quiz page's source, it will reset the data for that quiz. Quiz data is tabulated for each individual revision of the Quiz page. This makes sense because if the quiz is changed, the old data is usually invalid. So navigating to a Quiz page will only show data for the current revision. To see data for a previous revision, load that revision (use the history tab).

Known issuesEdit

  • $wgQuizNamespace should allow an array.
  • The extension won't work properly if more than one Quiz is on a page. The Quiz extension is currently buggy under those circumstances anyway.
  • The extension needs to record more question types.
  • The extension does not track which answer(s) were correct.
  • Answer submissions are displayed in the order they were submitted. They should probably be shown in the order they were displayed to the users. On a related note, Answers that were never selected and submitted will not be displayed at all in the Quiz results.

See alsoEdit

  • The quiz extension (required)