From b5127f1e262c9f04aeb95de43bf424258b3e2899 Mon Sep 17 00:00:00 2001 From: bobopinna Date: Mon, 27 Jun 2005 07:26:49 +0000 Subject: [PATCH] Added popup support --- mod/scorm/aicc.php | 45 +++++++++++++++++--- mod/scorm/db/mysql.php | 4 ++ mod/scorm/db/mysql.sql | 1 + mod/scorm/mod.html | 91 +++++++++++++++++++++++++++++++++++++---- mod/scorm/playscorm.php | 32 +++++++++------ mod/scorm/version.php | 2 +- 6 files changed, 148 insertions(+), 27 deletions(-) diff --git a/mod/scorm/aicc.php b/mod/scorm/aicc.php index 98e78e1330b..f43e6a888a4 100755 --- a/mod/scorm/aicc.php +++ b/mod/scorm/aicc.php @@ -49,6 +49,7 @@ $userdata->mode = $mode; if ($sco = get_record('scorm_scoes','id',$scoid)) { + $userdata->course_id = $sco->identifier; $userdata->datafromlms = $sco->datafromlms; $userdata->masteryscore = $sco->masteryscore; $userdata->maxtimeallowed = $sco->maxtimeallowed; @@ -89,6 +90,7 @@ echo "[Core_Lesson]\n"."\n"; } echo "[Core_Vendor]\n".$userdata->datafromlms."\n"; + echo "[Evaluation]\nCourse_ID = {".$userdata->course_id."}\n"; } else { error('Sco not found'); } @@ -96,47 +98,78 @@ break; case 'putparam': if ($status == 'Running') { - print_r($_POST['aicc_data']); echo "error = 0\nerror_text = Successful\n"; + } else if ($status == 'Terminated') { + echo "error = 1\nerror_text = Terminated\n"; + } else { + echo "error = 1\nerror_text = Not Initialized\n"; } break; case 'putcomments': if ($status == 'Running') { - print_r($_POST['aicc_data']); echo "error = 0\nerror_text = Successful\n"; + } else if ($status == 'Terminated') { + echo "error = 1\nerror_text = Terminated\n"; + } else { + echo "error = 1\nerror_text = Not Initialized\n"; } break; case 'putinteractions': if ($status == 'Running') { - print_r($_POST['aicc_data']); echo "error = 0\nerror_text = Successful\n"; + } else if ($status == 'Terminated') { + echo "error = 1\nerror_text = Terminated\n"; + } else { + echo "error = 1\nerror_text = Not Initialized\n"; } break; case 'putobjectives': if ($status == 'Running') { - print_r($_POST['aicc_data']); echo "error = 0\nerror_text = Successful\n"; + } else if ($status == 'Terminated') { + echo "error = 1\nerror_text = Terminated\n"; + } else { + echo "error = 1\nerror_text = Not Initialized\n"; } break; case 'putpath': if ($status == 'Running') { - print_r($_POST['aicc_data']); echo "error = 0\nerror_text = Successful\n"; + } else if ($status == 'Terminated') { + echo "error = 1\nerror_text = Terminated\n"; + } else { + echo "error = 1\nerror_text = Not Initialized\n"; } break; case 'putperformance': if ($status == 'Running') { - print_r($_POST['aicc_data']); echo "error = 0\nerror_text = Successful\n"; + } else if ($status == 'Terminated') { + echo "error = 1\nerror_text = Terminated\n"; + } else { + echo "error = 1\nerror_text = Not Initialized\n"; } break; case 'exitau': if ($status == 'Running') { $SESSION->scorm_status = 'Terminated'; echo "error = 0\nerror_text = Successful\n"; + } else if ($status == 'Terminated') { + echo "error = 1\nerror_text = Terminated\n"; + } else { + echo "error = 1\nerror_text = Not Initialized\n"; } break; + default: + echo "error = 1\nerror_text = Invalid Command\n"; + break; } } + } else { + if (empty($command)) { + echo "error = 1\nerror_text = Invalid Command\n"; + } else { + echo "error = 3\nerror_text = Invalid Session ID\n"; + } } ?> \ No newline at end of file diff --git a/mod/scorm/db/mysql.php b/mod/scorm/db/mysql.php index d873bd86e24..357b73bc769 100755 --- a/mod/scorm/db/mysql.php +++ b/mod/scorm/db/mysql.php @@ -178,6 +178,10 @@ function scorm_upgrade($oldversion) { if ($oldversion < 2005052200) { table_column("scorm_scoes_track", "", "timemodified", "INT", "10", "UNSIGNED", "0", "NOT NULL", "value"); } + + if ($oldversion < 2005062700) { + table_column("scorm", "", "popup", "TINYINT", "1", "UNSIGNED", "0", "NOT NULL", "auto"); + } return true; } diff --git a/mod/scorm/db/mysql.sql b/mod/scorm/db/mysql.sql index 90f7259fd49..6b414f7f465 100755 --- a/mod/scorm/db/mysql.sql +++ b/mod/scorm/db/mysql.sql @@ -14,6 +14,7 @@ CREATE TABLE prefix_scorm ( summary text NOT NULL, browsemode tinyint(2) NOT NULL default '0', auto tinyint(1) unsigned NOT NULL default '0', + popup tinyint(1) unsigned NOT NULL default '0', width int(10) unsigned NOT NULL default '800', height int(10) unsigned NOT NULL default '600', timemodified int(10) unsigned NOT NULL default '0', diff --git a/mod/scorm/mod.html b/mod/scorm/mod.html index a6df35f9652..074cf45493b 100755 --- a/mod/scorm/mod.html +++ b/mod/scorm/mod.html @@ -15,6 +15,9 @@ if (empty($form->auto)) { $form->auto = ""; } + if (empty($form->auto)) { + $form->popup = "0"; + } if (empty($form->datadir)) { $form->datadir = ""; } @@ -171,15 +174,55 @@ ?> +
+ + + : + + + " id="advancedsettingsbutton" onclick="javascrip: return showhide('advancedsettings');" /> + + + + + +
+ @@ -195,25 +238,57 @@ ?> + + + + + + + + +
: auto,''); - helpbutton("autocontinue", get_string("autocontinue", "scorm"), "scorm", true); + $options = array(); + $options[0]=get_string("no"); + $options[1]=get_string("yes"); + choose_from_menu ($options, "auto", $form->auto,''); + helpbutton("autocontinue", get_string("autocontinue", "scorm"), "scorm", true); ?>
: + popup,''); + helpbutton("popupwindow", get_string("popup", "scorm"), "scorm", true); + ?> +
+ + +  
: -
: -
+
+ + - + format == 'scorm') && ((count($scorms) == 0) || ($form->instance == $coursescorm->id))) { + ?> + + + diff --git a/mod/scorm/playscorm.php b/mod/scorm/playscorm.php index df03680d2b9..24a57fe1b5b 100755 --- a/mod/scorm/playscorm.php +++ b/mod/scorm/playscorm.php @@ -81,23 +81,23 @@ // // Print the page header // + $scripts = ''; + if ($scorm->popup = 1) { + $scripts = 'onUnload="top.main.close();"'; + } print_header($pagetitle, "$course->fullname", "$navigation ".format_string($scorm->name,true)."", - '', '', true, update_module_button($cm->id, $course->id, $strscorm)); + '', '', true, update_module_button($cm->id, $course->id, $strscorm), '', false, $scripts); ?> +popup == 0) { +?> + + +
-

summary) ?>

-
@@ -129,12 +129,26 @@
-