Permalink
Browse files

Fixed a storic problem with & in prerequisites definition

Now finally Moodle has a complete aicc_script conformity with SCORM 1.2
  • Loading branch information...
1 parent 7eb1d32 commit 23f0f6f72df9dc6fa65a370ac64e721413df0f5f bobopinna committed Nov 2, 2006
Showing with 16 additions and 7 deletions.
  1. +4 −4 mod/scorm/datamodels/scorm_12lib.php
  2. +12 −3 mod/scorm/datamodels/scormlib.php
@@ -81,7 +81,7 @@ function scorm_eval_prerequisites($prerequisites,$usertracks) {
$setelements = explode(',', substr($prerequisites, $open+1, $close-($open+1)-1));
$settrue = 0;
foreach ($setelements as $setelement) {
- if (eval_prerequisites($setelement,$usertracks)) {
+ if (scorm_eval_prerequisites($setelement,$usertracks)) {
$settrue++;
}
}
@@ -288,10 +288,10 @@ function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='n
$scoid = $sco->id;
}
if ($sco->scormtype == 'sco') {
- $statusicon= '<img src="'.$scormpixdir.'/notattempted.gif" alt="'.get_string('notattempted','scorm').'" title="'.get_string('notattempted','scorm').'" />';
+ $statusicon = '<img src="'.$scormpixdir.'/notattempted.gif" alt="'.get_string('notattempted','scorm').'" title="'.get_string('notattempted','scorm').'" />';
$incomplete = true;
} else {
- $statusicon .= '<img src="'.$scormpixdir.'/asset.gif" alt="'.get_string('asset','scorm').'" title="'.get_string('asset','scorm').'" />';
+ $statusicon = '<img src="'.$scormpixdir.'/asset.gif" alt="'.get_string('asset','scorm').'" title="'.get_string('asset','scorm').'" />';
}
}
if ($sco->id == $scoid) {
@@ -318,7 +318,7 @@ function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='n
if ($sco->id == $scoid) {
$result->prerequisites = false;
}
- $result->toc .= '&nbsp;'.$sco->title."</li>\n";
+ $result->toc .= $statusicon.'&nbsp;'.$sco->title."</li>\n";
}
} else {
$result->toc .= '&nbsp;'.$sco->title."</li>\n";
@@ -31,7 +31,11 @@ function scorm_get_manifest($blocks,$scoes) {
if (isset($metadata['tagData']) && (preg_match("/^(1\.2)$|^(CAM )?(1\.3)$/",$metadata['tagData'],$matches))) {
$scoes->version = 'SCORM_'.$matches[count($matches)-1];
} else {
- $scoes->version = 'SCORM_1.2';
+ if (isset($metadata['tagData']) && (preg_match("/^2004 3rd Edition$/",$metadata['tagData'],$matches))) {
+ $scoes->version = 'SCORM_1.3';
+ } else {
+ $scoes->version = 'SCORM_1.2';
+ }
}
}
}
@@ -187,9 +191,14 @@ function scorm_parse_scorm($pkgdir,$scormid) {
if (is_file($manifestfile)) {
- $xmlstring = file_get_contents($manifestfile);
+ $xmltext = file_get_contents($manifestfile);
+
+ $pattern = '/&(?!\w{2,6};)/';
+ $replacement = '&amp;';
+ $xmltext = preg_replace($pattern, $replacement, $xmltext);
+
$objXML = new xml2Array();
- $manifests = $objXML->parse($xmlstring);
+ $manifests = $objXML->parse($xmltext);
//print_r($manifests);
$scoes = new stdClass();
$scoes->version = '';

0 comments on commit 23f0f6f

Please sign in to comment.