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
Line 24: Line 24:
<pre>
<pre>
<question type="category">
<question type="category">
   <category name="$current category name$">
   <category>
     <description>Description of category</description>
    <name>
      <text>$current category name$</text>
    </name>
     <description>
      <text>Description of category</text>
    </description>
   </category>
   </category>
</question>
</question>
Line 34: Line 39:
<pre>
<pre>
<question type="category">
<question type="category">
   <category name="$parent category name$">
   <category>
     <description>Description of category</description>
    <name>
     <category name="$current category name$">
      <text>$parent category name$</text>
       <description>Description of category</description>
    </name>
     <description>
      <text>Description of category</text>
    </description>
     <category>
      <name>
        <text>$current category name$</text>
      </name>
       <description>
        <text>Description of category</text>
      </description>
     </category>
     </category>
   </category>
   </category>

Revision as of 12:04, 18 October 2014

What is not saved?

At this format of import/export is not saved:

1. description of the current category,

2. description of parental category(categories).

Current XML structure

<question type="category">
  <category>
    <text> $course$ / [ $parent category name$ / ] $current category name$ </text>
  </category>
</question>

The amount of block [ $parent category name$ / ] can be more or equally to zero.

Proposed XML structure

If the category has not parent then

<question type="category">
  <category>
    <name>
      <text>$current category name$</text>
    </name>
    <description>
      <text>Description of category</text>
    </description>
  </category>
</question>

else

<question type="category">
  <category>
    <name>
      <text>$parent category name$</text>
    </name>
    <description>
      <text>Description of category</text>
    </description>
    <category>
      <name>
        <text>$current category name$</text>
      </name>
      <description>
        <text>Description of category</text>
      </description>
    </category>
  </category>
</question>

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.