From 9316beca89e278597313579056a1c1dbf770c29c Mon Sep 17 00:00:00 2001 From: danmarsden Date: Mon, 1 Dec 2008 03:32:39 +0000 Subject: [PATCH] force scorm update:MDL-17034: force update of SCORM when scorm_simple_play is used. --- mod/scorm/locallib.php | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/mod/scorm/locallib.php b/mod/scorm/locallib.php index bd80ca6ff48..e36d6a058e2 100755 --- a/mod/scorm/locallib.php +++ b/mod/scorm/locallib.php @@ -775,23 +775,27 @@ function scorm_view_display ($user, $scorm, $action, $cm, $boxwidth='') { function scorm_simple_play($scorm,$user) { global $DB; - $result = false; + $result = false; - $scoes = $DB->get_records_select('scorm_scoes', 'scorm = ? AND launch <> ?', array($scorm->id, $DB->sql_empty())); + if ($scorm->updatefreq == UPDATE_EVERYTIME) { + scorm_parse($scorm, false); + } - if ($scoes && (count($scoes) == 1)) { - if ($scorm->skipview >= 1) { - $sco = current($scoes); - if (scorm_get_tracks($sco->id,$user->id) === false) { - header('Location: player.php?a='.$scorm->id.'&scoid='.$sco->id); - $result = true; - } else if ($scorm->skipview == 2) { - header('Location: player.php?a='.$scorm->id.'&scoid='.$sco->id); - $result = true; - } - } - } - return $result; + $scoes = $DB->get_records_select('scorm_scoes', 'scorm = ? AND launch <> ?', array($scorm->id, $DB->sql_empty())); + + if ($scoes && (count($scoes) == 1)) { + if ($scorm->skipview >= 1) { + $sco = current($scoes); + if (scorm_get_tracks($sco->id,$user->id) === false) { + header('Location: player.php?a='.$scorm->id.'&scoid='.$sco->id); + $result = true; + } else if ($scorm->skipview == 2) { + header('Location: player.php?a='.$scorm->id.'&scoid='.$sco->id); + $result = true; + } + } + } + return $result; } /* function scorm_simple_play($scorm,$user) {