]> git.mjollnir.org Git - moodle.git/commitdiff
Downgraded a new feature to fix the module
authorbobopinna <bobopinna>
Tue, 26 Sep 2006 10:23:37 +0000 (10:23 +0000)
committerbobopinna <bobopinna>
Tue, 26 Sep 2006 10:23:37 +0000 (10:23 +0000)
mod/scorm/datamodels/scormlib.php

index 54d419f9f0a0498aadc40fd7c1c352554bf49170..493a561c5a16e0e5f6aebfde5b5b5ca1552f68bd 100644 (file)
@@ -190,7 +190,7 @@ function scorm_parse_scorm($pkgdir,$scormid) {
         $xmlstring = file_get_contents($manifestfile);
         $objXML = new xml2Array();
         $manifests = $objXML->parse($xmlstring);
-        //   print_r($manifests); 
+        //print_r($manifests); 
         $scoes = new stdClass();
         $scoes->version = '';
         $scoes = scorm_get_manifest($manifests,$scoes);
@@ -200,7 +200,8 @@ function scorm_parse_scorm($pkgdir,$scormid) {
             foreach ($scoes->elements as $manifest => $organizations) {
                 foreach ($organizations as $organization => $items) {
                     foreach ($items as $identifier => $item) {
-                        $newitem = new stdClass();
+                        // This new db mngt will support all SCORM future extensions
+                        /*$newitem = new stdClass(); 
                         $newitem->scorm = $scormid;
                         $newitem->manifest = $manifest;
                         $newitem->organization = $organization;
@@ -228,8 +229,19 @@ function scorm_parse_scorm($pkgdir,$scormid) {
                                 $data->value = $item->$optionaldata;
                                 $dataid = insert_record('scorm_scoes_data');
                             }
-                        }
+                        } */
 
+                        $item->scorm = $scormid;
+                        $item->manifest = $manifest;
+                        $item->organization = $organization;
+                        if ($olditemid = scorm_array_search('identifier',$item->identifier,$olditems)) {
+                            $item->id = $olditemid;
+                            $id = update_record('scorm_scoes',$item);
+                            unset($olditems[$olditemid]);
+                        } else {
+                            $id = insert_record('scorm_scoes',$item);
+                        }
+                
                         if (($launch == 0) && ((empty($scoes->defaultorg)) || ($scoes->defaultorg == $identifier))) {
                             $launch = $id;
                         }
@@ -239,7 +251,7 @@ function scorm_parse_scorm($pkgdir,$scormid) {
             if (!empty($olditems)) {
                 foreach($olditems as $olditem) {
                    delete_records('scorm_scoes','id',$olditem->id);
-                   delete_records('scorm_scoes_data','scoid',$olditem->id);
+                   //delete_records('scorm_scoes_data','scoid',$olditem->id);
                    delete_records('scorm_scoes_track','scoid',$olditem->id);
                 }
             }