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 37: Line 37:
   <category>
   <category>
     <name>
     <name>
       <text>$current category name$</text>
       <text>$category$</text>
     </name>
     </name>
     <description>
     <description>
Line 52: Line 52:
   <category>
   <category>
     <name>
     <name>
       <text>$parent category name$</text>
       <text>$parent$</text>
     </name>
     </name>
     <description>
     <description>
Line 59: Line 59:
     <category>
     <category>
       <name>
       <name>
         <text>$current category name$</text>
         <text>$category$</text>
       </name>
       </name>
       <description>
       <description>

Revision as of 12:08, 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

If current category has not parent then

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

else

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

Proposed XML structure

If the category has not parent then

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

else

<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>

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.