Patched a problem with asset resources

This commit is contained in:
bobopinna
2004-08-25 08:34:52 +00:00
parent a366326397
commit d64bc8aea6
5 changed files with 38 additions and 20 deletions

View File

@ -543,7 +543,7 @@ function scorm_parse($basedir,$file,$scorm_id) {
} }
} else { } else {
foreach ($resources as $label => $resource) { foreach ($resources as $label => $resource) {
if ((isset($resource['type'])) && ($resource['type'] == 'sco')) { if (!empty($resource['href'])) {
$sco->identifier = $label; $sco->identifier = $label;
$sco->title = $label; $sco->title = $label;
$sco->parent = '/'; $sco->parent = '/';

BIN
mod/scorm/pix/asset.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 B

View File

@ -73,7 +73,7 @@
// //
$bodyscripts = ""; $bodyscripts = "";
if ($scorm->popup != "") { if ($scorm->popup != "") {
$bodyscripts = "onLoad='SCOInitialize();' onUnload='API.SaveTotalTime(); closeMain();' onbeforeUnload='API.SaveTotalTime();'"; $bodyscripts = "onLoad='SCOInitialize();' onUnload='SCOFinish(); closeMain();' onbeforeUnload='SCOFinish();'";
} }
print_header($pagetitle, "$course->fullname", print_header($pagetitle, "$course->fullname",
"$navigation <a target=\"{$CFG->framename}\" href=\"view.php?id=$cm->id\" title=\"$scorm->summary\">$scorm->name</a>", "$navigation <a target=\"{$CFG->framename}\" href=\"view.php?id=$cm->id\" title=\"$scorm->summary\">$scorm->name</a>",
@ -173,8 +173,9 @@
} }
$score = ""; $score = "";
if ($sco_user=get_record("scorm_sco_users","scoid",$sco->id,"userid",$USER->id)) { if ($sco_user=get_record("scorm_sco_users","scoid",$sco->id,"userid",$USER->id)) {
if ( $sco_user->cmi_core_lesson_status == "") if ( $sco_user->cmi_core_lesson_status == "") {
$sco_user->cmi_core_lesson_status = "not attempted"; $sco_user->cmi_core_lesson_status = "not attempted";
}
echo " <img src=\"pix/".scorm_remove_spaces($sco_user->cmi_core_lesson_status).".gif\" alt=\"".get_string(scorm_remove_spaces($sco_user->cmi_core_lesson_status),"scorm")."\" title=\"".get_string(scorm_remove_spaces($sco_user->cmi_core_lesson_status),"scorm")."\" />\n"; echo " <img src=\"pix/".scorm_remove_spaces($sco_user->cmi_core_lesson_status).".gif\" alt=\"".get_string(scorm_remove_spaces($sco_user->cmi_core_lesson_status),"scorm")."\" title=\"".get_string(scorm_remove_spaces($sco_user->cmi_core_lesson_status),"scorm")."\" />\n";
if (($sco_user->cmi_core_lesson_status == "not attempted") || ($sco_user->cmi_core_lesson_status == "incomplete")) { if (($sco_user->cmi_core_lesson_status == "not attempted") || ($sco_user->cmi_core_lesson_status == "incomplete")) {
if ($currentSCO == "") { if ($currentSCO == "") {
@ -188,8 +189,12 @@
$score = "(".get_string("score","scorm").":&nbsp;".$sco_user->cmi_core_score_raw.")"; $score = "(".get_string("score","scorm").":&nbsp;".$sco_user->cmi_core_score_raw.")";
} }
} else { } else {
echo " <img src=\"pix/notattempted.gif\" alt=\"".get_string("notattempted","scorm")."\" />"; if ($sco->type == 'sco') {
$incomplete = true; echo " <img src=\"pix/notattempted.gif\" alt=\"".get_string("notattempted","scorm")."\" />";
$incomplete = true;
} else {
echo " <img src=\"pix/asset.gif\" alt=\"".get_string("asset","scorm")."\" />";
}
} }
echo " &nbsp;$startbold<a href=\"javascript:playSCO(".$sco->id.");\">$sco->title</a> $score$endbold\n </li>\n"; echo " &nbsp;$startbold<a href=\"javascript:playSCO(".$sco->id.");\">$sco->title</a> $score$endbold\n </li>\n";
} else { } else {
@ -267,7 +272,7 @@
echo "<html>\n"; echo "<html>\n";
echo "<head><title>$course->shortname: $scorm->name</title></head>\n"; echo "<head><title>$course->shortname: $scorm->name</title></head>\n";
echo "<script id=\"scormAPI\" language=\"JavaScript\" type=\"text/javascript\" src=\"scormAPI.php?id=$cm->id&mode=".$mode.$scoid."\"></script>\n"; echo "<script id=\"scormAPI\" language=\"JavaScript\" type=\"text/javascript\" src=\"scormAPI.php?id=$cm->id&mode=".$mode.$scoid."\"></script>\n";
echo "<frameset rows=\"$CFG->scorm_framesize,*\" onLoad=\"SCOInitialize();\" onUnload=\"API.SaveTotalTime();\" onbeforeUnload=\"API.SaveTotalTime();\">\n"; echo "<frameset rows=\"$CFG->scorm_framesize,*\" onLoad=\"SCOInitialize();\" onUnload=\"SCOFinish();\" onbeforeUnload=\"SCOFinish();\">\n";
echo "\t <frame name=\"navigation\" src=\"playscorm.php?id=$cm->id&mode=".$mode.'&currentorg='.$currentorg."&frameset=top\">\n"; echo "\t <frame name=\"navigation\" src=\"playscorm.php?id=$cm->id&mode=".$mode.'&currentorg='.$currentorg."&frameset=top\">\n";
echo "\t <frame name=\"main\" src=\"\">\n"; echo "\t <frame name=\"main\" src=\"\">\n";
echo "</frameset>\n"; echo "</frameset>\n";

View File

@ -83,25 +83,25 @@
// Create user scoes records // Create user scoes records
// //
foreach ($scoes as $sco) { foreach ($scoes as $sco) {
if ($sco->launch != "") { if (($sco->launch != "") && ($sco->type != "sca") && ($sco->type != "asset")){
if (!isset($first)) if (!isset($first)) {
$first = $sco; $first = $sco;
}
$sco_user->userid = $USER->id; $sco_user->userid = $USER->id;
$sco_user->scoid = $sco->id; $sco_user->scoid = $sco->id;
$sco_user->scormid = $scorm->id; $sco_user->scormid = $scorm->id;
$element = "cmi_core_lesson_status"; $element = "cmi_core_lesson_status";
if ($sco->type == "sco") $sco_user->$element = "not attempted";
$sco_user->$element = "not attempted";
else if (($sco->type == "sca") || ($sco->type == "asset"))
$sco_user->$element = "completed";
$ident = insert_record("scorm_sco_users",$sco_user); $ident = insert_record("scorm_sco_users",$sco_user);
} }
} }
if (isset($first)) if (isset($first)) {
$sco = $first; $sco = $first;
}
if (!empty($scoid)) { if (!empty($scoid)) {
if ($sco = get_record("scorm_scoes","id",$scoid)) if ($sco = get_record("scorm_scoes","id",$scoid)) {
unset($first); unset($first);
}
} }
} }
} }
@ -147,10 +147,13 @@
} }
} }
$navObj = "top."; $navObj = "top.";
if ($scorm->popup == "") if ($scorm->popup == "") {
$navObj = "top.navigation."; $navObj = "top.navigation.";
}
include("api1_2.php");
if ($sco->type == 'sco') {
include("api1_2.php");
}
?> ?>
@ -186,6 +189,12 @@ function SCOInitialize() {
?> ?>
} }
function SCOFinish(){
if (typeof API != "undefined") {
SaveTotalTime();
}
}
function changeSco(direction) { function changeSco(direction) {
if (direction == "previous") if (direction == "previous")
<?php echo $navObj ?>document.navform.scoid.value="<?php echo $prevsco; ?>"; <?php echo $navObj ?>document.navform.scoid.value="<?php echo $prevsco; ?>";

View File

@ -163,8 +163,12 @@
$score = "(".get_string("score","scorm").":&nbsp;".$sco_user->cmi_core_score_raw.")"; $score = "(".get_string("score","scorm").":&nbsp;".$sco_user->cmi_core_score_raw.")";
} }
} else { } else {
echo " <img src=\"pix/notattempted.gif\" alt=\"".get_string("notattempted","scorm")."\" />"; if ($sco->type == 'sco') {
$incomplete = true; echo " <img src=\"pix/notattempted.gif\" alt=\"".get_string("notattempted","scorm")."\" />";
$incomplete = true;
} else {
echo " <img src=\"pix/asset.gif\" alt=\"".get_string("asset","scorm")."\" />";
}
} }
echo " &nbsp;<a href=\"javascript:playSCO(".$sco->id.")\">$sco->title</a> $score\n </li>\n"; echo " &nbsp;<a href=\"javascript:playSCO(".$sco->id.")\">$sco->title</a> $score\n </li>\n";
} else { } else {