Skip to content
Permalink
Browse files

Added user activity support

General TAB cleaning
SCO-LMS communication systeme changed to POST method
Several bug fix
  • Loading branch information...
bobopinna
bobopinna committed May 23, 2005
1 parent 362a7d4 commit 9633a4235042c4ef4adabdcccc08e0e7e8ae595d
@@ -1,17 +1,20 @@
SCORM Module by Roberto "Bobo" Pinna

This module is a SCORM player that import SCORM packages in .zip or .pif format
This module is a SCORM player that import SCORM packages in .zip or .pif format
(they are the same thing).
At this time the SCORM module import packages in SCORM1.2, SCORM1.3 (aka SCORM2004) and AICC.
It plays SCORM1.2 and AICC packages.
It plays SCORM1.2 and launch AICC packages.

Moodle SCORM Module is SCORM Version 1.2 Run-Time Environment Conformant -
Minimum with All Optional Data Model Elements (LMS-RTE3)

THIS MODULE IS JAVA FREE.

================================================================

Still in development (you can see this as a road map):
- LMS store for all datamodels for AICC;
- support for playing SCORM 1.3;
- LMS store for all datamodels;
- navigation/sequencing (prerequisites, objective,etc...);
- SCORM packages validation (I disabled the old one);

@@ -27,7 +30,7 @@ mod.html <-- onsubmit --> validate.php (-- include --> validatordomxml.php)
submit load
|| \
|| \
\/ request.js
\/ request.js
view.php

----------------------------------------------------------------
@@ -42,7 +45,7 @@ view.php
||
\/
playscorm.php -- load --> request.js
|| api.php -- include --> datamodels/((SCORM1_2.js.php &| SCORM1_3.js.php) || AICC.js.php)
|| api.php -- include --> datamodels/(SCORM1_2.js.php || SCORM1_3.js.php || AICC.js.php)
|| /\
iframe ||
"main"<----- XMLHTTP
@@ -53,8 +56,8 @@ playscorm.php -- load --> request.js
loadSCO.php |
| |
| |
---------
reload itself
---------
reload itself
to the right sco


