Permalink
Browse files

*** empty log message ***

  • Loading branch information...
1 parent d065dc2 commit fc274a5f40d1c1871a259baea7f28c5e828b6f75 bobopinna committed Jul 6, 2004
Showing with 73 additions and 35 deletions.
  1. +8 −9 mod/scorm/api1_2.php
  2. +8 −9 mod/scorm/cmi.php
  3. +10 −4 mod/scorm/lib.php
  4. +24 −5 mod/scorm/playscorm.php
  5. +23 −8 mod/scorm/view.php
View
@@ -3,6 +3,7 @@
//
function SCORMapi() {
var cmi= new Object();
+ var nav = new Object();
var errorCode = 0;
@@ -53,7 +54,7 @@ function LMSInitialize (param) {
// end CMI Initialization
//
- nav = new Object();
+ // Navigation Object
<?php
if ($scorm->auto) {
echo 'nav.event = "continue";'."\n";
@@ -111,14 +112,10 @@ function LMSSetValue (param,value) {
switch (param) {
case "cmi.core.session_time":
if (typeof(value) == "string") {
- var matchedtime = value.match(/([0-9]{2,4}):([0-9]{2}):([0-9]{2})/g);
- if (matchedtime != null) {
- var parsedtime = value.match(/[0-9]+/g);
- if (((parsedtime.length == 3) || (parsedtime.length == 4)) && (parsedtime[0]>=0) && (parsedtime[0]<=9999) && (parsedtime[1]>=0) && (parsedtime[1]<=59) && (parsedtime[2]>=0) && (parsedtime[2]<=59)) {
- if ((parsedtime.length == 4) && (parsedtime[3]<=0) && (parsedtime[3]>=99)) {
- errorCode = 405;
- return "false";
- }
+ var parsedtime = value.match(/^([0-9]{2,4}):([0-9]{2}):([0-9]{2})(\.[0-9]{1,2})?$/);
+ if (parsedtime != null) {
+ //top.alert(parsedtime);
+ if (((parsedtime.length == 4) || (parsedtime.length == 5)) && (parsedtime[2]>=0) && (parsedtime[2]<=59) && (parsedtime[3]>=0) && (parsedtime[3]<=59)) {
eval(param+'="'+value+'";');
errorCode = 0;
return "true";
@@ -249,11 +246,13 @@ function LMSFinish (param) {
Initialized = false;
errorCode = 0;
cmi.core.total_time = AddTime(cmi.core.total_time, cmi.core.session_time);
+ //top.alert(cmi.core.total_time);
if (<?php echo $navObj ?>cmi.document.theform) {
cmiform = <?php echo $navObj ?>cmi.document.forms[0];
cmiform.scoid.value = "<?php echo $sco->id; ?>";
cmiform.cmi_core_total_time.value = cmi.core.total_time;
cmiform.submit();
+
}
if (nav.event != "") {
<?php
View
@@ -32,23 +32,23 @@
require_login($course->id);
- if ($_POST["scoid"]) {
- if ($_POST["cmi_core_lesson_location"]) {
+ if (!empty($_POST["scoid"])) {
+ if (!empty($_POST["cmi_core_lesson_location"])) {
set_field("scorm_sco_users","cmi_core_lesson_location",$_POST["cmi_core_lesson_location"],"scoid",$_POST["scoid"],"userid",$USER->id);
}
- if ($_POST["cmi_core_lesson_status"]) {
+ if (!empty($_POST["cmi_core_lesson_status"])) {
set_field("scorm_sco_users","cmi_core_lesson_status",$_POST["cmi_core_lesson_status"],"scoid",$_POST["scoid"],"userid",$USER->id);
}
- if ($_POST["cmi_core_exit"]) {
+ if (!empty($_POST["cmi_core_exit"])) {
set_field("scorm_sco_users","cmi_core_exit",$_POST["cmi_core_exit"],"scoid",$_POST["scoid"],"userid",$USER->id);
}
- if ($_POST["cmi_core_total_time"]) {
+ if (!empty($_POST["cmi_core_total_time"])) {
set_field("scorm_sco_users","cmi_core_total_time",$_POST["cmi_core_total_time"],"scoid",$_POST["scoid"],"userid",$USER->id);
}
- if ($_POST["cmi_core_score_raw"]) {
+ if (!empty($_POST["cmi_core_score_raw"])) {
set_field("scorm_sco_users","cmi_core_score_raw",$_POST["cmi_core_score_raw"],"scoid",$_POST["scoid"],"userid",$USER->id);
}
- if ($_POST["cmi_suspend_data"]) {
+ if (!empty($_POST["cmi_suspend_data"])) {
set_field("scorm_sco_users","cmi_suspend_data",$_POST["cmi_suspend_data"],"scoid",$_POST["scoid"],"userid",$USER->id);
}
}
@@ -64,10 +64,9 @@
<input type="hidden" name="cmi_core_lesson_status" />
<input type="hidden" name="cmi_core_exit" />
<input type="hidden" name="cmi_core_session_time" />
- <input type="hidden" name="cmi_core_total_time" />
+ <input type="hidden" name="cmi_core_total_time" />
<input type="hidden" name="cmi_core_score_raw" />
<input type="hidden" name="cmi_suspend_data" />
</form>
- <?php echo $result?>
</body>
</html>
View
@@ -302,10 +302,15 @@ function scorm_endElement($parser, $name) {
if ($name == "ITEM") {
$level--;
}
- if ($name == "TITLE" && $level>0)
- $manifest[$i]["title"] = $datacontent;
- if ($name == "ADLCP:HIDERTSUI")
- $manifest[$i][$datacontent] = 1;
+ if ($name == "TITLE" && $level>0) {
+ $manifest[$i]["title"] = $datacontent;
+ }
+ if ($name == "ADLCP:HIDERTSUI") {
+ $manifest[$i][$datacontent] = 1;
+ }
+ if ($name == "ORGANIZATION") {
+ $level = 0;
+ }
}
function scorm_characterData($parser, $data) {
@@ -344,6 +349,7 @@ function scorm_parse($basedir,$file,$scorm_id) {
$sco->scorm = $scorm_id;
delete_records("scorm_scoes","scorm",$scorm_id);
delete_records("scorm_sco_users","scormid",$scorm_id);
+ print_r($manifest);
for ($j=1; $j<=$i; $j++) {
$sco->identifier = $manifest[$j]["identifier"];
$sco->parent = $manifest[$j]["parent"];
View
@@ -127,14 +127,25 @@ function expandCollide(which,list) {
echo " </ul></li>\n";
$level--;
} else {
- echo " <li><ul id='".$sublist."' class=\"scormlist\"'>\n";
- $level++;
+ $i = $level;
+ $closelist = "";
+ while (($i > 0) && ($parents[$level] != $sco->parent)) {
+ $closelist .= " </ul></li>\n";
+ $i--;
+ }
+ if (($i == 0) && ($sco->parent != "/")) {
+ echo " <li><ul id='".$sublist."' class=\"scormlist\"'>\n";
+ $level++;
+ } else {
+ echo $closelist;
+ $level = $i;
+ }
$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])))) {
+ if (($nextsco !== false) && ($sco->parent != $nextsco->parent) && (($level==0) || (($level>0) && ($nextsco->parent == $sco->identifier)))) {
$sublist++;
echo " <img src=\"pix/minus.gif\" onClick='expandCollide(this,".$sublist.");'/>\n";
} else {
@@ -189,7 +200,7 @@ function expandCollide(which,list) {
echo "<table width=\"100%\">\n <tr>\n";
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\">
<input name=\"scoid\" type=\"hidden\" />
<input name=\"mode\" type=\"hidden\" value=\"".$mode."\" />
@@ -204,7 +215,15 @@ function expandCollide(which,list) {
if ($level>0 && $parents[$level-1]==$sco->parent) {
$level--;
} else {
- $level++;
+ $i = $level;
+ while (($i > 0) && ($parents[$level] != $sco->parent)) {
+ $i--;
+ }
+ if (($i == 0) && ($sco->parent != "/")) {
+ $level++;
+ } else {
+ $level = $i;
+ }
$parents[$level]=$sco->parent;
}
}
View
@@ -105,33 +105,48 @@
echo " </ul></li>\n";
$level--;
} else {
- echo " <li><ul id='".$sublist."' class=\"scormlist\"'>\n";
- $level++;
+ $i = $level;
+ $closelist = "";
+ while (($i > 0) && ($parents[$level] != $sco->parent)) {
+ $closelist .= " </ul></li>\n";
+ $i--;
+ }
+ if (($i == 0) && ($sco->parent != "/")) {
+ echo " <li><ul id='".$sublist."' class=\"scormlist\"'>\n";
+ $level++;
+ } else {
+ echo $closelist;
+ $level = $i;
+ }
$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])))) {
+ if (($nextsco !== false) && ($sco->parent != $nextsco->parent) && (($level==0) || (($level>0) && ($nextsco->parent == $sco->identifier)))) {
$sublist++;
echo " <img src=\"pix/minus.gif\" onClick='expandCollide(this,".$sublist.");'/>\n";
} else {
echo " <img src=\"pix/spacer.gif\" />\n";
}
if ($sco->launch) {
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";
+ }
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")) {
$incomplete = true;
+ }
} else {
echo " <img src=\"pix/notattempted.gif\" alt=\"".get_string("notattempted","scorm")."\" />";
$incomplete = true;
}
$score = "";
- if ($sco_user->cmi_core_score_raw > 0)
- $score = "(".get_string("score","scorm").":&nbsp;".$sco_user->cmi_core_score_raw.")";
+ if ($sco_user->cmi_core_score_raw > 0) {
+ $score = "(".get_string("score","scorm").":&nbsp;".$sco_user->cmi_core_score_raw.")";
+ }
echo " &nbsp;<a href=\"javascript:playSCO(".$sco->id.")\">$sco->title</a> $score\n </li>\n";
} else {
echo " &nbsp;$sco->title\n </li>\n";

0 comments on commit fc274a5

Please sign in to comment.