Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed some undefined variable

  • Loading branch information...
commit fc1b2663042e8705df5a53e85e905d6faee31b01 1 parent 4ad5a49
bobopinna authored
View
22 mod/scorm/api1_2.php
@@ -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';
@@ -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;
@@ -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;
View
2  mod/scorm/details.php
@@ -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))) ?>">
View
3  mod/scorm/playscorm.php
@@ -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)) {
@@ -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
View
1  mod/scorm/report.php
@@ -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\"
View
26 mod/scorm/scormAPI.php
@@ -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)) {
@@ -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;
}
@@ -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);
}
}
@@ -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))
@@ -92,6 +98,8 @@
}
}
}
+ $first = NULL;
+ $last = NULL;
if ($sco->id == $min)
$first = $sco;
if ($sco->id == $max)
@@ -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;
@@ -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();
}
View
8 mod/scorm/view.php
@@ -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;
@@ -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 == "")
@@ -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";
Please sign in to comment.
Something went wrong with that request. Please try again.