<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
	<id>http://wiki.mipt.ru/index.php?action=history&amp;feed=atom&amp;title=Development%3AQuestion_import%2Fexport_formats</id>
	<title>Development:Question import/export formats - История изменений</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.mipt.ru/index.php?action=history&amp;feed=atom&amp;title=Development%3AQuestion_import%2Fexport_formats"/>
	<link rel="alternate" type="text/html" href="http://wiki.mipt.ru/index.php?title=Development:Question_import/export_formats&amp;action=history"/>
	<updated>2026-05-06T17:41:34Z</updated>
	<subtitle>История изменений этой страницы в вики</subtitle>
	<generator>MediaWiki 1.42.1</generator>
	<entry>
		<id>http://wiki.mipt.ru/index.php?title=Development:Question_import/export_formats&amp;diff=11630&amp;oldid=prev</id>
		<title>Олег Давидович: 1 версия импортирована</title>
		<link rel="alternate" type="text/html" href="http://wiki.mipt.ru/index.php?title=Development:Question_import/export_formats&amp;diff=11630&amp;oldid=prev"/>
		<updated>2024-10-21T08:52:59Z</updated>

		<summary type="html">&lt;p&gt;1 версия импортирована&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Предыдущая версия&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Версия от 08:52, 21 октября 2024&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Олег Давидович</name></author>
	</entry>
	<entry>
		<id>http://wiki.mipt.ru/index.php?title=Development:Question_import/export_formats&amp;diff=11629&amp;oldid=prev</id>
		<title>1&gt;TimHunt в 12:33, 5 марта 2009</title>
		<link rel="alternate" type="text/html" href="http://wiki.mipt.ru/index.php?title=Development:Question_import/export_formats&amp;diff=11629&amp;oldid=prev"/>
		<updated>2009-03-05T12:33:39Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Question development}}&lt;br /&gt;
&lt;br /&gt;
==Importing or exporting questions==&lt;br /&gt;
&lt;br /&gt;
Questions coming from other Moodle courses or from other e-learning systems (i.e. Blackboard, Webct etc.) can be imported in Moodle.&lt;br /&gt;
Similarly, Moodle offers a process to export questions to other systems in different format ( XML, QTI etc.).&lt;br /&gt;
The import and export code is mostly written in format.php files located in a directory specific to the type of format files from which the import or export is done.&lt;br /&gt;
&lt;br /&gt;
* examples:&lt;br /&gt;
** &amp;#039;&amp;#039;&amp;#039;question/format/aiken/format.php&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
** &amp;#039;&amp;#039;&amp;#039;question/format/blackboard/format.php&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
** &amp;#039;&amp;#039;&amp;#039;question/format/qti2/format.php&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
** &amp;#039;&amp;#039;&amp;#039;question/format/xml/format.php&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
there is a default class qformat_default defined in &amp;#039;&amp;#039;&amp;#039;question/format.php&amp;#039;&amp;#039;&amp;#039; and the process is controlled by&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;question/import.php&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;question/export.php&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Import/Export formats are a pluggable resource and will automatically be &amp;quot;discovered&amp;quot; and made available to users simply by adding the plugin to question/format. Cross-support for optional questiontype plugins was added in 1.9 and support for language files (specifically a help file) has been implemented in Moodle 2.0.&lt;br /&gt;
&lt;br /&gt;
=== Developing an import/export plugin ===&lt;br /&gt;
&lt;br /&gt;
The simplest and most comprehensive import/export type is probably the Moodle XML format. There are also a few option plugins in contrib (plugins/question/format) that you can look at. It is worth studying these file (question/format/xml/format.php) along with the parent class (question/format.php) to get an understanding of what is going on. Some other custom formats circumvent the normal rules and structure and should be studied with caution.&lt;br /&gt;
&lt;br /&gt;
Some things to note:&lt;br /&gt;
* Study the question/format.php file to establish which methods must be overridden. &lt;br /&gt;
* Each format.php file can support import, export or both indicated by the &amp;#039;&amp;#039;&amp;#039;provide_import()&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;provide_export()&amp;#039;&amp;#039;&amp;#039; methods which must be overridden to return &amp;#039;&amp;#039;true&amp;#039;&amp;#039; as required.  &lt;br /&gt;
* Do not read or write directly to the database, this is handled for you by the parent class&lt;br /&gt;
* when importing, question objects need to be in a format suitable for use by the questiontype-&amp;gt;save_options() method (see question/type/questiontype.php class). The easiest way to get this information is to do a &amp;#039;&amp;#039;&amp;#039;print_r($question);&amp;#039;&amp;#039;&amp;#039; at the start of the &amp;#039;&amp;#039;&amp;#039;save_options()&amp;#039;&amp;#039;&amp;#039; method for the appropriate question type when a question is saved. The imported object must be the same format.&lt;br /&gt;
* when importing, always obtain &amp;#039;empty&amp;#039; question objects from the &amp;#039;&amp;#039;&amp;#039;defaultquestion()&amp;#039;&amp;#039;&amp;#039; method, which sets all required properties to their default values.&lt;br /&gt;
* for exporting the populated $question object is supplied to the format class. Again, &amp;#039;&amp;#039;&amp;#039;print_r($question)&amp;#039;&amp;#039;&amp;#039; can be used to learn the format.&lt;br /&gt;
* You should add a help file for the plugin using the structure lang/en_utf8/help/&amp;#039;&amp;#039;myformat&amp;#039;&amp;#039;/&amp;#039;&amp;#039;myformat&amp;#039;&amp;#039;.html where &amp;#039;&amp;#039;myformat&amp;#039;&amp;#039; is the name of your import/export plugin (Moodle 2.0).&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
[https://docs.moodle.org/en/Lesson#Types_of_questions_available_within_a_lesson  Lesson question types] - both Lesson and Quiz can import the basic Moodle question types.&lt;br /&gt;
&lt;br /&gt;
[[Category:Developer|Question import/export formats]]&lt;br /&gt;
[[Category:Quiz]]&lt;br /&gt;
[[Category:Lesson]]&lt;/div&gt;</summary>
		<author><name>1&gt;TimHunt</name></author>
	</entry>
</feed>