Save category description in Moodle XML import/export: Difference between revisions
No edit summary |
|||
Line 12: | Line 12: | ||
<question type="category"> | <question type="category"> | ||
<category> | <category> | ||
<text>{< | <text>{<Context>}/{<Category>}[/<Subcategory>]...</text> | ||
</category> | </category> | ||
</question> | </question> | ||
</code> | </code> | ||
Context: | |||
#$course$ - сategory refers to the course, | #$course$ - сategory refers to the course, | ||
#$system$ - Category refers to the system. | #$system$ - Category refers to the system. | ||
Line 32: | Line 32: | ||
<question type="category"> | <question type="category"> | ||
<category> | <category> | ||
<text>{< | <text>{<Context>}/{<Category>}</text> | ||
</category> | </category> | ||
<description> | <description> | ||
Line 49: | Line 49: | ||
<question type="category"> | <question type="category"> | ||
<category> | <category> | ||
<text>{< | <text>{<Context>}/{<Category>}</text> | ||
</category> | </category> | ||
<description> | <description> | ||
Line 58: | Line 58: | ||
<question type="category"> | <question type="category"> | ||
<category> | <category> | ||
<text>{< | <text>{<Context>}/{<Category>}{/<Subcategory>}</text> | ||
</category> | </category> | ||
<description> | <description> | ||
Line 68: | Line 68: | ||
<question type="category"> | <question type="category"> | ||
<category> | <category> | ||
<text>{< | <text>{<Context>}/{<Category>}...{/<Subcategory>}</text> | ||
</category> | </category> | ||
<description> | <description> |
Revision as of 19:13, 24 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>{<Context>}/{<Category>}[/<Subcategory>]...</text>
</category>
</question>
Context:
- $course$ - сategory refers to the course,
- $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>{<Context>}/{<Category>}</text>
</category>
<description>
<text>{<Description>}</text>
</description>
</question>
In structure <question/> appended structure <description/> with description for last category in path.
Complex situation
We have category with parent.
<question type="category">
<category>
<text>{<Context>}/{<Category>}</text>
</category>
<description>
<text>{<Description>}</text>
</description>
</question>
<question type="category">
<category>
<text>{<Context>}/{<Category>}{/<Subcategory>}</text>
</category>
<description>
<text>{<Description>}</text>
</description>
</question>
...................................................................................
...................................................................................
<question type="category">
<category>
<text>{<Context>}/{<Category>}...{/<Subcategory>}</text>
</category>
<description>
<text>{<Description>}</text>
</description>
</question>
Block <description/> contains description for last category in path.
For category export we need export all categories with description which are parent for exported category.
Old export compatibility problem
If you use the suggested structure you will be able to save the category description and to import categories from XML files which were exported with old format.