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 1: Line 1:
== What is not saved? ==
== What is not saved? ==


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


1. description of the exported category,
1. description of the exported category,


2. description of parent category.
2. description of parent category,


== Current XML structure ==
== Current XML structure ==


If current category has not parent then
<code xml>
 
<pre>
<question type="category">
<question type="category">
  <category>
    <category>
    <text>$course$/$category$</text>
        <text>{<Assignment>}/{<Category>}[/<Subcategory>]...</text>
  </category>
    </category>
</question>
</question>
</pre>
</code>
 
Assignment can have one of two values:
#$course$ - сategory refers to the course,
#$system$ - Category refers to the system.


else
Category and Subcategory - name of category and subcategory.


<pre>
<question type="category">
  <category>
    <text>$course$/$parent$/$category$</text>
  </category>
</question>
</pre>


== Proposed XML structure ==
== Proposed XML structure ==


If the category has not parent then
<pre>
<question type="category">
<question type="category">
  <category>
<name>
    <name>
<text>{<Category>}</text>
      <text>$category$</text>
</name>
    </name>
<description>
    <description>
<text>{<Description>}</text>
      <text>Description of category</text>
</description>
    </description>
<parent type={<"category">|<"assignment">}>
  </category>
<name>
<text>{<Category>|<Assignment>}</text>
</name>
</parent>
</question>
</question>
</pre>
else
<pre>
<question type="category">
  <category>
    <name>
      <text>$parent$</text>
    </name>
    <description>
      <text>Description of category</text>
    </description>
    <category>
      <name>
        <text>$category$</text>
      </name>
      <description>
        <text>Description of category</text>
      </description>
    </category>
  </category>
</question>
</pre>


== Old export compatibility problem ==
== Old export compatibility problem ==
The proposed structure is not compatible to the old.
I consider that proposed structure is possible to use as an independent format.

Revision as of 14:58, 11 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.


Proposed XML structure

<question type="category"> <name> <text>{<Category>}</text> </name> <description> <text>{<Description>}</text> </description> <parent type={<"category">|<"assignment">}> <name> <text>{<Category>|<Assignment>}</text> </name> </parent> </question>

Old export compatibility problem