Permalink
Browse files

Added popup window scorm player and its settings

  • Loading branch information...
bobopinna
bobopinna committed Jun 21, 2004
1 parent aea8362 commit 76d3542313253ccb5dca3fe412aee2165e20897b
View
@@ -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
//
function SCORMapi() {
+ var cmi= new Object();
+
+ var errorCode = 0;
+
var Initialized = false;
function LMSInitialize (param) {
@@ -52,6 +16,37 @@ function LMSInitialize (param) {
if (!Initialized) {
Initialized = true;
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";
} else {
errorCode = 101;
@@ -277,6 +272,7 @@ function AddTime (first, second) {
return hours + ":" + mins + ":" + secs;
}
+
this.LMSInitialize = LMSInitialize;
this.LMSGetValue = LMSGetValue;
this.LMSSetValue = LMSSetValue;
View
@@ -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
@@ -5,14 +5,17 @@ function scorm_upgrade($oldversion) {
/// older versions to match current functionality
global $CFG;
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) {
- 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;
}
?>
-
View
@@ -6,11 +6,12 @@ CREATE TABLE prefix_scorm (
id int(10) unsigned NOT NULL auto_increment,
course int(10) unsigned NOT NULL default '0',
name varchar(255) NOT NULL default '',
- reference varchar(255) default NULL,
+ reference varchar(255) NOT NULL default '',
datadir varchar(255) NOT NULL default '',
launch int(10) unsigned NOT NULL default 0,
summary text NOT NULL,
auto tinyint(1) unsigned NOT NULL default '0',
+ popup varchar(255) NOT NULL default '',
timemodified int(10) unsigned NOT NULL default '0',
PRIMARY KEY (id),
UNIQUE KEY id (id)
View
@@ -3,7 +3,17 @@
function scorm_upgrade($oldversion) {
// This function does anything necessary to upgrade
// 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;
}
@@ -6,11 +6,12 @@ CREATE TABLE prefix_scorm (
id SERIAL PRIMARY KEY,
course integer NOT NULL default '0',
name varchar(255) NOT NULL default '',
- reference varchar(255) default NULL,
+ reference varchar(255) NOT NULL default '',
datadir varchar(255) NOT NULL default '',
launch integer NOT NULL default '0',
summary text NOT NULL default '',
auto integer NOT NULL default '0',
+ popup varchar(255) NOT NULL default '',
timemodified integer NOT NULL default '0'
);
View
@@ -79,16 +79,119 @@
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>".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 "</table>\n";
if ($result == "regular") {
+ if (empty($form->auto)) {
+ $form->auto = "";
+ }
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="datadir" value="<?php p(substr($tempdir,strlen($scormdir))) ?>">
<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="launch" value="<?php p($form->launch) ?>">
<input type="hidden" name="course" value="<?php p($form->course) ?>">
Oops, something went wrong.

0 comments on commit 76d3542

Please sign in to comment.