MDL-28937 SCORM 2004 ADL TEST CM-01 MDL-28740 first part of check for hidecontinue...
authorDan Marsden <dan@danmarsden.com>
Mon, 15 Aug 2011 04:59:30 +0000 (16:59 +1200)
committerDan Marsden <dan@danmarsden.com>
Mon, 15 Aug 2011 06:33:33 +0000 (18:33 +1200)
mod/scorm/locallib.php
mod/scorm/module.js

index 3938ba3..88de210 100644 (file)
@@ -1306,6 +1306,7 @@ function scorm_get_toc($user,$scorm,$cmid,$toclink=TOCJSLINK,$currentorg='',$sco
         $nextid = 0;
         $findnext = false;
         $parents[$level]='/';
         $nextid = 0;
         $findnext = false;
         $parents[$level]='/';
+        $prevsco = '';
         foreach ($scoes as $pos => $sco) {
             $isvisible = false;
             $sco->title = $sco->title;
         foreach ($scoes as $pos => $sco) {
             $isvisible = false;
             $sco->title = $sco->title;
@@ -1421,8 +1422,9 @@ function scorm_get_toc($user,$scorm,$cmid,$toclink=TOCJSLINK,$currentorg='',$sco
                         if ($sco->id == $scoid) {
                             $result->prerequisites = true;
                         }
                         if ($sco->id == $scoid) {
                             $result->prerequisites = true;
                         }
-
-                        if ($toclink == TOCFULLURL) { //display toc with urls for structure page
+                        if (!empty($prevsco) && scorm_version_check($scorm->version, SCORM_13) && !empty($prevsco->hidecontinue)) {
+                            $result->toc .= '<span>'.$statusicon.'&nbsp;'.format_string($sco->title).'</span>';
+                        } else if ($toclink == TOCFULLURL) { //display toc with urls for structure page
                             $url = $CFG->wwwroot.'/mod/scorm/player.php?a='.$scorm->id.'&amp;currentorg='.$currentorg.$modestr.'&amp;scoid='.$sco->id;
                             $result->toc .= $statusicon.'&nbsp;<a href="'.$url.'">'.format_string($sco->title).'</a>'.$score."\n";
                         } else { //display toc for inside scorm player
                             $url = $CFG->wwwroot.'/mod/scorm/player.php?a='.$scorm->id.'&amp;currentorg='.$currentorg.$modestr.'&amp;scoid='.$sco->id;
                             $result->toc .= $statusicon.'&nbsp;<a href="'.$url.'">'.format_string($sco->title).'</a>'.$score."\n";
                         } else { //display toc for inside scorm player
@@ -1457,6 +1459,7 @@ function scorm_get_toc($user,$scorm,$cmid,$toclink=TOCJSLINK,$currentorg='',$sco
                     $nextid = $nextsco->id;
                 }
             }
                     $nextid = $nextsco->id;
                 }
             }
+            $prevsco = $sco;
         }
         for ($i=0;$i<$level;$i++) {
             $result->toc .= "\t\t</ul></li>\n";
         }
         for ($i=0;$i<$level;$i++) {
             $result->toc .= "\t\t</ul></li>\n";
index fd14add..ef4d1ef 100644 (file)
@@ -146,11 +146,11 @@ M.mod_scorm.init = function(Y, hide_nav, hide_toc, toc_title, window_name, launc
          * @return void
          */
         var scorm_fixnav = function() {
          * @return void
          */
         var scorm_fixnav = function() {
-            scorm_buttons[0].set('disabled', (scorm_skipprev(scorm_current_node) == null));
-            scorm_buttons[1].set('disabled', (scorm_prev(scorm_current_node) == null));
-            scorm_buttons[2].set('disabled', (scorm_up(scorm_current_node) == null));
-            scorm_buttons[3].set('disabled', (scorm_next(scorm_current_node) == null));
-            scorm_buttons[4].set('disabled', (scorm_skipnext(scorm_current_node) == null));
+            scorm_buttons[0].set('disabled', (scorm_skipprev(scorm_current_node) == null || scorm_skipprev(scorm_current_node).title == null));
+            scorm_buttons[1].set('disabled', (scorm_prev(scorm_current_node) == null || scorm_prev(scorm_current_node).title == null));
+            scorm_buttons[2].set('disabled', (scorm_up(scorm_current_node) == null) || scorm_up(scorm_current_node).title == null);
+            scorm_buttons[3].set('disabled', (scorm_next(scorm_current_node) == null) || scorm_next(scorm_current_node).title == null);
+            scorm_buttons[4].set('disabled', (scorm_skipnext(scorm_current_node) == null || scorm_skipnext(scorm_current_node).title == null));
         };
 
         var scorm_resize_parent = function() {
         };
 
         var scorm_resize_parent = function() {