]> git.mjollnir.org Git - moodle.git/commitdiff
Bug #6050 - import glossary entries to new glossary not creating new glossary; merged...
authorskodak <skodak>
Fri, 7 Jul 2006 19:54:22 +0000 (19:54 +0000)
committerskodak <skodak>
Fri, 7 Jul 2006 19:54:22 +0000 (19:54 +0000)
mod/glossary/import.php

index fa1cd6b522fde0595a889720865454822be64909..0285eda2fd061949e0f82ff32ebf7d0cc92272a3 100644 (file)
@@ -8,7 +8,7 @@
     $id = required_param('id', PARAM_INT);    // Course Module ID
 
     $step     = optional_param('step', 0, PARAM_INT);
-    $current  = optional_param('dest', 'current', PARAM_ALPHA);   // current | new
+    $dest     = optional_param('dest', 'current', PARAM_ALPHA);   // current | new
     $file     = optional_param('file', '', PARAM_FILE);         // file to import
     $catsincl = optional_param('catsincl', 0, PARAM_INT);         // Import Categories too?
 
                     $mod->module = $currmodule->id;
                     $mod->course = $course->id;
                     $mod->modulename = 'glossary';
+                    $mod->section = 0;
 
                     if (! $mod->coursemodule = add_course_module($mod) ) {
                         error("Could not add a new course module");
                 if ( $newentry->id = insert_record("glossary_entries",$newentry) )  {
                     $importedentries++;
 
-                    $xmlaliases = $xmlentry['#']['ALIASES'][0]['#']['ALIAS'];
+                    $xmlaliases = @$xmlentry['#']['ALIASES'][0]['#']['ALIAS']; // ignore missing ALIASES
                     for($k = 0; $k < sizeof($xmlaliases); $k++) {
                     /// Importing aliases
                         $xmlalias = $xmlaliases[$k];
 
                     if ( $catsincl ) {
                         // If the categories must be imported...
-                        $xmlcats = $xmlentry['#']['CATEGORIES'][0]['#']['CATEGORY'];
+                        $xmlcats = @$xmlentry['#']['CATEGORIES'][0]['#']['CATEGORY']; // ignore missing CATEGORIES
                         for($k = 0; $k < sizeof($xmlcats); $k++) {
                             $xmlcat = $xmlcats[$k];
                             unset($newcat);