2004-05-20 17:06:19 +00:00
|
|
|
<?php
|
2004-07-19 14:53:43 +00:00
|
|
|
require_once('../../config.php');
|
|
|
|
require_once('lib.php');
|
2005-02-16 10:40:48 +00:00
|
|
|
|
2004-05-20 17:06:19 +00:00
|
|
|
optional_variable($id); // Course Module ID, or
|
|
|
|
optional_variable($a); // scorm ID
|
|
|
|
|
|
|
|
if ($id) {
|
2004-07-19 14:53:43 +00:00
|
|
|
if (! $cm = get_record('course_modules', 'id', $id)) {
|
|
|
|
error('Course Module ID was incorrect');
|
2004-05-20 17:06:19 +00:00
|
|
|
}
|
2005-02-16 10:40:48 +00:00
|
|
|
|
2004-07-19 14:53:43 +00:00
|
|
|
if (! $course = get_record('course', 'id', $cm->course)) {
|
|
|
|
error('Course is misconfigured');
|
2004-05-20 17:06:19 +00:00
|
|
|
}
|
2005-02-16 10:40:48 +00:00
|
|
|
|
2004-07-19 14:53:43 +00:00
|
|
|
if (! $scorm = get_record('scorm', 'id', $cm->instance)) {
|
|
|
|
error('Course module is incorrect');
|
2004-05-20 17:06:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
2004-07-19 14:53:43 +00:00
|
|
|
if (! $scorm = get_record('scorm', 'id', $a)) {
|
|
|
|
error('Course module is incorrect');
|
2004-05-20 17:06:19 +00:00
|
|
|
}
|
2004-07-19 14:53:43 +00:00
|
|
|
if (! $course = get_record('course', 'id', $scorm->course)) {
|
|
|
|
error('Course is misconfigured');
|
2004-05-20 17:06:19 +00:00
|
|
|
}
|
2004-07-19 14:53:43 +00:00
|
|
|
if (! $cm = get_coursemodule_from_instance('scorm', $scorm->id, $course->id)) {
|
|
|
|
error('Course Module ID was incorrect');
|
2004-05-20 17:06:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-02-16 10:40:48 +00:00
|
|
|
require_login($course->id, false, $cm);
|
2004-07-19 14:53:43 +00:00
|
|
|
if (!empty($_POST['scoid'])) {
|
|
|
|
//echo 'scoid: '.$_POST['scoid']."\n";
|
|
|
|
if (!empty($_POST['cmi_core_lesson_location'])) {
|
2005-02-16 10:40:48 +00:00
|
|
|
set_field('scorm_sco_users','cmi_core_lesson_location',$_POST['cmi_core_lesson_location'],'scoid',$_POST['scoid'],'userid',$USER->id);
|
|
|
|
//echo 'cmi_core_lesson_location: '.$_POST['cmi_core_lesson_location']."\n";
|
|
|
|
}
|
|
|
|
if (!empty($_POST['cmi_core_lesson_status'])) {
|
2004-07-19 14:53:43 +00:00
|
|
|
set_field('scorm_sco_users','cmi_core_lesson_status',$_POST['cmi_core_lesson_status'],'scoid',$_POST['scoid'],'userid',$USER->id);
|
|
|
|
//echo 'cmi_core_lesson_status: '.$_POST['cmi_core_lesson_status']."\n";
|
2004-07-01 09:54:08 +00:00
|
|
|
}
|
2005-02-16 10:40:48 +00:00
|
|
|
if (!empty($_POST['cmi_core_exit'])) {
|
2004-07-19 14:53:43 +00:00
|
|
|
set_field('scorm_sco_users','cmi_core_exit',$_POST['cmi_core_exit'],'scoid',$_POST['scoid'],'userid',$USER->id);
|
|
|
|
//echo 'cmi_core_exit: '.$_POST['cmi_core_exit']."\n";
|
2004-07-01 09:54:08 +00:00
|
|
|
}
|
2005-02-16 10:40:48 +00:00
|
|
|
if (!empty($_POST['cmi_core_score_raw'])) {
|
2004-07-19 14:53:43 +00:00
|
|
|
set_field('scorm_sco_users','cmi_core_score_raw',$_POST['cmi_core_score_raw'],'scoid',$_POST['scoid'],'userid',$USER->id);
|
|
|
|
//echo 'cmi_core_score_raw: '.$_POST['cmi_core_score_raw']."\n";
|
2004-07-01 09:54:08 +00:00
|
|
|
}
|
2005-02-16 10:40:48 +00:00
|
|
|
if (!empty($_POST['cmi_suspend_data'])) {
|
2004-07-19 14:53:43 +00:00
|
|
|
set_field('scorm_sco_users','cmi_suspend_data',$_POST['cmi_suspend_data'],'scoid',$_POST['scoid'],'userid',$USER->id);
|
|
|
|
//echo 'cmi_suspend_data: '.$_POST['cmi_suspend_data']."\n";
|
2004-07-01 09:54:08 +00:00
|
|
|
}
|
2004-07-19 14:53:43 +00:00
|
|
|
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);
|
|
|
|
//echo 'cmi_core_total_time: '.$_POST['cmi_core_total_time']."\n";
|
2004-07-01 09:54:08 +00:00
|
|
|
}
|
2004-05-20 17:06:19 +00:00
|
|
|
}
|
|
|
|
?>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>cmi</title>
|
|
|
|
</head>
|
|
|
|
<body>
|
2005-02-16 10:40:48 +00:00
|
|
|
<form name="theform" method="POST" action="<?php echo $ME ?>?id=<?php echo $cm->id ?>">
|
|
|
|
<input type="hidden" name="scoid" />
|
|
|
|
<input type="hidden" name="cmi_core_lesson_location" />
|
|
|
|
<input type="hidden" name="cmi_core_lesson_status" />
|
|
|
|
<input type="hidden" name="cmi_core_exit" />
|
|
|
|
<input type="hidden" name="cmi_core_total_time" />
|
|
|
|
<input type="hidden" name="cmi_core_score_raw" />
|
|
|
|
<input type="hidden" name="cmi_suspend_data" />
|
2004-05-20 17:06:19 +00:00
|
|
|
</form>
|
|
|
|
</body>
|
|
|
|
</html>
|