Skip to content
Browse files

SCORM MDL-26942 - initial fix for list in toc

  • Loading branch information...
1 parent 0797000 commit b6c88d755b9293e4e9feedca4eda7dae1cc5d344 @danmarsden danmarsden committed Jul 2, 2011
Showing with 13 additions and 10 deletions.
  1. +13 −10 mod/scorm/locallib.php
View
23 mod/scorm/locallib.php
@@ -1294,7 +1294,6 @@ function scorm_get_toc($user,$scorm,$cmid,$toclink=TOCJSLINK,$currentorg='',$sco
$nextid = 0;
$findnext = false;
$parents[$level]='/';
-
foreach ($scoes as $pos => $sco) {
$isvisible = false;
$sco->title = $sco->title;
@@ -1311,11 +1310,15 @@ function scorm_get_toc($user,$scorm,$cmid,$toclink=TOCJSLINK,$currentorg='',$sco
$i = $level;
$closelist = '';
while (($i > 0) && ($parents[$level] != $sco->parent)) {
- $closelist .= "\t\t</li></ul></li>\n";
+ if ($i === 1) {
+ $closelist .= "\t\t</ul></li>\n";
+ } else {
+ $closelist .= "\t</li></ul></li>\n";
+ }
$i--;
}
if (($i == 0) && ($sco->parent != $currentorg)) {
- $result->toc .= "\t\t<ul>\n";
+ $result->toc .= "\n\t<ul>\n";
$level++;
} else {
$result->toc .= $closelist;
@@ -1343,8 +1346,8 @@ function scorm_get_toc($user,$scorm,$cmid,$toclink=TOCJSLINK,$currentorg='',$sco
if (empty($sco->title)) {
$sco->title = $sco->identifier;
}
- if (!empty($sco->launch)) {
- if ($isvisible) {
+ if ($isvisible) {
+ if (!empty($sco->launch)) {
$score = '';
if (empty($scoid) && ($mode != 'normal')) {
$scoid = $sco->id;
@@ -1431,12 +1434,12 @@ function scorm_get_toc($user,$scorm,$cmid,$toclink=TOCJSLINK,$currentorg='',$sco
$result->toc .= $statusicon.'&nbsp;'.format_string($sco->title)."\n";
}
}
- if (($nextsco === false) || $nextsco->parent == $sco->parent) {
- $result->toc .= '</li>';
- }
+ } else {
+ $result->toc .= '&nbsp;'.format_string($sco->title);
+ }
+ if (($nextsco === false) || $nextsco->parent == $sco->parent) {
+ $result->toc .= "</li>\n";
}
- } else {
- $result->toc .= '&nbsp;'.format_string($sco->title)."\n";
}
if (($nextsco !== false) && ($nextid == 0) && ($findnext)) {
if (!empty($nextsco->launch)) {

0 comments on commit b6c88d7

Please sign in to comment.
Something went wrong with that request. Please try again.