Skip to content

Commit

Permalink
SCORM MDL-18202 MDL-21379 use correct Scorm format for 1.3 merged fro…
Browse files Browse the repository at this point in the history
…m HEAD
  • Loading branch information
danmarsden committed Apr 30, 2010
1 parent c1211da commit cfb345a
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions mod/scorm/locallib.php
Expand Up @@ -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){
Expand All @@ -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++;
Expand Down Expand Up @@ -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 = '';
Expand All @@ -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";
Expand Down

0 comments on commit cfb345a

Please sign in to comment.