Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Save category description in Moodle XML import/export: Difference between revisions

From MoodleDocs
No edit summary
Line 25: Line 25:
== Proposed XML structure ==
== Proposed XML structure ==


Simple situation. We have category without parent.
<code xml>
<question type="category">
<question type="category">
<category>
<category>
Line 33: Line 36:
</description>
</description>
</question>
</question>
</code>
Hard situation. We have category with parent.
<code xml>
<question type="category">
<category>
<text>{<Assignment>}/{<Category>}</text>
</category>
<description>
<text>{<Description>}</text>
</description>
</question>
<question type="category">
<category>
<text>{<Assignment>}/{<Category>}...</text>
</category>
<description>
<text>{<Description>}</text>
</description>
</question>
</code>


== Old export compatibility problem ==
== Old export compatibility problem ==

Revision as of 12:20, 13 November 2014

What is not saved?

Some things are not saved at this format of import/expor:

1. description of the exported category,

2. description of parent category,

Current XML structure

<question type="category">

   <category>
       <text>{<Assignment>}/{<Category>}[/<Subcategory>]...</text>
   </category>

</question>

Assignment can have one of two values:

  1. $course$ - сategory refers to the course,
  2. $system$ - Category refers to the system.

Category and Subcategory - name of category and subcategory written via '/' as path.

Proposed XML structure

Simple situation. We have category without parent.

<question type="category"> <category> <text>{<Assignment>}/{<Category>}</text> </category> <description> <text>{<Description>}</text> </description> </question>

Hard situation. We have category with parent.

<question type="category"> <category> <text>{<Assignment>}/{<Category>}</text> </category> <description> <text>{<Description>}</text> </description> </question>

<question type="category"> <category> <text>{<Assignment>}/{<Category>}...</text> </category> <description> <text>{<Description>}</text> </description> </question>

Old export compatibility problem