Skip to content

Commit

Permalink
Fixed some undefined variable
Browse files Browse the repository at this point in the history
  • Loading branch information
bobopinna committed May 27, 2004
1 parent 4ad5a49 commit fc1b266
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 25 deletions.
22 changes: 11 additions & 11 deletions mod/scorm/api1_2.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@

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.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.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';
Expand All @@ -18,15 +18,15 @@
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 $_GET["mode"] ?>";
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";
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.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;
Expand Down Expand Up @@ -180,7 +180,7 @@ function LMSCommit (param) {
if (Initialized) {
if (top.nav.cmi.document.theform) {
cmiform = top.nav.cmi.document.forms[0];
cmiform.scoid.value = "<?php echo $sco->id ?>";
cmiform.scoid.value = "<?php echo $sco->id; ?>";
cmiform.cmi_core_lesson_location.value = cmi.core.lesson_location;
cmiform.cmi_core_lesson_status.value = cmi.core.lesson_status;
cmiform.cmi_core_exit.value = cmi.core.exit;
Expand Down
2 changes: 1 addition & 1 deletion mod/scorm/details.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
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") {
echo "<form name=\"theform\" method=\"post\" $onsubmit action=\"$form->destination\">\n";
echo "<form name=\"theform\" method=\"post\" action=\"$form->destination\">\n";
?>
<input type="hidden" name="reference" value="<?php p($form->reference) ?>">
<input type="hidden" name="datadir" value="<?php p(substr($tempdir,strlen($scormdir))) ?>">
Expand Down
3 changes: 2 additions & 1 deletion mod/scorm/playscorm.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

optional_variable($id); // Course Module ID, or
optional_variable($a); // scorm ID
optional_variable($frameset, "");

if ($id) {
if (! $cm = get_record("course_modules", "id", $id)) {
Expand Down Expand Up @@ -54,7 +55,7 @@
update_module_button($cm->id, $course->id, $strscorm), navmenu($course, $cm));
notice(get_string("activityiscurrentlyhidden"));
}
if ($frameset) {
if ($frameset == "top") {
add_to_log($course->id, "scorm", "view", "playscorm.php?id=$cm->id", "$scorm->id");
//
// Print the page header
Expand Down
1 change: 1 addition & 0 deletions mod/scorm/report.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
$row[] = "<a href=\"$CFG->wwwroot/user/view.php?id=$data->userid&course=$course->id\">".
"$data->firstname $data->lastname</a>";
foreach ($user_data as $data) {
$scoreview = "";
if ($data->cmi_core_score_raw > 0)
$scoreview = "<br />".get_string("score","scorm").":&nbsp;".$data->cmi_core_score_raw;
$row[]="<img src=\"pix/".scorm_remove_spaces($data->cmi_core_lesson_status).".gif\"
Expand Down
26 changes: 17 additions & 9 deletions mod/scorm/scormAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

optional_variable($id); // Course Module ID, or
optional_variable($a); // scorm ID
optional_variable($scoid); // sco ID
optional_variable($mode);

if ($id) {
if (! $cm = get_record("course_modules", "id", $id)) {
Expand Down Expand Up @@ -33,15 +35,15 @@
require_login($course->id);

if ( $scoes_user = get_records_select("scorm_sco_users","userid = ".$USER->id." AND scormid = ".$scorm->id,"scoid ASC") ) {
if ($_GET["scoid"]) {
$sco = get_record("scorm_scoes","id",$_GET["scoid"]);
if ($scoid) {
$sco = get_record("scorm_scoes","id",$scoid);
} else {
foreach ( $scoes_user as $sco_user ) {
if (($sco_user->cmi_core_lesson_status != "completed") && ($sco_user->cmi_core_lesson_status != "passed") && ($sco_user->cmi_core_lesson_status != "failed")) {
$sco = get_record("scorm_scoes","id",$sco_user->scoid);
break;
} else {
if ($_GET["mode"] == "review") {
if ($mode == "review") {
$sco = get_record("scorm_scoes","id",$sco_user->scoid);
break;
}
Expand All @@ -68,8 +70,8 @@
}
}
$sco = $first;
if ($_GET["scoid"]) {
if ($sco = get_record("scorm_scoes","id",$_GET["scoid"]))
if ($scoid) {
if ($sco = get_record("scorm_scoes","id",$scoid))
unset($first);
}
}
Expand All @@ -78,6 +80,10 @@
// Get first, last, prev and next scoes
//
$scoes = get_records("scorm_scoes","scorm",$scorm->id,"id ASC");
$min = 0;
$max = 0;
$prevsco = 0;
$nextsco = 0;
foreach ($scoes as $fsco) {
if ($fsco->launch != "") {
if (!$min || ($min > $fsco->id))
Expand All @@ -92,6 +98,8 @@
}
}
}
$first = NULL;
$last = NULL;
if ($sco->id == $min)
$first = $sco;
if ($sco->id == $max)
Expand Down Expand Up @@ -124,7 +132,7 @@ function SCOInitialize() {
print "\ttop.nav.document.navform.next.style.display = 'none';\n";
}
?>
top.main.location="<?php echo $result ?>";
top.main.location="<?php echo $result; ?>";
for (i=0;i<top.nav.document.navform.courseStructure.options.length;i++) {
if ( top.nav.document.navform.courseStructure.options[i].value == <?php echo $sco->id; ?> )
top.nav.document.navform.courseStructure.options[i].selected = true;
Expand All @@ -133,10 +141,10 @@ function SCOInitialize() {

function changeSco(direction) {
if (direction == "prev")
top.nav.document.navform.scoid.value="<?php echo $prevsco ?>";
top.nav.document.navform.scoid.value="<?php echo $prevsco; ?>";
else
top.nav.document.navform.scoid.value="<?php echo $nextsco ?>";
top.nav.document.navform.scoid.value="<?php echo $nextsco; ?>";

//alert ("Prev: <?php echo $prevsco ?>\nNext: <?php echo $nextsco ?>\nNew SCO: "+top.nav.document.navform.scoid.value);
//alert ("Prev: <?php echo $prevsco; ?>\nNext: <?php echo $nextsco; ?>\nNew SCO: "+top.nav.document.navform.scoid.value);
top.nav.document.navform.submit();
}
8 changes: 5 additions & 3 deletions mod/scorm/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
echo "<table>\n";
echo " <tr><th>".get_string("coursestruct","scorm")."</th></tr>\n";
echo " <tr><td nowrap>\n<ul compact class=\"scormlist\"'>\n";
$incomplete = false;
if ($scoes = get_records_select("scorm_scoes","scorm='$scorm->id' order by id ASC")){
$level=0;
$sublist=0;
Expand All @@ -111,11 +112,12 @@
}
echo " <li>\n";
$nextsco = next($scoes);
if (($nextsco !== false) && ($sco->parent != $nextsco->parent) && ($nextsco->parent != $parents[$level-1])) {
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
} 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 == "")
Expand All @@ -141,7 +143,7 @@
echo "<table align=\"CENTER\">\n<tr>\n<td align=\"center\">";
print_string("mode","scorm");
echo ": <input type=\"radio\" id=\"b\" name=\"mode\" value=\"browse\" /><label for=\"b\">".get_string("browse","scorm")."</label>\n";
if ($incomplete) {
if ($incomplete === true) {
echo "<input type=\"radio\" id=\"n\" name=\"mode\" value=\"normal\" checked /><label for=\"n\">".get_string("normal","scorm")."</label>\n";
} else {
echo "<input type=\"radio\" id=\"r\" name=\"mode\" value=\"review\" checked /><label for=\"r\">".get_string("review","scorm")."</label>\n";
Expand Down

0 comments on commit fc1b266

Please sign in to comment.