From: agrabs Date: Fri, 13 Jun 2008 21:52:25 +0000 (+0000) Subject: MDL-15234 - exported questions from moodle 1.8 will not be imported correctly on... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=0f22be2e94fea817d158e3934c16bbf943f4894e;p=moodle.git MDL-15234 - exported questions from moodle 1.8 will not be imported correctly on moodle 1.9 --- diff --git a/mod/feedback/import.php b/mod/feedback/import.php index 3fdd94e5fd..230d2703ce 100644 --- a/mod/feedback/import.php +++ b/mod/feedback/import.php @@ -181,6 +181,33 @@ $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; @@ -195,6 +222,25 @@ $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 { diff --git a/mod/feedback/version.php b/mod/feedback/version.php index 8377caa116..e27f44ba56 100644 --- a/mod/feedback/version.php +++ b/mod/feedback/version.php @@ -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)