Permalink
Browse files

SCORM MDL-18202 MDL-21379 use correct Scorm format for 1.3 merged fro…

…m HEAD
  • Loading branch information...
1 parent c1211da commit cfb345a7bac4c4c4767a4b74aa3b1f4d30e1a5cd @danmarsden danmarsden committed Apr 30, 2010
Showing with 7 additions and 14 deletions.
  1. +7 −14 mod/scorm/locallib.php
View
@@ -1160,7 +1160,10 @@ function scorm_reconstitute_array_element($sversion, $userdata, $element_name, $
$current_sub = '';
$count = 0;
$count_sub = 0;
-
+ $scormseperator = '_';
+ if ($sversion == 'scorm_13') { //scorm 1.3 elements use a . instead of an _
+ $scormseperator = '.';
+ }
// filter out the ones we want
$element_list = array();
foreach($userdata as $element => $value){
@@ -1183,7 +1186,7 @@ function scorm_reconstitute_array_element($sversion, $userdata, $element_name, $
}
if (count($matches) > 0 && $current != $matches[1]) {
if ($count_sub > 0) {
- echo ' '.$element_name.'_'.$current.'.'.$current_subelement.'._count = '.$count_sub.";\n";
+ echo ' '.$element_name.$scormseperator.$current.'.'.$current_subelement.'._count = '.$count_sub.";\n";
}
$current = $matches[1];
$count++;
@@ -1212,12 +1215,7 @@ function scorm_reconstitute_array_element($sversion, $userdata, $element_name, $
// check the sub element type
if (count($matches) > 0 && $current_subelement != $matches[1]) {
if ($count_sub > 0) {
- if ($sversion == 'scorm_13') {
- echo ' '.$element_name.'.'.$current.'.'.$current_subelement.'._count = '.$count_sub.";\n";
- }
- else {
- echo ' '.$element_name.'_'.$current.'.'.$current_subelement.'._count = '.$count_sub.";\n";
- }
+ echo ' '.$element_name.$scormseperator.$current.'.'.$current_subelement.'._count = '.$count_sub.";\n";
}
$current_subelement = $matches[1];
$current_sub = '';
@@ -1239,12 +1237,7 @@ function scorm_reconstitute_array_element($sversion, $userdata, $element_name, $
echo ' '.$element.' = \''.$value."';\n";
}
if ($count_sub > 0) {
- if ($sversion == 'scorm_13') {
- echo ' '.$element_name.'.'.$current.'.'.$current_subelement.'._count = '.$count_sub.";\n";
- }
- else {
- echo ' '.$element_name.'_'.$current.'.'.$current_subelement.'._count = '.$count_sub.";\n";
- }
+ echo ' '.$element_name.$scormseperator.$current.'.'.$current_subelement.'._count = '.$count_sub.";\n";
}
if ($count > 0) {
echo ' '.$element_name.'._count = '.$count.";\n";

0 comments on commit cfb345a

Please sign in to comment.