mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 20:50:21 +01:00
MDL-33053 AICC: Incorrect Table Of Content hierarchy using "structured" AICC
courses [Fix] 'scorm_scoes' doesn't contain all the entries described in the DES file [Fix] HTMLizing the parent relationship, described in the CST file, fails: it considers 'index = 0' (found) equals to 'false' (not found)
This commit is contained in:
parent
4f7f2a8828
commit
8ac8aae4f4
@ -197,7 +197,10 @@ function scorm_parse_aicc($scorm) {
|
|||||||
if (preg_match($regexp, $rows[$i], $matches)) {
|
if (preg_match($regexp, $rows[$i], $matches)) {
|
||||||
for ($j=0; $j<count($columns->columns); $j++) {
|
for ($j=0; $j<count($columns->columns); $j++) {
|
||||||
if ($j != $columns->mastercol) {
|
if ($j != $columns->mastercol) {
|
||||||
$courses[$courseid]->elements[substr(trim($matches[$j+1]), 1 , -1)]->parent = substr(trim($matches[$columns->mastercol+1]), 1, -1);
|
$element = substr(trim($matches[$j+1]), 1 , -1);
|
||||||
|
if (!empty($element)) {
|
||||||
|
$courses[$courseid]->elements[$element]->parent = substr(trim($matches[$columns->mastercol+1]), 1, -1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -275,12 +278,16 @@ function scorm_parse_aicc($scorm) {
|
|||||||
} else {
|
} else {
|
||||||
$sco->parent = $element->parent;
|
$sco->parent = $element->parent;
|
||||||
}
|
}
|
||||||
if (isset($element->file_name)) {
|
$sco->launch = '';
|
||||||
$sco->launch = $element->file_name;
|
$sco->scormtype = '';
|
||||||
$sco->scormtype = 'sco';
|
|
||||||
$sco->previous = 0;
|
$sco->previous = 0;
|
||||||
$sco->next = 0;
|
$sco->next = 0;
|
||||||
$id = null;
|
$id = null;
|
||||||
|
// Is it an Assignable Unit (AU)?
|
||||||
|
if (isset($element->file_name)) {
|
||||||
|
$sco->launch = $element->file_name;
|
||||||
|
$sco->scormtype = 'sco';
|
||||||
|
}
|
||||||
if ($oldscoid = scorm_array_search('identifier', $sco->identifier, $oldscoes)) {
|
if ($oldscoid = scorm_array_search('identifier', $sco->identifier, $oldscoes)) {
|
||||||
$sco->id = $oldscoid;
|
$sco->id = $oldscoid;
|
||||||
$DB->update_record('scorm_scoes', $sco);
|
$DB->update_record('scorm_scoes', $sco);
|
||||||
@ -331,7 +338,6 @@ function scorm_parse_aicc($scorm) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (!empty($oldscoes)) {
|
if (!empty($oldscoes)) {
|
||||||
foreach ($oldscoes as $oldsco) {
|
foreach ($oldscoes as $oldsco) {
|
||||||
$DB->delete_records('scorm_scoes', array('id'=>$oldsco->id));
|
$DB->delete_records('scorm_scoes', array('id'=>$oldsco->id));
|
||||||
|
@ -1338,7 +1338,8 @@ function scorm_get_toc($user,$scorm,$cmid,$toclink=TOCJSLINK,$currentorg='',$sco
|
|||||||
$isvisible = true;
|
$isvisible = true;
|
||||||
}
|
}
|
||||||
if ($parents[$level] != $sco->parent) {
|
if ($parents[$level] != $sco->parent) {
|
||||||
if ($newlevel = array_search($sco->parent,$parents)) {
|
$newlevel = array_search($sco->parent,$parents);
|
||||||
|
if ($newlevel !== false) {
|
||||||
for ($i=0; $i<($level-$newlevel); $i++) {
|
for ($i=0; $i<($level-$newlevel); $i++) {
|
||||||
$result->toc .= "\t\t</li></ul></li>\n";
|
$result->toc .= "\t\t</li></ul></li>\n";
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user