diff --git a/mod/scorm/README.txt b/mod/scorm/README.txt index 585c2536131..d8eb8cf7f79 100644 --- a/mod/scorm/README.txt +++ b/mod/scorm/README.txt @@ -1,24 +1,62 @@ 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: -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. +THIS MODULE IS JAVA FREE. - * 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 diff --git a/mod/scorm/lib.php b/mod/scorm/lib.php index 9720f9656b7..6a7bfbf6278 100755 --- a/mod/scorm/lib.php +++ b/mod/scorm/lib.php @@ -467,7 +467,7 @@ function scorm_get_aicc_columns($row,$mastername='system_id') { return $result; } -function scorm_forge_cols_regexp($columns,$remodule='(".*"),') { +function scorm_forge_cols_regexp($columns,$remodule='(".*")?,') { $regexp = '/^'; foreach ($columns as $column) { $regexp .= $remodule; @@ -494,7 +494,7 @@ function scorm_parse_aicc($pkgdir,$scormid){ if (is_file($pkgdir.'/'.$id->crs)) { $rows = file($pkgdir.'/'.$id->crs); foreach ($rows as $row) { - if (preg_match("/^(\w+)=(.+)$/",$row,$matches)) { + if (preg_match("/^(.+)=(.+)$/",$row,$matches)) { switch (strtolower(trim($matches[1]))) { case 'course_id': $courses[$courseid]->id = trim($matches[2]); @@ -518,7 +518,7 @@ function scorm_parse_aicc($pkgdir,$scormid){ if (preg_match($regexp,$rows[$i],$matches)) { for ($j=0;$jcolumns);$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)) { for ($j=0;$jcolumns);$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)) { $rows = file($pkgdir.'/'.$id->cst); $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;$icolumns);$j++) { 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)) { $rows = file($pkgdir.'/'.$id->pre); $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;$ielements[$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); } } + //print_r($courses); $launch = 0; if (isset($courses)) { @@ -579,6 +580,7 @@ function scorm_parse_aicc($pkgdir,$scormid){ $sco->parent = '/'; $sco->launch = ''; $sco->scormtype = ''; + //print_r($sco); $id = insert_record('scorm_scoes',$sco); if ($launch == 0) { $launch = $id; @@ -607,7 +609,7 @@ function scorm_parse_aicc($pkgdir,$scormid){ } $sco->prerequisites = $element->prerequisites; if (!isset($element->max_time_allowed)) { - $element->maxtimeallowed = ''; + $element->max_time_allowed = ''; } $sco->maxtimeallowed = $element->max_time_allowed; if (!isset($element->time_limit_action)) { @@ -621,6 +623,7 @@ function scorm_parse_aicc($pkgdir,$scormid){ $sco->previous = 0; $sco->next = 0; + //print_r($sco); $id = insert_record('scorm_scoes',$sco); if ($launch==0) { @@ -832,6 +835,10 @@ function scorm_external_link($link) { 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) { global $USER; @@ -922,7 +929,7 @@ function scorm_display_structure($scorm,$liststyle,$currentorg='',$scoid='',$mod $nextid = 0; } } - if (($nextid == 0) && (count($scoes) > 1)) { + if (($nextid == 0) && (scorm_count_launchable($scorm->id,$currentorg) > 1)) { $previd = $sco->id; } diff --git a/mod/scorm/validate.php b/mod/scorm/validate.php index ad87bd0b5a9..5f945948445 100755 --- a/mod/scorm/validate.php +++ b/mod/scorm/validate.php @@ -37,7 +37,8 @@ if (confirm_sesskey()) { $validation->result = 'badreference'; $launch = -1; } - } + } + //$launch = 0; if ($launch == 0) { // // Package must be validated @@ -92,6 +93,9 @@ if (confirm_sesskey()) { 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 { echo 'result=' . get_string('badrequest','scorm') . "\n"; }