diff --git a/mod/scorm/aicc.php b/mod/scorm/aicc.php index 028bf0b6d17..745c88b9220 100644 --- a/mod/scorm/aicc.php +++ b/mod/scorm/aicc.php @@ -181,7 +181,13 @@ if (!empty($command)) { } echo 'Lesson_Mode='.$userdata->mode."\r\n"; if (isset($userdata->{'cmi.suspend_data'})) { - echo "[Core_Lesson]\r\n".rawurldecode($userdata->{'cmi.suspend_data'})."\r\n"; + $decoded = rawurldecode($userdata->{'cmi.suspend_data'}); + $header = "[Core_Lesson]\r\n"; + if (stripos($decoded, $header) === 0) { + // The header may have been stored with the content. If it was, trim it off the front. + $decoded = core_text::substr($decoded, core_text::strlen($header)); + } + echo "[Core_Lesson]\r\n".$decoded."\r\n"; } else { echo "[Core_Lesson]\r\n"; } @@ -229,8 +235,9 @@ if (!empty($command)) { // An element was passed by the external AICC package is not one we care about. continue; } + } else { + $multirowvalue .= $datarow . "\r\n"; } - $multirowvalue .= $datarow."\r\n"; if (isset($datarows[$did + 1]) && substr($datarows[$did + 1], 0, 1) != '[') { // This is a multiline row, we haven't found the end yet. continue;