2004-09-12 17:34:35 +00:00
|
|
|
<?php // $Id$
|
2004-05-20 17:06:19 +00:00
|
|
|
|
|
|
|
/// This page prints a particular instance of scorm
|
|
|
|
/// (Replace scorm with the name of your module)
|
|
|
|
|
|
|
|
require_once("../../config.php");
|
|
|
|
require_once("lib.php");
|
|
|
|
|
|
|
|
optional_variable($id); // Course Module ID, or
|
|
|
|
optional_variable($a); // scorm ID
|
2004-05-27 12:44:11 +00:00
|
|
|
optional_variable($frameset, "");
|
2004-05-20 17:06:19 +00:00
|
|
|
|
|
|
|
if ($id) {
|
|
|
|
if (! $cm = get_record("course_modules", "id", $id)) {
|
|
|
|
error("Course Module ID was incorrect");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (! $course = get_record("course", "id", $cm->course)) {
|
|
|
|
error("Course is misconfigured");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (! $scorm = get_record("scorm", "id", $cm->instance)) {
|
|
|
|
error("Course module is incorrect");
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
if (! $scorm = get_record("scorm", "id", $a)) {
|
|
|
|
error("Course module is incorrect");
|
|
|
|
}
|
|
|
|
if (! $course = get_record("course", "id", $scorm->course)) {
|
|
|
|
error("Course is misconfigured");
|
|
|
|
}
|
|
|
|
if (! $cm = get_coursemodule_from_instance("scorm", $scorm->id, $course->id)) {
|
|
|
|
error("Course Module ID was incorrect");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
require_login($course->id);
|
|
|
|
|
|
|
|
|
|
|
|
$strscorms = get_string("modulenameplural", "scorm");
|
|
|
|
$strscorm = get_string("modulename", "scorm");
|
|
|
|
|
|
|
|
if ($course->category) {
|
|
|
|
$navigation = "<a target=\"{$CFG->framename}\" href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->
|
|
|
|
<a target=\"{$CFG->framename}\" href=\"index.php?id=$course->id\">$strscorms</a> ->";
|
|
|
|
} else {
|
|
|
|
$navigation = "<a target=\"{$CFG->framename}\" href=\"index.php?id=$course->id\">$strscorms</a> ->";
|
|
|
|
}
|
|
|
|
|
|
|
|
$pagetitle = strip_tags("$course->shortname: $scorm->name");
|
|
|
|
|
|
|
|
if (!$cm->visible and !isteacher($course->id)) {
|
|
|
|
print_header($pagetitle, "$course->fullname", "$navigation $scorm->name", "", "", true,
|
|
|
|
update_module_button($cm->id, $course->id, $strscorm), navmenu($course, $cm));
|
|
|
|
notice(get_string("activityiscurrentlyhidden"));
|
|
|
|
}
|
2004-06-28 11:20:52 +00:00
|
|
|
|
|
|
|
if (!empty($_POST["scoid"]))
|
2004-09-16 17:13:57 +00:00
|
|
|
$scoid = "&scoid=".$_POST["scoid"];
|
2004-08-09 07:26:06 +00:00
|
|
|
if (!empty($_POST['currentorg'])) {
|
|
|
|
$currentorg = $_POST['currentorg'];
|
|
|
|
}
|
2004-06-28 11:20:52 +00:00
|
|
|
if (($scorm->popup != "") && (!empty($_POST["mode"])))
|
|
|
|
$mode = $_POST["mode"];
|
|
|
|
if (($scorm->popup == "") && (!empty($_GET["mode"])))
|
|
|
|
$mode = $_GET["mode"];
|
|
|
|
|
|
|
|
if (($frameset == "top") || ($scorm->popup != "")) {
|
2004-05-21 01:42:17 +00:00
|
|
|
add_to_log($course->id, "scorm", "view", "playscorm.php?id=$cm->id", "$scorm->id");
|
|
|
|
//
|
|
|
|
// Print the page header
|
|
|
|
//
|
2004-07-19 14:53:43 +00:00
|
|
|
$bodyscripts = "";
|
|
|
|
if ($scorm->popup != "") {
|
2004-09-20 13:50:38 +00:00
|
|
|
$bodyscripts = "onload='SCOInitialize();' onunload='SCOFinish(); closeMain();'";
|
2004-07-19 14:53:43 +00:00
|
|
|
}
|
2004-05-21 01:42:17 +00:00
|
|
|
print_header($pagetitle, "$course->fullname",
|
2004-05-20 17:06:19 +00:00
|
|
|
"$navigation <a target=\"{$CFG->framename}\" href=\"view.php?id=$cm->id\" title=\"$scorm->summary\">$scorm->name</a>",
|
2004-07-19 14:53:43 +00:00
|
|
|
"", "", true, update_module_button($cm->id, $course->id, $strscorm), navmenu($course, $cm, '_top'),"",$bodyscripts);
|
2004-05-20 17:06:19 +00:00
|
|
|
|
2004-06-21 11:27:52 +00:00
|
|
|
echo "<table width=\"100%\">\n <tr><td align=\"center\">".text_to_html($scorm->summary, true, false)."</td>\n";
|
2004-06-28 11:20:52 +00:00
|
|
|
if ($mode == "browse")
|
2004-09-12 17:34:35 +00:00
|
|
|
echo "<td align=\"right\" width=\"10%\" nowrap=\"nowrap\">".get_string("browsemode","scorm")."</td>\n";
|
2004-06-21 11:27:52 +00:00
|
|
|
echo " </tr>\n</table>\n";
|
|
|
|
|
2004-06-28 11:20:52 +00:00
|
|
|
if ($scorm->popup != "") {
|
2004-09-16 17:13:57 +00:00
|
|
|
echo "<script id=\"scormAPI\" language=\"JavaScript\" type=\"text/javascript\" src=\"scormAPI.php?id=$cm->id&mode=".$mode.$scoid."\"></script>\n";
|
2004-06-21 11:27:52 +00:00
|
|
|
$currentSCO = "";
|
2004-06-28 11:20:52 +00:00
|
|
|
if (!empty($_POST['scoid']))
|
|
|
|
$currentSCO = $_POST['scoid'];
|
2004-06-21 11:27:52 +00:00
|
|
|
?>
|
|
|
|
<br />
|
2004-09-20 13:50:38 +00:00
|
|
|
<script language="Javascript" type="text/javascript">
|
2004-06-21 11:27:52 +00:00
|
|
|
<!--
|
|
|
|
function playSCO(scoid) {
|
|
|
|
document.navform.scoid.value=scoid;
|
|
|
|
document.navform.submit();
|
|
|
|
}
|
|
|
|
|
|
|
|
function expandCollide(which,list) {
|
|
|
|
var nn=document.ids?true:false
|
|
|
|
var w3c=document.getElementById?true:false
|
2004-09-20 13:50:38 +00:00
|
|
|
var beg=nn?"document.ids.":w3c?"document.getElementById('":"document.all.";
|
|
|
|
var mid=w3c?"').style":".style";
|
2004-06-21 11:27:52 +00:00
|
|
|
|
|
|
|
if (eval(beg+list+mid+".display") != "none") {
|
|
|
|
which.src = "pix/plus.gif";
|
|
|
|
eval(beg+list+mid+".display='none';");
|
|
|
|
} else {
|
|
|
|
which.src = "pix/minus.gif";
|
|
|
|
eval(beg+list+mid+".display='block';");
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
-->
|
|
|
|
</script>
|
|
|
|
<?php
|
2004-09-20 13:50:38 +00:00
|
|
|
$liststyle = "style=\"list-style-type:none;\"";
|
|
|
|
print_simple_box_start("center");
|
2004-06-21 11:27:52 +00:00
|
|
|
echo "<table>\n";
|
|
|
|
echo " <tr><th>".get_string("coursestruct","scorm")."</th></tr>\n";
|
2004-09-20 13:50:38 +00:00
|
|
|
echo " <tr><td nowrap=\"nowrap\">\n<ul $liststyle>\n";
|
2004-06-21 11:27:52 +00:00
|
|
|
$incomplete = false;
|
2004-08-09 07:26:06 +00:00
|
|
|
if ($scoes = get_records_select("scorm_scoes","scorm='$scorm->id' AND organization='$currentorg' order by id ASC")){
|
2004-06-21 11:27:52 +00:00
|
|
|
$level=0;
|
|
|
|
$sublist=0;
|
|
|
|
$parents[$level]="/";
|
|
|
|
foreach ($scoes as $sco) {
|
|
|
|
if ($parents[$level]!=$sco->parent) {
|
|
|
|
if ($level>0 && $parents[$level-1]==$sco->parent) {
|
|
|
|
echo " </ul></li>\n";
|
|
|
|
$level--;
|
|
|
|
} else {
|
2004-07-06 12:45:56 +00:00
|
|
|
$i = $level;
|
|
|
|
$closelist = "";
|
|
|
|
while (($i > 0) && ($parents[$level] != $sco->parent)) {
|
|
|
|
$closelist .= " </ul></li>\n";
|
|
|
|
$i--;
|
|
|
|
}
|
2004-08-09 07:26:06 +00:00
|
|
|
if (($i == 0) && ($sco->parent != $currentorg)) {
|
2004-09-20 13:50:38 +00:00
|
|
|
echo " <li><ul id='s".$sublist."' $liststyle>\n";
|
2004-07-06 12:45:56 +00:00
|
|
|
$level++;
|
|
|
|
} else {
|
|
|
|
echo $closelist;
|
|
|
|
$level = $i;
|
|
|
|
}
|
2004-06-21 11:27:52 +00:00
|
|
|
$parents[$level]=$sco->parent;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
echo " <li>\n";
|
|
|
|
$nextsco = next($scoes);
|
2004-07-06 12:45:56 +00:00
|
|
|
if (($nextsco !== false) && ($sco->parent != $nextsco->parent) && (($level==0) || (($level>0) && ($nextsco->parent == $sco->identifier)))) {
|
2004-06-21 11:27:52 +00:00
|
|
|
$sublist++;
|
2004-09-20 13:50:38 +00:00
|
|
|
echo " <img src=\"pix/minus.gif\" onclick='expandCollide(this,\"s".$sublist."\");' alt=\"-\" title=\"".get_string('collide','scorm')."\" />\n";
|
2004-06-21 11:27:52 +00:00
|
|
|
} else {
|
2004-09-20 13:50:38 +00:00
|
|
|
echo " <img src=\"pix/spacer.gif\" alt=\" \" />\n";
|
2004-06-21 11:27:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ($sco->launch) {
|
|
|
|
$startbold = '';
|
|
|
|
$endbold = '';
|
|
|
|
if ($sco->id == $currentSCO) {
|
2004-09-20 13:50:38 +00:00
|
|
|
$startbold = '-> <b>';
|
|
|
|
$endbold = '</b> <-';
|
2004-06-29 07:50:07 +00:00
|
|
|
}
|
|
|
|
if (($currentSCO == "") && ($mode != "normal")) {
|
|
|
|
$currentSCO = $sco->id;
|
2004-09-20 13:50:38 +00:00
|
|
|
$startbold = '-> <b>';
|
|
|
|
$endbold = '</b> >-';
|
2004-06-21 11:27:52 +00:00
|
|
|
}
|
2004-08-09 07:26:06 +00:00
|
|
|
$score = "";
|
2004-06-21 11:27:52 +00:00
|
|
|
if ($sco_user=get_record("scorm_sco_users","scoid",$sco->id,"userid",$USER->id)) {
|
2004-08-25 08:34:52 +00:00
|
|
|
if ( $sco_user->cmi_core_lesson_status == "") {
|
2004-06-21 11:27:52 +00:00
|
|
|
$sco_user->cmi_core_lesson_status = "not attempted";
|
2004-08-25 08:34:52 +00:00
|
|
|
}
|
2004-06-21 11:27:52 +00:00
|
|
|
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 ($currentSCO == "") {
|
|
|
|
$incomplete = true;
|
|
|
|
$currentSCO = $sco->id;
|
2004-06-29 07:50:07 +00:00
|
|
|
$startbold = '-> <b>';
|
|
|
|
$endbold = '</b> <-';
|
2004-06-21 11:27:52 +00:00
|
|
|
}
|
|
|
|
}
|
2004-08-09 07:26:06 +00:00
|
|
|
if ($sco_user->cmi_core_score_raw > 0) {
|
|
|
|
$score = "(".get_string("score","scorm").": ".$sco_user->cmi_core_score_raw.")";
|
|
|
|
}
|
2004-06-21 11:27:52 +00:00
|
|
|
} else {
|
2004-08-25 08:34:52 +00:00
|
|
|
if ($sco->type == 'sco') {
|
2004-09-20 13:50:38 +00:00
|
|
|
echo " <img src=\"pix/notattempted.gif\" alt=\"".get_string("notattempted","scorm")."\" title=\"".get_string("notattempted","scorm")."\" />";
|
2004-08-25 08:34:52 +00:00
|
|
|
$incomplete = true;
|
|
|
|
} else {
|
2004-09-20 13:50:38 +00:00
|
|
|
echo " <img src=\"pix/asset.gif\" alt=\"".get_string("asset","scorm")."\" title=\"".get_string("asset","scorm")."\" />";
|
2004-08-25 08:34:52 +00:00
|
|
|
}
|
2004-06-21 11:27:52 +00:00
|
|
|
}
|
2004-08-09 07:26:06 +00:00
|
|
|
echo " $startbold<a href=\"javascript:playSCO(".$sco->id.");\">$sco->title</a> $score$endbold\n </li>\n";
|
2004-06-21 11:27:52 +00:00
|
|
|
} else {
|
|
|
|
echo " $sco->title\n </li>\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for ($i=0;$i<$level;$i++){
|
|
|
|
echo " </ul></li>\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
echo "</ul></td></tr>\n";
|
|
|
|
echo "</table>\n";
|
|
|
|
print_simple_box_end();
|
2004-06-28 11:20:52 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
echo "<table width=\"100%\">\n <tr>\n";
|
2004-09-12 17:34:35 +00:00
|
|
|
echo " <td align=\"center\" nowrap=\"nowrap\">
|
2004-07-06 12:45:56 +00:00
|
|
|
<iframe name=\"cmi\" width=\"1\" height=\"1\" src=\"cmi.php?id=$cm->id\" style=\"visibility: hidden\"></iframe>
|
2004-09-20 13:50:38 +00:00
|
|
|
<form name=\"navform\" method=\"post\" action=\"playscorm.php?id=$cm->id\" target=\"_top\">
|
2004-06-28 11:20:52 +00:00
|
|
|
<input name=\"scoid\" type=\"hidden\" />
|
2004-08-09 07:26:06 +00:00
|
|
|
<input name=\"currentorg\" type=\"hidden\" value=\"$currentorg\" />
|
2004-06-28 11:20:52 +00:00
|
|
|
<input name=\"mode\" type=\"hidden\" value=\"".$mode."\" />
|
2004-09-20 13:50:38 +00:00
|
|
|
<input name=\"prev\" type=\"button\" value=\"".get_string("prev","scorm")."\" onclick=\"top.changeSco('previous');\" /> \n";
|
2004-06-28 11:20:52 +00:00
|
|
|
|
|
|
|
if ($scorm->popup == "") {
|
2004-08-09 07:26:06 +00:00
|
|
|
$currentorg = '';
|
|
|
|
if (isset($_GET['currentorg'])) {
|
|
|
|
$currentorg = $_GET['currentorg'];
|
|
|
|
}
|
|
|
|
if ($scoes = get_records_select("scorm_scoes","scorm='$scorm->id' AND organization='$currentorg' order by id ASC")){
|
2004-06-28 11:20:52 +00:00
|
|
|
$level=0;
|
|
|
|
$parents[$level]="/";
|
|
|
|
foreach ($scoes as $sco) {
|
|
|
|
if ($parents[$level]!=$sco->parent) {
|
|
|
|
if ($level>0 && $parents[$level-1]==$sco->parent) {
|
|
|
|
$level--;
|
|
|
|
} else {
|
2004-07-06 12:45:56 +00:00
|
|
|
$i = $level;
|
|
|
|
while (($i > 0) && ($parents[$level] != $sco->parent)) {
|
|
|
|
$i--;
|
|
|
|
}
|
2004-08-09 07:26:06 +00:00
|
|
|
if (($i == 0) && ($sco->parent != $currentorg)) {
|
2004-07-06 12:45:56 +00:00
|
|
|
$level++;
|
|
|
|
} else {
|
|
|
|
$level = $i;
|
|
|
|
}
|
2004-06-28 11:20:52 +00:00
|
|
|
$parents[$level]=$sco->parent;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$indenting = "";
|
|
|
|
for ($i=0;$i<$level;$i++) {
|
|
|
|
$indenting .= "-";
|
|
|
|
}
|
|
|
|
$options[$sco->id] = $indenting."> ".$sco->title;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
choose_from_menu($options, "courseStructure", "", "", "document.navform.scoid.value=document.navform.courseStructure.options[document.navform.courseStructure.selectedIndex].value;document.navform.submit();");
|
|
|
|
}
|
2004-09-20 13:50:38 +00:00
|
|
|
echo " <input name=\"next\" type=\"button\" value=\"".get_string("next","scorm")."\" onclick=\"top.changeSco('continue')\" />\n";
|
2004-06-28 11:20:52 +00:00
|
|
|
echo " </form>
|
|
|
|
</td>\n";
|
|
|
|
|
|
|
|
echo "</tr>\n</table>\n";
|
2004-08-09 07:26:06 +00:00
|
|
|
if ($scorm->popup == "") {
|
|
|
|
echo "</body>\n</html>\n";
|
|
|
|
} else {
|
|
|
|
print_footer($course);
|
|
|
|
}
|
2004-05-21 01:42:17 +00:00
|
|
|
} else {
|
2004-06-21 11:27:52 +00:00
|
|
|
if ($scorm->popup == "") {
|
|
|
|
//
|
|
|
|
// Frameset
|
|
|
|
//
|
2004-06-28 11:20:52 +00:00
|
|
|
echo "<html>\n";
|
|
|
|
echo "<head><title>$course->shortname: $scorm->name</title></head>\n";
|
2004-09-16 17:13:57 +00:00
|
|
|
echo "<script id=\"scormAPI\" language=\"JavaScript\" type=\"text/javascript\" src=\"scormAPI.php?id=$cm->id&mode=".$mode.$scoid."\"></script>\n";
|
2004-09-20 14:35:24 +00:00
|
|
|
echo "<frameset rows=\"$CFG->scorm_framesize,*\" onLoad=\"SCOInitialize();\" onUnload=\"SCOFinish();\">\n";
|
2004-09-16 17:13:57 +00:00
|
|
|
echo "\t <frame name=\"navigation\" src=\"playscorm.php?id=$cm->id&mode=".$mode.'&currentorg='.$currentorg."&frameset=top\">\n";
|
2004-06-29 07:50:07 +00:00
|
|
|
echo "\t <frame name=\"main\" src=\"\">\n";
|
2004-06-28 11:20:52 +00:00
|
|
|
echo "</frameset>\n";
|
|
|
|
echo "</html>\n";
|
2004-06-21 11:27:52 +00:00
|
|
|
}
|
2004-05-20 17:06:19 +00:00
|
|
|
}
|
|
|
|
?>
|