mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 04:22:07 +02:00
MDL-63539 mod_scorm: AICC multi-row content not saving correctly.
This commit is contained in:
parent
b156b18c72
commit
e3fb15de88
@ -217,8 +217,28 @@ if (!empty($command)) {
|
||||
$datamodel['[comments]'] = 'cmi.comments';
|
||||
$datarows = explode("\r\n", $aiccdata);
|
||||
reset($datarows);
|
||||
foreach ($datarows as $datarow) {
|
||||
if (($equal = strpos($datarow, '=')) !== false) {
|
||||
$multirowvalue = '';
|
||||
$multirowelement = '';
|
||||
foreach ($datarows as $did => $datarow) {
|
||||
$equal = strpos($datarow, '=');
|
||||
if ($equal === false || !empty($multirowelement)) {
|
||||
if (empty($multirowelement)) {
|
||||
if (isset($datamodel[strtolower(trim($datarow))])) {
|
||||
$multirowelement = $datamodel[strtolower(trim($datarow))];
|
||||
} else {
|
||||
// An element was passed by the external AICC package is not one we care about.
|
||||
continue;
|
||||
}
|
||||
}
|
||||
$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;
|
||||
}
|
||||
$value = rawurlencode($multirowvalue);
|
||||
$id = scorm_insert_track($aiccuser->id, $scorm->id, $sco->id, $attempt, $multirowelement, $value);
|
||||
$multirowvalue = $multirowelement = '';
|
||||
} else {
|
||||
$element = strtolower(trim(substr($datarow, 0, $equal)));
|
||||
$value = trim(substr($datarow, $equal + 1));
|
||||
if (isset($datamodel[$element])) {
|
||||
@ -302,17 +322,6 @@ if (!empty($command)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (isset($datamodel[strtolower(trim($datarow))])) {
|
||||
$element = $datamodel[strtolower(trim($datarow))];
|
||||
$value = '';
|
||||
while ((($datarow = current($datarows)) !== false) && (substr($datarow, 0, 1) != '[')) {
|
||||
$value .= $datarow."\r\n";
|
||||
next($datarows);
|
||||
}
|
||||
$value = rawurlencode($value);
|
||||
$id = scorm_insert_track($aiccuser->id, $scorm->id, $sco->id, $attempt, $element, $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (($mode == 'browse') && ($initlessonstatus == 'not attempted')) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user