From 6917eee804439f7ec1dffe6be44e49c0b1fe649f Mon Sep 17 00:00:00 2001 From: Dan Marsden Date: Mon, 15 Aug 2011 16:59:30 +1200 Subject: [PATCH] MDL-28937 SCORM 2004 ADL TEST CM-01 MDL-28740 first part of check for hidecontinue param in SCO - prevent next item in TOC from being selectable and disable buttons in navbar if links don't exist in TOC --- mod/scorm/locallib.php | 7 +++++-- mod/scorm/module.js | 10 +++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/mod/scorm/locallib.php b/mod/scorm/locallib.php index 3938ba33ea0..88de2105172 100644 --- a/mod/scorm/locallib.php +++ b/mod/scorm/locallib.php @@ -1306,6 +1306,7 @@ function scorm_get_toc($user,$scorm,$cmid,$toclink=TOCJSLINK,$currentorg='',$sco $nextid = 0; $findnext = false; $parents[$level]='/'; + $prevsco = ''; 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 ($toclink == TOCFULLURL) { //display toc with urls for structure page + if (!empty($prevsco) && scorm_version_check($scorm->version, SCORM_13) && !empty($prevsco->hidecontinue)) { + $result->toc .= ''.$statusicon.' '.format_string($sco->title).''; + } else if ($toclink == TOCFULLURL) { //display toc with urls for structure page $url = $CFG->wwwroot.'/mod/scorm/player.php?a='.$scorm->id.'&currentorg='.$currentorg.$modestr.'&scoid='.$sco->id; $result->toc .= $statusicon.' '.format_string($sco->title).''.$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; } } + $prevsco = $sco; } for ($i=0;$i<$level;$i++) { $result->toc .= "\t\t\n"; diff --git a/mod/scorm/module.js b/mod/scorm/module.js index fd14add7552..ef4d1ef1ec3 100644 --- a/mod/scorm/module.js +++ b/mod/scorm/module.js @@ -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() { - 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() { -- 2.43.0