MDL-13093 "Continue" link jumps over items; merged from MOODLE_19_STABLE

This commit is contained in:
skodak 2008-03-15 15:05:06 +00:00
parent f043289d2f
commit 9fb2de4ea7
4 changed files with 33 additions and 9 deletions

View File

@ -333,6 +333,8 @@ function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='n
}
$result->attemptleft = $scorm->maxattempt - $attempt;
if ($scoes = get_records_select('scorm_scoes',"scorm='$scorm->id' $organizationsql order by id ASC")){
// drop keys so that we can access array sequentially
$scoes = array_values($scoes);
//
// Retrieve user tracking data for each learning object
//
@ -355,7 +357,7 @@ function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='n
$findnext = false;
$parents[$level]='/';
foreach ($scoes as $sco) {
foreach ($scoes as $pos=>$sco) {
$isvisible = false;
$sco->title = stripslashes($sco->title);
if ($optionaldatas = scorm_get_sco($sco->id, SCO_DATA)) {
@ -395,7 +397,11 @@ function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='n
if ($isvisible) {
$result->toc .= "\t\t<li>";
}
$nextsco = next($scoes);
if (isset($scoes[$pos+1])) {
$nextsco = $scoes[$pos+1];
} else {
$nextsco = false;
}
$nextisvisible = false;
if (($nextsco !== false) && ($optionaldatas = scorm_get_sco($nextsco->id, SCO_DATA))) {
if (!isset($optionaldatas->isvisible) || (isset($optionaldatas->isvisible) && ($optionaldatas->isvisible == 'true'))) {

View File

@ -189,6 +189,8 @@ function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='n
}
$result->attemptleft = $scorm->maxattempt - $attempt;
if ($scoes = get_records_select('scorm_scoes',"scorm='$scorm->id' $organizationsql order by id ASC")){
// drop keys so that we can access array sequentially
$scoes = array_values($scoes);
//
// Retrieve user tracking data for each learning object
//
@ -211,7 +213,7 @@ function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='n
$findnext = false;
$parents[$level]='/';
foreach ($scoes as $sco) {
foreach ($scoes as $pos=>$sco) {
$isvisible = false;
$sco->title = stripslashes($sco->title);
if ($optionaldatas = scorm_get_sco($sco->id, SCO_DATA)) {
@ -252,7 +254,11 @@ function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='n
if ($isvisible) {
$result->toc .= "\t\t<li>";
}
$nextsco = next($scoes);
if (isset($scoes[$pos+1])) {
$nextsco = $scoes[$pos+1];
} else {
$nextsco = false;
}
$nextisvisible = false;
if (($nextsco !== false) && ($optionaldatas = scorm_get_sco($nextsco->id, SCO_DATA))) {
if (!isset($optionaldatas->isvisible) || (isset($optionaldatas->isvisible) && ($optionaldatas->isvisible == 'true'))) {

View File

@ -35,6 +35,8 @@ function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='n
}
$result->attemptleft = $scorm->maxattempt - $attempt;
if ($scoes = get_records_select('scorm_scoes',"scorm='$scorm->id' $organizationsql order by id ASC")){
// drop keys so that we can access array sequentially
$scoes = array_values($scoes);
//
// Retrieve user tracking data for each learning object
//
@ -61,7 +63,7 @@ function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='n
$nextid = 0;
$findnext = false;
$parents[$level]='/';
foreach ($scoes as $sco) {
foreach ($scoes as $pos=>$sco) {
$isvisible = false;
$sco->title = stripslashes($sco->title);
if (isset($optionaldatas[$sco->identifier])) {
@ -97,7 +99,11 @@ function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='n
$parents[$level]=$sco->parent;
}
}
$nextsco = next($scoes);
if (isset($scoes[$pos+1])) {
$nextsco = $scoes[$pos+1];
} else {
$nextsco = false;
}
$nextisvisible = false;
if (($nextsco !== false) && (isset($optionaldatas[$nextsco->identifier]))) {
if (!isset($optionaldatas[$nextsco->identifier]->isvisible) ||

View File

@ -257,10 +257,12 @@ function scorm_user_complete($course, $user, $mod, $scorm) {
}
$report .= "<ul id='0' class='$liststyle'>";
if ($scoes = get_records_select('scorm_scoes',"scorm='$scorm->id' $organizationsql order by id ASC")){
// drop keys so that we can access array sequentially
$scoes = array_values($scoes);
$level=0;
$sublist=1;
$parents[$level]='/';
foreach ($scoes as $sco) {
foreach ($scoes as $pos=>$sco) {
if ($parents[$level]!=$sco->parent) {
if ($level>0 && $parents[$level-1]==$sco->parent) {
$report .= "\t\t</ul></li>\n";
@ -283,7 +285,11 @@ function scorm_user_complete($course, $user, $mod, $scorm) {
}
}
$report .= "\t\t<li>";
$nextsco = next($scoes);
if (isset($scoes[$pos+1])) {
$nextsco = $scoes[$pos+1];
} else {
$nextsco = false;
}
if (($nextsco !== false) && ($sco->parent != $nextsco->parent) && (($level==0) || (($level>0) && ($nextsco->parent == $sco->identifier)))) {
$sublist++;
} else {