@@ -5,113 +5,114 @@
require_login($course->id, false, $cm);
if (isset($_POST['command']) && confirm_sesskey($_POST['session_id'])) {
$command = strtolower($_POST['command']);
if (isset($SESSION->scorm_scoid)) {
$scoid = $SESSION->scorm_scoid;
} else {
error('Invalid script call');
}
$mode = 'normal';
if (isset($SESSION->scorm_mode)) {
$mode = $SESSION->scorm_mode;
}
$status = $SESSION->scorm_status;
if ($sco = get_record('scorm_scoes','id',$scoid)) {
if (!$scorm = get_record('scorm','id',$sco->scorm)) {
error('Invalid script call');
}
} else {
error('Invalid script call');
}
if ($scorm = get_record('scorm','id',$sco->scorm)) {
switch $command {
case 'getparam':
if ($status == 'Not Initialized') {
$SESSION->scorm_status = 'Running';
$status = 'Running';
}
if ($status != 'Running') {
echo "error = 101\nerror_text = Terminated\n";
} else {
if ($usertrack=scorm_get_tracks($scoid,$USER->id)) {
$userdata = $usertrack;
} else {
$userdata->status = '';
$userdata->scorre_raw = '';
}
$userdata->student_id = $USER->username;
$userdata->student_name = $USER->lastname .', '. $USER->firstname;
$userdata->mode = $mode;
}
if ($sco = get_record('scorm_scoes','id',$scoid)) {
$userdata->datafromlms = $sco->datafromlms;
$userdata->masteryscore = $sco->masteryscore;
$userdata->maxtimeallowed = $sco->maxtimeallowed;
$userdata->timelimitaction = $sco->timelimitaction;
if (!empty($sco->masteryscore)) {
$userdata->credit = 'credit';
} else {
$userdata->credit = 'no-credit';
}
} else {
error('Sco not found');
}
echo "error = 0\nerror_text = Successful\naicc_data=\n";
echo "[Core]\n";
echo 'Student_ID = '.$userdata->student_id."\n";
echo 'Student_Name = '.$userdata->student_name."\n";
echo 'Lesson_Location = '.isset($userdata->{'cmi.core.lesson_location'})?$userdata->{'cmi.core.lesson_location'}:''."\n";
echo 'Credit = '.$userdata->credit."\n";
echo 'Lesson_Status = '.isset($userdata->{'cmi.core.lesson_status'})?$userdata->{'cmi.core.lesson_status'}:''."\n";
echo 'Score = '.isset($userdata->{'cmi.core.score.raw'})?$userdata->{'cmi.core.score.raw'}:''."\n";
echo 'Time = '.isset($userdata->{'cmi.core.total_time'})?$userdata->{'cmi.core.total_time'}:'00:00:00'."\n";
echo "[Core_Lesson]\n".isset($userdata->{'cmi.suspend_data'})?$userdata->{'cmi.suspend_data'}:''."\n";
echo "[Core_Vendor]\n".$userdata->datafromlms."\n";
}
break;
case 'putparam':
if ($status == 'Running') {
print_r($_POST['aicc_data']);
echo "error = 0\nerror_text = Successful\n";
}
break;
case 'putcomments':
if ($status == 'Running') {
print_r($_POST['aicc_data']);
echo "error = 0\nerror_text = Successful\n";
}
break;
case 'putinteractions':
if ($status == 'Running') {
print_r($_POST['aicc_data']);
echo "error = 0\nerror_text = Successful\n";
}
break;
case 'putobjectives':
if ($status == 'Running') {
print_r($_POST['aicc_data']);
echo "error = 0\nerror_text = Successful\n";
}
break;
case 'putpath':
if ($status == 'Running') {
print_r($_POST['aicc_data']);
echo "error = 0\nerror_text = Successful\n";
}
break;
case 'putperformance':
if ($status == 'Running') {
print_r($_POST['aicc_data']);
echo "error = 0\nerror_text = Successful\n";
}
break;
case 'exitau':
if ($status == 'Running') {
$SESSION->scorm_status = 'Terminated';
echo "error = 0\nerror_text = Successful\n";
}
break;
$command = strtolower($_POST['command']);
if (isset($SESSION->scorm_scoid)) {
$scoid = $SESSION->scorm_scoid;
} else {
error('Invalid script call');
}
$mode = 'normal';
if (isset($SESSION->scorm_mode)) {
$mode = $SESSION->scorm_mode;
}
$status = $SESSION->scorm_status;
if ($sco = get_record('scorm_scoes','id',$scoid)) {
if (!$scorm = get_record('scorm','id',$sco->scorm)) {
error('Invalid script call');
}
} else {
error('Invalid script call');
}
if ($scorm = get_record('scorm','id',$sco->scorm)) {
switch $command {
case 'getparam':
if ($status == 'Not Initialized') {
$SESSION->scorm_status = 'Running';
$status = 'Running';
}
if ($status != 'Running') {
echo "error = 101\nerror_text = Terminated\n";
} else {
if ($usertrack=scorm_get_tracks($scoid,$USER->id)) {
$userdata = $usertrack;
} else {
$userdata->status = '';
$userdata->scorre_raw = '';
}
$userdata->student_id = $USER->username;
$userdata->student_name = $USER->lastname .', '. $USER->firstname;
$userdata->mode = $mode;
if ($sco = get_record('scorm_scoes','id',$scoid)) {
$userdata->datafromlms = $sco->datafromlms;
$userdata->masteryscore = $sco->masteryscore;
$userdata->maxtimeallowed = $sco->maxtimeallowed;
$userdata->timelimitaction = $sco->timelimitaction;
if (!empty($sco->masteryscore)) {
$userdata->credit = 'credit';
} else {
$userdata->credit = 'no-credit';
}
echo "error = 0\nerror_text = Successful\naicc_data=\n";
echo "[Core]\n";
echo 'Student_ID = '.$userdata->student_id."\n";
echo 'Student_Name = '.$userdata->student_name."\n";
echo 'Lesson_Location = '.isset($userdata->{'cmi.core.lesson_location'})?$userdata->{'cmi.core.lesson_location'}:''."\n";
echo 'Credit = '.$userdata->credit."\n";
echo 'Lesson_Status = '.isset($userdata->{'cmi.core.lesson_status'})?$userdata->{'cmi.core.lesson_status'}:''."\n";
echo 'Score = '.isset($userdata->{'cmi.core.score.raw'})?$userdata->{'cmi.core.score.raw'}:''."\n";
echo 'Time = '.isset($userdata->{'cmi.core.total_time'})?$userdata->{'cmi.core.total_time'}:'00:00:00'."\n";
echo "[Core_Lesson]\n".isset($userdata->{'cmi.suspend_data'})?$userdata->{'cmi.suspend_data'}:''."\n";
echo "[Core_Vendor]\n".$userdata->datafromlms."\n";
} else {
error('Sco not found');
}
}
break;
case 'putparam':
if ($status == 'Running') {
print_r($_POST['aicc_data']);
echo "error = 0\nerror_text = Successful\n";
}
break;
case 'putcomments':
if ($status == 'Running') {
print_r($_POST['aicc_data']);
echo "error = 0\nerror_text = Successful\n";
}
break;
case 'putinteractions':
if ($status == 'Running') {
print_r($_POST['aicc_data']);
echo "error = 0\nerror_text = Successful\n";
}
break;
case 'putobjectives':
if ($status == 'Running') {
print_r($_POST['aicc_data']);
echo "error = 0\nerror_text = Successful\n";
}
break;
case 'putpath':
if ($status == 'Running') {
print_r($_POST['aicc_data']);
echo "error = 0\nerror_text = Successful\n";
}
break;
case 'putperformance':
if ($status == 'Running') {
print_r($_POST['aicc_data']);
echo "error = 0\nerror_text = Successful\n";
}
break;
case 'exitau':
if ($status == 'Running') {
$SESSION->scorm_status = 'Terminated';
echo "error = 0\nerror_text = Successful\n";
}
break;
}
}
?>

@@ -48,9 +48,9 @@
$userdata->mode = $mode;
}
if ($userdata->mode == 'normal') {
$userdata->credit = 'credit';
$userdata->credit = 'credit';
} else {
$userdata->credit = 'no-credit';
$userdata->credit = 'no-credit';
}
if ($sco = get_record('scorm_scoes','id',$scoid)) {
$userdata->datafromlms = $sco->datafromlms;
@@ -64,16 +64,16 @@
switch ($scorm->version) {
case 'SCORM_1.2':
include_once ('datamodels/scorm1_2.js.php');
break;
break;
case 'SCORM_1.3':
include_once ('datamodels/scorm1_3.js.php');
break;
include_once ('datamodels/scorm1_3.js.php');
break;
case 'AICC':
include_once ('datamodels/aicc.js.php');
break;
include_once ('datamodels/aicc.js.php');
break;
default:
include_once ('datamodels/scorm1_2.js.php');
break;
break;
}
?>

@@ -6,16 +6,16 @@
//
// scorm
// (CL,pk->id)---------------------
// | |
// | |
// | |
// scorm_scoes |
// (UL,pk->id, fk->scorm) |
// | |
// | |
// | |
// scorm_scoes_track |
// (UL,k->id, fk->scormid, fk->scoid, k->element)---
// | |
// | |
// | |
// scorm_scoes |
// (UL,pk->id, fk->scorm) |
// | |
// | |
// | |
// scorm_scoes_track |
// (UL,k->id, fk->scormid, fk->scoid, k->element)---
//
// Meaning: pk->primary key field of the table
// fk->foreign key to link with parent
@@ -50,6 +50,8 @@ function scorm_backup_mods($bf,$preferences) {
fwrite ($bf,full_tag("SUMMARY",4,false,$scorm->summary));
fwrite ($bf,full_tag("BROWSEMODE",4,false,$scorm->browsemode));
fwrite ($bf,full_tag("AUTO",4,false,$scorm->auto));
fwrite ($bf,full_tag("WIDTH",4,false,$scorm->width));
fwrite ($bf,full_tag("HEIGHT",4,false,$scorm->height));
fwrite ($bf,full_tag("TIMEMODIFIED",4,false,$scorm->timemodified));
$status = backup_scorm_scoes($bf,$preferences,$scorm->id);
@@ -2,7 +2,7 @@
if (empty($CFG->scorm_frameheight)) {
$CFG->scorm_frameheight = 600;
}
if (empty($CFG->scorm_framewidth)) {
if (empty($CFG->scorm_framewidth)) {
$CFG->scorm_structurewidth = 800;
}
?>
@@ -36,7 +36,7 @@
<input type="text" name="scorm_framewidth" value="<?php echo $CFG->scorm_framewidth ?>" size="3" />
</td>
<td>
<?php print_string("framewidth", "scorm") ?>
<?php print_string("framewidth", "scorm") ?>
</td>
</tr>
<tr valign="top">
@@ -45,7 +45,7 @@
<input type="text" name="scorm_frameheight" value="<?php echo $CFG->scorm_frameheight ?>" size="4" />
</td>
<td>
<?php print_string("frameheight", "scorm") ?>
<?php print_string("frameheight", "scorm") ?>
</td>
</tr>
<tr>

0 comments on commit 9633a42

Please sign in to comment.
You can’t perform that action at this time.