Added popup window scorm player and its settings

This commit is contained in:
bobopinna 2004-06-21 11:27:52 +00:00
parent aea836221e
commit 76d3542313
14 changed files with 420 additions and 103 deletions

View File

@ -1,47 +1,11 @@
//
// CMI Initialization SCORM 1.2
//
var cmi= new Object();
cmi.core = new Object();
cmi.core._children = "student_id,student_name,lesson_location,credit,lesson_status,exit,entry,session_time,total_time,lesson_mode,score,suspend_data,launch_data";
cmi.core.student_id = "<?php echo $USER->username; ?>";
cmi.core.student_name = "<?php echo $USER->firstname." ".$USER->lastname; ?>";
cmi.core.lesson_location = "<?php echo $sco_user->cmi_core_lesson_location; ?>";
cmi.core.credit = "credit";
cmi.core.lesson_status = "<?php echo $sco_user->cmi_core_lesson_status; ?>";
cmi.core.exit = "<?php echo $sco_user->cmi_core_exit ?>";
cmi.core.entry = "<?php if ($sco_user->cmi_core_lesson_status=="not attempted")
echo 'ab-initio';
else
if ($sco_user->cmi_core_lesson_status!="completed")
echo 'resume';
else
echo '';?>";
cmi.core.session_time = "<?php echo $sco_user->cmi_core_session_time; ?>";
cmi.core.total_time = "<?php echo $sco_user->cmi_core_total_time; ?>";
cmi.core.lesson_mode = "<?php echo $mode; ?>";
cmi.core.score = new Object();
cmi.core.score._children = "raw,min,max";
cmi.core.score.raw = "<?php echo $sco_user->cmi_core_score_raw; ?>";
cmi.suspend_data = "<?php echo $sco_user->cmi_suspend_data; ?>";
cmi.launch_data = "<?php echo $sco_user->cmi_launch_data; ?>";
/* cmi.interactions = new Object();
cmi.interactions._children = "id,objectives,time,type,correct_responses,weighting,student_response,result,latency";
cmi.interactions._count = 0;
*/
var errorCode = 0;
//
// end CMI Initialization
//
// //
// SCORM API 1.2 Implementation // SCORM API 1.2 Implementation
// //
function SCORMapi() { function SCORMapi() {
var cmi= new Object();
var errorCode = 0;
var Initialized = false; var Initialized = false;
function LMSInitialize (param) { function LMSInitialize (param) {
@ -52,6 +16,37 @@ function SCORMapi() {
if (!Initialized) { if (!Initialized) {
Initialized = true; Initialized = true;
errorCode = 0; errorCode = 0;
//
// CMI Initialization SCORM 1.2
//
cmi.core = new Object();
cmi.core._children = "student_id,student_name,lesson_location,credit,lesson_status,exit,entry,session_time,total_time,lesson_mode,score,suspend_data,launch_data";
cmi.core.student_id = "<?php echo $USER->username; ?>";
cmi.core.student_name = "<?php echo $USER->firstname." ".$USER->lastname; ?>";
cmi.core.lesson_location = "<?php echo $sco_user->cmi_core_lesson_location; ?>";
cmi.core.credit = "credit";
cmi.core.lesson_status = "<?php echo $sco_user->cmi_core_lesson_status; ?>";
cmi.core.exit = "<?php echo $sco_user->cmi_core_exit ?>";
cmi.core.entry = "<?php if ($sco_user->cmi_core_lesson_status=="not attempted")
echo 'ab-initio';
else
if ($sco_user->cmi_core_lesson_status!="completed")
echo 'resume';
else
echo '';?>";
cmi.core.session_time = "";
cmi.core.total_time = "<?php echo $sco_user->cmi_core_total_time; ?>";
cmi.core.lesson_mode = "<?php echo $mode; ?>";
cmi.core.score = new Object();
cmi.core.score._children = "raw,min,max";
cmi.core.score.raw = "<?php echo $sco_user->cmi_core_score_raw; ?>";
cmi.suspend_data = "<?php echo $sco_user->cmi_suspend_data; ?>";
cmi.launch_data = "<?php echo $sco_user->cmi_launch_data; ?>";
//
// end CMI Initialization
//
return "true"; return "true";
} else { } else {
errorCode = 101; errorCode = 101;
@ -277,6 +272,7 @@ function SCORMapi() {
return hours + ":" + mins + ":" + secs; return hours + ":" + mins + ":" + secs;
} }
this.LMSInitialize = LMSInitialize; this.LMSInitialize = LMSInitialize;
this.LMSGetValue = LMSGetValue; this.LMSGetValue = LMSGetValue;
this.LMSSetValue = LMSSetValue; this.LMSSetValue = LMSSetValue;

50
mod/scorm/config.html Executable file
View File

@ -0,0 +1,50 @@
<form method="post" action="module.php" name="form">
<table cellpadding=9 cellspacing=0 >
<tr valign=top>
<td align=right><p>scorm_framesize:</td>
<td>
<input name=scorm_framesize type=text size=5 value="<?php p($CFG->scorm_framesize) ?>">
</td>
<td>
<?php print_string("configframesize", "scorm") ?>
</td>
</tr>
<tr valign=top>
<td align=right><p>scorm_popup:</td>
<td>
<?php
unset($choices);
$choices[""] = get_string("no");
$choices["checked"] = get_string("yes");
choose_from_menu ($choices, "scorm_popup", $CFG->scorm_popup, "");
?>
</td>
<td>
<?php print_string("configpopup", "scorm") ?>
</td>
</tr>
<?php foreach ($SCORM_WINDOW_OPTIONS as $optionname) {
$defaultvalue = "scorm_popup$optionname";
echo "<tr valign=top>";
echo "<td align=right><p>$defaultvalue:</td>";
echo "<td>";
if ($optionname == "height" or $optionname == "width") {
echo "<input name=$defaultvalue type=text size=5 value=\"".$CFG->$defaultvalue."\">";
} else {
choose_from_menu ($choices, $defaultvalue, $CFG->$defaultvalue, "");
}
echo "</td>";
echo "<td>";
print_string("configpopup$optionname", "scorm");
echo "</td>";
echo "</tr>";
}
?>
<tr>
<td colspan=3 align=center>
<input type="submit" value="<?php print_string("savechanges") ?>"></td>
</tr>
</table>
</form>

View File

@ -5,14 +5,17 @@ function scorm_upgrade($oldversion) {
/// older versions to match current functionality /// older versions to match current functionality
global $CFG; global $CFG;
if ($oldversion < 2004033000) { if ($oldversion < 2004033000) {
execute_sql(" ALTER TABLE `{$CFG->prefix}scorm` ADD `auto` TINYINT( 1 ) UNSIGNED DEFAULT '0' NOT NULL AFTER `summary`"); table_column("scorm", "", "auto", "TINYINT", "1", "UNSIGNED", "0", "NOT NULL", "summary");
} }
if ($oldversion < 2004040900) { if ($oldversion < 2004040900) {
execute_sql(" ALTER TABLE `{$CFG->prefix}scorm_sco_users` ADD `cmi_core_score_raw` FLOAT( 3 ) DEFAULT '0' NOT NULL AFTER `cmi_core_session_time`"); table_column("scorm_sco_users", "", "cmi_core_score_raw", "FLOAT", "3", "", "0", "NOT NULL", "cmi_core_session_time");
}
if ($oldversion < 2004061800) {
table_column("scorm", "", "popup", "VARCHAR", "255", "", "", "NOT NULL", "auto");
table_column("scorm", "reference", "reference", "VARCHAR", "255", "", "", "NOT NULL");
} }
return true; return true;
} }
?> ?>

View File

@ -6,11 +6,12 @@ CREATE TABLE prefix_scorm (
id int(10) unsigned NOT NULL auto_increment, id int(10) unsigned NOT NULL auto_increment,
course int(10) unsigned NOT NULL default '0', course int(10) unsigned NOT NULL default '0',
name varchar(255) NOT NULL default '', name varchar(255) NOT NULL default '',
reference varchar(255) default NULL, reference varchar(255) NOT NULL default '',
datadir varchar(255) NOT NULL default '', datadir varchar(255) NOT NULL default '',
launch int(10) unsigned NOT NULL default 0, launch int(10) unsigned NOT NULL default 0,
summary text NOT NULL, summary text NOT NULL,
auto tinyint(1) unsigned NOT NULL default '0', auto tinyint(1) unsigned NOT NULL default '0',
popup varchar(255) NOT NULL default '',
timemodified int(10) unsigned NOT NULL default '0', timemodified int(10) unsigned NOT NULL default '0',
PRIMARY KEY (id), PRIMARY KEY (id),
UNIQUE KEY id (id) UNIQUE KEY id (id)

View File

@ -3,7 +3,17 @@
function scorm_upgrade($oldversion) { function scorm_upgrade($oldversion) {
// This function does anything necessary to upgrade // This function does anything necessary to upgrade
// older versions to match current functionality // older versions to match current functionality
global $CFG;
if ($oldversion < 2004033000) {
table_column("scorm", "", "auto", "integer", "1", "", "0", "NOT NULL", "summary");
}
if ($oldversion < 2004040900) {
table_column("scorm_sco_users", "", "cmi_core_score_raw", "real", "3", "", "0", "NOT NULL", "cmi_core_session_time");
}
if ($oldversion < 2004061800) {
table_column("scorm", "", "popup", "varchar", "255", "", "", "NOT NULL", "auto");
table_column("scorm", "reference", "reference", "varchar", "255", "", "", "NOT NULL");
}
return true; return true;
} }

View File

@ -6,11 +6,12 @@ CREATE TABLE prefix_scorm (
id SERIAL PRIMARY KEY, id SERIAL PRIMARY KEY,
course integer NOT NULL default '0', course integer NOT NULL default '0',
name varchar(255) NOT NULL default '', name varchar(255) NOT NULL default '',
reference varchar(255) default NULL, reference varchar(255) NOT NULL default '',
datadir varchar(255) NOT NULL default '', datadir varchar(255) NOT NULL default '',
launch integer NOT NULL default '0', launch integer NOT NULL default '0',
summary text NOT NULL default '', summary text NOT NULL default '',
auto integer NOT NULL default '0', auto integer NOT NULL default '0',
popup varchar(255) NOT NULL default '',
timemodified integer NOT NULL default '0' timemodified integer NOT NULL default '0'
); );

View File

@ -79,16 +79,119 @@
echo "<table cellpadding=\"5\" align=\"center\">\n"; echo "<table cellpadding=\"5\" align=\"center\">\n";
echo " <tr><td align=\"right\" nowrap><p><b>$strname:</b></p></td><td><p>$form->name</p></a></td></tr>\n"; echo " <tr><td align=\"right\" nowrap><p><b>$strname:</b></p></td><td><p>$form->name</p></a></td></tr>\n";
echo " <tr><td align=\"right\" nowrap><p><b>".get_string("validation","scorm").":</b></p></td><td><p>".get_string($result,"scorm")."</p></a></td></tr>\n"; echo " <tr><td align=\"right\" nowrap><p><b>".get_string("validation","scorm").":</b></p></td><td><p>".get_string($result,"scorm")."</p></a></td></tr>\n";
if (($form->mode == "update") && ($form->launch == 0) && (get_records("scorm_sco_user","scormid",$form->instance))) if (($form->mode == "update") && ($form->launch == 0) && (get_records("scorm_sco_users","scormid",$form->instance)))
echo " <tr><td align=\"center\" colspan=\"2\" nowrap><p><b>".get_string("trackingloose","scorm")."</b></p></td></tr>\n"; echo " <tr><td align=\"center\" colspan=\"2\" nowrap><p><b>".get_string("trackingloose","scorm")."</b></p></td></tr>\n";
echo "</table>\n"; echo "</table>\n";
if ($result == "regular") { if ($result == "regular") {
if (empty($form->auto)) {
$form->auto = "";
}
echo "<form name=\"theform\" method=\"post\" action=\"$form->destination\">\n"; echo "<form name=\"theform\" method=\"post\" action=\"$form->destination\">\n";
$form->popup = $CFG->scorm_popup;
$strnewwindow = get_string("newwindow", "scorm");
$strnewwindowopen = get_string("newwindowopen", "scorm");
foreach ($SCORM_WINDOW_OPTIONS as $optionname) {
$stringname = "str$optionname";
$$stringname = get_string("new$optionname", "scorm");
$window->$optionname = "";
$jsoption[] = "\"$optionname\"";
}
$alljsoptions = implode(",", $jsoption);
if ($form->instance) { // Re-editing
if ($form->popup == "") {
$newwindow = ""; // Disable the new window
} else {
$newwindow = "checked";
$rawoptions = explode(',', $form->popup);
foreach ($rawoptions as $rawoption) {
$option = explode('=', trim($rawoption));
if ((option != 'location') && (option != 'menubar') && (option != 'toolbar')) {
$optionname = $option[0];
$optionvalue = $option[1];
if ($optionname == "height" or $optionname == "width") {
$window->$optionname = $optionvalue;
} else if ($optionvalue) {
$window->$optionname = "checked";
}
}
}
}
} else {
foreach ($SCORM_WINDOW_OPTIONS as $optionname) {
$defaultvalue = "scorm_popup$optionname";
$window->$optionname = $CFG->$defaultvalue;
}
$newwindow = $CFG->scorm_popup;
}
?> ?>
<table cellpadding="5" align="center">
<tr valign=top>
<td align=right><p><b><?php print_string("autocontinue","scorm") ?>:</b></p></td>
<td>
<?php
$options[]=get_string("no");
$options[]=get_string("yes");
choose_from_menu ($options, "auto", $form->auto);
?>
</td>
</tr>
<tr valign="top">
<td align="right" nowrap>
<p><b><?php p($strnewwindow) ?></b></p>
</td>
<td>
<script>
var subitems = [<?php echo $alljsoptions; ?>];
function autowindow() {
if (document.theform.newwindow.checked)
document.theform.auto.disabled=true;
else
document.theform.auto.disabled=false;
}
</script>
<input name="setnewwindow" type=hidden value=1>
<input name="newwindow" type=checkbox value=1 <?php p($newwindow) ?>
onclick="autowindow();return lockoptions('theform','newwindow', subitems);">
<?php p($strnewwindowopen) ?>
<ul>
<?php
foreach ($window as $name => $value) {
if ($name == "height" or $name == "width") {
continue;
}
echo "\t\t<input name=\"h$name\" type=hidden value=0>\n";
echo "\t\t<input name=\"$name\" type=checkbox value=1 ".$window->$name."> ";
$stringname = "str$name";
echo $$stringname."<br />\n";
}
?>
<input name="hwidth" type=hidden value=0>
<input name="width" type=text size=4 value="<?php p($window->width) ?>">
<?php p($strwidth) ?><br />
<input name="hheight" type=hidden value=0>
<input name="height" type=text size=4 value="<?php p($window->height) ?>">
<?php p($strheight) ?><br />
<?php
if (!$newwindow) {
echo "<script>";
echo "lockoptions('theform','newwindow', subitems);";
echo "</script>";
}
?>
</ul>
</p>
</td>
</tr>
</table>
<input type="hidden" name="reference" value="<?php p($form->reference) ?>"> <input type="hidden" name="reference" value="<?php p($form->reference) ?>">
<input type="hidden" name="datadir" value="<?php p(substr($tempdir,strlen($scormdir))) ?>"> <input type="hidden" name="datadir" value="<?php p(substr($tempdir,strlen($scormdir))) ?>">
<input type="hidden" name="summary" value="<?php p($form->summary) ?>"> <input type="hidden" name="summary" value="<?php p($form->summary) ?>">
<input type="hidden" name="auto" value="<?php p($form->auto) ?>">
<input type="hidden" name="name" value="<?php p($form->name) ?>"> <input type="hidden" name="name" value="<?php p($form->name) ?>">
<input type="hidden" name="launch" value="<?php p($form->launch) ?>"> <input type="hidden" name="launch" value="<?php p($form->launch) ?>">
<input type="hidden" name="course" value="<?php p($form->course) ?>"> <input type="hidden" name="course" value="<?php p($form->course) ?>">

View File

@ -3,8 +3,28 @@
/// Library of functions and constants for module scorm /// Library of functions and constants for module scorm
/// (replace scorm with the name of your module and delete this line) /// (replace scorm with the name of your module and delete this line)
$SCORM_WINDOW_OPTIONS = array("resizable", "scrollbars", "status", "height", "width");
$SCORM_FRAME_SIZE = 140; if (!isset($CFG->scorm_popup)) {
set_config("scorm_popup", "");
}
foreach ($SCORM_WINDOW_OPTIONS as $popupoption) {
$popupoption = "scorm_popup$popupoption";
if (!isset($CFG->$popupoption)) {
if ($popupoption == "scorm_popupheight") {
set_config($popupoption, 450);
} else if ($popupoption == "scorm_popupwidth") {
set_config($popupoption, 620);
} else {
set_config($popupoption, "checked");
}
}
}
if (!isset($CFG->scorm_framesize)) {
set_config("scorm_framesize", 140);
}
function scorm_add_instance($scorm) { function scorm_add_instance($scorm) {
/// Given an object containing all the necessary data, /// Given an object containing all the necessary data,
@ -15,6 +35,19 @@ function scorm_add_instance($scorm) {
$scorm->timemodified = time(); $scorm->timemodified = time();
# May have to add extra stuff in here # # May have to add extra stuff in here #
global $SCORM_WINDOW_OPTIONS;
if (isset($scorm->setnewwindow)) {
$optionlist = array();
foreach ($SCORM_WINDOW_OPTIONS as $option) {
if (isset($scorm->$option)) {
$optionlist[] = $option."=".$scorm->$option;
}
}
$scorm->popup = implode(',', $optionlist);
$scorm->popup .= ',location=0,menubar=0,toolbar=0';
$scorm->auto = '0';
}
return insert_record("scorm", $scorm); return insert_record("scorm", $scorm);
} }
@ -24,11 +57,24 @@ function scorm_update_instance($scorm) {
/// Given an object containing all the necessary data, /// Given an object containing all the necessary data,
/// (defined by the form in mod.html) this function /// (defined by the form in mod.html) this function
/// will update an existing instance with new data. /// will update an existing instance with new data.
$scorm->timemodified = time(); $scorm->timemodified = time();
$scorm->id = $scorm->instance; $scorm->id = $scorm->instance;
# May have to add extra stuff in here # # May have to add extra stuff in here #
global $SCORM_WINDOW_OPTIONS;
if (isset($scorm->setnewwindow)) {
$optionlist = array();
foreach ($SCORM_WINDOW_OPTIONS as $option) {
if (isset($scorm->$option)) {
$optionlist[] = $option."=".$scorm->$option;
}
}
$scorm->popup = implode(',', $optionlist);
$scorm->popup .= ',location=0,menubar=0,toolbar=0';
$scorm->auto = '0';
}
return update_record("scorm", $scorm); return update_record("scorm", $scorm);
} }

View File

@ -11,9 +11,6 @@
if (empty($form->launch)) { if (empty($form->launch)) {
$form->launch = ""; $form->launch = "";
} }
if (empty($form->auto)) {
$form->auto = "";
}
?> ?>
@ -58,16 +55,6 @@
<?php print_textarea($usehtmleditor, 20, 50, 680, 400, "summary", $form->summary); ?> <?php print_textarea($usehtmleditor, 20, 50, 680, 400, "summary", $form->summary); ?>
</td> </td>
</tr> </tr>
<tr valign=top>
<td align=right><p><b><?php print_string("autocontinue","scorm") ?>:</b></p></td>
<td>
<?php
$options[]=get_string("no");
$options[]=get_string("yes");
choose_from_menu ($options, "auto", $form->auto);
?>
</td>
</tr>
</table> </table>
<input type="hidden" name=course value="<?php p($form->course) ?>"> <input type="hidden" name=course value="<?php p($form->course) ?>">
<input type="hidden" name=coursemodule value="<?php p($form->coursemodule) ?>"> <input type="hidden" name=coursemodule value="<?php p($form->coursemodule) ?>">

View File

@ -64,55 +64,171 @@
"$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>",
"", "", true, update_module_button($cm->id, $course->id, $strscorm), navmenu($course, $cm, '_top')); "", "", true, update_module_button($cm->id, $course->id, $strscorm), navmenu($course, $cm, '_top'));
echo "<table width=\"100%\">\n <tr><td align=\"center\">".text_to_html($scorm->summary, true, false)."</td></tr></table>\n"; echo "<table width=\"100%\">\n <tr><td align=\"center\">".text_to_html($scorm->summary, true, false)."</td>\n";
if ($_GET["mode"] == "browse")
echo "<td align=\"right\" width=\"10%\" nowrap>".get_string("browsemode","scorm")."</td>\n";
echo " </tr>\n</table>\n";
if ($scoes = get_records_select("scorm_scoes","scorm='$scorm->id' order by id ASC")){
$level=0;
$parents[$level]="/";
foreach ($scoes as $sco) {
if ($parents[$level]!=$sco->parent) {
if ($level>0 && $parents[$level-1]==$sco->parent) {
$level--;
} else {
$level++;
$parents[$level]=$sco->parent;
}
}
$indenting = "";
for ($i=0;$i<$level;$i++) {
$indenting .= "-";
}
$options[$sco->id] = $indenting."&gt; ".$sco->title;
}
}
echo "<table width=\"100%\">\n <tr>\n"; echo "<table width=\"100%\">\n <tr>\n";
echo " <td nowrap> echo " <td align=\"center\" nowrap>
<iframe name=\"cmi\" width=\"1\" height=\"1\" src=\"cmi.php?id=$cm->id\" style=\"visibility: hidden;\"></iframe> <iframe name=\"cmi\" width=\"1\" height=\"1\" src=\"cmi.php?id=$cm->id\" style=\"visibility: hidden;\"></iframe>
<form name=\"navform\" method=\"POST\" action=\"playscorm.php?id=$cm->id\" target=\"_top\"> <form name=\"navform\" method=\"POST\" action=\"playscorm.php?id=$cm->id\" target=\"_top\">
<input name=\"scoid\" type=\"hidden\" /> <input name=\"scoid\" type=\"hidden\" />
<input name=\"mode\" type=\"hidden\" value=\"".$_GET["mode"]."\" /> <input name=\"mode\" type=\"hidden\" value=\"".$_GET["mode"]."\" />
<input name=\"prev\" type=\"button\" value=\"".get_string("prev","scorm")."\" onClick=\"top.changeSco('prev');\" />&nbsp;\n"; <input name=\"prev\" type=\"button\" value=\"".get_string("prev","scorm")."\" onClick=\"top.changeSco('prev');\" />&nbsp;\n";
choose_from_menu($options, "courseStructure", "", "", "document.navform.scoid.value=document.navform.courseStructure.options[document.navform.courseStructure.selectedIndex].value;document.navform.submit();");
echo " &nbsp;<input name=\"next\" type=\"button\" value=\"".get_string("next","scorm")."\" onClick=\"top.changeSco('next')\" /> if ($scorm->popup == "") {
</form> if ($scoes = get_records_select("scorm_scoes","scorm='$scorm->id' order by id ASC")){
$level=0;
$parents[$level]="/";
foreach ($scoes as $sco) {
if ($parents[$level]!=$sco->parent) {
if ($level>0 && $parents[$level-1]==$sco->parent) {
$level--;
} else {
$level++;
$parents[$level]=$sco->parent;
}
}
$indenting = "";
for ($i=0;$i<$level;$i++) {
$indenting .= "-";
}
$options[$sco->id] = $indenting."&gt; ".$sco->title;
}
}
choose_from_menu($options, "courseStructure", "", "", "document.navform.scoid.value=document.navform.courseStructure.options[document.navform.courseStructure.selectedIndex].value;document.navform.submit();");
}
echo " &nbsp;<input name=\"next\" type=\"button\" value=\"".get_string("next","scorm")."\" onClick=\"top.changeSco('next')\" />\n";
echo " </form>
</td>\n"; </td>\n";
if ($_GET["mode"] == "browse")
echo "<td align=\"right\">".get_string("browsemode","scorm")."</td>\n";
echo "</tr>\n</table>\n"; echo "</tr>\n</table>\n";
if ($scorm->popup != "") {
$currentSCO = "";
if (!empty($_GET['scoid']))
$currentSCO = $_GET['scoid'];
?>
<br />
<script language="Javascript">
<!--
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
var beg=nn?"document.ids.":w3c?"document.getElementById(":"document.all.";
var mid=w3c?").style":".style";
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>
<style type="text/css">
.scormlist { list-style-type:none; }
</style>
<?php
print_simple_box_start("CENTER");
echo "<table>\n";
echo " <tr><th>".get_string("coursestruct","scorm")."</th></tr>\n";
echo " <tr><td nowrap>\n<ul class=\"scormlist\"'>\n";
$incomplete = false;
if ($scoes = get_records_select("scorm_scoes","scorm='$scorm->id' order by id ASC")){
$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 {
echo " <li><ul id='".$sublist."' class=\"scormlist\"'>\n";
$level++;
$parents[$level]=$sco->parent;
}
}
echo " <li>\n";
$nextsco = next($scoes);
if (($nextsco !== false) && ($sco->parent != $nextsco->parent) && (($level==0) || (($level>0) && ($nextsco->parent != $parents[$level-1])))) {
$sublist++;
echo " <img src=\"pix/minus.gif\" onClick='expandCollide(this,".$sublist.");'/>\n";
} else {
echo " <img src=\"pix/spacer.gif\" />\n";
}
if ($sco->launch) {
$startbold = '';
$endbold = '';
if ($sco->id == $currentSCO) {
$startbold = '<b><u>';
$endbold = '</u></b>';
}
if ($sco_user=get_record("scorm_sco_users","scoid",$sco->id,"userid",$USER->id)) {
if ( $sco_user->cmi_core_lesson_status == "")
$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";
if (($sco_user->cmi_core_lesson_status == "not attempted") || ($sco_user->cmi_core_lesson_status == "incomplete")) {
if ($currentSCO == "") {
$incomplete = true;
$currentSCO = $sco->id;
$startbold = '<b><u>';
$endbold = '</u></b>';
}
}
} else {
echo " <img src=\"pix/notattempted.gif\" alt=\"".get_string("notattempted","scorm")."\" />";
$incomplete = true;
}
echo " &nbsp;$startbold<a href=\"javascript:playSCO(".$sco->id.");\">$sco->title</a>$endbold\n </li>\n";
} else {
echo " &nbsp;$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();
}
echo "</body>\n</html>\n"; echo "</body>\n</html>\n";
} else { } else {
// if ($_POST["scoid"])
// Frameset
//
if ($_POST["scoid"])
$scoid = "&scoid=".$_POST["scoid"]; $scoid = "&scoid=".$_POST["scoid"];
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=".$_POST["mode"].$scoid."\"></script>\n"; echo "<script id=\"scormAPI\" language=\"JavaScript\" type=\"text/javascript\" src=\"scormAPI.php?id=$cm->id&mode=".$_POST["mode"].$scoid."\"></script>\n";
echo "<frameset rows=\"$SCORM_FRAME_SIZE,*\" onLoad=\"SCOInitialize();\">\n";
echo " <frame name=\"nav\" src=\"playscorm.php?id=$cm->id&mode=".$_POST["mode"]."&frameset=top\">\n"; if ($scorm->popup == "") {
echo " <frame name=\"main\" src=\"\">\n"; //
// Frameset
//
echo "<frameset rows=\"$CFG->scorm_framesize,*\" onLoad=\"SCOInitialize();\">\n";
echo " <frame name=\"nav\" src=\"playscorm.php?id=$cm->id&mode=".$_POST["mode"]."&frameset=top\">\n";
echo " <frame name=\"main\" src=\"\">\n";
} else {
echo "<script language=\"Javascript\">\n";
echo '<!--';
echo "\nmain = window.open('','SCO Display','$scorm->popup');\n";
echo "-->\n";
echo '</script>';
echo "\n<frameset rows=\"*\" onLoad=\"SCOInitialize();\">\n";
echo " <frame name=\"nav\" src=\"playscorm.php?id=$cm->id&mode=".$_POST["mode"]."&frameset=top".$scoid."\">\n";
}
echo "</frameset>\n"; echo "</frameset>\n";
echo "</html>\n"; echo "</html>\n";
} }

View File

@ -90,6 +90,8 @@
$scoreview = ""; $scoreview = "";
if ($data->cmi_core_score_raw > 0) if ($data->cmi_core_score_raw > 0)
$scoreview = "<br />".get_string("score","scorm").":&nbsp;".$data->cmi_core_score_raw; $scoreview = "<br />".get_string("score","scorm").":&nbsp;".$data->cmi_core_score_raw;
if ( $data->cmi_core_lesson_status == "")
$data->cmi_core_lesson_status = "not attempted";
$row[]="<img src=\"pix/".scorm_remove_spaces($data->cmi_core_lesson_status).".gif\" $row[]="<img src=\"pix/".scorm_remove_spaces($data->cmi_core_lesson_status).".gif\"
alt=\"".get_string(scorm_remove_spaces($data->cmi_core_lesson_status),"scorm")."\" alt=\"".get_string(scorm_remove_spaces($data->cmi_core_lesson_status),"scorm")."\"
title=\"".get_string(scorm_remove_spaces($data->cmi_core_lesson_status),"scorm")."\">&nbsp;" title=\"".get_string(scorm_remove_spaces($data->cmi_core_lesson_status),"scorm")."\">&nbsp;"

View File

@ -135,6 +135,7 @@
include("api1_2.php"); include("api1_2.php");
?> ?>
function hilightcurrent(popupmenu) { function hilightcurrent(popupmenu) {
for (i=0;i < popupmenu.options.length;i++) { for (i=0;i < popupmenu.options.length;i++) {
if ( popupmenu.options[i].value == <?php echo $sco->id; ?> ) if ( popupmenu.options[i].value == <?php echo $sco->id; ?> )
@ -154,8 +155,9 @@ function SCOInitialize() {
} }
?> ?>
top.main.location="<?php echo $result; ?>"; top.main.location="<?php echo $result; ?>";
<?php if ($scorm->popup == "") { ?>
hilightcurrent(top.nav.document.navform.courseStructure); hilightcurrent(top.nav.document.navform.courseStructure);
<?php } ?>
} }
function changeSco(direction) { function changeSco(direction) {

View File

@ -5,7 +5,7 @@
/// This fragment is called by moodle_needs_upgrading() and /admin/index.php /// This fragment is called by moodle_needs_upgrading() and /admin/index.php
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
$module->version = 2004060400; // The (date) version of this module $module->version = 2004061800; // The (date) version of this module
$module->requires = 2004051600; // The version of Moodle that is required $module->requires = 2004051600; // The version of Moodle that is required
$module->cron = 0; // How often should cron check this module (seconds)? $module->cron = 0; // How often should cron check this module (seconds)?

View File

@ -93,7 +93,7 @@
print_simple_box_start("CENTER"); print_simple_box_start("CENTER");
echo "<table>\n"; echo "<table>\n";
echo " <tr><th>".get_string("coursestruct","scorm")."</th></tr>\n"; echo " <tr><th>".get_string("coursestruct","scorm")."</th></tr>\n";
echo " <tr><td nowrap>\n<ul compact class=\"scormlist\"'>\n"; echo " <tr><td nowrap>\n<ul class=\"scormlist\"'>\n";
$incomplete = false; $incomplete = false;
if ($scoes = get_records_select("scorm_scoes","scorm='$scorm->id' order by id ASC")){ if ($scoes = get_records_select("scorm_scoes","scorm='$scorm->id' order by id ASC")){
$level=0; $level=0;
@ -102,10 +102,10 @@
foreach ($scoes as $sco) { foreach ($scoes as $sco) {
if ($parents[$level]!=$sco->parent) { if ($parents[$level]!=$sco->parent) {
if ($level>0 && $parents[$level-1]==$sco->parent) { if ($level>0 && $parents[$level-1]==$sco->parent) {
echo " </ul>\n"; echo " </ul></li>\n";
$level--; $level--;
} else { } else {
echo " <ul id='".$sublist."' compact class=\"scormlist\"'>\n"; echo " <li><ul id='".$sublist."' class=\"scormlist\"'>\n";
$level++; $level++;
$parents[$level]=$sco->parent; $parents[$level]=$sco->parent;
} }
@ -135,7 +135,7 @@
} }
} }
for ($i=0;$i<$level;$i++){ for ($i=0;$i<$level;$i++){
echo " </ul>\n"; echo " </ul></li>\n";
} }
} }
echo "</ul></td></tr>\n"; echo "</ul></td></tr>\n";