]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-15234 - exported questions from moodle 1.8 will not be imported correctly on...
authoragrabs <agrabs>
Fri, 13 Jun 2008 21:52:25 +0000 (21:52 +0000)
committeragrabs <agrabs>
Fri, 13 Jun 2008 21:52:25 +0000 (21:52 +0000)
mod/feedback/import.php
mod/feedback/version.php

index 3fdd94e5fd6dd86896ef776a1bfd7d84fb42e708..230d2703cee21dff1a683a997e9d713479efc696 100644 (file)
             $position++;
             //check the typ
             $typ = $item['@']['TYPE'];
+            
+            //check oldtypes first
+            switch($typ) {
+                case 'radio':
+                    $typ = 'multichoice';
+                    $oldtyp = 'radio';
+                    break;
+                case 'dropdown':
+                    $typ = 'multichoice';
+                    $oldtyp = 'dropdown';
+                    break;
+                case 'check':
+                    $typ = 'multichoice';
+                    $oldtyp = 'check';
+                    break;
+                case 'radiorated':
+                    $typ = 'multichoicerated';
+                    $oldtyp = 'radiorated';
+                    break;
+                case 'dropdownrated':
+                    $typ = 'multichoicerated';
+                    $oldtyp = 'dropdownrated';
+                    break;
+                default:
+                    $oldtyp = $typ;
+            }
+
             $itemclass = 'feedback_item_'.$typ;
             if($typ != 'pagebreak' AND !class_exists($itemclass)) {
                 $error->stat = false;
             $newitem->typ = $typ;
             $newitem->name = trim($item['#']['ITEMTEXT'][0]['#']);
             $newitem->presentation = trim($item['#']['PRESENTATION'][0]['#']);
+            //check old types of radio, check, and so on
+            switch($oldtyp) {
+                case 'radio':
+                    $newitem->presentation = 'r>>>>>'.$newitem->presentation;
+                    break;
+                case 'dropdown':
+                    $newitem->presentation = 'd>>>>>'.$newitem->presentation;
+                    break;
+                case 'check':
+                    $newitem->presentation = 'c>>>>>'.$newitem->presentation;
+                    break;
+                case 'radiorated':
+                    $newitem->presentation = 'r>>>>>'.$newitem->presentation;
+                    break;
+                case 'dropdownrated':
+                    $newitem->presentation = 'd>>>>>'.$newitem->presentation;
+                    break;
+            }
+            
             if($typ != 'pagebreak') {
                 $newitem->hasvalue = $itemobj->get_hasvalue();
             }else {
index 8377caa1165657eb9dadff4f91b99c97e66fef87..e27f44ba5640dce1a01fdda85761a9ec89c431ef 100644 (file)
@@ -10,7 +10,7 @@
 */
 
    
-    $module->version = 2008052206; // The current module version (Date: YYYYMMDDXX)
+    $module->version = 2008052207; // The current module version (Date: YYYYMMDDXX)
     $module->requires = 2007101503;  // Requires this Moodle version
     $feedback_version_intern = 1; //this version is used for restore older backups
     $module->cron = 0; // Period for cron to check this module (secs)