Jump to content

Extension:Quiz

From mediawiki.org
This page is a translated version of the page Extension:Quiz and the translation is 100% complete.
MediaWiki 拡張機能マニュアル
Quiz
リリースの状態: 安定
実装 タグ , フック
説明 クイズ機能を提供
作者 Lrbabeトーク
最新バージョン 1.2.0 (2015-12-08)
MediaWiki 1.25+
ライセンス GNU 一般公衆利用許諾書 2.0 以降
ダウンロード
and format documentation: v:Help:Quiz
四半期ごとのダウンロード数 28 (Ranked 112nd)
translatewiki.net で翻訳を利用できる場合は、Quiz 拡張機能の翻訳にご協力ください
問題点 未解決のタスク · バグを報告

QuizWikiversityで使われています。 この拡張機能の目的:

  • 使い方がいたってシンプル; 可能性を有す強力な拡張機能。
  • 提案や改善が良く行われる(新タイプが簡単に追加できる)

使用法

Other help pages are hosted on the Wikiversities in order to allow for working examples.

インストール

  • ダウンロードして、ファイルをextensions/フォルダー内のQuizという名前のディレクトリ内に配置します。
    開発者とコード寄稿者は、上記の代わりに以下を使用してGitからインストールします:cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/Quiz
  • 以下のコードを LocalSettings.php ファイルの末尾に追加します:
    wfLoadExtension( 'Quiz' );
    
  • Yes 完了 – ウィキの「Special:Version」に移動して、拡張機能が正しくインストールされたことを確認します。

開発

新しい質問のタイプを追加

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.

  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.

関連項目