mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 17:06:53 +02:00
Added support to AICC
This commit is contained in:
parent
ad7fa8ed34
commit
f55a672eea
3 changed files with 77 additions and 28 deletions
|
@ -1,24 +1,62 @@
|
||||||
SCORM Module by Roberto "Bobo" Pinna
|
SCORM Module by Roberto "Bobo" Pinna
|
||||||
|
|
||||||
The current module version seem to work fine but I tried it only with 3/4 SCORM courses (Marine Navigation distribuited with ADL RTE 1.2 and some courses developed by our course team).
|
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.
|
||||||
|
|
||||||
I try to explain how SCORM module works:
|
THIS MODULE IS JAVA FREE.
|
||||||
SCORM packages come in .zip or .pif (is a zip file with another extension);
|
|
||||||
Like any other file we must upload the package using the files page.
|
|
||||||
|
|
||||||
* Create an activity:
|
================================================================
|
||||||
When we create a new activity, we can choose from a popup menu the right package.
|
|
||||||
After that, on continue, the package is checked and validated (the current version check only if the package contains a imsmanifest.xml file; future versions will check if this file is well formed and other);
|
|
||||||
This operation creates a record in the scorm table and a directory containing the unpacked SCORM course.
|
|
||||||
* View an activity:
|
|
||||||
The first time someone try to view a SCORM activity the module parse the imsmanifest file and insert a record for every manifest item in the scorm_scoes table.
|
|
||||||
Then the module show the course summary with two buttons of three, browse and review or enter the course.
|
|
||||||
When we click one of them will load an new page that will show the first SCO or the last viewed not completed SCO.
|
|
||||||
* Activity report:
|
|
||||||
I develop also a begining report page that show the status of every SCO in the SCORM and the time spent in each SCO.
|
|
||||||
|
|
||||||
If anyone what to help me to design and develop this module is welcome.
|
Still in development (you can see this as a road map):
|
||||||
|
- support for playing SCORM 1.3;
|
||||||
|
- LMS store for all datamodels;
|
||||||
|
- navigation/sequencing (prerequisites, objective,etc...);
|
||||||
|
- SCORM packages validation (I disabled the old one);
|
||||||
|
|
||||||
Sorry for my poor English.
|
================================================================
|
||||||
|
|
||||||
Bobo
|
SCORM MODULE Schema:
|
||||||
|
|
||||||
|
Insert and Update an activity:
|
||||||
|
|
||||||
|
mod.html <-- onsubmit --> validate.php (-- include --> validatordomxml.php)
|
||||||
|
|| \
|
||||||
|
|| \
|
||||||
|
submit load
|
||||||
|
|| \
|
||||||
|
|| \
|
||||||
|
\/ request.js
|
||||||
|
view.php
|
||||||
|
|
||||||
|
----------------------------------------------------------------
|
||||||
|
|
||||||
|
View an activity:
|
||||||
|
|
||||||
|
view.php
|
||||||
|
||
|
||||||
|
||
|
||||||
|
submit
|
||||||
|
||
|
||||||
|
||
|
||||||
|
\/
|
||||||
|
playscorm.php -- load --> request.js
|
||||||
|
|| api.php -- include --> datamodels/((SCORM1_2.js.php &| SCORM1_3.js.php) || AICC.js.php)
|
||||||
|
|| /\
|
||||||
|
iframe ||
|
||||||
|
"main"<----- XMLHTTP
|
||||||
|
load | request
|
||||||
|
|| | ||
|
||||||
|
|| | \/
|
||||||
|
\/ | datamodel.php
|
||||||
|
loadSCO.php |
|
||||||
|
| |
|
||||||
|
| |
|
||||||
|
---------
|
||||||
|
reload itself
|
||||||
|
to the right sco
|
||||||
|
|
||||||
|
|
||||||
|
================================================================
|
||||||
|
Updated to April 19 2005
|
||||||
|
|
|
@ -467,7 +467,7 @@ function scorm_get_aicc_columns($row,$mastername='system_id') {
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
function scorm_forge_cols_regexp($columns,$remodule='(".*"),') {
|
function scorm_forge_cols_regexp($columns,$remodule='(".*")?,') {
|
||||||
$regexp = '/^';
|
$regexp = '/^';
|
||||||
foreach ($columns as $column) {
|
foreach ($columns as $column) {
|
||||||
$regexp .= $remodule;
|
$regexp .= $remodule;
|
||||||
|
@ -494,7 +494,7 @@ function scorm_parse_aicc($pkgdir,$scormid){
|
||||||
if (is_file($pkgdir.'/'.$id->crs)) {
|
if (is_file($pkgdir.'/'.$id->crs)) {
|
||||||
$rows = file($pkgdir.'/'.$id->crs);
|
$rows = file($pkgdir.'/'.$id->crs);
|
||||||
foreach ($rows as $row) {
|
foreach ($rows as $row) {
|
||||||
if (preg_match("/^(\w+)=(.+)$/",$row,$matches)) {
|
if (preg_match("/^(.+)=(.+)$/",$row,$matches)) {
|
||||||
switch (strtolower(trim($matches[1]))) {
|
switch (strtolower(trim($matches[1]))) {
|
||||||
case 'course_id':
|
case 'course_id':
|
||||||
$courses[$courseid]->id = trim($matches[2]);
|
$courses[$courseid]->id = trim($matches[2]);
|
||||||
|
@ -518,7 +518,7 @@ function scorm_parse_aicc($pkgdir,$scormid){
|
||||||
if (preg_match($regexp,$rows[$i],$matches)) {
|
if (preg_match($regexp,$rows[$i],$matches)) {
|
||||||
for ($j=0;$j<count($columns->columns);$j++) {
|
for ($j=0;$j<count($columns->columns);$j++) {
|
||||||
$column = $columns->columns[$j];
|
$column = $columns->columns[$j];
|
||||||
$courses[$courseid]->elements[substr($matches[$columns->mastercol+1],1,-1)]->$column = substr($matches[$j+1],1,-1);
|
$courses[$courseid]->elements[substr(trim($matches[$columns->mastercol+1]),1,-1)]->$column = substr(trim($matches[$j+1]),1,-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -531,7 +531,7 @@ function scorm_parse_aicc($pkgdir,$scormid){
|
||||||
if (preg_match($regexp,$rows[$i],$matches)) {
|
if (preg_match($regexp,$rows[$i],$matches)) {
|
||||||
for ($j=0;$j<count($columns->columns);$j++) {
|
for ($j=0;$j<count($columns->columns);$j++) {
|
||||||
$column = $columns->columns[$j];
|
$column = $columns->columns[$j];
|
||||||
$courses[$courseid]->elements[substr($matches[$columns->mastercol+1],1,-1)]->$column = substr($matches[$j+1],1,-1);
|
$courses[$courseid]->elements[substr(trim($matches[$columns->mastercol+1]),1,-1)]->$column = substr(trim($matches[$j+1]),1,-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -539,12 +539,12 @@ function scorm_parse_aicc($pkgdir,$scormid){
|
||||||
if (isset($id->cst)) {
|
if (isset($id->cst)) {
|
||||||
$rows = file($pkgdir.'/'.$id->cst);
|
$rows = file($pkgdir.'/'.$id->cst);
|
||||||
$columns = scorm_get_aicc_columns($rows[0],'block');
|
$columns = scorm_get_aicc_columns($rows[0],'block');
|
||||||
$regexp = scorm_forge_cols_regexp($columns->columns,'(".+")?,');
|
$regexp = scorm_forge_cols_regexp($columns->columns,'(.+)?,');
|
||||||
for ($i=1;$i<count($rows);$i++) {
|
for ($i=1;$i<count($rows);$i++) {
|
||||||
if (preg_match($regexp,$rows[$i],$matches)) {
|
if (preg_match($regexp,$rows[$i],$matches)) {
|
||||||
for ($j=0;$j<count($columns->columns);$j++) {
|
for ($j=0;$j<count($columns->columns);$j++) {
|
||||||
if ($j != $columns->mastercol) {
|
if ($j != $columns->mastercol) {
|
||||||
$courses[$courseid]->elements[substr($matches[$j+1],1,-1)]->parent = substr($matches[$columns->mastercol+1],1,-1);
|
$courses[$courseid]->elements[substr(trim($matches[$j+1]),1,-1)]->parent = substr(trim($matches[$columns->mastercol+1]),1,-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -556,10 +556,10 @@ function scorm_parse_aicc($pkgdir,$scormid){
|
||||||
if (isset($id->pre)) {
|
if (isset($id->pre)) {
|
||||||
$rows = file($pkgdir.'/'.$id->pre);
|
$rows = file($pkgdir.'/'.$id->pre);
|
||||||
$columns = scorm_get_aicc_columns($rows[0],'structure_element');
|
$columns = scorm_get_aicc_columns($rows[0],'structure_element');
|
||||||
$regexp = scorm_forge_cols_regexp($columns->columns,'(".+"),');
|
$regexp = scorm_forge_cols_regexp($columns->columns,'(.+),');
|
||||||
for ($i=1;$i<count($rows);$i++) {
|
for ($i=1;$i<count($rows);$i++) {
|
||||||
if (preg_match($regexp,$rows[$i],$matches)) {
|
if (preg_match($regexp,$rows[$i],$matches)) {
|
||||||
$courses[$courseid]->elements[$columns->mastercol+1]->prerequisites = substr($matches[1-$columns->mastercol+1],1,-1);
|
$courses[$courseid]->elements[$columns->mastercol+1]->prerequisites = substr(trim($matches[1-$columns->mastercol+1]),1,-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -567,6 +567,7 @@ function scorm_parse_aicc($pkgdir,$scormid){
|
||||||
$rows = file($pkgdir.'/'.$id->cmp);
|
$rows = file($pkgdir.'/'.$id->cmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//print_r($courses);
|
||||||
$launch = 0;
|
$launch = 0;
|
||||||
if (isset($courses)) {
|
if (isset($courses)) {
|
||||||
|
|
||||||
|
@ -579,6 +580,7 @@ function scorm_parse_aicc($pkgdir,$scormid){
|
||||||
$sco->parent = '/';
|
$sco->parent = '/';
|
||||||
$sco->launch = '';
|
$sco->launch = '';
|
||||||
$sco->scormtype = '';
|
$sco->scormtype = '';
|
||||||
|
//print_r($sco);
|
||||||
$id = insert_record('scorm_scoes',$sco);
|
$id = insert_record('scorm_scoes',$sco);
|
||||||
if ($launch == 0) {
|
if ($launch == 0) {
|
||||||
$launch = $id;
|
$launch = $id;
|
||||||
|
@ -607,7 +609,7 @@ function scorm_parse_aicc($pkgdir,$scormid){
|
||||||
}
|
}
|
||||||
$sco->prerequisites = $element->prerequisites;
|
$sco->prerequisites = $element->prerequisites;
|
||||||
if (!isset($element->max_time_allowed)) {
|
if (!isset($element->max_time_allowed)) {
|
||||||
$element->maxtimeallowed = '';
|
$element->max_time_allowed = '';
|
||||||
}
|
}
|
||||||
$sco->maxtimeallowed = $element->max_time_allowed;
|
$sco->maxtimeallowed = $element->max_time_allowed;
|
||||||
if (!isset($element->time_limit_action)) {
|
if (!isset($element->time_limit_action)) {
|
||||||
|
@ -621,6 +623,7 @@ function scorm_parse_aicc($pkgdir,$scormid){
|
||||||
$sco->previous = 0;
|
$sco->previous = 0;
|
||||||
$sco->next = 0;
|
$sco->next = 0;
|
||||||
|
|
||||||
|
//print_r($sco);
|
||||||
$id = insert_record('scorm_scoes',$sco);
|
$id = insert_record('scorm_scoes',$sco);
|
||||||
|
|
||||||
if ($launch==0) {
|
if ($launch==0) {
|
||||||
|
@ -832,6 +835,10 @@ function scorm_external_link($link) {
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function scorm_count_launchable($scormid,$organization) {
|
||||||
|
return count_records_select('scorm_scoes',"scorm=$scormid AND organization='$organization' AND launch<>''");
|
||||||
|
}
|
||||||
|
|
||||||
function scorm_display_structure($scorm,$liststyle,$currentorg='',$scoid='',$mode='normal',$play=false) {
|
function scorm_display_structure($scorm,$liststyle,$currentorg='',$scoid='',$mode='normal',$play=false) {
|
||||||
global $USER;
|
global $USER;
|
||||||
|
|
||||||
|
@ -922,7 +929,7 @@ function scorm_display_structure($scorm,$liststyle,$currentorg='',$scoid='',$mod
|
||||||
$nextid = 0;
|
$nextid = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (($nextid == 0) && (count($scoes) > 1)) {
|
if (($nextid == 0) && (scorm_count_launchable($scorm->id,$currentorg) > 1)) {
|
||||||
$previd = $sco->id;
|
$previd = $sco->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,8 @@ if (confirm_sesskey()) {
|
||||||
$validation->result = 'badreference';
|
$validation->result = 'badreference';
|
||||||
$launch = -1;
|
$launch = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//$launch = 0;
|
||||||
if ($launch == 0) {
|
if ($launch == 0) {
|
||||||
//
|
//
|
||||||
// Package must be validated
|
// Package must be validated
|
||||||
|
@ -92,6 +93,9 @@ if (confirm_sesskey()) {
|
||||||
echo get_string($error->type,"scorm",$error->data) . "\n";
|
echo get_string($error->type,"scorm",$error->data) . "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*if ($validation->pkgtype == 'AICC') {
|
||||||
|
scorm_parse_aicc("$CFG->dataroot/$courseid/$CFG->moddata/scorm$datadir",$scormid);
|
||||||
|
}*/
|
||||||
} else {
|
} else {
|
||||||
echo 'result=' . get_string('badrequest','scorm') . "\n";
|
echo 'result=' . get_string('badrequest','scorm') . "\n";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue