MDL-26894: merged from SCORM 1.2 (scorm_12lib.php) after an XDebug audit session
authorMatteo Scaramuccia <moodle@matteoscaramuccia.com>
Sat, 19 Mar 2011 10:15:10 +0000 (11:15 +0100)
committerMatteo Scaramuccia <moodle@matteoscaramuccia.com>
Sat, 19 Mar 2011 10:15:10 +0000 (11:15 +0100)
mod/scorm/datamodels/scorm_12lib.php
mod/scorm/datamodels/scorm_13lib.php

index 4319dca..dcae0e4 100644 (file)
@@ -313,7 +313,7 @@ function scorm_get_toc($user,$scorm,$cmid,$toclink=TOCJSLINK,$currentorg='',$sco
         }
 
         if ($play) {
-            // it is possible that scoid is still not set, in this case we dont want an empty object
+            // it is possible that $scoid is still not set, in this case we don't want an empty object
             if ($scoid) {
                 $sco = scorm_get_sco($scoid);
             }
index 3630285..d78b444 100644 (file)
@@ -207,7 +207,10 @@ function scorm_get_toc($user,$scorm,$cmid,$toclink=TOCJSLINK,$currentorg='',$sco
         }
 
         if ($play) {
-            $sco = $DB->get_record('scorm_scoes', array('id'=>$scoid));
+            // it is possible that $scoid is still not set, in this case we don't want an empty object
+            if ($scoid) {
+                $sco = scorm_get_sco($scoid);
+            }
             $sco->previd = $previd;
             $sco->nextid = $nextid;
             $result->sco = $sco;